/* ─────────────────────────────────────────────────────────────────────────────
   Oil–Rates Monitor · Nittan Rates Desk
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  --paper:  #e7e1d3;
  --ink:    #191814;
  --muted:  #6b665a;
  --line:   #39362f;
  --panel:  #f3efe6;
  --night:  #101411;
  --amber:  #c78b2a;
  --blue:   #315f84;
  --green:  #276c4d;
  --red:    #8d352f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(25,24,20,.05) 1px, transparent 1px),
    linear-gradient(rgba(25,24,20,.04) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

/* ── Shared surfaces ─────────────────────────────────────────────────────── */

.topbar,
.signal-band,
.regime-band,
.panel {
  border: 1px solid var(--line);
  background: rgba(243,239,230,.94);
  box-shadow: 5px 5px 0 rgba(25,24,20,.16);
}

/* ── Typography ──────────────────────────────────────────────────────────── */

h1, h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

h1 { font-size: clamp(30px, 4.5vw, 62px); line-height: .92; }
h2 { font-size: 20px; }

.eyebrow,
.label,
.mono {
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--muted);
}

.muted { color: var(--muted); }

/* ── Topbar ──────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 20px 24px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, auto));
  gap: 8px;
}

.status-strip > div {
  border-left: 4px solid var(--line);
  padding: 8px 12px;
  background: #fff9eb;
}

.status-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

/* ── ① Regime Band ───────────────────────────────────────────────────────── */

.regime-band {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  gap: 24px;
  padding: 20px 24px;
  align-items: start;
}

.regime-desc {
  font-size: 13px;
  line-height: 1.6;
  margin: 8px 0 0;
  max-width: 360px;
}

/* KPI row */
.kpi-row {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.kpi {
  border-left: 4px solid var(--line);
  padding: 8px 14px;
  background: #fff9eb;
  min-width: 140px;
}

.kpi strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  margin: 4px 0 2px;
}

.kpi-delta {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.kpi-note {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Channel status colours */
#channelStatus.channel-green  { color: var(--green); }
#channelStatus.channel-amber  { color: var(--amber); }
#channelStatus.channel-red    { color: var(--red); }
#channelStatus.channel-muted  { color: var(--muted); }

/* Transmission chain visual */
.chain {
  display: flex;
  align-items: center;
  background: var(--night);
  padding: 16px 18px;
  gap: 0;
  overflow-x: auto;
}

.chain-node {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.18);
  padding: 12px 14px;
  min-width: 120px;
  flex-shrink: 0;
}

.chain-node--target {
  border-color: rgba(199,139,42,.5);
  background: rgba(199,139,42,.06);
}

.cn-label {
  display: block;
  color: #f4efdf;
  font-weight: 700;
  font-size: 13px;
}

.cn-sub {
  display: block;
  color: #8a857a;
  font-size: 11px;
  margin-top: 4px;
}

.chain-arrow {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 10px;
  min-width: 120px;
}

.ca-stat {
  color: var(--amber);
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 4px;
}

.ca-line-wrap {
  display: flex;
  align-items: center;
  width: 100%;
}

.ca-line {
  flex: 1;
  height: 2px;
  background: rgba(255,255,255,.3);
}

.ca-arrow {
  color: rgba(255,255,255,.5);
  font-size: 14px;
  margin-left: 2px;
}

.ca-label {
  color: #7a756b;
  font-size: 10px;
  text-align: center;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.chain-note {
  font-size: 12px;
  line-height: 1.55;
  margin: 10px 0 0;
}

/* Mini regime comparison table */
.mini-wrap {
  border: 1px solid rgba(25,24,20,.3);
  background: #fff9eb;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 0;
}

.mini-table th {
  background: var(--night);
  color: #f4efdf;
  padding: 7px 10px;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

.mini-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(25,24,20,.1);
  white-space: nowrap;
}

.mini-table tr.current-regime td {
  background: rgba(199,139,42,.12);
  font-weight: 700;
}

/* ── ② Consensus Signal Band ─────────────────────────────────────────────── */

.signal-band {
  margin-top: 16px;
  padding: 18px 24px;
  display: grid;
  grid-template-columns: 1fr minmax(240px, 320px);
  gap: 24px;
  align-items: start;
}

.consensus {
  margin-top: 6px;
  font-size: clamp(26px, 4vw, 48px);
  font-weight: 800;
  line-height: 1;
}

.signal-caveat {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  border-left: 3px solid var(--amber);
  padding-left: 10px;
}

.meter {
  border: 1px solid var(--line);
  padding: 16px;
  background: var(--night);
  color: #f4efdf;
}

.meter strong {
  display: block;
  font-size: 38px;
  font-weight: 800;
  margin: 8px 0 10px;
}

.meter-sub {
  font-size: 11px;
  color: #7a756b;
  margin: 8px 0 0;
  line-height: 1.5;
}

.pill {
  display: inline-flex;
  padding: 6px 10px;
  border: 1px solid currentColor;
  font-weight: 700;
  font-size: 13px;
}

.long    { color: #4fc184; }
.short   { color: #ff897d; }
.neutral { color: #d4cbb7; }

/* ── ③ Divergence Alert ──────────────────────────────────────────────────── */

.divergence-alert {
  margin-top: 14px;
  background: rgba(199,139,42,.08);
  border: 1px solid var(--amber);
  border-left: 4px solid var(--amber);
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.6;
}

.divergence-alert strong { margin-right: 8px; }

/* ── ④ Signal Cards ──────────────────────────────────────────────────────── */

.section-label {
  margin-top: 20px;
  padding: 0 2px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.signal-card {
  border: 1px solid var(--line);
  background: rgba(243,239,230,.96);
  box-shadow: 4px 4px 0 rgba(25,24,20,.10);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.signal-card.long  { border-top: 4px solid var(--green); }
.signal-card.short { border-top: 4px solid var(--red); }
.signal-card.neutral { border-top: 4px solid var(--muted); }

.sc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

.sc-family {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 700;
}

.sc-position-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.sc-position-badge.long    { background: rgba(39,108,77,.12);  color: var(--green); border: 1px solid var(--green); }
.sc-position-badge.short   { background: rgba(141,53,47,.12);  color: var(--red);   border: 1px solid var(--red); }
.sc-position-badge.neutral { background: rgba(107,102,90,.12); color: var(--muted); border: 1px solid var(--muted); }

.sc-prediction {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 2px;
}

.sc-signal-lbl {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sc-explain {
  font-size: 12px;
  line-height: 1.55;
  color: #3a3730;
  border-top: 1px solid rgba(25,24,20,.13);
  padding-top: 10px;
  margin: 0 0 10px;
  flex: 1;
}

.sc-footer {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
  border-top: 1px solid rgba(25,24,20,.1);
  padding-top: 8px;
  margin-top: auto;
}

.sc-footer strong { color: var(--ink); }

.sc-date { margin-left: auto; }

/* ── ⑤ Grid + Panels ─────────────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.span-7  { grid-column: span 7; }
.span-5  { grid-column: span 5; }
.span-8  { grid-column: span 8; }
.span-4  { grid-column: span 4; }
.span-12 { grid-column: span 12; }

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.small {
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 10px;
}

canvas {
  width: 100%;
  height: 320px;
  display: block;
  background: #fff9eb;
  border: 1px solid rgba(25,24,20,.25);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  border-top: 4px solid var(--line);
  background: #fff9eb;
  padding: 10px 12px;
  min-height: 76px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
}

/* Leaderboard table */
.table-wrap {
  overflow: auto;
  border: 1px solid rgba(25,24,20,.3);
  background: #fff9eb;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 860px;
}

th, td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(25,24,20,.15);
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--night);
  color: #f4efdf;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
}

td.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Model comparison */
.model-section {
  margin-top: 18px;
  grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr);
}

.model-section .model-compare-panel,
.model-section .regime-glossary-panel {
  grid-column: auto;
}

.model-table {
  min-width: 900px;
}

.model-read {
  display: inline-block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.35;
  white-space: normal;
}

.glossary-list {
  display: grid;
  gap: 9px;
}

.glossary-list div {
  border-left: 4px solid var(--line);
  background: #fff9eb;
  padding: 9px 11px;
}

.glossary-list strong {
  display: block;
  font-size: 12px;
  margin-bottom: 3px;
}

.glossary-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* ── ⑤ Data Inputs Audit Panel ──────────────────────────────────────────── */

.audit-panel {
  margin-top: 0;
}

.audit-intro {
  margin-bottom: 14px;
}

.audit-unfiltered-bar {
  padding: 12px 16px;
  background: rgba(49,95,132,.07);
  border-left: 4px solid var(--blue);
  font-size: 13px;
  line-height: 1.6;
}

.audit-table-wrap {
  overflow: auto;
  border: 1px solid rgba(25,24,20,.3);
  background: #fff9eb;
}

#auditTable {
  min-width: 900px;
}

#auditTable td.audit-reason {
  font-size: 12px;
  white-space: normal;
  min-width: 280px;
  max-width: 460px;
  line-height: 1.5;
  color: var(--muted);
}

#auditTable tr.status-active td            { background: rgba(39,108,77,.06); }
#auditTable tr.status-deduped td           { background: rgba(49,95,132,.05); }
#auditTable tr.status-rejected td          { background: rgba(141,53,47,.05); opacity: .85; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.status-badge.active   { color: var(--green); }
.status-badge.deduped  { color: var(--blue);  }
.status-badge.rejected { color: var(--red);   }

/* ── ⑥ Methodology Footer ────────────────────────────────────────────────── */

.methodology {
  margin-top: 24px;
  border: 1px solid rgba(25,24,20,.3);
  background: rgba(243,239,230,.6);
  padding: 18px 24px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.methodology p { margin: 0 0 10px; }
.methodology p:last-child { margin-bottom: 0; }
.methodology strong, .methodology em { color: var(--ink); }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .regime-band {
    grid-template-columns: 1fr 1fr;
  }
  .regime-right {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .topbar,
  .signal-band,
  .regime-band {
    display: block;
  }

  .status-strip {
    margin-top: 16px;
    grid-template-columns: 1fr 1fr;
  }

  .regime-band > * { margin-bottom: 16px; }

  .span-7, .span-5, .span-8, .span-4, .span-12 {
    grid-column: span 12;
  }

  .model-section {
    grid-template-columns: 1fr;
  }

  .model-section .model-compare-panel,
  .model-section .regime-glossary-panel {
    grid-column: 1;
  }

  .kpi-row { flex-direction: column; }

  .chain { flex-direction: column; padding: 14px; }
  .chain-arrow { flex-direction: row; width: 100%; padding: 8px 0; min-width: 0; }
  .ca-label { margin-top: 0; margin-left: 8px; }
}
