:root{
  --bg:#0b0f17;
  --card:rgba(255,255,255,.06);
  --card2:rgba(255,255,255,.08);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.70);
  --border:rgba(255,255,255,.10);

  --accent:#7c5cff;
  --good:#36d399;
  --warn:#fbbf24;
  --bad:#fb7185;

  --shadow:0 18px 50px rgba(0,0,0,.35);
  --radius:18px;
  --radius2:14px;

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
}
[data-theme="light"]{
  --bg:#f6f7fb;
  --card:rgba(12,18,34,.05);
  --card2:rgba(12,18,34,.07);
  --text:rgba(12,18,34,.92);
  --muted:rgba(12,18,34,.70);
  --border:rgba(12,18,34,.12);
  --shadow:0 18px 50px rgba(12,18,34,.10);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:
    radial-gradient(1100px 700px at 18% 0%, rgba(124,92,255,.20), transparent 0%),
    radial-gradient(900px 650px at 88% 10%, rgba(54,211,153,.14), transparent 0%),
    var(--bg);
  color:var(--text);
  font-family:var(--sans);
}
a{color:inherit}
code{font-family:var(--mono); background:var(--card); padding:.15rem .35rem; border-radius:8px; border:1px solid var(--border)}

.app{min-height:100%; display:flex; flex-direction:column}

/* HEADER */
.header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:16px 18px;
  border-bottom:1px solid var(--border);
  backdrop-filter:blur(10px);
}
.brand{display:flex; align-items:flex-start; gap:12px; min-width:0}
.logo{
  width:46px; height:46px;
  border-radius:12px;
  object-fit:contain;
  background:var(--card);
  border:1px solid var(--border);
  padding:6px;
  flex:0 0 auto;
}
.brand-text{min-width:0}
.title{
  margin:0;
  font-size:1.12rem;
  letter-spacing:.2px;
  line-height:1.2;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.subhead{margin-top:8px; display:flex; flex-direction:column; gap:6px}
.tz,.next{color:var(--muted); font-size:.92rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}

/* Toggle */
.theme-toggle{
  display:flex; align-items:center; gap:10px;
  background:transparent; color:var(--text);
  border:1px solid var(--border);
  border-radius:999px;
  padding:8px 10px;
  cursor:pointer;
  transition:transform .06s ease, background .2s ease;
}
.theme-toggle:hover{background:var(--card)}
.theme-toggle:active{transform:scale(.98)}
.toggle-track{
  position:relative;
  width:66px; height:30px;
  border-radius:999px;
  background:var(--card2);
  border:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 10px;
  overflow:hidden;
}
.toggle-icon{font-size:14px; opacity:.9; user-select:none}
.toggle-thumb{
  position:absolute; top:50%; transform:translateY(-50%);
  left:4px; width:24px; height:24px; border-radius:999px;
  background:linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,.08));
  border:1px solid var(--border);
  box-shadow:0 10px 18px rgba(0,0,0,.22);
  transition:left .18s ease;
}
[data-theme="light"] .toggle-thumb{left:calc(100% - 28px); box-shadow:0 10px 18px rgba(12,18,34,.12)}
.toggle-text{font-size:.92rem; color:var(--muted); min-width:54px; text-align:right}

/* MAIN */
.main{
  width:min(1180px, 100%);
  margin:0 auto;
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:16px;
  flex:1;
}

/* CARDS */
.card{
  background:linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.04));
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow:var(--shadow);
}
.card.inset{
  background:linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.05));
  border-radius:16px;
  padding:14px;
}

/* HERO */
.hero{
  padding:16px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:16px;
  align-items:start;
}
.hero-left{display:flex; flex-direction:column; gap:14px; min-width:0}
.hero-right{display:flex; flex-direction:column; gap:14px; min-width:0}

/* Text */
.section-title{margin:0; font-size:1.05rem}
.section-title.small{font-size:.98rem}
.h2{margin:0; font-size:1.02rem; letter-spacing:.2px}
.muted{color:var(--muted)}
.tiny{font-size:.88rem; line-height:1.35}
.footnote{margin:0; padding-top:6px}
.list{margin:8px 0 0; padding-left:18px; color:var(--muted)}
.list li{margin:6px 0}

/* Card head */
.card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
}
.badge{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--muted);
  font-size:.86rem;
  white-space:nowrap;
}

/* FOMC tools */
.fomc-tools{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:flex-end;
  margin-bottom:10px;
}

/* Countdown */
.countdown{
  display:flex;
  align-items:stretch;
  gap:14px;
  padding:14px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--card);
}
.cd-item{flex:1; text-align:center}
.cd-num{font-family:var(--mono); font-weight:900; font-size:2rem; line-height:1.05}
.cd-lbl{color:var(--muted); font-size:.9rem; margin-top:6px}
.cd-sep{width:1px; background:var(--border); border-radius:99px}

.actions{display:flex; flex-wrap:wrap; gap:10px; margin-top:12px}
.alert-status{
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--muted);
}
.info{margin-top:10px; color:var(--muted); line-height:1.55}

/* Stats */
.stats{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:10px;
}
.stat{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
}
.stat-label{display:block; font-size:.82rem; color:var(--muted); margin-bottom:6px}
.stat-value{display:block; font-family:var(--mono); font-weight:900; letter-spacing:.2px}

/* Pills */
.pill-row{display:flex; flex-wrap:wrap; gap:8px}
.pill{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--card);
  font-size:.9rem;
}
.pill.subtle{color:var(--muted)}

/* Buttons */
.btn{
  border:1px solid var(--border);
  background:rgba(124,92,255,.16);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  transition:transform .06s ease, background .2s ease;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.btn:hover{background:rgba(124,92,255,.22)}
.btn:active{transform:scale(.98)}
.btn.ghost{background:transparent}
.btn.ghost:hover{background:var(--card)}
.linkbtn[aria-disabled="true"]{
  opacity:.55;
  pointer-events:none;
}

/* Fields */
.field{display:flex; flex-direction:column; gap:6px; min-width:200px}
.field-lbl{font-size:.86rem; color:var(--muted)}
select{
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  padding:10px 10px;
  border-radius:12px;
  outline:none;
}

/* GAUGE */
.gauge-wrap{padding:6px}
.gauge{
  --arc-inset:18px;
  --arc-height:210px;
  --pivot-y: calc(var(--arc-inset) + var(--arc-height));
  position:relative;
  height:310px;
  border-radius:18px;
  border:1px solid var(--border);
  background:var(--card);
  overflow:hidden;
}
.gauge-arc{
  position:absolute;
  left:var(--arc-inset);
  right:var(--arc-inset);
  top:var(--arc-inset);
  height:var(--arc-height);
  border-radius:999px 999px 22px 22px;
  background:conic-gradient(from 180deg, var(--good) 0deg, var(--warn) 90deg, var(--bad) 180deg, transparent 180deg);
  -webkit-mask: radial-gradient(circle at 50% 100%, transparent 0 58%, #000 59%);
  mask: radial-gradient(circle at 50% 100%, transparent 0 58%, #000 59%);
  opacity:.95;
  z-index:1;
}
.ticks{
  position:absolute;
  left:var(--arc-inset);
  right:var(--arc-inset);
  top:var(--arc-inset);
  height:var(--arc-height);
  pointer-events:none;
  z-index:2;
}
.tick{
  position:absolute;
  left:50%;
  top:100%;
  width:2px;
  height:12px;
  transform-origin:bottom center;
  background:rgba(255,255,255,.55);
  opacity:.75;
}
[data-theme="light"] .tick{background:rgba(12,18,34,.55)}
.tick-label{
  position:absolute;
  left:50%;
  top:100%;
  transform-origin:bottom center;
  font-family:var(--mono);
  font-size:11px;
  color:var(--muted);
  white-space:nowrap;
  opacity:.95;
}

.needle{
  position:absolute;
  left:50%;
  top:var(--pivot-y);
  transform:translateX(-50%) rotate(-90deg);
  transform-origin:50% 0%;
  transition:transform .55s cubic-bezier(.2,.9,.2,1);
  z-index:3;
}
.needle-stem{
  position:absolute;
  left:50%;
  top:0;
  width:7px;
  height:150px;
  transform:translate(-50%, -100%);
  background:linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.25));
  border:1px solid var(--border);
  border-radius:999px;
  box-shadow:0 16px 30px rgba(0,0,0,.22);
}
.needle-cap{
  position:absolute;
  left:50%;
  top:0;
  width:18px;
  height:18px;
  transform:translate(-50%, -50%);
  border-radius:999px;
  background:linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,.10));
  border:1px solid var(--border);
  box-shadow:0 18px 26px rgba(0,0,0,.22);
}

.gauge-center{
  position:absolute;
  left:50%;
  top:calc(var(--pivot-y) - 62px);
  transform:translateX(-50%);
  text-align:center;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(0,0,0,.16);
  border:1px solid var(--border);
  backdrop-filter:blur(10px);
  min-width:170px;
  z-index:4;
}
[data-theme="light"] .gauge-center{background:rgba(255,255,255,.68)}
.center-value{font-family:var(--mono); font-weight:900; font-size:22px}
.center-sub{color:var(--muted); font-size:12px; margin-top:4px}

.legend{
  position:absolute;
  left:14px; right:14px; bottom:12px;
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:8px 10px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.10);
  z-index:5;
}
[data-theme="light"] .legend{background:rgba(255,255,255,.55)}
.legend-item{display:flex; align-items:center; gap:8px; color:var(--muted); font-size:12px}
.legend-dot{width:10px; height:10px; border-radius:999px}
.dot-easy{background:var(--good)}
.dot-neutral{background:var(--warn)}
.dot-tight{background:var(--bad)}

.range-scale{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-top:10px;
}
.scale-min,.scale-max{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:var(--card);
  min-width:140px;
}
.scale-label{font-size:.82rem; color:var(--muted)}
.scale-value{font-family:var(--mono); font-weight:900}

/* HISTO */
.mini{
  display:flex;
  gap:6px;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--muted);
  font-size:.86rem;
  white-space:nowrap;
}
.mini-value{font-family:var(--mono); font-weight:900; color:var(--text)}

.chart-wrap{
  width:calc(100% - 32px);
  margin:0 16px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.10);
  overflow:hidden;
}
[data-theme="light"] .chart-wrap{background:rgba(255,255,255,.50)}
canvas{display:block; width:100%; height:auto}

.chart-foot{
  margin:12px 16px 0;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.chip{
  border:1px solid var(--border);
  background:var(--card);
  border-radius:999px;
  padding:8px 10px;
  display:flex;
  gap:8px;
  align-items:center;
  font-size:.9rem;
}
.chip-k{color:var(--muted)}
.chip-v{font-family:var(--mono); font-weight:900}

.controls-row{
  margin:12px 16px 16px;
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:flex-end;
}

/* MODAL */
.modal{
  position:fixed;
  inset:0;
  display:none;
  place-items:center;
  background:rgba(0,0,0,.55);
  z-index:9999;
  padding:18px;
}
.modal.show{display:grid}
.modal-card{
  width:min(520px, 100%);
  border-radius:18px;
  border:1px solid var(--border);
  background:linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.06));
  box-shadow:var(--shadow);
  padding:16px;
}
.modal-title{margin:0 0 10px}
.modal-text{margin:0 0 14px; color:var(--muted); line-height:1.5}
.modal-actions{display:flex; justify-content:flex-end}

/* FOOTER */
.footer{
  padding:16px 18px;
  border-top:1px solid var(--border);
  text-align:center;
  color:var(--muted);
}
.footer p{margin:0}
.footer a{text-decoration:underline; text-underline-offset:3px}

/* Responsive */
@media (max-width: 1020px){
  .hero{grid-template-columns:1fr}
  .stats{grid-template-columns:1fr}
  .range-scale{flex-direction:column}
  .scale-min,.scale-max{min-width:0; width:100%}
  .tz,.next{white-space:normal}
  .field{min-width:240px}
}
