/* ============================================================
   desk.css — the FO desk surface.

   Tokens only (src/shared/tokens.css). Light and dark are both real;
   [data-theme="dark"] redefines the same names, so a file that never
   writes a hex literal gets dark mode for free.

   The @media print block at the bottom is not a courtesy. The morning-IC
   job ends in a PDF attached to a committee pack, so the printed page is
   a deliverable: white ground, no chrome, panels unbroken across pages,
   and the provenance strip kept — a number in a pack that cannot be
   sourced six weeks later is not worth printing.
   ============================================================ */

.desk-page {
  padding-bottom: var(--space-24);
}

/* ---------- head ---------- */

.desk-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-8);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
}

.desk-kicker {
  margin: 0 0 var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-kicker);
  text-transform: uppercase;
  color: var(--brand);
}

.desk-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-h1);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-tight);
  color: var(--ink);
}

/* The job line is the product's opinion about your morning, so it is set in
   the editorial italic rather than dropped to caption grey. */
.desk-job {
  margin: var(--space-3) 0 0;
  max-width: 62ch;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--fs-lead);
  line-height: var(--lh-snug);
  color: var(--ink-2);
}

.desk-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* ---------- buttons ---------- */

.desk-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--control-sm);
  padding: 0 var(--space-6);
  border: var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink-1);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  cursor: pointer;
  white-space: nowrap;
}
.desk-btn:hover { border-color: var(--rule-strong); background: var(--paper-1); }
.desk-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.desk-btn.is-primary { background: var(--brand); border-color: var(--brand); color: var(--paper); }
.desk-btn.is-primary:hover { background: var(--brand); filter: brightness(1.08); }
.desk-btn.is-quiet { color: var(--ink-3); }

.desk-lock {
  margin-left: var(--space-2);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--brand);
}

/* ---------- switcher ---------- */

.desk-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding-bottom: var(--space-6);
  margin-bottom: var(--space-8);
  border-bottom: var(--hairline);
}

.desk-tabs {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
  flex-wrap: wrap;
  min-width: 0;
}

/* Each preset is a named answer to a job, so the tab carries the job line.
   That is the whole difference between choosing a desk and choosing a tab. */
.desk-tab {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-width: 30ch;
  padding: var(--space-4) var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--ink-2);
}
.desk-tab:hover { background: var(--paper-1); }
.desk-tab:focus-visible { outline: none; box-shadow: var(--ring); }
.desk-tab.is-active { background: var(--card); border-color: var(--rule); }
.desk-tab.is-active .desk-tab-n { color: var(--ink); }

.desk-tab-n {
  font-family: var(--font-sans);
  font-size: var(--fs-title);
  font-weight: var(--fw-semibold);
  color: var(--ink-1);
}
.desk-tab-j {
  font-family: var(--font-sans);
  font-size: var(--fs-mini);
  line-height: var(--lh-snug);
  color: var(--ink-3);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.desk-tabs-rule { width: 1px; align-self: stretch; background: var(--rule); margin: 0 var(--space-2); }

.desk-fullterm {
  flex: none;
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}
.desk-fullterm:hover { color: var(--brand); }

/* ---------- grid ---------- */

.desk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-8);
  align-items: start;
}
.desk-panel[data-span="2"] { grid-column: span 2; }

@media (max-width: 900px) {
  .desk-grid { grid-template-columns: minmax(0, 1fr); }
  .desk-panel[data-span="2"] { grid-column: span 1; }
}

.desk-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.desk-panel-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-8);
  border-bottom: var(--hairline-soft);
}

.desk-panel-t {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-snug);
  color: var(--ink);
}

/* The question sits under the title at every panel, in every desk. It is the
   label that makes composition a question-selection exercise rather than
   chart shopping. */
.desk-panel-q {
  margin: var(--space-2) 0 0;
  max-width: 52ch;
  font-family: var(--font-sans);
  font-size: var(--fs-mini);
  line-height: var(--lh-snug);
  color: var(--ink-3);
}

.desk-panel-tools { display: flex; gap: var(--space-1); flex: none; }

.desk-icon {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-3);
  font-size: var(--fs-small);
  line-height: 1;
  cursor: pointer;
}
.desk-icon:hover:not(:disabled) { background: var(--paper-2); color: var(--ink-1); }
.desk-icon:disabled { opacity: 0.3; cursor: default; }
.desk-icon:focus-visible { outline: none; box-shadow: var(--ring); }

.desk-panel-bd { padding: var(--space-8); flex: 1 1 auto; min-width: 0; }

.desk-panel-ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-5) var(--space-8);
  border-top: var(--hairline-soft);
  background: var(--paper-1);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-wrap: wrap;
}
.desk-panel-export { flex: none; }

/* A panel that cannot answer says so IN PLACE. It never disappears — a hole in
   the grid reads as broken software, a stated gap reads as an instrument. */
.desk-panel-state {
  margin-bottom: var(--space-6);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
  color: var(--ink-2);
  background: var(--paper-1);
}
.desk-panel-state.is-out { border-left-color: var(--down); }
.desk-panel-state.is-degraded { border-left-color: var(--chart-threshold); }
.desk-panel-state-k {
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--ink-1);
}

.desk-quiet {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--ink-3);
}

.desk-empty {
  grid-column: 1 / -1;
  padding: var(--space-20) var(--space-8);
  text-align: center;
  border: 1px dashed var(--rule);
  border-radius: var(--radius-lg);
  color: var(--ink-3);
}

/* ---------- kind: brief ---------- */

.desk-regime { display: flex; align-items: baseline; gap: var(--space-6); flex-wrap: wrap; }
.desk-regime-label {
  font-family: var(--font-serif);
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  color: var(--ink);
}
.desk-regime.is-up .desk-regime-label { color: var(--up); }
.desk-regime.is-down .desk-regime-label { color: var(--down); }
.desk-regime.is-warn .desk-regime-label { color: var(--chart-threshold); }
.desk-regime-score {
  font-family: var(--font-mono);
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}
.desk-regime-max { color: var(--ink-3); font-size: var(--fs-small); }

.desk-lede {
  margin: var(--space-5) 0 0;
  max-width: 68ch;
  font-family: var(--font-serif);
  font-size: var(--fs-body-lg);
  line-height: var(--lh-normal);
  color: var(--ink-1);
}

.desk-brief-items { margin: var(--space-6) 0 0; padding: 0; list-style: none; }
.desk-brief-items li {
  position: relative;
  padding: var(--space-3) 0 var(--space-3) var(--space-8);
  border-top: var(--hairline-soft);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-snug);
  color: var(--ink-1);
}
.desk-brief-items li::before {
  content: "";
  position: absolute;
  left: var(--space-2);
  top: calc(var(--space-3) + 0.55em);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--brand);
}

/* ---------- kind: stat-row ---------- */

.desk-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-8) var(--space-6);
}
.desk-stat { min-width: 0; }
.desk-stat-k {
  font-family: var(--font-sans);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--space-2);
}
.desk-stat-v {
  font-family: var(--font-mono);
  font-size: var(--fs-h3);
  font-weight: var(--fw-medium);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
/* Direction colour rides the DELTA, not the level: a price is not good or bad,
   the move is. The level stays ink so a wall of tiles is readable. */
.desk-stat-d {
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.desk-stat-d.is-up { color: var(--up); }
.desk-stat-d.is-down { color: var(--down); }
.desk-stat-d.is-warn { color: var(--chart-threshold); }
.desk-stat-v.is-warn { color: var(--chart-threshold); }
.desk-stat-u { margin-left: 3px; font-size: var(--fs-mini); color: var(--ink-3); font-family: var(--font-sans); }
.desk-stat-s { margin-top: var(--space-1); font-size: var(--fs-mini); color: var(--ink-4); font-family: var(--font-sans); }

/* ---------- kind: table ---------- */

.desk-tablewrap { overflow-x: auto; margin: calc(var(--space-2) * -1) 0; }
.desk-table { width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: var(--fs-small); }
.desk-table th {
  position: sticky; top: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--card);
  border-bottom: var(--hairline);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.desk-table td {
  padding: var(--space-4);
  border-bottom: var(--hairline-soft);
  color: var(--ink-1);
  white-space: nowrap;
}
.desk-table tr:last-child td { border-bottom: none; }
.desk-table tr.is-emphasis td { font-weight: var(--fw-semibold); color: var(--ink); background: var(--paper-1); }
.desk-table .ta-r { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.desk-table .ta-l { text-align: left; }
.desk-table th.ta-r { font-family: var(--font-sans); }
.desk-table .is-up { color: var(--up); }
.desk-table .is-down { color: var(--down); }
.desk-table .is-warn { color: var(--chart-threshold); }
.desk-link { color: var(--ink); text-decoration: none; font-weight: var(--fw-semibold); }
.desk-link:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- kind: signal-list ---------- */

.desk-signals { margin: 0; padding: 0; list-style: none; }
.desk-signal {
  display: flex; gap: var(--space-5);
  padding: var(--space-5) 0;
  border-bottom: var(--hairline-soft);
}
.desk-signal:last-child { border-bottom: none; }
.desk-signal-sev {
  flex: none; align-self: flex-start;
  padding: 1px var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--ink-2);
}
.desk-signal.sev-critical .desk-signal-sev,
.desk-signal.sev-high .desk-signal-sev { color: var(--down); border-color: var(--down); }
.desk-signal.sev-medium .desk-signal-sev { color: var(--chart-threshold); border-color: var(--chart-threshold); }
.desk-signal-t { font-size: var(--fs-body); font-weight: var(--fw-semibold); color: var(--ink); }
.desk-signal-d { margin-top: var(--space-1); font-size: var(--fs-small); line-height: var(--lh-snug); color: var(--ink-2); }

/* ---------- kind: curve ---------- */

.desk-curve svg { width: 100%; height: auto; display: block; overflow: visible; }
.desk-curve-line { stroke: var(--brand); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.desk-curve-dots circle { fill: var(--brand); }
.desk-curve-tick {
  fill: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 8.5px;
}
.desk-curve-cap {
  margin: var(--space-4) 0 0;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--ink-2);
}

/* ---------- shared-desk banner ---------- */

.desk-banner {
  margin-bottom: var(--space-8);
  border: 1px solid var(--brand);
  border-radius: var(--radius-lg);
  background: var(--brand-bg);
}
.desk-banner-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-8); flex-wrap: wrap;
  padding: var(--space-6) var(--space-8);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  color: var(--ink);
}
.desk-banner-sub { display: block; margin-top: var(--space-1); font-size: var(--fs-mini); color: var(--ink-2); }
.desk-banner-acts { display: flex; gap: var(--space-4); }

/* ---------- foot + toast ---------- */

.desk-foot {
  margin: var(--space-16) 0 0;
  max-width: 72ch;
  font-family: var(--font-serif);
  font-size: var(--fs-small);
  line-height: var(--lh-normal);
  color: var(--ink-3);
}

.desk-toast {
  position: fixed;
  left: 50%; bottom: var(--space-12);
  transform: translateX(-50%) translateY(8px);
  z-index: var(--z-toast);
  padding: var(--space-4) var(--space-8);
  border: var(--hairline);
  border-radius: var(--radius-pill);
  background: var(--card);
  box-shadow: var(--shadow-floating);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.desk-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   PRINT — the IC handout.

   This is the path by which the morning brief leaves the screen and lands
   in a committee pack, so everything that is not evidence comes off and
   everything that lets a number be argued with stays on.
   ============================================================ */
@media print {
  /* Force the light palette: a dark-mode reader must not print a black page. */
  :root, [data-theme="dark"] {
    --paper: #fff; --paper-1: #fff; --paper-2: #f4f4f4; --card: #fff;
    --ink: #111; --ink-1: #222; --ink-2: #444; --ink-3: #555; --ink-4: #777;
    --rule: #bbb; --rule-soft: #ddd; --rule-strong: #999;
    --up: #1a6b3c; --down: #9b2226; --brand: #2f5d39; --chart-threshold: #8a6100;
  }

  /* App chrome, by the class names these modules ACTUALLY emit — verified
     against header-v3.js (.topbar, .ribbon-rail, .bottom-nav), footer-v3.js
     (.site-footer-v3), watchlist-sidebar.js (#watchlist-sidebar), beta-config.js
     (.beta-banner-global) and search-frontend.js (.spotlight-*). A guessed
     selector here means a handout that prints the nav. */
  .header, .topbar, .ribbon-rail, .bottom-nav, #tmt-bottomnav-mount,
  footer, .site-footer, .site-footer-v3,
  #watchlist-sidebar, #watchlist-sidebar-scrim, .watchlist-sidebar,
  .beta-banner-global, .spotlight-backdrop, .spotlight-content,
  .desk-switcher, .desk-actions, .desk-panel-tools, .desk-banner,
  .desk-toast, .tmt-export-btn, .desk-fullterm {
    display: none !important;
  }

  body { background: #fff; }
  .desk-page { padding: 0; max-width: none; }

  .desk-head { margin-bottom: 16pt; border-bottom: 1px solid #bbb; padding-bottom: 8pt; }
  .desk-title { font-size: 20pt; }
  .desk-job { font-size: 10pt; }

  /* One column reads better on paper than two half-width tables. */
  .desk-grid { display: block; }
  .desk-panel {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 14pt;
    border: 1px solid #bbb;
  }
  .desk-panel-bd { padding: 10pt 12pt; }
  .desk-panel-hd { padding: 8pt 12pt; }
  .desk-panel-ft { padding: 6pt 12pt; background: #f7f7f7; }

  /* The provenance strip is the point of printing it. */
  .tmt-prov { color: #333 !important; font-size: 8pt; }

  /* On paper the grid is one column, so an SVG at width:100% stretches to the
     full text measure and eats most of a page. Cap it to the width it was drawn
     for — the curve is a reference, not the exhibit. */
  .desk-curve svg { max-width: 320px; height: auto; }

  .desk-table { font-size: 9pt; }
  .desk-tablewrap { overflow: visible; }
  .desk-link { color: #111; text-decoration: none; }

  .desk-foot { margin-top: 12pt; font-size: 8pt; }

  @page { margin: 14mm; }
}
