/* ============================================================
   news.css -- /brain/news, the pre-market news brief (2026-10-07,
   moved from the Research Lab). Brain tokens only (tokens.css); tones
   follow the pills: bull = accent, bear = red, mixed = amber,
   neutral = muted.
   ============================================================ */

.nb-h2 { font-size: var(--text-base); display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.nb-h2 .meta { font-weight: 500; }
.pos { color: var(--accent-text); }
.neg { color: var(--red); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* hero: the setup in one line */
.nb-hero { display: flex; align-items: center; gap: var(--s4); padding: var(--s4) var(--s5); border-left: 5px solid var(--border-strong); }
.nb-hero.bull { border-left-color: var(--accent); }
.nb-hero.bear { border-left-color: var(--red); }
.nb-hero.mixed { border-left-color: var(--amber); }
.nb-mood { flex: none; padding: var(--s2) var(--s3); border-radius: var(--r-md); font-weight: 800; font-size: var(--text-sm);
  letter-spacing: 0.06em; background: var(--panel-3); color: var(--muted); }
.nb-hero.bull .nb-mood { background: var(--accent-soft); color: var(--accent-text); }
.nb-hero.bear .nb-mood { background: var(--red-soft); color: var(--red); }
.nb-hero.mixed .nb-mood { background: var(--amber-soft); color: var(--amber); }
.nb-hero-text { min-width: 0; }
.nb-hero-line { font: 700 var(--text-lg)/1.35 var(--font-display); margin-bottom: var(--s1); }
.nb-hero .callout, .nb-hero + .callout { margin-top: var(--s3); }
.callout + .callout, .page-head + .callout { margin-bottom: var(--s3); }

/* key levels */
.nb-levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s2); margin-top: var(--s4); }
.nb-level { display: flex; flex-direction: column; gap: 2px; padding: var(--s3); border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--panel); min-width: 0; }
.nb-level-l { font-size: var(--text-2xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.nb-level-v { font: 700 18px var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nb-level-c { font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.nb-level-c.pos { color: var(--accent-text); }
.nb-level-c.neg { color: var(--red); }

/* headlines */
.nb-grid { align-items: start; }
.nb-top { width: 100%; border-collapse: collapse; font-size: var(--text-sm); table-layout: fixed; }
.nb-top td { padding: var(--s3) var(--s2); border-bottom: 1px solid var(--border); vertical-align: top; line-height: 1.45; }
.nb-top tr:last-child td { border-bottom: 0; }
.nb-top td.nb-l { overflow-wrap: anywhere; }
.nb-row td:first-child { box-shadow: inset 3px 0 var(--border); }
.nb-row.bull td:first-child { box-shadow: inset 3px 0 var(--accent); }
.nb-row.bear td:first-child { box-shadow: inset 3px 0 var(--red); }
.nb-row.mixed td:first-child { box-shadow: inset 3px 0 var(--amber); }
.nb-n { width: 40px; color: var(--faint); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.nb-b { width: 112px; white-space: nowrap; }
.nb-i { width: 190px; font-weight: 700; }
.nb-bias { display: inline-flex; align-items: center; gap: 4px; padding: 1px var(--s2); border-radius: 999px; font-size: var(--text-2xs);
  font-weight: 700; background: var(--panel-3); color: var(--muted); }
.nb-bias.bull { background: var(--accent-soft); color: var(--accent-text); }
.nb-bias.bear { background: var(--red-soft); color: var(--red); }
.nb-bias.mixed { background: var(--amber-soft); color: var(--amber); }
.nb-cites { white-space: nowrap; opacity: 0.8; }
.nb-cites .cite { font-size: 10px; padding: 0 3px; }

/* citations and bias words inside rendered Markdown (news_brief.render) */
.cite { display: inline-block; margin-left: 2px; padding: 0 4px; border-radius: var(--r-sm); font-size: 11px; font-weight: 700;
  line-height: 1.5; vertical-align: 1px; background: var(--blue-soft); color: var(--blue); text-decoration: none; }
.cite:hover { text-decoration: underline; }
.cite.bad { background: var(--red-soft); color: var(--red); }
.bias { padding: 0 5px; border-radius: var(--r-sm); font-weight: 700; font-size: 0.92em; background: var(--panel-3); color: var(--muted); }
.bias.ok { background: var(--accent-soft); color: var(--accent-text); }
.bias.bad { background: var(--red-soft); color: var(--red); }
.bias.warn { background: var(--amber-soft); color: var(--amber); }
.nb-md { font-size: var(--text-sm); line-height: 1.6; max-width: 92ch; }
.nb-md h3 { font-size: var(--text-base); margin: var(--s5) 0 var(--s2); padding-bottom: var(--s1); border-bottom: 1px solid var(--border); }
.nb-md h3:first-child { margin-top: var(--s1); }
.nb-md h4 { font-size: var(--text-sm); margin: var(--s3) 0 var(--s1); }
.nb-md ul, .nb-md ol { margin: var(--s1) 0 var(--s2); padding-left: 22px; }
.nb-md ul { list-style: disc; }
.nb-md ol { list-style: decimal; }
.nb-md li { margin: 3px 0; }
.nb-md li > ul, .nb-md li > ol { color: var(--muted); }
.nb-md p { margin: var(--s2) 0; }
.nb-md a:not(.cite) { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.nb-md code { font-family: var(--font-mono); font-size: 0.92em; }
.nb-md .tw { overflow-x: auto; }
.nb-md table, .nb-table { width: 100%; border-collapse: collapse; font-size: var(--text-xs); margin: var(--s2) 0; }
.nb-md th, .nb-md td, .nb-table th, .nb-table td { padding: var(--s2); border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.nb-md th, .nb-table th { color: var(--muted); font-weight: 700; }
.nb-table td.num, .nb-table th.num { text-align: right; }

/* derivatives desk */
.nb-side { display: grid; gap: var(--s4); }
.nb-block { padding: var(--s3) 0; border-top: 1px solid var(--border); }
.nb-block:first-of-type { border-top: 0; padding-top: 0; }
.nb-k { margin-bottom: var(--s2); font-size: var(--text-2xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.nb-k .meta { text-transform: none; letter-spacing: 0; font-weight: 500; }
.nb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nb-chip { padding: 2px var(--s2); border-radius: var(--r-sm); font: 700 var(--text-xs) var(--font-mono);
  background: var(--red-soft); color: var(--red); border: 1px solid color-mix(in oklab, var(--red) 30%, transparent); }
.nb-chip.new b { font-size: 9.5px; text-transform: uppercase; margin-left: 2px; }
.nb-chip.out { background: transparent; color: var(--muted); border: 1px dashed var(--border-strong); text-decoration: line-through; }
.nb-flow { display: grid; grid-template-columns: 34px 1fr 70px; align-items: center; gap: var(--s2); font-size: var(--text-xs); margin: 4px 0; }
.nb-flow-l { font-weight: 700; }
.nb-flow-bar { height: 8px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.nb-flow-bar i { display: block; height: 100%; border-radius: 4px; }
.nb-flow-bar i.pos { background: var(--accent); }
.nb-flow-bar i.neg { background: var(--red); }
.nb-flow-v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.nb-deals { display: grid; gap: var(--s1); font-size: var(--text-xs); }
.nb-deals .meta { display: block; }
.nb-watch { display: grid; }
.nb-watch li { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: var(--s2); align-items: baseline; padding: var(--s2) 0;
  border-bottom: 1px solid var(--border); font-size: var(--text-xs); }
.nb-watch li:last-child { border-bottom: 0; }
.nb-sym { font: 700 var(--text-xs) var(--font-mono); }
.nb-watch li.bull .nb-sym { color: var(--accent-text); }
.nb-watch li.bear .nb-sym { color: var(--red); }
.nb-watch li.mixed .nb-sym { color: var(--amber); }

/* event calendar */
.nb-cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s3); }
.nb-day { padding: var(--s3) var(--s4); min-width: 0; }
.nb-day.today { border-color: var(--accent); }
.nb-day-h { margin-bottom: var(--s2); font-weight: 700; font-size: var(--text-sm); }
.nb-day ul { display: grid; gap: var(--s1); font-size: var(--text-xs); line-height: 1.4; }
.nb-risk { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--faint); }
.nb-risk.high { background: var(--red); }
.nb-risk.medium { background: var(--amber); }
.nb-risk.low { background: var(--accent); }
.section-title .nb-risk { margin: 0 3px 0 var(--s2); }
.nb-kind { font-size: var(--text-2xs); color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; }
.nb-res { margin-top: var(--s2); font-size: var(--text-xs); color: var(--muted); }

/* sections */
.nb-secs { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--s4); }
.nb-sec h3 { font-size: var(--text-sm); display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s2); }
.nb-sec-tag { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: var(--r-sm); text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--blue-soft); color: var(--blue); }
.nb-sec-tag.earnings { background: var(--accent-soft); color: var(--accent-text); }
.nb-sec-tag.macro { background: var(--amber-soft); color: var(--amber); }
.nb-sec-tag.commodities { background: var(--accent-soft); color: var(--accent-text); }
.nb-sec-tag.derivatives { background: var(--red-soft); color: var(--red); }
.nb-sec-body { font-size: var(--text-xs); max-height: 340px; overflow: auto; padding-right: var(--s1); }
.nb-fold > summary, .nb-d > summary { cursor: pointer; font-size: var(--text-sm); padding: var(--s1) 0; }
.nb-fold[open] > summary { margin-bottom: var(--s3); }
.nb-d { margin: var(--s2) 0; }
.nb-d > summary { font-weight: 700; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.nb-d > summary::before { content: "▸"; color: var(--faint); }
.nb-d[open] > summary::before { content: "▾"; }

/* sources */
.nb-src { display: grid; font-size: var(--text-xs); }
.nb-src li { display: grid; grid-template-columns: 3.2em minmax(0, 1fr); gap: var(--s2); padding: var(--s2) 0; border-bottom: 1px solid var(--border); }
.nb-src li:target { background: var(--accent-soft); }
.nb-src a { color: var(--accent-text); }
.nb-src .meta { display: block; }
.nb-src-id { font-family: var(--font-mono); color: var(--faint); }

/* status */
.nb-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s3); }
.nb-kpi { padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--panel-2); min-width: 0; }
.nb-kpi dt { font-size: var(--text-2xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.nb-kpi dd { display: grid; gap: 2px; margin-top: var(--s1); }
.nb-kpi strong { font: 700 var(--text-base) var(--font-display); }
.nb-now { display: inline-flex; align-items: center; gap: var(--s2); color: var(--blue); }
.nb-now.bad { color: var(--red); }
.nb-status .callout { margin-bottom: var(--s3); }
.nb-run { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.spin { animation: nb-spin 1s linear infinite; }
@keyframes nb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* forms */
.nb-two { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.nb-form { display: grid; gap: var(--s4); margin-bottom: var(--s3); }
.nb-form textarea { min-height: 0; font-size: var(--text-sm); }
.nb-form textarea[name="prompt"] { min-height: 320px; }
.nb-form [aria-invalid="true"] { border-color: var(--red); }
.nb-fieldset { border: 0; padding: 0; margin: 0; }
.nb-fieldset legend { margin-bottom: var(--s2); }
.nb-models { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: var(--text-sm); font-weight: 500; color: var(--text); }
.nb-models label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.nb-pre { white-space: pre-wrap; font: var(--text-xs)/1.5 var(--font-mono); max-height: 360px; overflow: auto; padding: var(--s3);
  border-radius: var(--r-md); border: 1px solid var(--border); background: var(--panel-2); margin-top: var(--s2); }
.nb-sm { min-height: 32px; padding: 0 var(--s2); font-size: var(--text-xs); margin-top: var(--s1); }
.nb-hist { columns: 2; font-size: var(--text-sm); }
.nb-hist li { padding: 2px 0; }
.nb-hist a[aria-current="page"] { font-weight: 800; text-decoration: none; }

/* Today page: the pre-market strip */
.nb-today { display: grid; gap: var(--s3); padding: var(--s4) var(--s5); margin-bottom: var(--s4); border-left: 5px solid var(--border-strong); }
.nb-today.bull { border-left-color: var(--accent); }
.nb-today.bear { border-left-color: var(--red); }
.nb-today.mixed { border-left-color: var(--amber); }
.nb-today-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.nb-today-head h2 { font-size: var(--text-base); }
.nb-today ol { display: grid; gap: var(--s2); font-size: var(--text-sm); }
.nb-today li { display: grid; grid-template-columns: 104px 150px minmax(0, 1fr); gap: var(--s2); align-items: baseline; }
.nb-today .nb-levels { margin-top: 0; }

@media (max-width: 980px) {
  .nb-two, .nb-kpis { grid-template-columns: minmax(0, 1fr); }
  .nb-i { width: auto; }
  .nb-top td.nb-i { display: block; padding-bottom: 0; border-bottom: 0; }
  .nb-today li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .nb-hist { columns: 1; }
}
