:root{
  --bg:#070707;
  --panel:#0f0f10;
  --panel2:#0b0b0c;
  --gold:#d4af37;
  --gold2:#b99226;
  --line:#232323;
  --muted:#8d7a3a;

  --g:#21c27a;
  --y:#f0c04d;
  --r:#e05252;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(212,175,55,0.08), transparent 55%),
              linear-gradient(180deg, #050505, var(--bg));
  color: var(--gold);
}

.wrap{max-width:1280px;margin:0 auto;padding:18px 16px 60px}

.header{
  position:sticky; top:0; z-index:50;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(7,7,7,.92), rgba(7,7,7,.65));
  border-bottom:1px solid rgba(212,175,55,.12);
  padding:14px 16px;
  display:flex; align-items:center; justify-content:space-between;
}

.brand-top{
  letter-spacing:10px;
  font-weight:700;
  font-size:18px;
}
.brand-sub{
  margin-top:6px;
  color: var(--muted);
  font-size:12px;
}

.controls{display:flex;gap:12px;align-items:center}

.seg{
  display:flex;
  border:1px solid rgba(212,175,55,.25);
  background: rgba(15,15,16,.75);
  border-radius:999px;
  padding:4px;
}
.seg-btn{
  border:0;
  background:transparent;
  color:var(--muted);
  padding:8px 12px;
  border-radius:999px;
  cursor:pointer;
  font-weight:600;
}
.seg-btn.active{
  background: rgba(212,175,55,.12);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(212,175,55,.18);
}

.top{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
  margin-top:16px;
}
.kpi{
  background: linear-gradient(180deg, rgba(16,16,18,.9), rgba(10,10,11,.9));
  border:1px solid rgba(212,175,55,.18);
  border-radius:18px;
  padding:18px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
  position:relative;
  overflow:hidden;
}
.kpi::before{
  content:"";
  position:absolute; inset:-1px;
  background: radial-gradient(600px 120px at 10% 0%, rgba(212,175,55,.16), transparent 60%);
  pointer-events:none;
}
.kpi-h{
  font-weight:700;
  letter-spacing:.12em;
  text-transform:uppercase;
  font-size:12px;
  color: var(--muted);
}
.kpi-v{
  font-size:56px;
  margin-top:10px;
  font-weight:800;
}
.kpi-s{
  margin-top:4px;
  font-weight:700;
  font-size:12px;
  letter-spacing:.18em;
  text-transform:uppercase;
}
.kpi-note{
  margin-top:10px;
  font-size:12px;
  color: rgba(212,175,55,.75);
  line-height:1.35;
}
.kpi.wide{
  grid-column: 1 / -1;
}
.kpi-foot{
  margin-top:10px;
  color: rgba(212,175,55,.55);
  font-size:11px;
}

.modules{
  margin-top:18px;
}

.module{
  margin-top:16px;
  background: linear-gradient(180deg, rgba(15,15,16,.95), rgba(10,10,11,.95));
  border:1px solid rgba(212,175,55,.14);
  border-radius:18px;
  padding:16px;
}
.module-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.module-title{
  font-size:16px;
  letter-spacing:.18em;
  text-transform:uppercase;
  font-weight:800;
}
.module-desc{
  color: rgba(212,175,55,.65);
  font-size:12px;
  max-width:520px;
  line-height:1.3;
}
.module-score{
  text-align:right;
  min-width:160px;
}
.module-score .num{
  font-size:20px;
  font-weight:800;
}
.badge{
  margin-top:6px;
  display:inline-flex;
  padding:6px 10px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
  border:1px solid rgba(212,175,55,.16);
  background: rgba(0,0,0,.25);
}

.cols{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
.col{
  border:1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.18);
  border-radius:14px;
  padding:12px;
}
.col-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:10px;
}
.col-name{
  font-size:12px;
  font-weight:900;
  letter-spacing:.22em;
  text-transform:uppercase;
  color: rgba(212,175,55,.9);
}
.tile-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
}
.tile{
  border:1px solid rgba(212,175,55,.10);
  background: rgba(12,12,13,.85);
  border-radius:14px;
  padding:10px;
  position:relative;
  overflow:hidden;
}
.tile::before{
  content:"";
  position:absolute; inset:-1px;
  background: radial-gradient(420px 110px at 0% 0%, rgba(212,175,55,.10), transparent 60%);
  pointer-events:none;
}
.tile-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.tile-name{
  font-size:12px;
  font-weight:700;
  line-height:1.2;
  color: rgba(212,175,55,.92);
}
.tile-help{
  font-size:11px;
  color: rgba(212,175,55,.55);
  margin-top:6px;
  line-height:1.25;
}
.tile-val{
  font-weight:900;
  font-size:18px;
  white-space:nowrap;
}
.state-dot{
  width:10px;height:10px;border-radius:50%;
  display:inline-block;margin-right:8px;
  vertical-align:middle;
}
.spark canvas{width:100%!important;height:38px!important}
.small{
  font-size:11px;
  color: rgba(212,175,55,.55);
}

.g{color:var(--g)}
.y{color:var(--y)}
.r{color:var(--r)}
.dot-g{background:var(--g)}
.dot-y{background:var(--y)}
.dot-r{background:var(--r)}

.footer{
  margin-top:22px;
  border-top:1px solid rgba(212,175,55,.10);
  padding-top:18px;
  color: rgba(212,175,55,.65);
}
.foot-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}
.foot-title{
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
  font-size:12px;
  color: rgba(212,175,55,.85);
}
.foot-text{
  margin-top:8px;
  font-size:12px;
  line-height:1.35;
}

@media (max-width: 980px){
  .top{grid-template-columns: 1fr}
  .cols{grid-template-columns: 1fr}
  .tile-grid{grid-template-columns: 1fr}
  .foot-grid{grid-template-columns: 1fr}
}
.cpi-chart-wrap {
  height: 20vh;        /* Responsive vertical size */
  min-height: 180px;   /* Prevent too small on phones */
  max-height: 260px;   /* Prevent massive growth */
  position: relative;
}
/* === Historical Position Bar === */

.range-bar{
  position:relative;
  height:6px;
  background:rgba(255,255,255,0.06);
  border-radius:6px;
  margin-top:8px;
}

.range-fill{
  position:absolute;
  height:100%;
  left:0;
  top:0;
  background:linear-gradient(90deg,#21c27a,#f0c04d,#e05252);
  border-radius:6px;
  width:0%;
}

.range-marker{
  position:absolute;
  top:-3px;
  width:10px;
  height:10px;
  background:#fff;
  border-radius:50%;
  transform:translateX(-50%);
  left:0%;
}
.market-overview{
  display:grid;
  grid-template-columns: repeat(auto-fit,minmax(160px,1fr));
  gap:16px;
  margin:30px 0;
}

.market-card{
  background: rgba(255,255,255,0.02);
  border:1px solid rgba(255,215,0,0.2);
  padding:14px;
  border-radius:10px;
}

.market-name{
  font-size:12px;
  opacity:0.7;
}

.market-value{
  font-size:20px;
  font-weight:600;
  margin:4px 0 10px;
}
.range-meta{
  margin-top: 6px;
  font-size: 11px;
  opacity: .78;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.range-meta b{ opacity: .98; }
.spark{
  height: 46px;        /* fixed spark height */
  margin-top: 10px;
}
.spark canvas{
  width: 100% !important;
  height: 46px !important;
  display: block;
}
/* Warning subtle glow */
.warning-tile {
  box-shadow: 0 0 12px rgba(255,140,0,0.35);
  border-color: rgba(255,140,0,0.5);
}

/* Crisis aggressive glow */
.crisis-tile {
  box-shadow: 0 0 20px rgba(255,0,0,0.6);
  border-color: rgba(255,0,0,0.8);
  animation: crisisPulse 1.5s infinite;
}

/* Pulse animation */
@keyframes crisisPulse {
  0% { box-shadow: 0 0 10px rgba(255,0,0,0.4); }
  50% { box-shadow: 0 0 25px rgba(255,0,0,0.9); }
  100% { box-shadow: 0 0 10px rgba(255,0,0,0.4); }
}
