/* Retention dashboard (projects/retention-dashboard.html). Uses the tokens from signal.css. */
.dash { max-width: 1240px; padding-bottom: 40px; }
.dash h1 { font-weight: 500; font-size: clamp(2rem, 4.4vw, 3.4rem); line-height: 1.05; letter-spacing: -0.04em; text-wrap: balance; }
.dash-intro { max-width: 76ch; margin: 14px 0 0; font-size: 17px; color: var(--ink-2); }
.dash-intro a { color: var(--accent); }

.dash-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; margin-top: 30px; align-items: start; }

/* controls */
.dash-controls {
  position: sticky; top: 96px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.dash-controls fieldset { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.dash-main { min-width: 0; }
.dash-controls legend { margin-bottom: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }
.slider { display: block; margin-bottom: 14px; font-size: 14px; color: var(--ink-2); }
.slider span { display: flex; justify-content: space-between; gap: 8px; }
.slider output { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.slider input { width: 100%; margin-top: 6px; accent-color: var(--accent); }
.dash-assume { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: 500 12.5px/1 var(--sans); padding: 7px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink-3); transition: background-color 0.15s ease;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip:hover { border-color: var(--ink-3); }
.dash-reset { width: 100%; justify-content: center; height: 40px; font-size: 14px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); min-width: 0; }
.kpi-label { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.kpi strong { margin-top: 6px; font-family: var(--serif); font-size: clamp(1.4rem, 2.2vw, 1.9rem); font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); line-height: 1.35; }
.kpi-hi { background: var(--accent-soft); border-color: rgba(255, 59, 47, 0.35); }
.kpi-hi strong { color: var(--accent); }

/* cards and charts */
.dash-charts { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.dash-card { margin: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.dash-main > .dash-card { margin-top: 16px; }
.dash-card figcaption { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.dash-card figcaption strong { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.dash-card figcaption span { font-size: 13.5px; color: var(--ink-2); }
.dash-scatter { position: relative; height: 330px; }
.dash-scatter canvas { display: block; }
.dash-legend { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 12.5px; color: var(--ink-2); }

.bars { display: grid; gap: 10px; margin-top: 6px; }
.dash-card .sub-caption { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.bar-row .bar-value { white-space: nowrap; }
.bar-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 74px; align-items: center; gap: 10px; font-size: 13.5px; }
.bar-label { color: var(--ink-2); }
.bar-track { height: 12px; border-radius: 0 4px 4px 0; background: color-mix(in srgb, var(--line) 60%, transparent); }
.bar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--accent); transition: width 0.25s ease; }
.bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* table */
.dash-table-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dash-table-head h2 { font-size: 20px; }
.dash-table-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); }
.dash-table-head .btn { height: 40px; font-size: 14px; }
.dash-table-head .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.dash-table th { padding: 8px 10px; text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.dash-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.dash-table td strong { color: var(--accent); }
.dash-table .mono { font-family: var(--mono); font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.dash-empty { color: var(--ink-3); font-size: 14px; }
.dash-error { padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); }
.dash-note { margin: 18px 0 0; font-size: 13px; line-height: 1.55; color: var(--ink-3); }
.dash-note a { color: var(--accent); }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-charts { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .dash-layout { grid-template-columns: minmax(0, 1fr); }   /* minmax: the wide table scrolls instead of widening the page */
  .dash-controls { position: static; }
  .dash-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
  .dash-controls fieldset:first-child, .dash-reset { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-controls { grid-template-columns: 1fr; }
  .dash-scatter { height: 280px; }
}
