/* ==========================================================================
   Dashboard: layout only. Cards, chips, rows, tiles, tables, pills and the tab group come from components/ui.css
   and Web Awesome. The panels are drawn by dashboard.js and dashboard_today.js.
   ========================================================================== */
@layer app-pages {

    /* The two tabs are big: an icon, a title and a line under it, and the count chip at the end. */
    #dashTabs wa-tab::part(base) { gap: 0.75rem; padding: 0.5rem 1.25rem; }
    .dash-tab-text { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
    .dash-tab-title { font-size: 0.9375rem; font-weight: 700; color: var(--d26-ink); }
    .dash-tab-sub { font-size: 0.75rem; font-weight: 400; color: var(--d26-ink-muted); }
    @media (max-width: 640px) {
        /* The line under the title goes, so both tabs fit without scroll arrows */
        .dash-tab-sub { display: none; }
        #dashTabs wa-tab::part(base) { flex-direction: column; align-items: flex-start; gap: 0.25rem; padding: 0.5rem 0.75rem; }
        #dashTabs wa-tab > i { display: none; }
        #dashTabs wa-tab .ui-chip { font-size: 0.75rem; padding: 0.1rem 0.5rem; }
    }

    /* A panel is a column of sections; wide screens pair related cards into a 2-column Bento grid */
    .dash-stack, .dash-today { display: flex; flex-direction: column; gap: 1.5rem; }
    .dash-bento {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.25rem;
        align-items: start;
    }
    .dash-bento-col { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
    @media (max-width: 960px) {
        .dash-bento { grid-template-columns: minmax(0, 1fr); }
    }
    .dash-section { display: flex; flex-direction: column; }
    .dash-section-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.625rem; }
    .dash-section-title .ui-card-title { margin: 0; }
    .dash-error, .dash-also {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem 1rem;
    }

    /* A card that holds a list of rows. The rows are .ui-row; the last one has no line under it. */
    .dash-list { padding-top: 0.25rem; padding-bottom: 0.25rem; }
    .dash-needs-card { border-color: color-mix(in srgb, var(--d26-wait-fg) 45%, transparent); }
    .dash-list .ui-row { padding: 0.75rem 0; gap: 0.5rem 0.875rem; }
    .dash-list .ui-row:last-child { border-bottom: 0; }
    .dash-list .ui-row > .ui-chip { flex: 0 0 auto; }
    .dash-list-top {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem 0.75rem;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--d26-line);
        font-weight: 600;
        color: var(--d26-ink);
    }
    .dash-pad { padding: 0.75rem 0; }

    /* Date box on a leave row */
    .dash-datebox {
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        min-width: 3rem;
        overflow: hidden;
        background: var(--d26-card);
        border: 1px solid var(--d26-line);
        border-radius: var(--d26-radius-control);
        line-height: 1.2;
    }
    .dash-datebox span {
        width: 100%;
        padding: 0.15rem 0.4rem;
        background: var(--d26-accent);
        color: var(--wa-color-brand-on);
        font-size: 0.6875rem;
        font-weight: 700;
        text-align: center;
        text-transform: uppercase;
    }
    .dash-datebox b { padding: 0.25rem 0.4rem; font-size: 1.125rem; color: var(--d26-ink); }

    /* Number cards */
    .dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; }
    .dash-kpi { display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 1.25rem; }
    .dash-kpi--warn { border-color: color-mix(in srgb, var(--d26-wait-fg) 45%, transparent); }
    .dash-kpi--bad { border-color: color-mix(in srgb, var(--d26-bad-fg) 45%, transparent); }
    .dash-kpi-label { font-size: 0.8125rem; font-weight: 500; color: var(--d26-ink-2); }
    .dash-kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--d26-ink); }
    .dash-kpi-sub { font-size: 0.75rem; color: var(--d26-ink-2); }
    .dash-kpi-value.is-warn, .dash-warn { color: var(--d26-wait-fg); }
    .dash-kpi-value.is-bad, .dash-bad { color: var(--d26-bad-fg); }
    .dash-kpi-value.is-accent, .dash-accent { color: var(--d26-accent); }
    .dash-warn, .dash-bad, .dash-accent { font-weight: 700; }

    /* HR: two cards side by side, a big number and a button */
    .dash-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; }
    .dash-wait { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
    .dash-big { font-size: 1.75rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

    /* Overtime by department: a label row over a progress bar */
    .dash-bars { display: flex; flex-direction: column; gap: 0.875rem; }
    .dash-bar-label { display: flex; justify-content: space-between; margin-bottom: 0.375rem; }
    .dash-bar-label span { color: var(--d26-ink-2); font-variant-numeric: tabular-nums; }
    .dash-bars wa-progress-bar { --height: 0.625rem; }

    /* Today: a field row at the right of the section heading, and uniform stat-card tiles */
    .dash-today .ui-section-head { flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }
    .dash-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
    .dash-tools > wa-select,
    .dash-tools > wa-input { width: auto; min-width: 11rem; flex: 0 1 auto; }
    .dash-today .ui-tiles {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 0.75rem;
        margin: 0;
    }
    @media (max-width: 960px) {
        .dash-today .ui-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    @media (max-width: 540px) {
        .dash-today .ui-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }
    .dash-report-strip {
        margin-top: 0.75rem;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.625rem 1rem;
        padding: 0.75rem 1rem;
    }
    .dash-report-main { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
    .dash-disclosure { margin: 0; }
    .dash-disclosure-head {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem 1rem;
        width: 100%;
        font-weight: 700;
        color: var(--d26-ink);
    }
    .dash-disclosure-body { display: flex; flex-direction: column; gap: 0.875rem; padding-top: 0.25rem; }
    @container (width <= 40rem) { .dash-disclosure-body .ui-table--cards-narrow td:empty { display: none; } }     /* the empty cell of the totals row */
    .dash-today .ui-tile {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 0.375rem;
        padding: 0.875rem 1rem;
        min-height: 5rem;
        transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }
    .dash-tile-top {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        width: 100%;
        color: var(--d26-ink-2);
    }
    .dash-tile-top > i { color: var(--d26-accent); font-size: 0.875rem; flex: 0 0 auto; }
    .dash-today .ui-tile-label { white-space: normal; font-weight: 600; font-size: 0.8125rem; }
    .dash-today .ui-tile-count { font-size: 1.5rem; font-weight: 700; line-height: 1.15; }
    .dash-tile--warn { border-color: color-mix(in srgb, var(--d26-wait-fg) 45%, transparent); }
    .dash-tile--warn .dash-tile-top > i, .dash-tile--warn .ui-tile-count { color: var(--d26-wait-fg); }
    .dash-tile--bad { border-color: color-mix(in srgb, var(--d26-bad-fg) 45%, transparent); }
    .dash-tile--bad .dash-tile-top > i, .dash-tile--bad .ui-tile-count { color: var(--d26-bad-fg); }
    .dash-tiles-help { margin: 0.5rem 0 0; }
    .dash-tile-open { font-size: 0.75rem; font-weight: 600; color: var(--d26-accent); display: inline-flex; align-items: center; gap: 0.25rem; }
    .dash-dates { margin: 0 0 0.75rem; }
    .dash-tile-text { display: flex; flex-direction: column; gap: 0.15rem; }
    .dash-today #dtList:focus-visible { outline: 2px solid var(--d26-accent); outline-offset: 2px; }
    #dtList { margin-top: 1rem; }

    @media (max-width: 640px) {
        .dash-tools { width: 100%; }
    }
}
