/* ── Дашборд (dashboard.js) ──────────────────────────────────────────────
   Everything runs on the panel tokens, so moods repaint it. Blue carries the
   data (bars, selected tile, sparklines); green/red say better/worse; the
   ember accent is left to actions. Charts read the tokens when they draw. */

#dash-root { max-width: 1360px; transition: opacity .2s ease; }
#dash-root.is-loading { opacity: .55; pointer-events: none; }

/* ── 1. Сейчас важно ── */
/* One even row of compact chips: icon, the number, the words right beside it.
   Tall cards with a lone number left the right half of each one empty. */
.dh-alerts {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  gap: 10px; margin-bottom: 14px;
}
.dh-alert {
  --tone: var(--subtle); --tone-weak: var(--elevated);
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 10px 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--stroke);
  box-shadow: inset 3px 0 0 var(--tone), var(--sh-card);
  color: var(--ink); text-align: left; font: inherit; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  animation: dh-rise .35s ease both;
}
.dh-alert:nth-child(2) { animation-delay: .04s; }
.dh-alert:nth-child(3) { animation-delay: .08s; }
.dh-alert:nth-child(4) { animation-delay: .12s; }
button.dh-alert:hover { transform: translateY(-1px); border-color: var(--tone); box-shadow: inset 3px 0 0 var(--tone), 0 8px 20px -14px rgba(16, 20, 36, .35); }
.dh-alert.is-static { cursor: default; }
.dh-alert.tone-red   { --tone: var(--red);    --tone-weak: var(--red-weak); }
.dh-alert.tone-amber { --tone: var(--amber);  --tone-weak: var(--amber-weak); }
.dh-alert.tone-blue  { --tone: var(--blue);   --tone-weak: var(--blue-weak); }
.dh-alert.tone-green { --tone: var(--green);  --tone-weak: var(--green-weak); }
.dh-alert-ic {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px;
  border-radius: 9px; background: var(--tone-weak); font-size: 16px;
}
.dh-alert-n {
  flex: none; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.03em;
  line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink);
}
.dh-alert.tone-red .dh-alert-n { color: var(--red); }
.dh-alert.tone-green .dh-alert-n { font-size: 16px; color: var(--green); }
.dh-alert-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.dh-alert-label { font-size: 13px; font-weight: 500; }
.dh-alert-sub { margin-top: 1px; font-size: 11.5px; color: var(--subtle); }
.dh-alert-label, .dh-alert-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dh-alert-go { flex: none; color: var(--subtle); font-size: 15px; transition: transform .15s ease, color .15s ease; }
button.dh-alert:hover .dh-alert-go { transform: translateX(3px); color: var(--tone); }

.dh-note {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin: 0 0 10px; padding: 8px 12px;
  border-radius: var(--r-sm); background: var(--amber-weak); color: var(--ink-2); font-size: 12.5px; line-height: 1.4;
}
.dh-note .dh-head-link { padding: 0; font-size: 12.5px; }

/* ── 2. Pulse hero ── */
.dh-hero {
  position: relative; isolation: isolate;
  padding: 22px 24px 16px; margin-bottom: 16px; border-radius: var(--r-xl);
  background:
    radial-gradient(70% 120% at 100% 0%, var(--blue-weak), transparent 62%),
    var(--surface);
  border: 1px solid var(--stroke); box-shadow: var(--sh-card);
  animation: dh-rise .4s ease both;
}
.dh-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; margin-bottom: 16px; }
.dh-hero-head { min-width: 0; }
.dh-eyebrow { font-size: 12.5px; font-weight: 600; letter-spacing: .02em; color: var(--subtle); }
.dh-headline {
  margin-top: 4px; font-family: var(--font-display); font-size: clamp(17px, 1.9vw, 22px); font-weight: 500;
  line-height: 1.3; letter-spacing: -0.01em; color: var(--ink-2); text-wrap: balance;
}
.dh-headline b { color: var(--ink); font-weight: 700; }
.dh-headline em { font-style: normal; font-weight: 600; }
.dh-headline em.up { color: var(--green); }
.dh-headline em.down { color: var(--red); }

.dh-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--elevated); flex: none; }
.dh-seg button {
  border: 0; background: transparent; color: var(--ink-2); font-weight: 500; font-size: 13px;
  padding: 6px 12px; border-radius: 9px; cursor: pointer; transition: background .15s ease, color .15s ease;
}
.dh-seg button:hover { color: var(--ink); }
.dh-seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 20, 36, .14); }

.dh-hero-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: stretch; }
.dh-tiles { display: grid; grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dh-tile {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 11px 14px; border-radius: 12px; text-align: left; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--stroke);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
button.dh-tile { cursor: pointer; }
button.dh-tile:hover { border-color: var(--field-border); box-shadow: 0 6px 16px -12px rgba(16, 20, 36, .35); }
.dh-tile.on {
  background: linear-gradient(90deg, var(--blue-weak), transparent 80%), var(--surface);
  border-color: var(--blue); box-shadow: inset 3px 0 0 var(--blue);
}
.dh-tile-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dh-tile-label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.dh-tile-note { font-size: 10.5px; padding: 1px 6px; border-radius: 99px; background: var(--elevated); color: var(--subtle); margin-left: 2px; }
.dh-tile-value {
  margin: 2px 0 4px; font-family: var(--font-display); font-weight: 700; font-size: 24px;
  letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--ink);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.dh-fit-short { display: none; }
.dh-tile-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; }
.dh-tile-sub { color: var(--subtle); white-space: nowrap; }
.dh-delta { font-weight: 600; font-size: 11.5px; padding: 1px 7px; border-radius: 99px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dh-delta.up { background: var(--green-weak); color: var(--green); }
.dh-delta.down { background: var(--red-weak); color: var(--red); }
.dh-delta.flat { background: var(--elevated); color: var(--subtle); }
.dh-spark { flex: none; width: 76px; height: 34px; pointer-events: none; }
.dh-spark path { fill: none; stroke: var(--blue); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.dh-spark path.area { fill: var(--blue-weak); stroke: none; }
.dh-tile:not(.on) .dh-spark path { stroke: var(--subtle); opacity: .5; }
.dh-tile:not(.on) .dh-spark path.area { fill: var(--elevated); opacity: 1; }

.dh-chart-card { display: flex; flex-direction: column; min-width: 0; padding: 14px 14px 8px; border-radius: 14px; background: var(--paper-2); border: 1px solid var(--divider); }
.dh-chart-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin: 0 4px 8px; font-size: 13.5px; }
.dh-chart-head b { color: var(--ink); font-weight: 600; }
.dh-chart-grain { color: var(--subtle); }
.dh-chart-sum { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.dh-chart-prev { color: var(--subtle); font-weight: 400; }
.dh-compare { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.dh-compare input { accent-color: var(--blue); margin: 0; }
.dh-key-prev { width: 18px; height: 0; border-top: 2px dashed var(--subtle); }
.dh-chart { position: relative; height: 230px; overflow: hidden; }
.dh-chart-card .dh-chart { flex: 1; min-height: 280px; height: auto; }
.dh-chart canvas { display: block; width: 100% !important; height: 100% !important; }
.dh-chart-light { height: 200px; }

/* ── Panels ── */
.dh-grid { display: grid; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.dh-grid-a { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.dh-grid-b { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.dh-grid > .panel { margin-bottom: 0; min-width: 0; animation: dh-rise .4s ease both; }
.dh-panel-h { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.dh-panel-h h3 { margin: 0; }
.dh-h-note { font-weight: 500; font-size: 12.5px; color: var(--subtle); margin-left: 4px; }
.dh-lede { margin: -4px 0 12px; color: var(--subtle); font-size: 12.5px; line-height: 1.45; }
.dh-mini-seg button { font-size: 12.5px; padding: 4px 10px; }
.dh-mini-seg button b { font-weight: 600; margin-left: 3px; color: var(--subtle); font-variant-numeric: tabular-nums; }
.dh-mini-seg button.on b { color: var(--ink); }
.dh-mini-seg button[data-dep-filter="risk"].on b { color: var(--red); }
.dh-mini-seg button:disabled { opacity: .45; cursor: default; }
.dh-empty { padding: 26px 8px; text-align: center; color: var(--subtle); font-size: 13.5px; border: 1px dashed var(--stroke); border-radius: var(--r-md); }
.dh-more {
  margin-top: 8px; width: 100%; padding: 8px; border-radius: var(--r-sm); border: 1px dashed var(--stroke);
  background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.dh-more:hover { background: var(--paper-2); color: var(--ink); }

/* ── 3a. Departures ── */
.dh-deps { display: flex; flex-direction: column; }
.dh-dep {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) minmax(120px, 0.8fr) auto 12px; align-items: center; gap: 14px;
  padding: 10px 8px; margin: 0 -8px; border-radius: var(--r-md); color: inherit; text-decoration: none;
  transition: background .12s ease;
}
.dh-dep + .dh-dep { box-shadow: 0 -1px 0 var(--divider); }
a.dh-dep:hover { background: var(--paper-2); }
a.dh-dep:hover .dh-dep-name, a.dh-top-row:hover .dh-top-name { color: var(--accent-ink); }
.dh-chev { font-size: 20px; line-height: 1; color: var(--subtle); opacity: .45; transition: transform .15s ease, opacity .15s ease, color .15s ease; }
a:hover > .dh-chev { opacity: 1; color: var(--accent-ink); transform: translateX(2px); }
.dh-head-tools { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.dh-head-link {
  border: 0; background: transparent; padding: 4px 2px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--accent-ink); cursor: pointer; white-space: nowrap;
}
.dh-head-link span { display: inline-block; transition: transform .15s ease; }
.dh-head-link:hover span { transform: translateX(3px); }
.dh-chart-head .dh-head-link { padding: 0; }
.dh-dep-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center; height: 46px; border-radius: 11px;
  background: var(--elevated); line-height: 1;
}
.dh-dep-date b { font-family: var(--font-display); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dh-dep-date small { font-size: 11px; color: var(--subtle); margin-top: 3px; text-transform: lowercase; }
.dh-dep.is-risk .dh-dep-date { background: var(--red-weak); color: var(--red); }
.dh-dep.is-risk .dh-dep-date small { color: var(--red); }
.dh-dep-main { display: flex; flex-direction: column; min-width: 0; }
.dh-dep-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dh-dep-sub { font-size: 12.5px; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dh-dep-when.soon { color: var(--ink); font-weight: 600; }
.dh-dep.is-risk .dh-dep-when { color: var(--red); font-weight: 600; }
.dh-dep-fill { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.dh-dep-nums { font-size: 12.5px; color: var(--subtle); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dh-dep-nums b { color: var(--ink); font-weight: 600; }

.dh-bar { --c: var(--blue); position: relative; display: block; height: 8px; border-radius: 99px; background: var(--elevated); overflow: hidden; }
.dh-bar i { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: var(--c); transform-origin: left; animation: dh-grow .6s cubic-bezier(.2, .8, .2, 1) both; }
.dh-bar.tone-risk { --c: var(--red); }
.dh-bar.tone-low  { --c: var(--blue); }
.dh-bar.tone-ok   { --c: var(--blue); }
.dh-bar.tone-good { --c: var(--green); }

/* ── 3b. Заявки сейчас ── */
.st-requested { background: var(--amber); }
.st-confirmed { background: var(--blue); }
.st-prepaid   { background: var(--accent); }
.st-paid      { background: var(--green); }
.dh-pipe { display: flex; flex-direction: column; margin-bottom: 12px; }
.dh-pipe-row {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) 34px; align-items: center; gap: 12px;
  padding: 6px 8px; margin: 0 -8px; border: 0; border-radius: var(--r-sm); background: transparent;
  font: inherit; color: inherit; text-align: left;
}
button.dh-pipe-row { cursor: pointer; }
button.dh-pipe-row:hover { background: var(--paper-2); }
.dh-pipe-label { display: flex; flex-direction: column; font-size: 13.5px; line-height: 1.2; }
.dh-pipe-label small { font-size: 11.5px; color: var(--subtle); font-variant-numeric: tabular-nums; }
.dh-pipe-bar { height: 8px; border-radius: 99px; background: var(--elevated); overflow: hidden; }
.dh-pipe-bar i { display: block; height: 100%; border-radius: inherit; animation: dh-grow .6s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left; }
.dh-pipe-n { text-align: right; font-variant-numeric: tabular-nums; }
.dh-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dh-stat {
  display: flex; flex-direction: column; min-width: 0; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--paper-2); border: 1px solid var(--divider); text-align: left; font: inherit; color: inherit;
}
button.dh-stat { cursor: pointer; }
button.dh-stat:hover { border-color: var(--stroke); }
.dh-stat b { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dh-stat span { font-size: 12.5px; color: var(--ink-2); }
.dh-stat small { font-size: 11.5px; color: var(--subtle); line-height: 1.3; margin-top: 2px; }
.dh-sub-h { margin: 14px 0 8px; font-size: 13px; font-weight: 600; }
.dh-lost { display: flex; flex-direction: column; gap: 6px; }
.dh-lost-row { border: 0; background: transparent; font: inherit; color: inherit; text-align: left; padding: 3px 6px; margin: 0 -6px; border-radius: 6px; display: grid; grid-template-columns: minmax(0, 120px) minmax(0, 1fr) 24px; align-items: center; gap: 10px; font-size: 12.5px; }
.dh-lost-row span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.dh-lost-row b { text-align: right; font-variant-numeric: tabular-nums; }
button.dh-lost-row { cursor: pointer; }
button.dh-lost-row:hover { background: var(--paper-2); }
.dh-lost-bar { height: 6px; border-radius: 99px; background: var(--elevated); overflow: hidden; }
.dh-lost-bar i { display: block; height: 100%; border-radius: inherit; background: var(--red); opacity: .75; animation: dh-grow .6s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left; }

/* ── 4a. Top programs ── */
.dh-top { display: flex; flex-direction: column; gap: 2px; }
.dh-top-row {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto 10px; align-items: center; gap: 12px;
  padding: 8px; margin: 0 -8px; border-radius: var(--r-md); color: inherit; text-decoration: none;
}
a.dh-top-row:hover { background: var(--paper-2); }
.dh-top-rank {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px;
  background: var(--elevated); font-size: 12px; font-weight: 700; color: var(--subtle);
}
.dh-top-row:first-child .dh-top-rank { background: var(--blue); color: #fff; }
.dh-top-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.dh-top-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dh-top-bar { height: 6px; border-radius: 99px; background: var(--elevated); overflow: hidden; }
.dh-top-bar i { display: block; height: 100%; border-radius: inherit; background: var(--blue); opacity: .9; animation: dh-grow .6s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left; }
.dh-top-row:not(:first-child) .dh-top-bar i { opacity: .45; }
.dh-top-val { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; font-variant-numeric: tabular-nums; }
.dh-top-val small { font-size: 11.5px; color: var(--subtle); }

/* ── 4b. Months ── */
.dh-months-sum { margin: -4px 0 8px; font-variant-numeric: tabular-nums; }
.dh-months-sum b { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }

/* ── 5. Base ── */
.dh-base {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-lg); box-shadow: var(--sh-card); overflow: hidden;
}
.dh-base-item {
  display: flex; flex-direction: column; min-width: 0; padding: 14px 18px; border: 0; background: transparent;
  font: inherit; color: inherit; text-align: left;
}
.dh-base-item + .dh-base-item { box-shadow: -1px 0 0 var(--divider); }
button.dh-base-item { cursor: pointer; }
button.dh-base-item:hover { background: var(--paper-2); }
.dh-base-item b { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dh-base-item span { font-size: 12.5px; color: var(--ink-2); }
.dh-base-item small { font-size: 11.5px; color: var(--subtle); line-height: 1.3; margin-top: 2px; }

/* ── 0. Date + period ── */
.dh-bar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.dh-date { font-size: 13px; font-weight: 600; color: var(--subtle); letter-spacing: .01em; }

/* Section heads inside a card (P&L, Деньги, Продажи). */
.dh-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.dh-sec-h h3 { margin: 0; font-size: 15px; }
.dh-sec-h2 { margin-top: 16px; }

/* ── 2. Economics ── */
.dh-econ {
  padding: 16px 18px; margin-bottom: 16px; border-radius: var(--r-xl);
  background: var(--surface); border: 1px solid var(--stroke); box-shadow: var(--sh-card);
  animation: dh-rise .4s ease both;
}
.dh-kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); border: 1px solid var(--divider); border-radius: var(--r-md); overflow: hidden; }
.dh-kpis-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dh-kpi { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 11px 13px; background: var(--paper-2); }
.dh-kpi + .dh-kpi { box-shadow: -1px 0 0 var(--divider); }
.dh-kpi-label { font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dh-kpi-value {
  font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: -0.03em; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dh-kpi-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 6px; font-size: 11.5px; }
.dh-kpi.tone-neg .dh-kpi-value { color: var(--red); }
.dh-kpi.tone-pos .dh-kpi-value { color: var(--green); }
.dh-kpi.tone-warn { box-shadow: inset 0 -2px 0 var(--amber); }
.dh-kpi.tone-warn + .dh-kpi, .dh-kpi + .dh-kpi.tone-warn { box-shadow: -1px 0 0 var(--divider), inset 0 -2px 0 var(--amber); }
/* KPI cells are narrow: short money («2,8 млн ₽») below a wide screen. */
@media (max-width: 1500px) {
  .dh-kpis .dh-fit-full { display: none; }
  .dh-kpis .dh-fit-short { display: inline; }
}
.dh-flags {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin-top: 10px; padding: 7px 12px;
  border-radius: var(--r-sm); background: var(--amber-weak); color: var(--ink-2); font-size: 12.5px;
}
.dh-flags .dh-head-link { padding: 0; font-size: 12.5px; }

/* ── 3. Forecast + portfolio ── */
.dh-grid-f { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.dh-legend { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--subtle); }
.dh-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: -6px; vertical-align: -1px; }
.dh-legend .k-fact { background: var(--blue); }
.dh-legend .k-plan { background: var(--blue); opacity: .5; }
.dh-legend .k-pot { background: var(--elevated); border: 1px solid var(--stroke); }
.dh-legend .k-margin { height: 2px; border-radius: 0; background: var(--green); }
.dh-fc-sums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.dh-fc-sum { display: flex; flex-direction: column; min-width: 0; padding: 8px 11px; border-radius: var(--r-sm); background: var(--paper-2); border: 1px solid var(--divider); }
.dh-fc-sum span { font-size: 12px; color: var(--ink-2); }
.dh-fc-sum b { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dh-fc-sum small { font-size: 11.5px; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dh-grid-f > .panel:first-child { display: flex; flex-direction: column; }
.dh-chart-fc { flex: 1; height: auto; min-height: 280px; }
.dh-fc-big { display: flex; flex-direction: column; padding: 12px 14px; margin-bottom: 8px; border-radius: var(--r-md); background: var(--blue-weak); }
.dh-fc-big span { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.dh-fc-big b { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--ink); }
.dh-fc-big small { font-size: 11.5px; color: var(--subtle); }
.dh-book-rows { display: flex; flex-direction: column; }
.dh-book-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 2px; font-size: 13px; }
.dh-book-row + .dh-book-row { box-shadow: 0 -1px 0 var(--divider); }
.dh-book-row span { display: flex; flex-direction: column; min-width: 0; color: var(--ink-2); }
.dh-book-row small { font-size: 11.5px; color: var(--subtle); }
.dh-book-row b { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); white-space: nowrap; }
.dh-book-row.tone-neg b { color: var(--red); }

/* Departures carry their money when dashboard_finance answered. */
.dh-deps.has-money .dh-dep { grid-template-columns: 46px minmax(0, 1fr) minmax(110px, 0.7fr) minmax(104px, auto) auto 12px; }
.dh-dep-money { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dh-dep-money b { font-weight: 600; color: var(--green); }
.dh-dep-money b.neg { color: var(--red); }
.dh-dep-money small { font-size: 11.5px; color: var(--subtle); }

/* ── 6. Programs: unit economics ── */
.dh-table-wrap { overflow-x: auto; margin: 0 -6px; }
.dh-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.dh-table th {
  position: sticky; top: 0; padding: 0 10px 9px; text-align: left; font-weight: 500; font-size: 11.5px;
  letter-spacing: .02em; color: var(--subtle); white-space: nowrap; border-bottom: 1px solid var(--stroke); background: var(--surface);
}
.dh-table th.num, .dh-table td.num { text-align: right; }
.dh-table th button { display: inline-flex; align-items: center; gap: 3px; border: 0; background: transparent; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.dh-table th button:hover { color: var(--ink); }
.dh-table th button.on { color: var(--ink); font-weight: 600; }
.dh-sort { display: inline-block; width: 9px; color: var(--blue); }
.dh-table td { padding: 9px 10px; border-bottom: 1px solid var(--divider); white-space: nowrap; vertical-align: middle; }
.dh-table td.num small { display: block; margin-top: 2px; font-size: 11px; color: var(--subtle); }
.dh-table tbody tr { transition: background .12s ease; }
.dh-table tbody tr:hover td { background: var(--paper-2); }
.dh-table td.neg { color: var(--red); font-weight: 600; }
.dh-table td.dim { color: var(--subtle); }
.dh-table td.warn { color: var(--amber-ink, var(--amber)); font-weight: 600; }
.dh-z { color: var(--subtle); opacity: .55; }

.dh-prog { white-space: normal !important; min-width: 220px; }
.dh-prog a, .dh-prog b { display: block; font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.3; }
.dh-prog a:hover { color: var(--accent-ink); }
.dh-prog small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--subtle); }

.dh-fillcell { display: inline-flex; align-items: center; gap: 8px; }
.dh-fillcell > span:last-child { min-width: 34px; font-weight: 600; }
.dh-mbar { --c: var(--blue); display: inline-block; width: 64px; height: 6px; border-radius: 99px; background: var(--elevated); overflow: hidden; }
.dh-mbar i { display: block; height: 100%; border-radius: inherit; background: var(--c); }
.dh-mbar.tone-good { --c: var(--green); }
.dh-mbar.tone-ok   { --c: var(--blue); }
.dh-mbar.tone-low  { --c: var(--amber); }
.dh-mbar.tone-bad  { --c: var(--red); }
.dh-revbar { display: block; height: 3px; margin: 4px 0 0 auto; width: 92px; overflow: hidden; }
.dh-revbar i { display: block; height: 100%; margin-left: auto; border-radius: inherit; background: var(--blue); opacity: .7; }

.dh-pill { display: inline-block; min-width: 46px; padding: 2px 8px; border-radius: 99px; font-weight: 600; font-size: 12px; text-align: center; }
.dh-pill.tone-good { background: var(--green-weak); color: var(--green); }
.dh-pill.tone-ok   { background: var(--blue-weak); color: var(--blue); }
.dh-pill.tone-low  { background: var(--amber-weak); color: var(--ink-2); }
.dh-pill.tone-bad  { background: var(--red-weak); color: var(--red); }
.dh-chip { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 500; }
.dh-chip.warn { background: var(--amber-weak); color: var(--ink-2); }

.dh-idle tr:not(.dh-idle-toggle) { display: none; }
.dh-idle.open tr:not(.dh-idle-toggle) { display: table-row; }
.dh-idle tr:not(.dh-idle-toggle) td { color: var(--subtle); }
.dh-idle tr:not(.dh-idle-toggle) .dh-prog a { color: var(--ink-2); font-weight: 500; }
.dh-idle-toggle td { padding: 0; border-bottom: 1px solid var(--divider); }
.dh-idle-toggle button {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 10px; border: 0; background: transparent;
  font: inherit; font-size: 12.5px; color: var(--ink-2); text-align: left; cursor: pointer;
}
.dh-idle-toggle button:hover { background: var(--paper-2); color: var(--ink); }
.dh-idle-toggle b { color: var(--ink); font-weight: 600; }
.dh-idle-chev { display: inline-block; font-size: 16px; line-height: 1; color: var(--subtle); transition: transform .15s ease; }
.dh-idle.open .dh-idle-chev { transform: rotate(90deg); }

.dh-table tfoot td { padding-top: 11px; border-bottom: 0; border-top: 1.5px solid var(--stroke); font-weight: 700; background: var(--paper-2); }
.dh-table tfoot td:first-child { border-radius: 0 0 0 var(--r-sm); }
.dh-table tfoot td:last-child { border-radius: 0 0 var(--r-sm) 0; }
.dh-table tfoot .dh-prog b { font-weight: 700; }
.dh-flags-sm { margin-top: 12px; }

@media (max-width: 1180px) {
  .dh-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dh-kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dh-kpi { box-shadow: -1px 0 0 var(--divider), 0 -1px 0 var(--divider) !important; }
  .dh-grid-f { grid-template-columns: minmax(0, 1fr); }
  .dh-deps.has-money .dh-dep { grid-template-columns: 46px minmax(0, 1fr) minmax(110px, 0.7fr) minmax(104px, auto) 12px; }
  .dh-deps.has-money .dh-dep-status { display: none; }
}

@keyframes dh-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes dh-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  #view-dashboard *, #view-dashboard *::before, #view-dashboard *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 1180px) {
  .dh-alerts { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dh-hero-body { grid-template-columns: minmax(0, 1fr); }
  .dh-tiles { grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dh-chart-card .dh-chart { min-height: 240px; }
  .dh-grid-a, .dh-grid-b { grid-template-columns: minmax(0, 1fr); }
  .dh-base { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dh-base-item:nth-child(4) { box-shadow: 0 -1px 0 var(--divider); }
  .dh-base-item:nth-child(5) { box-shadow: -1px 0 0 var(--divider), 0 -1px 0 var(--divider); }
}
