:root {
  --bg: #07090c;
  --surface: rgba(22, 27, 34, 0.6);
  --surface-solid: #10151b;
  --surface-hover: rgba(38, 46, 56, 0.7);
  --border: rgba(60, 72, 86, 0.6);
  --border-hover: #56657a;
  --fg: #f1f5f9;
  --fg-2: #d2dbe5;
  --fg-3: #93a1b3;
  --fg-4: #6b7889;
  --accent: #34d399;
  --accent-2: #38bdf8;
  --good: #34d399;
  --good-bg: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.12);
  --danger: #fb7185;
  --danger-bg: rgba(251, 113, 133, 0.12);
  --reg: #38bdf8;
  --vol: #a78bfa;
  --radius: 16px;
  --radius-sm: 10px;
  font-synthesis: none;
}

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

body {
  background:
    radial-gradient(1100px 480px at 82% -8%, rgba(52, 211, 153, 0.10), transparent),
    radial-gradient(900px 420px at 8% 0%, rgba(56, 189, 248, 0.08), transparent),
    var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.06), transparent);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-glyph { font-size: 28px; filter: drop-shadow(0 0 12px rgba(52, 211, 153, 0.55)); }
.brand-text h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.brand-text p { font-size: 12px; color: var(--fg-4); letter-spacing: 0.03em; text-transform: uppercase; }
.topbar-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.as-of { font-size: 13px; color: var(--fg-3); }
.as-of strong { color: var(--fg-2); }
.disclaimer-pill {
  font-size: 11px; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 999px;
  color: var(--fg-4); white-space: nowrap;
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 28px 56px;
  align-items: start;
}

/* ---------- Controls ---------- */
.controls { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 92px; }
.control-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(8px);
}
.control-card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-3); margin-bottom: 14px; }
.home-line { font-size: 13px; color: var(--fg-2); margin: -6px 0 16px; line-height: 1.45; }

.field { display: block; margin-bottom: 18px; }
.field.compact { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--fg-2); margin-bottom: 8px;
}
.field-label em { font-style: normal; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.hint { display: block; font-size: 11px; color: var(--fg-4); margin-top: 6px; line-height: 1.4; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: #232b36; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18); transition: transform .1s; }
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: none; border-radius: 50%; background: var(--accent); cursor: pointer; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18); }

select {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--surface-solid); color: var(--fg); border: 1px solid var(--border);
  font-family: inherit; font-size: 13px; cursor: pointer;
}
select:hover { border-color: var(--border-hover); }

.autopick-btn {
  margin-top: 10px; width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.16), rgba(52, 211, 153, 0.08));
  color: var(--accent); border: 1px solid rgba(52, 211, 153, 0.4);
  font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .12s;
}
.autopick-btn:hover { background: rgba(52, 211, 153, 0.22); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  font-size: 12px; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-solid); color: var(--fg-3);
  transition: all .12s; text-transform: capitalize; user-select: none;
}
.chip:hover { border-color: var(--border-hover); color: var(--fg-2); }
.chip.active { background: rgba(56, 189, 248, 0.15); border-color: var(--accent-2); color: #bae6fd; }

.checkline { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--fg-2); cursor: pointer; }
.checkline input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

.export-card .export-btns { display: flex; gap: 8px; margin-top: 4px; }
.export-card button {
  flex: 1; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--surface-solid); color: var(--fg-2); border: 1px solid var(--border);
  font-family: inherit; font-size: 12px; font-weight: 600; transition: all .12s;
}
.export-card button:hover { border-color: var(--border-hover); color: var(--fg); background: var(--surface-hover); }
.copy-status { display: block; font-size: 11.5px; color: var(--accent); margin-top: 8px; min-height: 14px; }

/* ---------- Dashboard ---------- */
.dashboard { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.renewal-banner {
  border-radius: var(--radius); padding: 14px 18px; font-size: 13.5px; line-height: 1.45;
  border: 1px solid var(--border); display: none;
}
.renewal-banner.show { display: block; }
.renewal-banner.danger { background: var(--danger-bg); border-color: rgba(251, 113, 133, 0.45); color: #fecdd3; }
.renewal-banner.warn { background: var(--warn-bg); border-color: rgba(251, 191, 36, 0.4); color: #fde68a; }
.renewal-banner.good { background: var(--good-bg); border-color: rgba(52, 211, 153, 0.4); color: #bbf7d0; }
.renewal-banner strong { font-weight: 700; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; backdrop-filter: blur(8px); min-width: 0;
}
.kpi-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-4); margin-bottom: 8px; }
.kpi-value { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11.5px; color: var(--fg-3); margin-top: 5px; }
.kpi-value.good { color: var(--accent); }
.kpi-value.warn { color: var(--warn); }

.score-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.score-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; backdrop-filter: blur(8px); }
.score-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 16px; }
.score-head h3 { font-size: 14px; font-weight: 700; }
.score-sub { font-size: 11px; color: var(--fg-4); }
.score-bars { display: flex; flex-direction: column; gap: 14px; }
.score-bar-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--fg-3); margin-bottom: 6px; }
.score-bar-label strong { color: var(--fg); font-variant-numeric: tabular-nums; }
.meter { height: 10px; border-radius: 999px; background: #1c232c; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; transition: width .35s ease; }
.meter-now { background: linear-gradient(90deg, #fb7185, #fbbf24); }
.meter-after { background: linear-gradient(90deg, #38bdf8, #34d399); }

.premium-compare { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.premium-now, .premium-after { display: flex; flex-direction: column; }
.premium-amt { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.premium-after .premium-amt { color: var(--accent); }
.premium-tag { font-size: 11px; color: var(--fg-4); text-transform: uppercase; letter-spacing: 0.04em; }
.premium-arrow { font-size: 20px; color: var(--fg-4); }
.premium-pct { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--accent); background: var(--good-bg); border: 1px solid rgba(52,211,153,0.3); padding: 5px 10px; border-radius: 999px; }

/* ---------- Action list ---------- */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.list-head h2 { font-size: 16px; font-weight: 700; }
.list-count { font-size: 13px; color: var(--fg-4); font-weight: 500; }
.list-legend { display: flex; gap: 14px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--fg-3); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-reg { background: var(--reg); }
.dot-vol { background: var(--vol); }

.action-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.action {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; backdrop-filter: blur(8px); transition: border-color .12s, background .12s;
}
.action:hover { border-color: var(--border-hover); }
.action.in-plan { border-color: rgba(52, 211, 153, 0.45); background: linear-gradient(180deg, rgba(52,211,153,0.06), var(--surface)); }
.action.done { opacity: 0.72; }

.toggle { position: relative; width: 40px; height: 23px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider { position: absolute; inset: 0; border-radius: 999px; background: #2a323d; cursor: pointer; transition: background .15s; }
.toggle .slider::before { content: ""; position: absolute; height: 17px; width: 17px; left: 3px; top: 3px; border-radius: 50%; background: #cbd5e1; transition: transform .15s; }
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(17px); background: #04110b; }
.toggle.locked .slider { background: rgba(52,211,153,0.35); cursor: default; }
.toggle.locked .slider::before { transform: translateX(17px); background: #04110b; }

.action-main { min-width: 0; }
.action-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.action-name { font-size: 14.5px; font-weight: 600; }
.badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 999px; }
.badge-reg { color: var(--reg); background: rgba(56,189,248,0.12); border: 1px solid rgba(56,189,248,0.3); }
.badge-vol { color: var(--vol); background: rgba(167,139,250,0.12); border: 1px solid rgba(167,139,250,0.3); }
.badge-done { color: var(--good); background: var(--good-bg); border: 1px solid rgba(52,211,153,0.3); }
.action-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--fg-3); }
.action-meta .m { display: inline-flex; align-items: center; gap: 4px; }
.action-meta .m strong { color: var(--fg-2); font-variant-numeric: tabular-nums; }
.action-note { font-size: 12px; color: var(--fg-4); margin-top: 7px; line-height: 1.4; }
.cat-tag { font-size: 10.5px; color: var(--fg-4); text-transform: uppercase; letter-spacing: 0.04em; }

.action-stats { text-align: right; flex-shrink: 0; }
.discount-chip { font-size: 16px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.discount-chip small { font-size: 11px; font-weight: 600; color: var(--fg-4); }
.payback-line { font-size: 11.5px; color: var(--fg-3); margin-top: 4px; white-space: nowrap; }
.payback-line strong { color: var(--fg-2); font-variant-numeric: tabular-nums; }

.footnote { font-size: 11px; color: var(--fg-4); line-height: 1.5; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .layout { grid-template-columns: 1fr; }
  .controls { position: static; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .score-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .action { grid-template-columns: auto 1fr; }
  .action-stats { grid-column: 2; text-align: left; margin-top: 4px; }
  .layout { padding: 16px; }
}
