:root {
  --bg: #070B12;
  --panel: #0D1520;
  --panel2: #0F1B28;
  --border: #1B2733;
  --borderBright: #274153;
  --cyan: #4FD8E8;
  --amber: #F2A93B;
  --green: #5FE0A0;
  --red: #FF6B6B;
  --violet: #9B8CFF;
  --text: #E7EEF5;
  --muted: #A9B7C6;
  --mutedDim: #7E8FA0;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  min-height: 100vh;
  padding: 16px;
}

#bgGrid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.35;
  background-image:
    linear-gradient(#1B273322 1px, transparent 1px),
    linear-gradient(90deg, #1B273322 1px, transparent 1px);
  background-size: 34px 34px;
}

.wrap { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; }

/* Header */
.header {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 14px;
  flex-wrap: wrap; gap: 10px;
}
.statusRow { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.statusText { font-family: var(--mono); font-size: 10.5px; color: var(--green); letter-spacing: 0.15em; }
.title { font-size: 22px; font-weight: 800; letter-spacing: 0.03em; margin-top: 4px; }
.subtitle { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.headerStats { display: flex; gap: 10px; flex-wrap: wrap; }

/* Layout */
.layout { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.controlPanel { width: 300px; flex-shrink: 0; }
.mainArea { flex: 1; min-width: 320px; }

/* Panel (collapsible group) */
.panel { border: 1px solid var(--border); background: var(--panel); position: relative; margin-bottom: 10px; }
.panelHeader {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: transparent; border: none; color: var(--text); padding: 10px 14px; cursor: pointer;
  font-family: var(--sans);
}
.panelHeaderLabel {
  display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--cyan);
}
.panelBody { padding: 4px 14px 14px; }
.panelBody.hidden { display: none; }

.corner { position: absolute; width: 8px; height: 8px; border-color: var(--borderBright); }
.corner.tl { top: -1px; left: -1px; border-top: 1px solid; border-left: 1px solid; }
.corner.tr { top: -1px; right: -1px; border-top: 1px solid; border-right: 1px solid; }
.corner.bl { bottom: -1px; left: -1px; border-bottom: 1px solid; border-left: 1px solid; }
.corner.br { bottom: -1px; right: -1px; border-bottom: 1px solid; border-right: 1px solid; }

/* Fields */
.field { margin-bottom: 9px; }
.fieldLabel { font-family: var(--sans); font-size: 11.5px; color: var(--muted); letter-spacing: 0.04em; margin-bottom: 3px; text-transform: uppercase; }
.fieldRow { display: flex; align-items: center; gap: 6px; }
.fieldInput, select.fieldInput {
  width: 100%; background: #060A10; border: 1px solid var(--border); color: var(--cyan);
  font-family: var(--mono); font-size: 14.5px; padding: 7px 9px; outline: none;
}
.fieldInput:focus { border-color: var(--cyan); }
.fieldSuffix { font-family: var(--mono); font-size: 12.5px; color: var(--mutedDim); white-space: nowrap; }

/* Toggle */
.toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: #060A10; border: 1px solid var(--border); padding: 7px 10px; cursor: pointer; margin-bottom: 9px;
  font-family: var(--sans);
}
.toggle.on { border-color: var(--cyan); }
.toggleLabel { font-size: 11px; color: var(--text); letter-spacing: 0.03em; }
.toggleTrack { width: 30px; height: 15px; border-radius: 8px; background: #1B2733; position: relative; transition: background .15s; }
.toggleTrack.on { background: var(--cyan); }
.toggleThumb { position: absolute; top: 1.5px; left: 1.5px; width: 12px; height: 12px; border-radius: 50%; background: var(--mutedDim); transition: left .15s; }
.toggleThumb.on { left: 16px; background: #04161A; }

/* Stat chips */
.statChip { border: 1px solid var(--border); background: var(--panel2); padding: 10px 14px; flex: 1; min-width: 130px; }
.statLabel { font-family: var(--sans); font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; }
.statValue { font-family: var(--mono); font-size: 21px; font-weight: 600; }

/* Tabs */
.tabRow { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabBtn {
  display: flex; align-items: center; gap: 6px; padding: 9px 14px; cursor: pointer;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font-family: var(--sans); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
}
.tabBtn.active { background: #0F2530; border-bottom-color: var(--cyan); color: var(--cyan); }

/* Chart frame */
.chartFrame { border: 1px solid var(--border); background: var(--panel); padding: 14px; margin-bottom: 14px; position: relative; }
.chartTitle { font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--amber); margin-bottom: 10px; }
.chartSvgWrap { position: relative; width: 100%; }
.chartLegend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-family: var(--mono); font-size: 12.5px; }
.legendItem { display: flex; align-items: center; gap: 5px; }
.legendSwatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.tooltip {
  position: absolute; pointer-events: none; background: #0D1826; border: 1px solid var(--border);
  padding: 9px 11px; font-family: var(--mono); font-size: 13px; color: var(--text); display: none; z-index: 5;
  white-space: nowrap;
}
.tooltipTitle { color: var(--amber); margin-bottom: 4px; }

/* Note / footer / body text */
.note { font-family: var(--mono); font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 4px; }
.footer {
  margin-top: 18px; padding: 10px 14px; border: 1px solid var(--border); background: var(--panel2);
  font-family: var(--mono); font-size: 12px; color: var(--muted); display: flex; gap: 8px;
}

/* Stat cards grid (pension option cards) */
.cardGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.optCard { border: 1px solid var(--border); background: var(--panel2); padding: 12px; }
.optCardLabel { font-family: var(--sans); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.optCardAmt { font-family: var(--mono); font-size: 20px; margin-top: 4px; }
.optCardSub { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Table */
.tableWrap { border: 1px solid var(--border); background: var(--panel); position: relative; overflow: auto; max-height: 480px; }
table.dataTable { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11.5px; }
table.dataTable th {
  position: sticky; top: 0; background: #0F1B28; text-align: right; padding: 8px 10px; color: var(--amber);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--border); z-index: 1;
}
table.dataTable td { text-align: right; padding: 7px 10px; color: var(--text); white-space: nowrap; border-bottom: 1px solid var(--border); font-size: 12.5px; }

/* Install banner */
#installBanner {
  display: none; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--cyan); background: #0C1F26; padding: 10px 14px; margin-bottom: 14px;
  font-family: var(--mono); font-size: 11.5px; color: var(--text);
}
#installBanner button {
  background: var(--cyan); color: #04161A; border: none; padding: 7px 14px; font-family: var(--sans);
  font-weight: 700; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer;
}
#installBanner .dismiss { background: transparent; color: var(--muted); text-decoration: underline; padding: 0; }

@media (max-width: 700px) {
  .controlPanel { width: 100%; }
  .title { font-size: 18px; }
}

/* Account widget */
.accountWidget { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acctEmail { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-right: 2px; }
.acctBtn {
  background: transparent; border: 1px solid var(--cyan); color: var(--cyan);
  font-family: var(--sans); font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 7px 12px; cursor: pointer;
}
.acctBtn:hover { background: #0F2530; }
.acctBtn.ghost { border-color: var(--border); color: var(--muted); }
.acctBtn.ghost:hover { border-color: var(--red); color: var(--red); background: transparent; }
.acctSaved { color: var(--green) !important; border-color: var(--green) !important; }

/* Modal */
.modalOverlay {
  position: fixed; inset: 0; background: rgba(3,6,10,0.75); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modalBox {
  background: var(--panel); border: 1px solid var(--borderBright); max-width: 420px; width: 100%;
  max-height: 84vh; overflow: auto; padding: 20px; position: relative;
}
.modalTitle {
  font-family: var(--sans); font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--cyan); margin-bottom: 14px;
}
.modalClose {
  position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer; line-height: 1;
}

/* Auth form */
.authForm { display: flex; flex-direction: column; gap: 10px; }
.authForm .fieldInput { padding: 9px 10px; font-size: 13px; }
.authError { color: var(--red); font-family: var(--mono); font-size: 11.5px; min-height: 14px; }
.authSubmit {
  background: var(--cyan); color: #04161A; border: none; padding: 10px 14px; font-family: var(--sans);
  font-weight: 700; font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; margin-top: 4px;
}
.authSubmit:disabled { opacity: 0.6; cursor: default; }
.authSwitch { font-family: var(--mono); font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 6px; }
.authSwitch a { color: var(--cyan); text-decoration: underline; cursor: pointer; }

/* Scenario list */
.scenarioRow {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--border); background: var(--panel2); padding: 10px 12px; margin-bottom: 8px;
}
.scenarioInfo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.scenarioName { font-family: var(--sans); font-size: 12.5px; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scenarioDate { font-family: var(--mono); font-size: 11.5px; color: var(--mutedDim); }
.scenarioActions { display: flex; gap: 6px; flex-shrink: 0; }

