/* MoneyMap (formerly PotCast) — Single Font, Phone-First, Fine-Line & RAG Design. PD-046: calm sage & sand theme at the end of this file. */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;

  /* RAG Traffic-Light System */
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --green: #16a34a;
  --green-bg: #f0fdf4;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.brand-tag {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Inline Contextual "?" FAQ Links */
.faq-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  flex-shrink: 0;
  vertical-align: middle;
}

.faq-link:hover,
.faq-link:focus {
  color: var(--text);
  border-color: var(--text);
  background: #e2e8f0;
}

@keyframes faqPulse {
  0% { background: var(--amber-bg); border-color: var(--amber); }
  100% { background: var(--surface); border-color: var(--border); }
}

.faq-flash {
  animation: faqPulse 1.8s ease;
}

.main-tabs {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 8px;
  gap: 2px;
}

.main-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1 0 auto;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.tab-btn.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--text);
}

.app-main {
  padding: 14px;
  flex: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

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

.section-head h2 {
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.summary-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

input, select {
  width: 100%;
  padding: 8px 9px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--text);
}

select:disabled, input:disabled {
  background: var(--bg);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.compact-select {
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-sm {
  padding: 5px 9px;
  font-size: 12px;
}

.btn-primary {
  background: var(--text);
  color: #ffffff;
  border-color: var(--text);
}

.btn-block {
  width: 100%;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.empty-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 14px 8px;
  border: 1px dashed var(--border);
  border-radius: 6px;
}

.muted-text {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.item-row.subpot-row {
  margin-left: 14px;
  border-left: 3px solid var(--muted);
  background: var(--bg);
}

.item-main {
  min-width: 0;
  flex: 1;
}

.item-title {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.item-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.amount-pos {
  font-weight: 600;
  color: var(--green);
}

.amount-neg {
  font-weight: 600;
  color: var(--text);
}

.amount-transfer {
  font-weight: 600;
  color: var(--muted);
}

.amount-red {
  font-weight: 600;
  color: var(--red);
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 11px;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

.reconcile-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.reconcile-row span {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

.reconcile-row input {
  width: 105px;
  padding: 6px 8px;
}

.sub-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.sub-tab-btn {
  flex: 1;
  padding: 6px 4px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.sub-tab-btn.active {
  background: var(--text);
  color: #ffffff;
  border-color: var(--text);
}

.chart-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.chart-title {
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-subtitle {
  font-size: 11px;
  color: var(--muted);
}

.chart-viewport {
  width: 100%;
  overflow: hidden;
}

.fine-line-svg {
  width: 100%;
  height: auto;
  display: block;
}

.grid-line {
  stroke: #e2e8f0;
  stroke-width: 1;
  stroke-dasharray: 2, 2;
}

.zero-line {
  stroke: #94a3b8;
  stroke-width: 1;
}

.axis-label {
  font-size: 9px;
  fill: #64748b;
}

.rag-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.rag-green {
  color: var(--green);
  background: var(--green-bg);
}

.rag-amber {
  color: var(--amber);
  background: var(--amber-bg);
}

.rag-red {
  color: var(--red);
  background: var(--red-bg);
}

.rag-alert {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12px;
}

.rag-green-box {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid #bbf7d0;
}

.rag-amber-box {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid #fde68a;
}

.rag-red-box {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #fecaca;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.faq-card p {
  font-size: 13px;
  color: var(--text);
}

.faq-highlight {
  background: var(--bg);
  border-left: 3px solid var(--text);
  padding: 8px 10px;
  margin-bottom: 8px;
}

.plain-list {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }

/* PotCast chart controls: native typography and colour-key legend below chart */
.potcast-chart-controls {
  width: 100%;
  margin-top: 8px;
}
.potcast-account-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 16px;
  padding: 4px 0 2px;
  color: var(--text);
  font: inherit;
  font-size: inherit;
}
.potcast-account-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.potcast-account-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--text);
}
.potcast-legend-dot {
  display: inline-block;
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* PD-016 CHANGE: dot legend for In/Out and Sub-pot charts (Balance uses the checkbox row instead) */
.potcast-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 8px;
}
.potcast-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.potcast-legend-item i {
  display: inline-block;
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* PD-017 CHANGE: forecast status badge with "?" beside it */
.rag-status { display: inline-flex; align-items: center; gap: 5px; }

/* PD-017 CHANGE: legend table (tick-box, dot, name, balance today, balance at end of period) */
.potcast-legend-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px 78px;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.potcast-legend-row.is-toggle { cursor: pointer; }
.potcast-legend-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.potcast-legend-name input { width: 16px; height: 16px; margin: 0; flex: 0 0 16px; accent-color: var(--text); }
.potcast-legend-val { text-align: right; font-variant-numeric: tabular-nums; }
.potcast-legend-head { font-size: 11px; font-weight: 500; color: var(--muted); }

/* PD-018 CHANGE: Check-In manual items - amount box and tick button */
.amber-value { width: 96px; padding: 6px 8px; }
.btn-tick { min-width: 36px; font-weight: 700; }

/* PD-021 CHANGE: £ sign inside every money box */
.money-wrap { position: relative; display: block; width: 100%; }
.money-sign {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: var(--muted); pointer-events: none;
}
.money-wrap input { padding-left: 20px; }
.reconcile-row .money-wrap { width: 140px; flex: 0 0 140px; }
.reconcile-row .money-wrap input { width: 100%; }
.item-right .money-wrap { width: 104px; flex: 0 0 104px; }
.amber-value { width: 100%; padding: 6px 8px 6px 20px; }

/* PD-021 CHANGE: Advanced section on the Add Item form */
details.advanced {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 10px;
  margin-bottom: 10px;
}
details.advanced > summary {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 0; font-size: 12px; font-weight: 600; cursor: pointer;
  list-style: none;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: '▸'; color: var(--muted); font-size: 11px; }
details.advanced[open] > summary::before { content: '▾'; }
details.advanced[open] > .form-grid { margin-bottom: 10px; }

/* PD-021 CHANGE: per-item Advanced edit panel on the Transactions list */
.tx-block { display: flex; flex-direction: column; }
.tx-edit-panel {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  background: var(--bg);
  padding: 10px;
}
.tx-block .item-row:has(+ .tx-edit-panel:not([hidden])) { border-radius: 6px 6px 0 0; }
.tx-edit-panel input, .tx-edit-panel select { background: var(--surface); }
.panel-actions { display: flex; justify-content: flex-end; gap: 6px; }
.btn-outline { background: var(--surface); }
.icon-btn.is-open { color: var(--text); border-color: var(--text); }

/* Transactions list: let the buttons wrap under the amount on narrow phones */
#txList .item-right { flex-wrap: wrap; justify-content: flex-end; max-width: 50%; }

/* PD-021 CHANGE: Check-In - items already checked this month */
.item-row.is-checked { background: var(--bg); }
.btn-tick.is-done { color: var(--green); border-color: var(--green); background: var(--green-bg); }

/* PD-021 CHANGE: "?" beside the forecast period selector */
.horizon-wrap { display: inline-flex; align-items: center; gap: 5px; }
.chart-meta .rag-badge { white-space: nowrap; }
.chart-meta > div:first-child { min-width: 0; margin-right: 8px; }

/* PD-022 CHANGE: collapsible "Your Accounts & Virtual Sub-Pots" section with +/- */
.collapse-card { padding: 0; }
.collapse-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; cursor: pointer; list-style: none;
}
.collapse-head::-webkit-details-marker { display: none; }
.collapse-head .card-title { margin-bottom: 0; }
.collapse-sign::before {
  content: '+'; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 16px; font-weight: 600; color: var(--text);
}
.collapse-card[open] .collapse-sign::before { content: '−'; }
.collapse-card > .stack-list { padding: 0 12px 12px; margin-bottom: 0; }

/* PD-022 CHANGE: fine dotted £0 line and "Today" marker */
.zero-line { stroke: #475569; stroke-width: 1; stroke-dasharray: 3, 3; }
.zero-label { font-weight: 600; }
.today-line { stroke: #94a3b8; stroke-width: 1; }
.today-label { font-weight: 600; fill: #0f172a; text-anchor: start; }

/* PD-023 CHANGE: line under the transaction form saying what will be recorded */
.tx-kind { margin: -2px 0 10px; }
.tx-kind.is-error { color: var(--red); }

/* PD-024 CHANGE: larger graph text (SVG units; roughly 10-11px on a phone) and larger legends */
.axis-label { font-size: 21px; }
.axis-label-x.anchor-start { text-anchor: start; }
.axis-label-x.anchor-middle { text-anchor: middle; }
.today-label { font-size: 21px; }
.potcast-chart-legend { font-size: 15px; gap: 8px 18px; }
.potcast-legend-item i { width: 11px; height: 11px; flex-basis: 11px; }
.potcast-legend-table { font-size: 15px; }
.potcast-legend-head { font-size: 13px; }
.potcast-legend-row { grid-template-columns: minmax(0, 1fr) 92px 92px; }

/* PD-024 CHANGE: Accounts & sub-pots block graph */
.block-name { font-size: 24px; font-weight: 600; fill: #0f172a; }
.block-total { font-size: 24px; fill: #0f172a; text-anchor: end; font-variant-numeric: tabular-nums; }
.block-total.is-neg { fill: var(--red); }
.block-overspent { stroke: var(--red); stroke-width: 3; }
.when-toggle { display: flex; gap: 6px; margin: 10px 0 4px; }
.when-btn {
  flex: 1; padding: 6px 4px; font-size: 13px; font-weight: 500; cursor: pointer;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border); border-radius: 4px;
}
.when-btn.active { background: var(--text); color: #fff; border-color: var(--text); }

/* PD-025 CHANGE: "Add ..." sections open and close with +/-; lists are plain cards */
.add-section > .collapse-body { padding: 0 12px 12px; }
.list-card > .stack-list { margin-bottom: 0; }
.field-hint { font-size: 11px; color: var(--muted); }

/* PD-026 CHANGE: transaction type note at the top of Add Transaction - green, red for a problem */
.tx-kind {
  margin: 0 0 10px; padding: 8px 10px; border-radius: 4px; font-size: 12px;
  background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0;
}
.tx-kind:empty { display: none; }
.tx-kind.is-error { background: var(--red-bg); color: var(--red); border-color: #fecaca; }
.reconcile-pot { margin-left: 14px; background: var(--bg); }
.reconcile-pot span { font-weight: 400; }

/* PD-027 CHANGE: ✎ edit icon, Delete inside edit panels, Due / Expired flags */
.edit-icon { font-size: 15px; line-height: 1; padding: 4px 8px; }
.panel-actions .spacer { flex: 1; }
.btn-danger { background: var(--surface); color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.rag-grey { color: var(--muted); background: #f1f5f9; }
.rag-amber-solid { color: #fff; background: var(--amber); }
.item-row.is-due { border-color: var(--amber); background: var(--amber-bg); }
.item-row.is-expired { opacity: 0.7; }
.subpot-block { margin-left: 14px; }
.subpot-block .item-row.subpot-row { margin-left: 0; }

/* PD-029 CHANGE: red count circles on tab headers */
.tab-btn { position: relative; }
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px; margin-left: 4px;
  border-radius: 9px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1; vertical-align: 1px;
}
.tab-count[hidden] { display: none; }
.text-red { color: var(--red); }
.tx-route { font-weight: 400; color: var(--muted); font-size: 12px; }

/* PD-030 CHANGE: red count of unchecked payments on a due Manual item */
.count-dot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
}

/* PD-031 CHANGE: backup reminder dot on Save .potcast */
#saveFileBtn { position: relative; }
.save-dot {
  position: absolute; top: -4px; right: -4px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--surface);
}
.save-dot[hidden] { display: none; }

/* PD-033 CHANGE: show / hide sub-pots under an account */
.pots-toggle {
  margin-top: 6px; padding: 3px 8px; font-size: 11px; font-weight: 500;
  color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; cursor: pointer;
}
.pots-group { display: flex; flex-direction: column; gap: 8px; }
.pots-group[hidden] { display: none; }

/* PD-034 CHANGE: list header with Sort box */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.list-head .card-title { margin-bottom: 0; }
.list-head .compact-select { flex: 0 0 auto; max-width: 48%; }

/* PD-035 CHANGE: graph uses the full card width; values sit inside the graph with a white halo */
.chart-card { padding-left: 6px; padding-right: 6px; }
.chart-card .chart-meta { padding: 0 6px; }
.y-inside { paint-order: stroke; stroke: #ffffff; stroke-width: 6px; stroke-linejoin: round; }

/* PD-035 CHANGE: short slide when changing tab by swiping */
@keyframes slideFromRight { from { transform: translateX(28px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes slideFromLeft { from { transform: translateX(-28px); opacity: .4; } to { transform: none; opacity: 1; } }
.tab-panel.slide-from-right { animation: slideFromRight .18s ease-out; }
.tab-panel.slide-from-left { animation: slideFromLeft .18s ease-out; }
.app-main { touch-action: pan-y; }
.chart-card .potcast-chart-controls, .chart-card .potcast-chart-legend { padding: 0 6px; }

/* PD-036 CHANGE: Example on/off button and banner */
.example-btn.is-on { background: var(--amber); border-color: var(--amber); color: #fff; }
.example-banner {
  margin: 0 14px 8px; padding: 7px 10px; border-radius: 4px; font-size: 12px;
  background: var(--amber-bg); color: #92400e; border: 1px solid #fde68a;
  line-height: 1.5;
}
.example-banner .faq-link { margin-left: 2px; }
.example-banner[hidden] { display: none; }
.file-actions { flex-wrap: wrap; justify-content: flex-end; }

/* PD-037 CHANGE: +/- button to open and close an item's details (same look as the Add sections) */
.edit-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text);
  font-size: 17px; font-weight: 600; line-height: 1;
}
.edit-toggle::before { content: '+'; }
.edit-toggle[aria-expanded="true"]::before { content: '−'; }
.edit-toggle[aria-expanded="true"] { border-color: var(--text); }

/* PD-038 CHANGE: intro video viewer */
.video-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: #0b1220;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.video-overlay[hidden] { display: none; }
.video-box { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 100%; }
.video-box video {
  width: auto;
  display: block; height: min(80vh, 760px); max-width: 100%; aspect-ratio: 9 / 16;
  border-radius: 14px; background: #0b1220;
}
.video-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.video-note { color: #cbd5e1; font-size: 12px; }
.video-actions .btn-primary { background: #16a34a; border-color: #16a34a; white-space: nowrap; flex: 0 0 auto; }
body.video-open { overflow: hidden; }
.watch-intro { margin-top: 12px; }

/* PD-039 CHANGE: sub-pot colour key with values */
.potcast-pot-legend { margin-top: 8px; font-size: 15px; padding: 0 6px; }
.potcast-pot-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 110px; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}

/* PD-040 CHANGE: full-screen PIN lock */
body.locked { overflow: hidden; }
body.locked .app-shell, body.locked > header, body.locked > main { visibility: hidden; }
.lock-screen {
  position: fixed; inset: 0; z-index: 200;
  background: linear-gradient(180deg, #0b1220 0%, #13233d 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
}
.lock-inner { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.lock-brand { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 18px; }
.lock-brand span { color: #4ade80; }
.lock-title { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.lock-sub { font-size: 13px; color: #cbd5e1; line-height: 1.45; margin-bottom: 8px; }
.lock-dots { display: flex; gap: 18px; margin: 22px 0 8px; }
.lock-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #cbd5e1; transition: background .1s; }
.lock-dots i.on { background: #fff; border-color: #fff; }
.lock-dots.shake { animation: lockShake .4s; }
@keyframes lockShake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.lock-msg { min-height: 20px; font-size: 13px; color: #fca5a5; margin: 4px 0 10px; }
.lock-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 26px; justify-content: center; }
.lock-key {
  width: 76px; height: 76px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #fff;
  font-size: 30px; font-weight: 500; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.lock-key:active { background: rgba(255,255,255,.28); }
.lock-back { font-size: 24px; background: transparent; border-color: transparent; }
.lock-links { display: flex; flex-direction: column; gap: 6px; margin-top: 22px; }
.lock-link { background: none; border: none; color: #86efac; font-size: 15px; font-weight: 500; padding: 8px; cursor: pointer; }
.lock-link.is-danger { color: #fca5a5; font-size: 13px; }
.lock-form { width: 100%; display: flex; flex-direction: column; gap: 14px; margin-top: 16px; text-align: left; }
.lock-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #e2e8f0; }
.lock-field input {
  height: 48px; padding: 0 14px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08); color: #fff; font-size: 17px;
}
.lock-submit {
  height: 50px; border: none; border-radius: 8px; background: #16a34a; color: #fff;
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.lock-screen.is-busy .lock-inner { opacity: .6; pointer-events: none; }
@media (max-height: 640px) {
  .lock-pad { gap: 10px 22px; grid-template-columns: repeat(3, 64px); }
  .lock-key { width: 64px; height: 64px; font-size: 26px; }
  .lock-brand { margin-bottom: 8px; font-size: 28px; }
}

/* PIN settings card */
.security-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
body.lock-unavailable .security-card { display: none; }

/* PD-041 CHANGE: Summary tab */
.about-head { margin-top: 26px; }
.sum-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.sum-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 84px; padding: 10px 6px; border-radius: 8px; cursor: pointer; text-align: center;
  border: 1px solid var(--border); background: var(--surface); font-family: inherit; color: var(--text);
}
.sum-tile-num { font-size: 22px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.sum-tile-label { font-size: 11px; color: var(--muted); line-height: 1.25; }
.sum-tile.is-ok { border-color: #bbf7d0; background: var(--green-bg); }
.sum-tile.is-ok .sum-tile-num { color: var(--green); }
.sum-tile.is-red { border-color: #fecaca; background: var(--red-bg); }
.sum-tile.is-red .sum-tile-num { color: var(--red); }
.sum-tile.is-amber { border-color: #fde68a; background: var(--amber-bg); }
.sum-tile.is-amber .sum-tile-num { color: var(--amber); }
.sum-period { font-weight: 400; font-size: 11px; color: var(--muted); margin-left: 4px; }
.sum-list { display: flex; flex-direction: column; }
.sum-acc { padding: 10px 0; border-bottom: 1px solid var(--border); }
.sum-acc-main { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.sum-acc-name { font-weight: 600; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.sum-acc-vals { display: inline-flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; font-size: 13px; }
.sum-now { color: var(--muted); }
.sum-arrow { color: var(--muted); font-size: 11px; }
.sum-end { font-weight: 600; }
.sum-end.neg, .sum-pot-val.neg { color: var(--red); }
.sum-net { border-bottom: none; border-top: 2px solid var(--text); margin-top: 2px; }
.sum-trend { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 11px; line-height: 1; color: #fff; }
.sum-trend.up { background: var(--green); }
.sum-trend.down { background: var(--red); }
.sum-trend.flat { background: var(--amber); font-size: 9px; }
.sum-bang {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; background: var(--red); color: #fff;
  font-size: 12px; font-weight: 800; line-height: 1; vertical-align: 1px;
}
.sum-flag { margin: 4px 0 0 30px; font-size: 12px; color: var(--red); }
.sum-pots { margin: 6px 0 0 30px; display: flex; flex-direction: column; gap: 4px; }
.sum-pot { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; font-size: 13px; }
.sum-pot-name { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.sum-pot-val { font-variant-numeric: tabular-nums; }
.sum-pot-note { grid-column: 1 / -1; font-size: 11px; color: var(--red); margin-left: 16px; }
.sum-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: transparent; flex: 0 0 10px; }
.sum-dot.red { background: var(--red); }
.sum-dot.big { width: 14px; height: 14px; flex-basis: 14px; }
.sum-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 11px; color: var(--muted); }
.sum-key .sum-trend, .sum-key .sum-bang { width: 16px; height: 16px; font-size: 9px; }
.sum-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sum-chip {
  padding: 6px 10px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg);
  font-size: 12px; font-family: inherit; color: var(--text); cursor: pointer;
}
.sum-chip:active { background: var(--green-bg); border-color: var(--green); }
.sum-empty p { margin: 0; }
.when-toggle { margin: 8px 6px 6px; }

/* =============================================================================
   PD-042 CHANGE: one fine, uniform type style for the whole site.
   One font, three sizes and two weights:
     --fs-head 15px (section headings), --fs-body 13px (everything else),
     --fs-small 12px (secondary notes, labels, keys)
     400 regular, 500 medium (titles, amounts, active tab). No bold/extra-bold.
   One text colour (--text) and one secondary colour (--muted); red/amber/green
   only for RAG meaning. These rules come last so they win over older sizes.
   ============================================================================= */
:root {
  --text: #1e293b;
  --muted: #64748b;
  --fs-head: 15px;
  --fs-body: 13px;
  --fs-small: 12px;
}
body { font-size: var(--fs-body); font-weight: 400; color: var(--text); line-height: 1.5; letter-spacing: 0; }
input, select, textarea, button { font-family: var(--font-sans); font-size: var(--fs-body); }
strong, b { font-weight: 500; }

/* Headings and titles */
.section-head h2 { font-size: var(--fs-head); font-weight: 500; color: var(--text); }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.card-title, .collapse-head .card-title, .item-title, .sum-acc-name { font-size: var(--fs-body); font-weight: 500; color: var(--text); }

/* Body text */
p, li, .card p, .faq-card p, .faq-card li, .sum-pot, .sum-acc-vals,
.potcast-legend-table, .potcast-pot-legend, .potcast-chart-legend, .potcast-pot-row,
.tx-kind, .example-banner, .reconcile-row span { font-size: var(--fs-body); }
.amount-pos, .amount-neg, .amount-transfer, .amount-red, .sum-end { font-weight: 500; }

/* Secondary / small text */
.item-sub, .muted-text, label, .field-hint, .tx-route, .sum-period, .sum-flag, .sum-pot-note,
.sum-tile-label, .sum-key, .potcast-legend-head, .brand-tag, .video-note, .pots-toggle,
details.advanced > summary, .chart-meta, .chart-meta *:not(.rag-badge) { font-size: var(--fs-small); }
.item-sub, .muted-text, .field-hint, .tx-route, .sum-period, .potcast-legend-head, .sum-tile-label, .sum-key { color: var(--muted); }
label { font-weight: 400; color: var(--muted); }
details.advanced > summary { font-weight: 500; }

/* Controls */
.btn, .btn-sm, .icon-btn, .compact-select, .when-btn, .sum-chip, .pots-toggle { font-size: var(--fs-small); font-weight: 500; }
.tab-btn { font-size: var(--fs-body); font-weight: 400; }
.tab-btn.active { font-weight: 500; }
.rag-badge, .tab-count, .count-dot { font-size: 11px; font-weight: 500; }
.faq-link { font-size: 10px; font-weight: 500; }
.sum-tile-num { font-size: var(--fs-head); font-weight: 500; }

/* Charts (SVG units scale with the graph; these land at about 10–12px on a phone) */
.axis-label, .today-label { font-size: 21px; font-weight: 400; }
.today-label { font-weight: 500; fill: var(--text); }
.zero-label { font-weight: 400; }
.block-name { font-size: 24px; font-weight: 500; fill: var(--text); }
.block-total { font-size: 24px; font-weight: 400; fill: var(--text); }

/* PIN screen: same font, lighter weights */
.lock-brand { font-weight: 600; }
.lock-title { font-size: 18px; font-weight: 500; }
.lock-sub, .lock-msg, .lock-link.is-danger { font-size: var(--fs-body); }
.lock-field, .lock-link { font-size: 14px; }
.lock-key { font-weight: 400; }
.lock-submit { font-size: 15px; font-weight: 500; }

/* PD-042 CHANGE: Add buttons - green pill with a fine plus, like "+ Transaction" */
.btn-add {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 46px; margin-top: 4px;
  border: none; border-radius: 999px; background: var(--green); color: #fff;
  font-size: 15px; font-weight: 500; letter-spacing: 0.01em; cursor: pointer;
  box-shadow: 0 1px 2px rgba(22, 163, 74, .25);
}
.btn-add:hover { background: #15803d; }
.btn-add:active { transform: translateY(1px); }
.btn-add-plus { position: relative; width: 14px; height: 14px; flex: 0 0 14px; }
.btn-add-plus::before, .btn-add-plus::after {
  content: ''; position: absolute; background: currentColor; border-radius: 2px;
}
.btn-add-plus::before { left: 0; right: 0; top: 50%; height: 2.5px; transform: translateY(-50%); }
.btn-add-plus::after { top: 0; bottom: 0; left: 50%; width: 2.5px; transform: translateX(-50%); }
/* Summary "might add" buttons: small green outline pills with the same plus */
.sum-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 10px;
  border-radius: 999px; border: 1px solid var(--green); background: var(--green-bg); color: #15803d;
}
.sum-chip .btn-add-plus { width: 9px; height: 9px; flex-basis: 9px; }
.sum-chip .btn-add-plus::before { height: 1.5px; }
.sum-chip .btn-add-plus::after { width: 1.5px; }

/* PD-042 CHANGE: Summary status icons - one size in the list, one finer size in the key */
.sum-trend, .sum-bang { width: 16px; height: 16px; font-size: 8px; font-weight: 500; }
.sum-trend.flat { font-size: 6px; }
.sum-bang { font-size: 10px; }
.sum-dot { width: 8px; height: 8px; flex: 0 0 8px; }
.sum-dot.big { width: 10px; height: 10px; flex-basis: 10px; }
.sum-acc-main { grid-template-columns: 16px minmax(0, 1fr) auto; }
.sum-flag, .sum-pots { margin-left: 24px; }
.sum-pot-name { gap: 8px; }
.sum-key {
  display: grid; grid-template-columns: repeat(3, auto); justify-content: start;
  gap: 6px 16px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
}
.sum-key-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 11px; color: var(--muted); }
.sum-key .sum-trend, .sum-key .sum-bang { width: 12px; height: 12px; font-size: 6px; }
.sum-key .sum-trend.flat { font-size: 5px; }
.sum-key .sum-bang { font-size: 8px; }
.sum-key .sum-dot { width: 8px; height: 8px; margin: 0 2px; }

/* PD-043 CHANGE: Add sections open from a green pill (no title); Save button inside */
.add-pill-section { margin-bottom: 12px; }
.add-pill-section > summary { list-style: none; }
.add-pill-section > summary::-webkit-details-marker { display: none; }
.add-toggle { margin-top: 0; }
.add-pill-section[open] > .add-toggle {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: none;
}
.add-pill-section[open] > .add-toggle .btn-add-plus::after { display: none; }  /* plus becomes minus */
.add-pill-section > .collapse-body {
  margin-top: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.btn-save { margin-top: 8px; }

/* PD-043 CHANGE: tab headings removed - the remaining controls sit right-aligned */
.section-tools { justify-content: flex-end; gap: 8px; margin-bottom: 10px; }

/* PD-043 CHANGE: search box */
.tx-search { margin-bottom: 10px; }
.tx-search input {
  width: 100%; height: 38px; padding: 0 12px 0 34px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3.5 3.5'/%3E%3C/svg%3E") no-repeat 12px center;
  font-size: var(--fs-body); color: var(--text);
}
.tx-search input:focus { outline: none; border-color: var(--text); background-color: var(--surface); }

/* PD-043 CHANGE: Expired transactions in an amber hue (lighter than "Due") */
.item-row.is-expired { opacity: 1; background: #fff8eb; border-color: #fcd9a0; }
.item-row.is-expired .item-title, .item-row.is-expired .item-sub { color: #92400e; }
.rag-expired { color: #b45309; background: #fde7c2; }

/* PD-043 CHANGE: Summary key - every symbol the same 12px circle */
.sum-key .sum-trend, .sum-key .sum-bang, .sum-key .sum-dot {
  width: 12px; height: 12px; flex: 0 0 12px; margin: 0; border-radius: 50%;
}
/* and in the account list, the sub-pot red dot matches the 8px used throughout */
.sum-pots .sum-dot { width: 8px; height: 8px; flex-basis: 8px; }

/* PD-044 CHANGE: welcome card */
.welcome-card { border-color: #bbf7d0; background: var(--green-bg); }
.welcome-card p { margin: 6px 0; }
.welcome-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 12px 0 6px; }
.welcome-actions .btn-sm { align-self: center; border: none; background: none; color: var(--muted); text-decoration: underline; }

/* PD-045 CHANGE: remove all data (with typed check) */
.wipe-open { margin-top: 8px; }
.wipe-panel {
  margin-top: 10px; padding: 12px; border: 1px solid #fecaca; border-radius: 10px; background: var(--red-bg);
  display: flex; flex-direction: column; gap: 8px;
}
.wipe-panel[hidden] { display: none; }
.wipe-panel p { margin: 0; }
.wipe-title { font-weight: 500; color: var(--red); }
.wipe-label { margin-top: 4px; color: var(--text); }
.wipe-panel input {
  height: 40px; padding: 0 12px; border: 1px solid #fca5a5; border-radius: 6px; background: var(--surface);
  font-size: var(--fs-body); letter-spacing: 0.08em;
}
.wipe-actions { display: flex; justify-content: flex-end; gap: 8px; }
.wipe-go { background: var(--red); border-color: var(--red); color: #fff; }
.wipe-go:disabled { opacity: .4; cursor: not-allowed; }

/* =============================================================================
   PD-046 CHANGE: calm "sage & sand" look.
   - Warm sand background, soft cream cards, gentle rounded corners and shadows.
   - Sage is the accent for buttons, the active tab and selected options.
   - Red / Amber / Green are kept for flags only (status badges, warnings,
     Manual items, overdrawn and over-budget marks), so they still stand out.
   These rules come last so they win over the older ones above.
   ============================================================================= */
:root {
  --bg: #f6f3ec;          /* sand */
  --surface: #fffdf9;     /* cream card */
  --border: #e7e1d5;
  --text: #3b4541;        /* soft charcoal */
  --muted: #7d8681;
  --accent: #6f8f7f;      /* sage */
  --accent-dark: #587666;
  --accent-bg: #edf2ee;
  --shadow: 0 1px 3px rgba(59, 69, 65, .06);

  /* RAG: same meaning, slightly softer tones */
  --red: #c4473e;
  --red-bg: #fbefed;
  --red-line: #efc9c4;
  --amber: #c27f12;
  --amber-bg: #fcf5e6;
  --amber-line: #efd9a8;
  --green: #3d8a57;
  --green-bg: #eef6f0;
  --green-line: #c4e1cc;
}

body { background: var(--bg); }
.app-shell { background: var(--bg); border-color: transparent; }
.app-header { background: rgba(246, 243, 236, .96); border-bottom: 1px solid var(--border); backdrop-filter: blur(6px); }
.header-row { padding: 14px 16px 8px; }
.brand-name { color: var(--accent-dark); font-weight: 600; letter-spacing: 0; }
.app-main { padding: 16px; }

/* Top-bar FAQ button */
.faq-open { position: relative; border-radius: 999px; padding: 6px 16px; border-color: var(--border); background: var(--surface); color: var(--text); }
.faq-open.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.faq-open .save-dot { position: absolute; top: -2px; right: -2px; }

/* Tabs */
.main-tabs { padding: 0 10px; }
.tab-btn { color: var(--muted); border-bottom-width: 2px; }
.tab-btn.active { color: var(--accent-dark); border-bottom-color: var(--accent); }

/* Cards and inputs */
.card, .form-card, .faq-card { background: var(--surface); border-color: var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.card { padding: 14px; margin-bottom: 14px; }
input, select { border-radius: 8px; border-color: var(--border); background: #fff; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.summary-pill { border-radius: 999px; background: var(--surface); }
.empty-note { border-radius: 10px; }

/* Buttons: sage accent (green is kept for "healthy" flags) */
.btn { border-radius: 8px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-add { background: var(--accent); box-shadow: 0 1px 2px rgba(88, 118, 102, .25); }
.btn-add:hover { background: var(--accent-dark); }
.sum-chip { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-dark); }
.sub-tab-btn { border-radius: 999px; background: var(--surface); }
.sub-tab-btn.active, .when-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.edit-toggle { border-radius: 8px; }
.edit-toggle[aria-expanded="true"] { border-color: var(--accent); }
.faq-link { background: var(--surface); }
.faq-link:hover, .faq-link:focus { color: var(--accent-dark); border-color: var(--accent); background: var(--accent-bg); }

/* Charts */
.grid-line { stroke: #ebe5da; }
.zero-line { stroke: #9aa39e; }
.axis-label { fill: var(--muted); }
.y-inside { stroke: var(--surface); }
.today-label, .block-name, .block-total { fill: var(--text); }

/* RAG flags: same colours and meaning, softer edges */
.rag-badge { border-radius: 999px; padding: 2px 9px; }
.rag-green-box, .tx-kind, .welcome-card, .sum-tile.is-ok { border-color: var(--green-line); }
.rag-amber-box, .sum-tile.is-amber { border-color: var(--amber-line); }
.rag-red-box, .tx-kind.is-error, .btn-danger, .sum-tile.is-red, .wipe-panel { border-color: var(--red-line); }
.sum-tile { border-radius: 12px; }
.tx-kind { border-radius: 8px; }
.wipe-panel { border-radius: 12px; }

/* Example banner with its own Turn off button */
.example-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0 16px 8px; border-radius: 10px; color: #7a5310; border-color: var(--amber-line);
}
.example-banner[hidden] { display: none; }
.banner-btn {
  flex: 0 0 auto; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--amber); background: var(--surface); color: #7a5310; font-size: var(--fs-small); font-weight: 500;
}
.example-btn.is-on { background: var(--amber-bg); border-color: var(--amber); color: #7a5310; }

/* FAQ page */
.faq-page-head { justify-content: flex-start; gap: 12px; }
.faq-page-head .btn { border-radius: 999px; padding: 5px 12px; }
.tool-actions { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 10px; }
.tool-actions .btn { width: 100%; padding: 10px 12px; }
.tool-actions .save-dot { margin-left: 6px; position: static; }
.about-head { margin-top: 22px; }
.faq-card { margin-bottom: 10px; }

/* PIN screen and video: calm sage instead of dark navy */
.lock-screen { background: linear-gradient(180deg, #5d7a6b 0%, #45604f 100%); }
.lock-brand span { color: #d9ead9; }
.lock-submit { background: #fffdf9; color: var(--accent-dark); }
.lock-link { color: #e7f1e7; }
.video-overlay, .video-box video { background: #2f3b35; }
.video-actions .btn-primary { background: var(--accent); border-color: var(--accent); }

/* PD-046 CHANGE: five tabs fit across a phone screen without scrolling */
.main-tabs { padding: 0 4px; gap: 0; }
.tab-btn { flex: 1 1 auto; padding: 10px 4px; white-space: nowrap; font-size: 12.5px; }
.tab-btn .tab-count { margin-left: 3px; }
.tab-btn { position: relative; padding: 12px 7px 9px; font-size: 12px; }
.tab-btn .tab-count {
  position: absolute; top: 2px; right: -1px; margin: 0;
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
  font-size: 9.5px; line-height: 15px; border: 1.5px solid var(--bg);
}

/* =============================================================================
   PD-047 CHANGE: simple tab-style bars for the period (1W … 25Y) and for the four
   Forecast graphs. Pale bar, the chosen option sits on a white chip.
   ============================================================================= */
.section-tools .horizon-wrap { display: flex; align-items: center; gap: 8px; width: 100%; }
.seg-control {
  display: flex; flex: 1; gap: 2px; padding: 3px;
  background: #ece7dc; border-radius: 10px;
}
.seg-btn {
  flex: 1 1 0; min-width: 0; padding: 6px 2px; cursor: pointer;
  border: none; border-radius: 8px; background: transparent;
  color: var(--muted); font-size: var(--fs-small); font-weight: 500; white-space: nowrap;
}
.seg-btn.active { background: var(--surface); color: var(--accent-dark); box-shadow: 0 1px 2px rgba(59, 69, 65, .12); }
.seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* the graph bar re-uses the seg look instead of the older pill buttons */
.graph-seg { margin-bottom: 12px; }
.graph-seg .sub-tab-btn, .graph-seg .sub-tab-btn.active { border: none; border-radius: 8px; flex: 1 1 0; }
.graph-seg .sub-tab-btn { background: transparent; color: var(--muted); }
.graph-seg .sub-tab-btn.active { background: var(--surface); color: var(--accent-dark); box-shadow: 0 1px 2px rgba(59, 69, 65, .12); }
