/* ============================================================================
   Equities UX Dashboard — design system
   Aesthetic: institutional research-note. Light, sober, precise.
   Palette is SEMANTIC: green = favorable, red = drawdown/caution,
   amber = watch, blue = primary/structure, white = surface.
   ========================================================================== */

:root {
  /* Surfaces */
  --paper:      #FBFAF5;   /* warm off-white page */
  --surface:    #FFFFFF;
  --surface-2:  #F4F3EC;
  --hairline:   #E7E5DA;
  --hairline-2: #D8D6C9;

  /* Ink */
  --ink:        #1B1E26;
  --ink-soft:   #5C6470;
  --ink-faint:  #8A909B;

  /* Semantic palette */
  --blue:       #1F4FD8;   /* primary / structure / info */
  --blue-ink:   #1A3FA8;
  --blue-tint:  #ECF0FD;
  --green:      #18895A;   /* favorable */
  --green-tint: #E7F3EC;
  --red:        #C53D29;   /* caution / drawdown / loss */
  --red-tint:   #FBEAE6;
  --amber:      #C98A11;   /* watch / warning */
  --amber-tint: #FBF1DC;

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Public Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;

  /* Geometry */
  --radius:   14px;
  --radius-s: 9px;
  --shadow:   0 1px 2px rgba(27,30,38,.04), 0 8px 24px rgba(27,30,38,.06);
  --shadow-s: 0 1px 2px rgba(27,30,38,.05);
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at 12% -10%, rgba(31,79,216,.05), transparent 42%),
    radial-gradient(circle at 100% 0%, rgba(24,137,90,.045), transparent 38%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 560; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: 2.1rem; line-height: 1.12; margin: 0 0 .2em; font-variation-settings: "opsz" 40; }
h2 { font-size: 1.42rem; margin: 0 0 .5em; }
h3 { font-size: 1.08rem; margin: 0 0 .4em; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }

/* ---- Layout ---------------------------------------------------------------*/
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 26px; }

header.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.topbar .wrap { display: flex; align-items: center; gap: 28px; height: 66px; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .mark {
  font-family: var(--font-display); font-size: 1.28rem; font-weight: 600;
  letter-spacing: -.02em;
}
.brand .mark b { color: var(--blue); }
.brand .tag {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--ink-faint); border-left: 1px solid var(--hairline-2); padding-left: 10px;
}
nav.main { display: flex; gap: 4px; margin-left: auto; align-items: center; }
nav.main a {
  color: var(--ink-soft); font-size: .92rem; font-weight: 500;
  padding: 7px 13px; border-radius: 8px; text-decoration: none;
}
nav.main a:hover { background: var(--surface-2); color: var(--ink); }
nav.main a.active { color: var(--blue-ink); background: var(--blue-tint); }
nav.main a.logout { color: var(--ink-faint); }

main { padding: 38px 0 80px; }

/* ---- Mode banner ----------------------------------------------------------*/
.mode-banner {
  font-family: var(--font-mono); font-size: .76rem; letter-spacing: .04em;
  text-align: center; padding: 7px; border-bottom: 1px solid var(--amber);
  background: var(--amber-tint); color: #8a5e08;
}
.mode-banner.live { background: var(--green-tint); border-color: var(--green); color: #0f5e3d; }

/* ---- Cards ----------------------------------------------------------------*/
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
}
.card + .card { margin-top: 22px; }
.section-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .15em;
  color: var(--ink-faint); margin-bottom: 14px; font-weight: 600;
}
.lede { color: var(--ink-soft); font-size: 1.02rem; max-width: 64ch; }

.grid { display: grid; gap: 22px; }
@media (min-width: 900px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }

/* ---- KPI cards ------------------------------------------------------------*/
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-s); padding: 15px 16px; box-shadow: var(--shadow-s);
  border-top: 3px solid var(--hairline-2);
}
.kpi.good { border-top-color: var(--green); }
.kpi.bad  { border-top-color: var(--red); }
.kpi.warn { border-top-color: var(--amber); }
.kpi.info { border-top-color: var(--blue); }
.kpi .k-label { font-size: .73rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .07em; }
.kpi .k-value { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 500; margin-top: 4px; letter-spacing: -.02em; }
.kpi .k-value.pos { color: var(--green); }
.kpi .k-value.neg { color: var(--red); }
.kpi .k-sub { font-size: .76rem; color: var(--ink-faint); margin-top: 2px; }

/* ---- Pills / badges -------------------------------------------------------*/
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600;
  padding: 4px 11px; border-radius: 999px; border: 1px solid transparent;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.favorable { background: var(--green-tint); color: var(--green); }
.pill.watch     { background: var(--amber-tint); color: var(--amber); }
.pill.neutral   { background: var(--surface-2); color: var(--ink-soft); }
.pill.info      { background: var(--blue-tint); color: var(--blue-ink); }
.pill.danger    { background: var(--red-tint); color: var(--red); }
/* Distinct from .watch: a deeper, more emphatic amber treatment so the
   sentiment 'Edge pending' label reads as a state, not a passing note. */
.pill.edge_pending { background: var(--amber-tint); color: #6f4d06; border-color: var(--amber); }

/* ---- Forms ----------------------------------------------------------------*/
label.field { display: block; margin-bottom: 18px; }
label.field .lab { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; font-family: var(--font-body); font-size: .98rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--hairline-2); border-radius: 9px;
  padding: 11px 13px; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint);
}
textarea { resize: vertical; min-height: 64px; font-family: var(--font-mono); }
.row { display: grid; gap: 18px; }
@media (min-width: 720px) { .row.two { grid-template-columns: 1fr 1fr; } }

.checks { display: grid; gap: 10px; }
.check {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px;
  border: 1px solid var(--hairline); border-radius: var(--radius-s); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.check:hover { border-color: var(--hairline-2); }
.check:has(input:checked) { border-color: var(--blue); background: var(--blue-tint); }
.check input { margin-top: 3px; accent-color: var(--blue); }
.check .c-title { font-weight: 600; font-size: .96rem; }
.check .c-desc { font-size: .85rem; color: var(--ink-soft); }
.check .c-base { font-size: .72rem; color: var(--blue-ink); font-weight: 600; }

.btn {
  font-family: var(--font-body); font-size: .98rem; font-weight: 600; cursor: pointer;
  background: var(--blue); color: #fff; border: 1px solid var(--blue);
  padding: 12px 22px; border-radius: 10px; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--blue-ink); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--blue); }
.btn.ghost:hover { background: var(--blue-tint); }

/* ---- Flash ----------------------------------------------------------------*/
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: .92rem; border: 1px solid; }
.flash.error { background: var(--red-tint); border-color: var(--red); color: #8e2b1c; }

/* ---- Charts ---------------------------------------------------------------*/
.chart { width: 100%; height: 300px; }
.gauge { width: 100%; height: 210px; }

/* ---- Strategy result block ------------------------------------------------*/
.result-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 6px; }
.result-head h2 { margin: 0; }
.baseline-tag { font-size: .72rem; color: var(--blue-ink); background: var(--blue-tint); padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.plain { background: var(--surface-2); border-left: 3px solid var(--blue); padding: 14px 18px; border-radius: 0 var(--radius-s) var(--radius-s) 0; color: var(--ink); font-size: .98rem; }
.plain .pe-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--blue-ink); font-weight: 700; display: block; margin-bottom: 5px; }

.flag { background: var(--amber-tint); border-left: 3px solid var(--amber); padding: 11px 16px; border-radius: 0 var(--radius-s) var(--radius-s) 0; font-size: .88rem; color: #6f4d06; margin-top: 12px; }

/* ---- Edge-pending banner (sentiment, accumulation insufficient) -----------*/
/* Sits above the KPIs on the sentiment card. Deliberately heavier than .flag
   so a viewer skimming past the disposition pill still cannot read the Sharpe
   or vs-baseline as a verdict. Distinct, additive treatment — never replaces
   the Category-2 in-sample tripwire (that one raises in the adapter). */
.edge-pending-banner {
  background: var(--amber-tint);
  border: 1px solid var(--amber);
  border-left-width: 4px;
  border-radius: var(--radius-s);
  padding: 14px 18px;
  margin: 4px 0 18px;
  color: #6f4d06;
}
.edge-pending-banner .ep-title { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.edge-pending-banner .ep-body  { font-size: .92rem; line-height: 1.45; }
.edge-pending-banner em { font-style: italic; }

/* ---- Accumulation telemetry panel (sentiment) -----------------------------*/
/* DB-derived, descriptive, NOT a countdown promise. */
.accumulation-panel {
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-s);
}
.accumulation-panel .section-label { margin-bottom: 10px; }
.accumulation-panel .ap-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 10px;
}
.accumulation-panel .ap-cell { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-s); padding: 11px 13px; }
.accumulation-panel .ap-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); font-weight: 600; margin-bottom: 4px; }
.accumulation-panel .ap-value { font-family: var(--font-mono); font-feature-settings: "tnum" 1; font-size: 1.08rem; color: var(--ink); }
.accumulation-panel .ap-sub   { font-size: .8rem; color: var(--ink-soft); margin-top: 2px; }
.accumulation-panel .ap-note  { font-size: .82rem; color: var(--ink-soft); margin: 6px 0 0; }
.accumulation-panel .ap-empty { font-size: .9rem; color: var(--ink-soft); margin: 0; }

/* ---- Tables ---------------------------------------------------------------*/
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.tbl th, table.tbl td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--hairline); }
table.tbl th { font-size: .73rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); font-weight: 600; }
table.tbl td.num { font-family: var(--font-mono); text-align: right; }
table.tbl tr.is-baseline td { background: var(--blue-tint); }
.pos { color: var(--green); } .neg { color: var(--red); }

/* ---- Methodology / prose --------------------------------------------------*/
.prose p { color: var(--ink-soft); max-width: 70ch; }
.prose h3 { margin-top: 26px; }
.glossary dt { font-weight: 700; font-family: var(--font-mono); font-size: .9rem; margin-top: 14px; }
.glossary dd { margin: 2px 0 0; color: var(--ink-soft); }

/* ---- Research blog --------------------------------------------------------*/
.research-list { list-style: none; padding: 0; margin: 0; }
.research-list-item { border-top: 1px solid var(--hairline); }
.research-list-item:first-child { border-top: none; }
.research-list-link {
  display: block; padding: 18px 4px; text-decoration: none; color: inherit;
  border-radius: var(--radius-s); transition: background .12s;
}
.research-list-link:hover { background: var(--surface-2); text-decoration: none; }
.research-list-meta { display: flex; align-items: baseline; gap: 12px; }
.research-date {
  font-size: .76rem; color: var(--ink-faint); letter-spacing: .04em;
}
.research-list-title {
  font-family: var(--font-display); font-size: 1.18rem; font-weight: 560;
  margin: 4px 0 6px; color: var(--ink); letter-spacing: -.01em;
}
.research-list-standfirst {
  color: var(--ink-soft); margin: 0; max-width: 72ch; font-size: .96rem;
}

.research-back {
  font-size: .88rem; color: var(--ink-soft); text-decoration: none;
}
.research-back:hover { color: var(--blue); text-decoration: underline; }

.research-entry-meta { margin-bottom: 4px; }
.research-entry-title { margin: 4px 0 18px; }

.editors-note {
  margin: 8px 0 22px; padding: 14px 18px;
  background: var(--amber-tint); border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius-s) var(--radius-s) 0; color: #6f4d06;
}
.editors-note p { color: #6f4d06; max-width: 72ch; }
.editors-note p:last-child { margin-bottom: 0; }
.editors-note-label {
  display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--amber); font-weight: 700; margin-bottom: 6px;
}

.research-body { margin-top: 6px; }

.research-entry-footer {
  margin-top: 38px; padding-top: 18px; border-top: 1px solid var(--hairline);
}
.research-footer-note {
  font-size: .82rem; color: var(--ink-faint); max-width: 78ch;
}
.research-footer-links {
  font-size: .88rem; color: var(--ink-soft); margin-top: 10px;
}

/* ---- Rendered-markdown prose (research bodies) ---------------------------*/
.prose h1 { margin: 0 0 .3em; }
.prose h2 { margin: 1.6em 0 .5em; font-size: 1.32rem; }
.prose h3 { margin: 1.4em 0 .4em; font-size: 1.08rem; }
.prose ul, .prose ol { color: var(--ink-soft); padding-left: 1.4em; }
.prose li { margin: .25em 0; }
.prose hr {
  border: 0; border-top: 1px solid var(--hairline); margin: 28px 0;
}
.prose blockquote {
  margin: 18px 0; padding: 10px 16px;
  border-left: 3px solid var(--blue); background: var(--blue-tint);
  color: var(--ink-soft); border-radius: 0 var(--radius-s) var(--radius-s) 0;
}
.prose blockquote p { color: var(--ink); margin: .35em 0; }
.prose code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--surface-2); padding: 1px 6px; border-radius: 4px;
  color: var(--ink);
}
.prose pre {
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--radius-s); padding: 14px 16px; overflow-x: auto;
  font-size: .86rem; line-height: 1.5;
}
.prose pre code { background: transparent; padding: 0; font-size: 1em; }
.prose table {
  width: 100%; border-collapse: collapse; font-size: .9rem; margin: 16px 0;
}
.prose table th, .prose table td {
  text-align: left; padding: 9px 12px;
  border-bottom: 1px solid var(--hairline);
}
.prose table th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-faint); font-weight: 600; border-bottom-color: var(--hairline-2);
}
.prose table td { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.prose table td:first-child { font-family: var(--font-body); }

.disclaimer {
  margin-top: 40px; font-size: .82rem; color: var(--ink-faint);
  border-top: 1px solid var(--hairline); padding-top: 18px; max-width: 78ch;
}

/* ---- Login ----------------------------------------------------------------*/
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 388px; }
.login-card .brand { justify-content: center; margin-bottom: 22px; }

/* ---- Staggered reveal -----------------------------------------------------*/
.reveal { opacity: 0; transform: translateY(8px); animation: rise .5s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---- Daily Signals board (issue 012) --------------------------------------*/
/* The board is the most recommendation-shaped surface in the dashboard, so
 * the visual treatment leans on the existing semantic palette (.pos / .neg /
 * .pill states) instead of introducing a new design language. The honesty
 * panel and sell-side sub-notes are intentionally prominent and use the
 * existing .watch / muted tones so they read as caveats, not decoration. */
.signal-honesty { border-left: 3px solid var(--amber); }
.signal-honesty p:first-of-type { margin-top: 0; }

.signal-coverage .kpis { margin-top: 0; }
.signal-note { color: var(--ink-faint); font-size: .85rem; margin-top: 10px; }

.signal-board {
  display: grid; gap: 22px; margin-top: 22px;
  grid-template-columns: 1fr;
}
@media (min-width: 980px) {
  .signal-board { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1320px) {
  .signal-board { grid-template-columns: repeat(2, 1fr); }
}

.signal-col + .signal-col { margin-top: 0; }
.signal-col h2 { margin: 0; }

.signal-lists {
  display: grid; gap: 18px; margin-top: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .signal-lists { grid-template-columns: 1fr 1fr; }
}

.signal-list .section-label { margin-bottom: 6px; }
.signal-sub {
  color: var(--ink-faint); font-size: .8rem; margin: 4px 0 10px;
  font-style: italic;
}
.signal-sym { font-family: var(--font-mono); font-weight: 600; }
.signal-val { font-family: var(--font-mono); text-align: right; }
.signal-empty { color: var(--ink-faint); font-size: .9rem; padding: 8px 0; }
.signal-why { margin: 8px 0 0; }
.signal-method-note {
  margin-top: 14px; color: var(--ink-faint); font-size: .85rem;
  border-top: 1px solid var(--hairline); padding-top: 10px;
}
.signal-method-note code {
  font-family: var(--font-mono); font-size: .82rem;
  background: var(--paper-2, rgba(0,0,0,.04));
  padding: 1px 4px; border-radius: 3px;
}

.signal-col-benchmark { background: transparent; border-style: dashed; }
