/*
 * /preview/about/data — dashboard page styles.
 *
 * Pure CSS charts: bar rows use CSS variable `--w: <pct>` to size their fill.
 * Sparklines are inline SVG built by the chart mixin. No JS chart library.
 *
 * The page is meant to feel like a terminal report — monospace numbers, dense
 * data, calm orange accents. Section headings borrow the site's existing
 * Fraunces / prompt-eyebrow rhythm.
 */

/* ---------- layout rhythm ---------- */

.dash-hero,
.dash-section,
.dash-closer {
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

.dash-section {
  background: color-mix(in oklab, var(--ink-deep, #11151a) 94%, transparent);
  border-top: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 8%, transparent);
}

.dash-hero h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.1;
  margin: 0.5rem 0 1rem;
}

.dash-hero__sub {
  max-width: 60ch;
  color: color-mix(in oklab, var(--text, #ebe9e4) 80%, transparent);
  line-height: 1.6;
}

.dash-h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  margin: 1.75rem 0 0.85rem;
  color: var(--text, #ebe9e4);
}

.dash-note {
  max-width: 60ch;
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 72%, transparent);
  line-height: 1.55;
}

.dash-note--warning {
  border-left: 3px solid var(--accent, #F16C0A);
  padding-left: 0.8rem;
}

.dash-empty {
  padding-block: 3rem;
  text-align: center;
  color: color-mix(in oklab, var(--text, #ebe9e4) 60%, transparent);
}

.dashboard-empty {
  color: color-mix(in oklab, var(--text, #ebe9e4) 50%, transparent);
  font-style: italic;
  margin: 0.4rem 0;
}

/* ---------- big-number tiles ---------- */

.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.dash-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  background: color-mix(in oklab, var(--ink-deep, #11151a) 80%, transparent);
  border: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 10%, transparent);
  border-radius: 0.5rem;
}

.dash-stat__value {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text, #ebe9e4);
}

.dash-stat__label {
  font-size: 0.82rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 75%, transparent);
}

.dash-stat__sub {
  font-size: 0.72rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 55%, transparent);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.02em;
}

/* ---------- bar chart (horizontal bars) ---------- */

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.5rem 0 1.5rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 80px;
  align-items: center;
  gap: 0.85rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem;
}

@media (max-width: 540px) {
  .bar-row {
    grid-template-columns: 100px 1fr 60px;
    gap: 0.5rem;
    font-size: 0.78rem;
  }
}

.bar-row__label {
  color: color-mix(in oklab, var(--text, #ebe9e4) 80%, transparent);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row__bar {
  position: relative;
  height: 18px;
  background: color-mix(in oklab, var(--ink-deep, #11151a) 70%, transparent);
  border-radius: 3px;
  overflow: hidden;
}

.bar-row__fill {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  background: linear-gradient(
    to right,
    var(--accent, #F16C0A),
    color-mix(in oklab, var(--accent, #F16C0A) 70%, white)
  );
  border-radius: 3px;
  transition: width 200ms ease;
}

.bar-row__value {
  color: var(--text, #ebe9e4);
  text-align: right;
}

/* ---------- data table ---------- */

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem;
  margin: 0.5rem 0 1.5rem;
}

.dash-table th,
.dash-table td {
  text-align: left;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 8%, transparent);
}

.dash-table th {
  color: color-mix(in oklab, var(--text, #ebe9e4) 75%, transparent);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  font-size: 0.78rem;
}

.dash-table td {
  color: var(--text, #ebe9e4);
}

.dash-table tbody tr:hover {
  background: color-mix(in oklab, var(--accent, #F16C0A) 6%, transparent);
}

/* numeric columns should right-align */
.dash-table td:nth-child(n+2),
.dash-table th:nth-child(n+2) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dash-table[data-sortable="true"] th[data-sort] {
  cursor: pointer;
  user-select: none;
}

.dash-table[data-sortable="true"] th[data-sort]:hover {
  color: var(--accent, #F16C0A);
}

.dash-table[data-sortable="true"] th[data-sort][aria-sort="ascending"]::after {
  content: ' ▲';
  font-size: 0.7em;
  color: var(--accent, #F16C0A);
}

.dash-table[data-sortable="true"] th[data-sort][aria-sort="descending"]::after {
  content: ' ▼';
  font-size: 0.7em;
  color: var(--accent, #F16C0A);
}

/* ---------- sparkline ---------- */

.sparkline {
  color: var(--accent, #F16C0A);
  vertical-align: middle;
}

.sparkline--empty {
  color: color-mix(in oklab, var(--text, #ebe9e4) 40%, transparent);
}

/* tick lines drawn inside the sparkline svg by the chart mixin when
 * opts.ticks is passed. A patch ship date overlay on the sparkline. */
.intent-sparkline-tick {
  stroke: color-mix(in oklab, var(--accent, #F16C0A) 65%, transparent);
  stroke-width: 1;
  stroke-dasharray: 2 2;
  opacity: 0.85;
}

/* ---------- closer ---------- */

.dash-closer__inner {
  text-align: center;
  padding-block: 1.5rem;
}

.dash-closer__text {
  margin: 0;
  font-size: 0.9rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 65%, transparent);
}

.dash-closer__text--muted {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 50%, transparent);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ---------- accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  .bar-row__fill { transition: none; }
}

/* ---------- print: dashboard prints well ---------- */

@media print {
  .dash-section { break-inside: avoid; }
  .dash-stat,
  .dash-table { background: white; color: black; }
}

/* ============================================================
 * INTENT (Phase 2)
 * ============================================================
 * Colors: muted amber for the "filed" / neutral state, gentle green
 * for the rising trajectory, faded ochre for chronic, dim grey-blue
 * for dying. The "gold" of unfiled muttering uses the page's accent
 * orange — that's the operator's signal to look.
 */

/* ---- shared atoms ---- */

.intent-quote {
  font-style: italic;
  margin: 0.3rem 0 0.3rem 0.9rem;
  padding-left: 0.85rem;
  border-left: 2px solid color-mix(in oklab, var(--accent, #F16C0A) 35%, transparent);
  color: color-mix(in oklab, var(--text, #ebe9e4) 80%, transparent);
  font-size: 0.88rem;
  line-height: 1.5;
  max-width: 60ch;
}

.intent-quote::before {
  content: '— ';
  color: color-mix(in oklab, var(--accent, #F16C0A) 60%, transparent);
  font-style: normal;
}

.intent-badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  background: color-mix(in oklab, var(--ink-deep, #11151a) 70%, transparent);
  border: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 12%, transparent);
  color: color-mix(in oklab, var(--text, #ebe9e4) 78%, transparent);
  margin-right: 0.35rem;
}

.intent-badge--channel {
  color: color-mix(in oklab, var(--accent, #F16C0A) 80%, white);
  border-color: color-mix(in oklab, var(--accent, #F16C0A) 28%, transparent);
}

/* trajectory pills — distinct colors per state */
.intent-trajectory {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  border: 1px solid currentColor;
  background: transparent;
}

.intent-trajectory-rising {
  color: #7ec98a; /* gentle green */
}

.intent-trajectory-chronic {
  color: #d6a04a; /* ochre */
}

.intent-trajectory-dying {
  color: #7a8a9a; /* dim grey-blue */
}

.intent-trajectory-one-off {
  color: color-mix(in oklab, var(--text, #ebe9e4) 50%, transparent);
}

.intent-trajectory-other {
  color: color-mix(in oklab, var(--text, #ebe9e4) 60%, transparent);
}

/* ---- 1. hot now ---- */

.intent-hot-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.intent-hot-row {
  padding: 1rem 1.1rem 1.1rem;
  background: color-mix(in oklab, var(--ink-deep, #11151a) 82%, transparent);
  border: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 10%, transparent);
  border-radius: 0.5rem;
}

.intent-hot-row.intent-action-needed {
  border-left: 3px solid var(--accent, #F16C0A);
  background: color-mix(in oklab, var(--accent, #F16C0A) 4%, var(--ink-deep, #11151a));
}

.intent-hot-row__head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.intent-hot-row__subject {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 500;
  margin: 0;
  color: var(--text, #ebe9e4);
}

.intent-hot-row__summary {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 82%, transparent);
  max-width: 70ch;
  line-height: 1.55;
}

.intent-hot-row__chart {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0.5rem 0 0.75rem;
}

.intent-patch-didnt-stick {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--accent, #F16C0A);
  letter-spacing: 0.04em;
}

.intent-hot-row__meta {
  margin-bottom: 0.6rem;
}

.intent-quotes-details {
  margin-top: 0.5rem;
}

.intent-quotes-details > summary {
  cursor: pointer;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 65%, transparent);
  padding: 0.2rem 0;
}

.intent-quotes-details > summary:hover {
  color: var(--accent, #F16C0A);
}

/* ---- 2. chronic backlog (sparkline-only rows) ---- */

.intent-sparkline-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.intent-sparkline-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 6%, transparent);
}

.intent-sparkline-row__subject {
  font-size: 0.88rem;
  color: var(--text, #ebe9e4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intent-sparkline-row__count {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 65%, transparent);
}

/* ---- 3. rising + dying (two-col) ---- */

.intent-curves {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin: 0.5rem 0 2rem;
}

@media (min-width: 880px) {
  .intent-curves {
    grid-template-columns: 1fr 1fr;
  }
}

.intent-curves__head {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 1rem;
  margin: 0 0 0.75rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 85%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 12%, transparent);
  padding-bottom: 0.4rem;
}

.intent-curve-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.intent-curve-row {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 6%, transparent);
}

.intent-curve-row__head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.intent-curve-row__subject {
  font-weight: 500;
  color: var(--text, #ebe9e4);
}

.intent-curve-row__spark {
  margin: 0.25rem 0 0.5rem;
}

/* ---- 4. filed vs unfiled ---- */

.intent-filed-vs-unfiled {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 0.5rem 0 1.5rem;
}

@media (min-width: 820px) {
  .intent-filed-vs-unfiled {
    grid-template-columns: 1fr 1fr;
  }
}

.intent-filed-vs-unfiled__col {
  padding: 1rem 1.1rem;
  background: color-mix(in oklab, var(--ink-deep, #11151a) 82%, transparent);
  border: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 10%, transparent);
  border-radius: 0.5rem;
}

.intent-filed-vs-unfiled__col--unfiled {
  border-color: color-mix(in oklab, var(--accent, #F16C0A) 35%, transparent);
  background: color-mix(in oklab, var(--accent, #F16C0A) 3%, var(--ink-deep, #11151a));
}

.intent-filed-vs-unfiled__head {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 1rem;
  margin: 0 0 0.75rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 85%, transparent);
}

.intent-filed-vs-unfiled__col--unfiled .intent-filed-vs-unfiled__head {
  color: var(--accent, #F16C0A);
}

.intent-fvu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.intent-fvu-row {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 5%, transparent);
}

.intent-fvu-row__subject {
  color: var(--text, #ebe9e4);
  flex: 1 1 200px;
}

.intent-fvu-row__refs,
.intent-fvu-row__count {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.76rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 65%, transparent);
}

.intent-fvu-row--gold .intent-fvu-row__subject {
  color: color-mix(in oklab, var(--accent, #F16C0A) 30%, var(--text, #ebe9e4));
  font-weight: 500;
}

.intent-fvu-row__star {
  color: var(--accent, #F16C0A);
  font-size: 0.85rem;
  flex: 0 0 auto;
}

.intent-fvu-filed-only {
  margin-top: 1rem;
}

.intent-fvu-filed-only > summary {
  cursor: pointer;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 65%, transparent);
  padding: 0.25rem 0;
}

/* ---- 5. quiet zones ---- */

.intent-quiet-zones {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 0.5rem 0 1.5rem;
}

.intent-quiet-zone {
  padding: 0.85rem 1rem;
  background: color-mix(in oklab, var(--ink-deep, #11151a) 85%, transparent);
  border-left: 2px solid color-mix(in oklab, var(--text, #ebe9e4) 25%, transparent);
  max-width: 70ch;
}

.intent-quiet-zone__signal {
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
  color: color-mix(in oklab, var(--text, #ebe9e4) 75%, transparent);
}

.intent-quiet-zone__signal strong {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: color-mix(in oklab, var(--accent, #F16C0A) 70%, white);
}

.intent-quiet-zone__callout {
  margin: 0.4rem 0 0;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--text, #ebe9e4);
  line-height: 1.5;
}

/* ---- 6. staff divergence ---- */

.intent-staff-divergence {
  margin: 1.5rem 0;
  padding: 0.4rem 0;
  border-top: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 8%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--text, #ebe9e4) 8%, transparent);
}

.intent-staff-divergence > summary {
  cursor: pointer;
  padding: 0.6rem 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem;
}

.intent-staff-divergence__title {
  color: var(--text, #ebe9e4);
}

.intent-staff-divergence__count {
  color: color-mix(in oklab, var(--text, #ebe9e4) 55%, transparent);
  font-size: 0.78rem;
}

/* ---- 7. full index ---- */

.intent-full-index {
  font-size: 0.78rem;
}

.intent-full-index th {
  white-space: nowrap;
}
