/* Dashboards and charts (Dashboard, Network, Workload, Team Dynamics, Compare). Uses the variables from app.css. */

:root {
    --good-ink: #067647;
    --bad-ink: #b42318;
    --status-good: #0ca30c;
    --status-warning: #fab219;
    --status-critical: #d03b3b;
    --chart-surface: #ffffff;
}

/* ---------- page rhythm ---------- */
.dash-body { animation: dash-in .35s ease-out both; transition: opacity .2s ease; }
.is-refreshing { opacity: .55; pointer-events: none; }
.dash-note { margin: .5rem 0 0; }
.dash-charts { margin-top: 1.25rem; }
.dash-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.small { font-size: .82rem; }

@keyframes dash-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .dash-body { animation: none; }
    .is-refreshing { transition: none; }
}

/* ---------- at a glance ---------- */
.glance {
    margin: 1rem 0 1.25rem;
    padding: 1.1rem 1.25rem;
    background: linear-gradient(135deg, #0b3d91 0%, #1560bd 100%);
    border-radius: 16px;
    color: #fff;
    box-shadow: var(--shadow);
}
.glance-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; margin-bottom: .6rem; }
.glance h2 { margin: 0; font-size: 1.05rem; color: #fff; }
.glance-headline { margin: 0; color: #dbeafe; font-size: .95rem; }
.glance-calm { margin: 0; color: #e0ecff; display: flex; align-items: center; gap: .5rem; }
.glance-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.glance-item {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .75rem;
    padding: .6rem .75rem; background: rgba(255, 255, 255, .1); border-radius: 10px;
}
.glance-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.glance-text strong { color: #fff; font-weight: 600; }
.glance-text .muted { color: #cfe0fb; font-size: .86rem; }
.glance-link { color: #fff; font-weight: 600; text-decoration: none; white-space: nowrap; font-size: .88rem; }
.glance-link:hover { text-decoration: underline; }

.sev {
    display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem .2rem .25rem;
    border-radius: 999px; font-size: .75rem; font-weight: 700; background: #fff; color: var(--text); white-space: nowrap;
}
.sev-icon {
    display: inline-grid; place-items: center; width: 1.15rem; height: 1.15rem; border-radius: 50%;
    font-size: .68rem; color: #fff; background: var(--muted);
}
.sev-high .sev-icon { background: var(--status-critical); }
.sev-medium .sev-icon { background: var(--status-warning); color: #0b0b0b; }
.sev-low .sev-icon { background: var(--blue-600); }
.status-dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
.status-dot.good { background: var(--status-good); box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); }

/* ---------- KPI tiles ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; }
.kpi {
    position: relative; display: flex; flex-direction: column; gap: .2rem;
    padding: 1rem 1.1rem .7rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    transition: box-shadow .15s ease, transform .15s ease;
}
.kpi:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.kpi-value-row { display: flex; align-items: baseline; gap: .35rem; min-height: 2.4rem; }
.kpi-value { font-size: 1.9rem; font-weight: 650; letter-spacing: -.02em; color: var(--text); line-height: 1.15; }
.kpi-empty { color: var(--muted); }
.kpi-unit { font-size: .82rem; color: var(--muted); }
.kpi-delta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem; font-size: .8rem; font-weight: 600; }
.kpi-delta.good { color: var(--good-ink); }
.kpi-delta.bad { color: var(--bad-ink); }
.kpi-delta.neutral { color: var(--muted); }
.kpi-delta-period { font-weight: 400; color: var(--muted); }
.kpi-hint { font-size: .78rem; color: var(--muted); }
.kpi-spark { margin-top: .25rem; }

/* ---------- chart cards ---------- */
.chart-card { padding: 1.1rem 1.25rem 1rem; }
.chart-card-head h2 { margin: 0 0 .15rem; }
.chart-card-head p { margin: 0 0 .5rem; }
.chart-card-head-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.echart { width: 100%; }
.chart-missing { display: grid; place-items: center; color: var(--muted); font-size: .85rem; border: 1px dashed var(--border); border-radius: 8px; }

.segmented { display: inline-flex; padding: 3px; background: #eef2f7; border-radius: 10px; gap: 2px; }
.segmented button {
    border: 0; background: transparent; font: inherit; font-size: .82rem; font-weight: 600; color: var(--muted);
    padding: .35rem .75rem; border-radius: 8px; cursor: pointer; transition: background .15s ease, color .15s ease;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, .1); }

/* ---------- skeleton (first load only, static) ---------- */
.skeleton .kpi-grid { margin-top: 1rem; }
.skeleton-block { background: #eef2f7; border: 0; border-radius: var(--radius); box-shadow: none; }

/* ---------- team table bars (Team Dynamics) ---------- */
.cell-bar { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; }
.cell-bar-track { width: 70px; height: 6px; border-radius: 3px; background: #eef2f7; overflow: hidden; flex: none; }
.cell-bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--blue-500); }
.cell-bar-fill.hot { background: var(--status-critical); }

@media (max-width: 640px) {
    .glance-item { grid-template-columns: 1fr; }
    .kpi-value { font-size: 1.6rem; }
}

/* ---------- data date / empty state ---------- */
.data-asof { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; margin: .25rem 0 1rem; }
.asof-pill { display: inline-flex; align-items: center; padding: .2rem .65rem; border-radius: 999px; background: #e3eefc; color: var(--blue-800); font-size: .8rem; font-weight: 600; }
.asof-stale { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .65rem; border-radius: 999px; background: #fff4e0; color: #7a4b00; font-size: .8rem; font-weight: 600; }
.asof-stale::before { content: "!"; display: inline-grid; place-items: center; width: 1rem; height: 1rem; border-radius: 50%; background: var(--status-warning); color: #0b0b0b; font-size: .65rem; font-weight: 700; }
.no-activity { margin-top: 1rem; border-left: 4px solid var(--blue-500); }
.no-activity h2 { margin-bottom: .4rem; }
.th-sub { font-weight: 400; margin-top: .1rem; }
