/* ==========================================================================
   Compliance rule and levels: layout only. Tab group, tables, chips, buttons, fields, callouts and the dialog come from
   components/ui.css and Web Awesome. (The "My compliance" card on My attendance is drawn by the same script and keeps its own rules.)
   ========================================================================== */
@layer app-pages {

    #cmp2ScError:not([hidden]), #cmp2Error:not([hidden]), #cmp2RuleError:not([hidden]), #cmp2LevelsError:not([hidden]), #cmp2ConfirmError:not([hidden]) { margin: 0 0 1rem; }
    #cmp2ScLoading:not([hidden]), #cmp2Loading:not([hidden]) { margin: 0 0 1rem; }

    /* The tab: a title and a line under it */
    .cmp-tab-text { display: flex; flex-direction: column; align-items: flex-start; text-align: left; line-height: 1.3; }
    .cmp-tab-title { font-weight: 700; color: var(--d26-ink); }
    .cmp-tab-sub { font-size: 0.75rem; font-weight: 400; color: var(--d26-ink-muted); }

    /* Scores */
    .cmp-summary { margin: 0 0 0.25rem; }
    #cmp2ScSummary:empty { display: none; }
    #cmp2ScStatus:not(:empty) { margin: 0 0 0.75rem; }

    /* Rule and levels: three sections one under the other */
    .cmp-section { margin: 0 0 2rem; padding: 0 0 0.5rem; }
    .cmp-section + .cmp-section { padding-top: 1.5rem; border-top: 1px solid var(--d26-line); }
    .cmp-heading { margin: 0 0 0.5rem; font-size: 1.125rem; font-weight: 700; color: var(--d26-ink); }
    .cmp-subheading { margin: 1.5rem 0 0.5rem; font-size: 0.9375rem; font-weight: 700; color: var(--d26-ink); }
    .cmp-events { border: 0; margin: 0 0 1rem; padding: 0; min-width: 0; }
    .cmp-events legend { padding: 0; margin-bottom: 0.5rem; }
    .cmp-events-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 1.5rem; }
    #cmp2Content wa-select { max-width: 24rem; }
    .cmp-action-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--d26-line); }
    .cmp-action-row wa-select { flex: 1 1 18rem; }
    .cmp-action-row .ui-form-actions { margin: 0; }
    .cmp-actions { white-space: nowrap; }

    /* A narrow screen: one column of events. */
    @media (max-width: 760px) { .cmp-events-grid { grid-template-columns: minmax(0, 1fr); } }
    @container (width > 55rem) {                                                    /* wide Levels table: keep Remove in view while it scrolls sideways */
        .ui-table--cards-wide th.cmp-actions, .ui-table--cards-wide td.cmp-actions { position: sticky; right: 0; box-shadow: -1px 0 0 var(--d26-line); }
        .ui-table--cards-wide td.cmp-actions { background: var(--d26-card); }
        .ui-table--cards-wide th.cmp-actions { background: var(--d26-surface); }
    }
    /* The card switch is the shared data_table() (narrow for Scores and Rule history, wide for Levels); in a Levels card the text fields fill the width. */
    @container (width <= 55rem) {
        .cmp-actions { white-space: normal; }
        #cmp2LevelsTable td > wa-input { justify-self: stretch; }
    }
}
