@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500;600&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #F5F2EC;
  --surface:   #FDFAF5;
  --border:    #DDD8CE;
  --border-hi: #C8C2B6;
  --text:      #1A1612;
  --text-sec:  #6B6358;
  --text-dim:  #A09890;
  --blue:      #1A6FBF;
  --green:     #1A8C6E;
  --red:       #C0392B;
  --amber:     #C47E0A;
  --purple:    #6D4FB5;
  --nav-h:     52px;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
}

/* ── NAV ─────────────────────────────────────────── */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
  z-index: 100;
}

#nav .brand {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
  margin-right: 32px;
  flex-shrink: 0;
}

#nav .brand span {
  color: var(--amber);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  display: flex;
  align-items: center;
  height: var(--nav-h);
  padding: 0 14px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: 'IBM Plex Mono', monospace;
}

.nav-link:hover { color: var(--text-sec); }
.nav-link.active { color: var(--amber); border-bottom-color: var(--amber); }

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding-left: 24px;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.06em;
}

.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

.refresh-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 9px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-sec);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: border-color 0.15s, color 0.15s;
}

.refresh-btn:hover { border-color: var(--amber); color: var(--amber); }
.refresh-btn:disabled { opacity: 0.4; cursor: default; }

/* ── MAIN CONTENT ────────────────────────────────── */
#content {
  padding: calc(var(--nav-h) + 20px) 24px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── DASHBOARD PANEL ─────────────────────────────── */
.dashboard { display: none; }
.dashboard.active { display: block; }

/* ── STAT STRIP ──────────────────────────────────── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.stat-cell {
  background: var(--surface);
  padding: 11px 14px;
}

.stat-cell .s-label {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.stat-cell .s-value {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.stat-cell .s-sub {
  font-size: 9px;
  color: var(--text-sec);
}

/* ── GRID ────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* ── CARD ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
}

.card.full { grid-column: 1 / -1; }

.card-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-label .title {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ── TAG ─────────────────────────────────────────── */
.tag {
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 2px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ── DATA ROW ────────────────────────────────────── */
.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.data-row:last-child { border-bottom: none; }

.data-row .label {
  font-size: 10px;
  color: var(--text-sec);
}

.data-row .value {
  font-size: 11px;
  font-weight: 500;
}

/* ── LOADING ─────────────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  gap: 16px;
}

.loading-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.loading-bar {
  width: 260px;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  background: var(--blue);
  animation: loadbar 2.2s ease-in-out infinite;
}

@keyframes loadbar { 0%{width:5%} 65%{width:80%} 100%{width:97%} }

/* ── ERROR ───────────────────────────────────────── */
.error-box {
  background: color-mix(in srgb, var(--red) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
  border-radius: 4px;
  padding: 16px;
  color: var(--red);
  font-size: 11px;
  line-height: 1.7;
  margin-top: 12px;
}

/* ── SPARKLINE ───────────────────────────────────── */
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  margin-top: 10px;
}

.spark-bar {
  flex: 1;
  border-radius: 1px 1px 0 0;
  min-width: 3px;
}

/* ── CYCLE TRACK ─────────────────────────────────── */
.cycle-track {
  position: relative;
  height: 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  margin: 14px 0 8px;
  background: linear-gradient(to right,
    color-mix(in srgb, var(--green) 25%, transparent),
    color-mix(in srgb, var(--blue) 15%, transparent),
    color-mix(in srgb, var(--amber) 25%, transparent),
    color-mix(in srgb, var(--red) 25%, transparent));
}

.cycle-needle {
  position: absolute;
  top: -5px;
  width: 4px;
  height: 20px;
  background: var(--amber);
  border-radius: 2px;
  transform: translateX(-50%);
}

.cycle-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* ── PROGRESS BAR ────────────────────────────────── */
.prog-wrap {
  height: 8px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  flex: 1;
}

.prog-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ── SAHM BAR ────────────────────────────────────── */
.sahm-wrap {
  height: 10px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  margin: 8px 0 4px;
}

.sahm-fill { height: 100%; border-radius: 2px; }
.sahm-marker {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--red);
  opacity: 0.6;
  left: 50%;
}

/* ── FOOTER ──────────────────────────────────────── */
.dash-footer {
  margin-top: 14px;
  font-size: 9px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  letter-spacing: 0.03em;
}

/* ── STANCE METER ────────────────────────────────── */
.stance-track {
  position: relative;
  height: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin: 14px 0 8px;
  background: linear-gradient(to right,
    color-mix(in srgb, var(--green) 20%, transparent),
    color-mix(in srgb, var(--blue) 15%, transparent),
    color-mix(in srgb, var(--red) 20%, transparent));
}

.stance-needle {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 20px;
  background: var(--amber);
  border-radius: 2px;
  transform: translateX(-50%);
}

.stance-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-dim);
  margin-bottom: 14px;
}

/* ── YIELD CELL ──────────────────────────────────── */
.yield-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.yield-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 6px;
  text-align: center;
}

.yield-cell .y-tenor { font-size: 9px; color: var(--text-dim); margin-bottom: 4px; }
.yield-cell .y-val   { font-size: 13px; font-weight: 500; }
.yield-cell .y-chg   { font-size: 9px; margin-top: 2px; }

/* ── DOT PLOT ────────────────────────────────────── */
.dot-row {
  display: flex;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.dot-row:last-child { border-bottom: none; }
.dot-year { width: 52px; font-size: 9px; color: var(--text-dim); flex-shrink: 0; }
.dot-track { flex: 1; position: relative; height: 16px; }
.dot-median-label { width: 52px; font-size: 10px; font-weight: 500; text-align: right; flex-shrink: 0; }

/* ── INFLATION GRID ──────────────────────────────── */
.inf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.inf-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 9px 11px;
}

.inf-cell .il { font-size: 9px; color: var(--text-dim); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.08em; }
.inf-cell .iv { font-size: 18px; font-weight: 500; }
.inf-cell .is { font-size: 9px; color: var(--text-sec); margin-top: 2px; }

/* ── IMPLICATIONS ────────────────────────────────── */
.impl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.impl-card {
  padding: 11px 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 0 3px 3px 0;
}

.impl-card .impl-term {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 10px;
}

.impl-card .impl-body {
  color: var(--text-sec);
  font-size: 10px;
  line-height: 1.6;
  font-family: 'IBM Plex Sans', sans-serif;
}

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 900px) {
  .grid, .grid-3 { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(3, 1fr); }
  .yield-grid { grid-template-columns: repeat(3, 1fr); }
  .impl-grid  { grid-template-columns: 1fr; }
  #content    { padding: calc(var(--nav-h) + 16px) 16px 16px; }
  #nav        { padding: 0 16px; }
}

@media (max-width: 600px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .inf-grid   { grid-template-columns: 1fr; }
}
