/* «Обзор» dashboards, vault lock, AI card. Tokens come from style.css (dark and light). */
:root {
  --c-new: var(--gold); --c-renewal: #6FCF97; --c-manual: #7FB2E5; --c-line: #C9A4F0;
  --heat: var(--gold);
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --c-renewal: #1B8A4A; --c-manual: #2F6FB0; --c-line: #7A3FB0; --heat: #C48A00; } }
:root[data-theme="light"] { --c-renewal: #1B8A4A; --c-manual: #2F6FB0; --c-line: #7A3FB0; --heat: #C48A00; }

.section-title { font: 600 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--gold-text); margin: 20px 0 10px; }
.small-note { font-size: 12px; margin: 8px 0 0; }
.dash-bar { justify-content: space-between; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); }
.seg button { background: none; border: 0; color: var(--text-2); font: inherit; font-weight: 500; padding: 0 14px; min-height: 36px; cursor: pointer; transition: background-color .15s, color .15s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--gold-tint); color: var(--gold-text); font-weight: 600; }
@media (pointer: coarse) { .seg button { min-height: 44px; } }

/* KPI tiles */
.dash-kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.dash-kpi { gap: 6px; }
.delta { font: 600 12px/1.4 var(--mono); width: fit-content; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.delta.good { color: var(--ok); background: var(--ok-tint); } .delta.bad { color: var(--bad); background: var(--bad-tint); }
.spark { width: 100%; height: 34px; display: block; margin-top: 4px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--text-3); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark .fill { stroke: none; fill: var(--text-3); opacity: .1; }
.spark circle { fill: var(--text-3); }
.spark.good polyline, .spark.good circle { stroke: var(--ok); } .spark.good circle, .spark.good .fill { fill: var(--ok); }
.spark.bad polyline { stroke: var(--bad); } .spark.bad circle, .spark.bad .fill { fill: var(--bad); }

/* goals */
.goal { display: grid; gap: 6px; }
.goal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.goal-head .l { color: var(--text-3); font: 600 11px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.goal-val b { font-size: 22px; letter-spacing: -.02em; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold-mid), var(--gold-hi)); transition: width .5s var(--ease); }
.goal-edit { margin-top: 10px; } .goal-edit summary { cursor: pointer; }
.goals { margin-bottom: 8px; }

/* charts */
#dash .chart { min-width: 0; }
#dash .chart text { font-size: 12px; }
.chart .seg-new, .sw.seg-new { fill: var(--c-new); background: var(--c-new); }
.chart .seg-renewal, .sw.seg-renewal { fill: var(--c-renewal); background: var(--c-renewal); }
.chart .seg-manual, .sw.seg-manual { fill: var(--c-manual); background: var(--c-manual); }
.chart .tip-g { outline: none; cursor: default; }
.chart .tip-g:hover rect:not(.hit), .chart .tip-g:focus rect:not(.hit) { filter: brightness(1.2); }
.chart .tip-g:focus-visible .hit { stroke: var(--focus); stroke-width: 2; fill: var(--gold-tint); }
.chart .views-line { fill: none; stroke: var(--c-line); stroke-width: 2; stroke-linejoin: round; pointer-events: none; }
.chart .r-axis { fill: var(--c-line); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .sw.line { height: 3px; border-radius: 2px; background: var(--c-line); vertical-align: 3px; }

/* milestones */
.ms-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ms { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); color: var(--text-3); }
.ms small { display: block; font-size: 12px; }
.ms-ico { font-size: 20px; line-height: 1; }
.ms.done { border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line)); background: var(--gold-tint); color: var(--text); }
.ms.done .ms-ico { color: var(--gold-text); }

/* chips, dots, queue, feed */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 999px; font: inherit; font-size: 12.5px; padding: 0 12px; min-height: 30px; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; }
.chip:hover { border-color: var(--gold-mid); }
.chip[aria-pressed="true"] { background: var(--gold-tint); color: var(--gold-text); border-color: var(--gold-mid); font-weight: 600; }
@media (pointer: coarse) { .chip { min-height: 40px; } }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--text-3); vertical-align: 0; }
.dot.green { background: var(--ok); } .dot.yellow { background: var(--warn); } .dot.red { background: var(--bad); }
.health-cell { white-space: nowrap; }
.feed { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 2px; }
.feed-item { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed-ico { width: 18px; height: 18px; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.feed-ico.f-payment, .feed-ico.f-manual_payment { stroke: var(--ok); } .feed-ico.f-expiry { stroke: var(--bad); } .feed-ico.f-admin_grant, .feed-ico.f-registration { stroke: var(--gold-text); }
.feed-text { min-width: 0; overflow-wrap: anywhere; }
.feed time { font-size: 12px; white-space: nowrap; }

/* cohorts */
.heatmap th, .heatmap td { text-align: center; white-space: nowrap; }
.heatmap tbody th { text-align: left; font-weight: 600; }
.heat { background: color-mix(in srgb, var(--heat) calc(var(--a) * 70%), transparent); font-variant-numeric: tabular-nums; }
.heat.na { color: var(--text-3); }

/* AI */
.ai-report { margin-top: 10px; }
.ai-summary { font-size: 15px; margin: 6px 0 4px; }
.ai-list { margin: 0 0 6px; padding-left: 20px; display: grid; gap: 8px; }
.ai-warn { color: var(--warn); margin: 0; padding-left: 20px; }
.ai-history { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.badge.conf-low, .badge.prio-low { color: var(--text-3); } .badge.conf-high, .badge.prio-high { color: var(--gold-text); background: var(--gold-tint); border-color: transparent; }
.link-btn { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--gold-text); cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
.link-btn[aria-current="true"] { color: var(--text); font-weight: 600; text-decoration: none; }

/* vault lock */
.vault-lock { margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vault-lock .filters { margin: 0; }
.vault-lock:not(.is-open) { background: var(--bad-tint); }
.vault-lock.is-open { background: var(--ok-tint); }
.vault-lock #lock-code { width: 9ch; text-align: center; letter-spacing: .15em; }
.chip-timer { font: 600 12px/1 var(--mono); color: var(--warn); padding: 3px 8px; border-radius: 999px; background: var(--surface-3); }

@media (max-width: 700px) {
  .dash-kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-kpi .v { font-size: 20px; }
  .dash-bar { flex-direction: column; align-items: stretch; }
  .seg { width: 100%; } .seg button { flex: 1; padding: 0 4px; }
  #dash-queue td, #dash-queue th { white-space: normal; }
  .feed-item { grid-template-columns: 22px 1fr; } .feed-item time { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { .progress i { transition: none; } }
