/* =====================================================================
   BackOffice Dashboard — PostHog-style condensed overview
   Flat KPI tiles, hairline borders, muted labels, tight spacing.
   Uses the shared --bo-* design tokens (backoffice-theme.css).
   ===================================================================== */

.dash {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --- KPI tile row -------------------------------------------------- */
.dash-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

@media (max-width: 960px) {
    .dash-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .dash-kpis {
        grid-template-columns: 1fr;
    }
}

.dash-kpi {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background-color: var(--bo-surface);
    border: 1px solid var(--bo-border);
    border-radius: var(--bo-radius-lg);
    transition: border-color 0.12s ease;
}

    .dash-kpi:hover {
        border-color: var(--bo-border-strong);
    }

.dash-kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: var(--bo-radius);
    background-color: var(--bo-primary-soft);
    color: var(--bo-primary);
}

    .dash-kpi-icon .mud-icon-root {
        font-size: 1.25rem;
    }

.dash-kpi-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.dash-kpi-label {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bo-text-muted);
}

.dash-kpi-value {
    font-size: 1.65rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--bo-text);
}

.dash-kpi-meta {
    font-size: 0.75rem;
    color: var(--bo-text-muted);
    margin-top: 2px;
}

    .dash-kpi-meta strong {
        color: var(--bo-text);
        font-weight: 600;
    }

/* --- Breakdown panels --------------------------------------------- */
.dash-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 960px) {
    .dash-cols {
        grid-template-columns: 1fr;
    }
}

.dash-panel {
    display: flex;
    flex-direction: column;
    padding: 16px 18px;
    background-color: var(--bo-surface);
    border: 1px solid var(--bo-border);
    border-radius: var(--bo-radius-lg);
}

.dash-panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bo-text);
}

    .dash-panel-head .mud-icon-root {
        font-size: 1.05rem;
        color: var(--bo-text-muted);
    }

.dash-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

    .dash-row + .mud-progress-linear {
        margin-bottom: 14px;
    }

    .dash-row:last-child + .mud-progress-linear {
        margin-bottom: 0;
    }

.dash-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--bo-text-muted);
}

.dash-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background-color: var(--bo-text-muted);
}

.dash-dot--primary { background-color: var(--bo-primary); }
.dash-dot--muted   { background-color: var(--bo-border-strong); }
.dash-dot--info    { background-color: #2196f3; }
.dash-dot--success { background-color: #2e9e5b; }

.dash-row-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bo-text);
    font-variant-numeric: tabular-nums;
}

/* --- "Needs attention" strip (ongoing / upcoming / action items) --- */
.dash-cols-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 1100px) {
    .dash-cols-3 {
        grid-template-columns: 1fr;
    }
}

.dash-panel-head-count {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--bo-text-muted);
    background-color: var(--bo-surface-muted);
    border: 1px solid var(--bo-border);
    border-radius: 999px;
    padding: 1px 8px;
}

    .dash-panel-head-count.is-alert {
        color: #b42318;
        background-color: rgba(217, 45, 32, 0.08);
        border-color: rgba(217, 45, 32, 0.2);
    }

/* A scrollable list of compact items inside a panel. */
.dash-list {
    display: flex;
    flex-direction: column;
}

.dash-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 0;
    border-top: 1px solid var(--bo-border);
}

    .dash-item:first-child {
        border-top: none;
        padding-top: 0;
    }

.dash-item-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dash-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bo-text);
    line-height: 1.25;
    /* clamp long names/descriptions to two lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dash-item-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    color: var(--bo-text-muted);
}

    .dash-item-sub .sep {
        opacity: 0.5;
    }

.dash-item-aside {
    flex-shrink: 0;
    text-align: right;
    font-size: 0.74rem;
    color: var(--bo-text-muted);
    white-space: nowrap;
}

/* Small status pill. */
.dash-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 1px 7px;
    border-radius: 999px;
    background-color: var(--bo-surface-muted);
    border: 1px solid var(--bo-border);
    color: var(--bo-text-muted);
    white-space: nowrap;
}

.dash-badge--primary {
    color: var(--bo-primary);
    background-color: var(--bo-primary-soft);
    border-color: transparent;
}

.dash-badge--overdue {
    color: #b42318;
    background-color: rgba(217, 45, 32, 0.08);
    border-color: rgba(217, 45, 32, 0.2);
}

/* League week-progress micro-bar. */
.dash-mini-progress {
    height: 4px;
    width: 100%;
    margin-top: 6px;
    border-radius: 999px;
    background-color: var(--bo-surface-muted);
    overflow: hidden;
}

    .dash-mini-progress > span {
        display: block;
        height: 100%;
        border-radius: 999px;
        background-color: var(--bo-primary);
    }

/* Empty-state line inside a panel. */
.dash-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.82rem;
    color: var(--bo-text-muted);
}

    .dash-empty .mud-icon-root {
        font-size: 1.05rem;
        color: #2e9e5b;
    }

/* --- Quick actions ------------------------------------------------- */
.dash-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

@media (max-width: 960px) {
    .dash-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .dash-actions {
        grid-template-columns: 1fr;
    }
}

.dash-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background-color: var(--bo-surface);
    border: 1px solid var(--bo-border);
    border-radius: var(--bo-radius-lg);
    text-decoration: none;
    color: var(--bo-text);
    transition: border-color 0.12s ease, background-color 0.12s ease;
}

    .dash-action:hover {
        border-color: var(--bo-primary);
        background-color: var(--bo-primary-soft);
    }

.dash-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: var(--bo-radius);
    background-color: var(--bo-surface-muted);
    color: var(--bo-primary);
}

    .dash-action:hover .dash-action-icon {
        background-color: var(--bo-surface);
    }

    .dash-action-icon .mud-icon-root {
        font-size: 1.15rem;
    }

.dash-action-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dash-action-title {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.2;
}

.dash-action-sub {
    font-size: 0.75rem;
    color: var(--bo-text-muted);
}
