/* ---------------------------------------------------------------------- */
/* Sidebar                                                                 */
/* ---------------------------------------------------------------------- */

.sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-4);
  gap: var(--space-7);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-2);
}

/* Milestone 23: rebranded from a "PM" text mark to the real "Me In
   Numbers" icon (assets/icon.png — a transparent-background mark, so it
   sits directly on the dark sidebar with no background box needed).
   Milestone 24: sized up (30px → 44px) per feedback that it read as too
   small next to the wordmark — the source file is 1024×1024, so this has
   plenty of room before looking soft. Name/tagline font sizes nudged up
   slightly to stay in proportion with the larger mark. */
.brand-mark {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* Milestone 17: pins the Settings item to the bottom of the sidebar column
   (same `margin-top:auto` trick .sidebar-footer below already uses),
   instead of it sitting as just one more item directly under Liabilities —
   see sidebar.js's BOTTOM_NAV_ITEMS. */
.nav-list-bottom {
  margin-top: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.nav-item.disabled {
  color: var(--text-muted);
  cursor: default;
}

.nav-item .soon-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-hover);
  border-radius: var(--radius-full);
  padding: 2px 7px;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------------------------------------------------------------------- */
/* Topbar                                                                  */
/* ---------------------------------------------------------------------- */

.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-7);
  border-bottom: 1px solid var(--border-hairline);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--page-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.topbar-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--delta-positive);
  box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.6);
  animation: live-pulse 2.2s infinite;
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.55);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(12, 163, 12, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(12, 163, 12, 0);
  }
}

.manual-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-hover);
  border-radius: 999px;
  vertical-align: middle;
  border: none;
  font-family: inherit;
}

.review-badge {
  color: #eda100;
  background: rgba(237, 161, 0, 0.14);
  cursor: pointer;
}

.review-badge:hover {
  background: rgba(237, 161, 0, 0.24);
}

.review-badge:disabled {
  opacity: 0.5;
  cursor: default;
}

.fix-match-btn {
  border: none;
  background: none;
  padding: 0;
  margin-left: 6px;
  font-family: inherit;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: underline dotted;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}

tr:hover .fix-match-btn,
.fix-match-btn:focus-visible {
  opacity: 1;
}

.fix-match-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ---------------------------------------------------------------------- */
/* Dividends page                                                         */
/* ---------------------------------------------------------------------- */

.dividend-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-6);
}

.dividend-summary-card {
  padding: var(--space-5) var(--space-6);
}

.dividend-summary-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.dividend-summary-value {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-top: 8px;
  font-variant-numeric: proportional-nums;
}

.div-tag {
  display: inline-block;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}

.div-tag-confirmed {
  color: var(--delta-positive);
  background: rgba(12, 163, 12, 0.14);
}

.div-tag-estimated {
  color: var(--text-muted);
  background: var(--surface-hover);
}

.live-dot-manual {
  background: var(--text-muted);
  animation: none;
  box-shadow: none;
}

.live-dot-review {
  background: #eda100;
  animation: none;
  box-shadow: none;
}

.icon-btn.spinning svg {
  animation: icon-spin 0.8s linear infinite;
}

@keyframes icon-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-md);
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, opacity 0.12s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  background: var(--chart-line);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: #4f95ea;
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
}

.btn-secondary:hover {
  color: var(--text-primary);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* Milestone 19: the topbar's Privacy Mode toggle in its "on" (amounts
   hidden) state — an accent-colored highlight so it's obvious at a glance
   that amounts are currently masked, not just an icon swap. */
.icon-btn.active {
  background: color-mix(in srgb, var(--accent, #3987e5) 16%, transparent);
  color: var(--accent, #3987e5);
}

.icon-btn.active:hover {
  background: color-mix(in srgb, var(--accent, #3987e5) 24%, transparent);
  color: var(--accent, #3987e5);
}

/* A tiny icon-only button that sits inline within a line of text — used
   for the "copy IBAN" button (Milestone 10), unlike .icon-btn which is
   sized for a table-row action column. */
.icon-btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  vertical-align: -5px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}

.icon-btn-inline:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-hover);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

@media (max-width: 860px) {
  .topbar {
    padding: 0 var(--space-4);
  }
  .topbar-title {
    font-size: 16px;
  }
}

/* ---------------------------------------------------------------------- */
/* Cards                                                                   */
/* ---------------------------------------------------------------------- */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6) 0;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------------------------------------------------------------------- */
/* Broker filter                                                          */
/* ---------------------------------------------------------------------- */

.filter-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.filter-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-hairline);
  background: var(--surface-1);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.filter-pill:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--surface-hover);
  border-color: var(--border-hairline-strong);
  color: var(--text-primary);
}

.filter-pill:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.filter-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------- */
/* Hero summary                                                           */
/* ---------------------------------------------------------------------- */

.hero-card {
  padding: var(--space-6) var(--space-7) var(--space-7);
}

.hero-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.hero-value {
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 6px 0 10px;
  font-variant-numeric: proportional-nums;
}

/* A smaller variant for the per-tab total-value summary (Milestone 10) —
   deliberately less prominent than the Dashboard's own net-worth number,
   since it's a secondary metric on every other page. */
.hero-value.compact {
  font-size: clamp(24px, 3.4vw, 34px);
  margin: 4px 0 8px;
}

.hero-delta-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.delta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 8px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.delta-chip.positive {
  color: var(--delta-positive);
  background: var(--delta-positive-bg);
}

.delta-chip.negative {
  color: var(--delta-negative);
  background: var(--delta-negative-bg);
}

.delta-chip svg {
  width: 13px;
  height: 13px;
}

.hero-meta {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------- */
/* Range selector                                                         */
/* ---------------------------------------------------------------------- */

.range-selector {
  display: flex;
  gap: 2px;
  background: var(--page-bg);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 3px;
}

.range-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.range-btn:hover {
  color: var(--text-secondary);
}

.range-btn.active {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* ---------------------------------------------------------------------- */
/* Chart                                                                   */
/* ---------------------------------------------------------------------- */

.chart-wrap {
  position: relative;
  padding: var(--space-5) var(--space-6) var(--space-6);
}

.chart-svg {
  width: 100%;
  height: 280px;
  overflow: visible;
}

/* Compact variant for the per-tab summary charts (Milestone 10) — a
   secondary widget on every asset-class page, so it takes up less vertical
   space than the Dashboard's own full-size chart. 180px (not the original
   160px) pairs with performanceChart.js's own `compact` viewBox (1000x200
   instead of 1000x320) — together they keep the SVG's non-uniform
   width/height stretch close to what the full-size chart already uses, so
   the axis-label text doesn't come out visibly flattened. See
   performanceChart.js's renderPerformanceChart() comment for the full
   explanation of why a stretched fixed-viewBox SVG distorts text at all. */
.chart-wrap.compact .chart-svg {
  height: 180px;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12px;
  box-shadow: var(--shadow-card);
  transform: translate(-50%, -110%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.08s ease;
  z-index: 5;
}

.chart-tooltip.visible {
  opacity: 1;
}

.chart-tooltip .tt-value {
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.chart-tooltip .tt-date {
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------------------------------------------------------------------- */
/* Allocation card                                                        */
/* ---------------------------------------------------------------------- */

.allocation-list {
  display: flex;
  flex-direction: column;
  /* Milestone 23, per your request: the Today page's "Change by account"/
     "Change by asset class" boxes ran taller than the chart next to them —
     tightened from --space-4 (16px) to --space-3 (12px). This only affects
     the gap BETWEEN this list's own children (the bar-track and the rows
     wrapper on the Dashboard's Allocation cards; individual rows directly
     on the Today page, which don't have that extra nested wrapper) — the
     Dashboard's own per-row spacing is controlled separately by
     .allocation-rows below, so it's untouched. */
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6) var(--space-6);
}

.allocation-bar-track {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--page-bg);
  gap: 2px;
}

.allocation-bar-seg {
  height: 100%;
}

.allocation-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.allocation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.allocation-row .label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.allocation-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.allocation-row .value {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.allocation-row .pct {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 6px;
}

/* ---------------------------------------------------------------------- */
/* Holdings table                                                         */
/* ---------------------------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
  padding: var(--space-4) var(--space-2) var(--space-4);
}

.holdings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 920px;
}

.holdings-table th {
  text-align: right;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 10px var(--space-4);
  border-bottom: 1px solid var(--border-hairline);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.holdings-table th.col-security,
.holdings-table td.col-security {
  text-align: left;
}

.holdings-table th:hover {
  color: var(--text-secondary);
}

.holdings-table th .sort-arrow {
  margin-left: 3px;
  opacity: 0.6;
}

.holdings-table td {
  padding: 12px var(--space-4);
  text-align: right;
  border-bottom: 1px solid var(--border-hairline);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.holdings-table tbody tr {
  transition: background 0.1s ease;
}

.holdings-table tbody tr:hover {
  background: var(--surface-hover);
}

.holdings-table tbody tr:last-child td {
  border-bottom: none;
}

.security-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.security-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface-hover);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.security-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13.5px;
}

.security-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

.broker-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.broker-tag .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Milestone 15: the Precious Metals "Tax-free?" indicator dot — unlike
   .filter-pill/.allocation-row/.broker-tag's ".dot" (which only get their
   size from a flex-container parent selector), this one stands alone in a
   plain table cell with no such parent, so it needs its own complete rule
   rather than relying on one of those. */
.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  cursor: default;
}

.cell-positive {
  color: var(--delta-positive);
}

.cell-negative {
  color: var(--delta-negative);
}

/* `.holdings-table td { color: var(--text-primary); }` above is a class +
   element selector, which beats a bare `.cell-positive`/`.cell-negative`
   class on specificity regardless of source order — so without this, every
   "today's change" and "unrealized gain/loss" cell silently rendered in
   plain white no matter the sign. These table-scoped overrides win instead. */
.holdings-table td.cell-positive {
  color: var(--delta-positive);
}

.holdings-table td.cell-negative {
  color: var(--delta-negative);
}

.cell-sub {
  font-size: 11.5px;
  color: inherit;
  opacity: 0.75;
  margin-top: 1px;
}

/* ---------------------------------------------------------------------- */
/* Empty / misc                                                           */
/* ---------------------------------------------------------------------- */

.section-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.page-title {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------------------------------------------------------------------- */
/* Modal / Add transaction form                                           */
/* ---------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* The Holding detail modal (Milestone 11) is the one modal that opens
   ANOTHER modal on top of itself — its own "Add purchase"/per-row "Edit"
   buttons open the transaction modal while it stays open underneath (so
   the purchase list can live-update once you save). Every `.modal-backdrop`
   otherwise shares the same z-index (100), so which one painted on top used
   to depend on DOM order alone — the transaction modal's container happens
   to come BEFORE the holding-detail modal's in index.html, so it rendered
   underneath the holding modal's still-visible backdrop: still functionally
   open (clicking Edit did work), just completely invisible and unclickable
   behind the opaque backdrop on top of it. A real bug reported by the user.
   Giving this one modal a lower z-index fixes it for good, regardless of
   markup order. */
#holding-detail-modal .modal-backdrop {
  z-index: 90;
}

.modal {
  background: var(--surface-1);
  border: 1px solid var(--border-hairline-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(8px);
  transition: transform 0.14s ease;
}

/* Wider variant for the holding-detail modal (Milestone 11) — it holds a
   whole purchase-history table alongside the security-info fields, which
   doesn't fit comfortably in the standard 560px modal width. */
.modal-wide {
  max-width: 760px;
}

.modal-backdrop.visible .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border-hairline);
}

.modal-title {
  font-size: 16px;
  font-weight: 650;
}

.modal-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  flex: 1;
}

.form-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.form-row .form-field {
  min-width: 130px;
}

.form-field input,
.form-field select {
  background: var(--page-bg);
  border: 1px solid var(--border-hairline-strong);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
}

.form-field input:focus,
.form-field select:focus {
  outline: 2px solid var(--chart-line);
  outline-offset: -1px;
}

.new-security-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px dashed var(--border-hairline-strong);
  border-radius: var(--radius-md);
  background: var(--page-bg);
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* A small note attached under a single field (as opposed to .form-hint,
   which sits under a whole group) — introduced for the "why is this field
   disabled?" explanation on the locked Cash currency field. */
.form-field-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  font-weight: 400;
  margin-bottom: 4px;
}

/* A standalone field-group label, used above the Cash "Balance history"
   mini-table (Milestone 12) — unlike .form-field's <span>, this isn't
   paired with a single input right below it. */
.form-field-label-standalone {
  display: block;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* A compact read-only-looking table for showing a short list inside a
   modal (Milestone 12: the Cash "Balance history" list) — smaller and
   plainer than .holdings-table, which is built for a full page. */
.mini-table-scroll {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.mini-table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-hairline);
  position: sticky;
  top: 0;
  background: var(--surface-1);
}

.mini-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-hairline);
  color: var(--text-primary);
  white-space: nowrap;
}

.mini-table tr:last-child td {
  border-bottom: none;
}

.mini-table td:last-child {
  text-align: right;
}

/* A plain, no-border text button styled like a link — used for "Cancel
   editing this entry" under the Cash balance-history table (Milestone 12),
   where a full .btn-secondary would be visually heavier than this small,
   easily-reversible action deserves. */
.btn-link {
  background: none;
  border: none;
  padding: 0;
  margin: -4px 0 4px;
  color: var(--chart-line);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline dotted;
  align-self: flex-start;
}

.btn-link:hover {
  text-decoration: underline solid;
}

.form-error {
  background: var(--delta-negative-bg);
  color: var(--delta-negative);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
}

/* Coin-search dropdown for the "Add crypto" form (Milestone 11) — a small
   floating result list under the search box, same idea as a native
   autocomplete but styled to match the rest of the app. */
.coin-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.coin-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-hairline);
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.coin-search-result:last-child {
  border-bottom: none;
}

.coin-search-result:hover {
  background: var(--surface-hover);
}

.coin-search-result .coin-symbol {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
}

.load-error-banner {
  display: none;
  background: var(--delta-negative-bg);
  color: var(--delta-negative);
  border: 1px solid var(--delta-negative);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
}

/* ---------------------------------------------------------------------- */
/* Import CSV modal                                                       */
/* ---------------------------------------------------------------------- */

.modal-wide {
  max-width: 960px;
}

.import-mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}

.import-summary-bar {
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--page-bg);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.import-review-table select,
.import-review-table input {
  background: var(--page-bg);
  border: 1px solid var(--border-hairline-strong);
  border-radius: var(--radius-sm);
  padding: 5px 7px;
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: inherit;
  width: 100%;
}

/* Table auto-layout sizes a column from its th/content before the select's
   own text is taken into account, which can collapse a short-option select
   (e.g. Buy/Sell) down to just its arrow with the text clipped off. An
   explicit minimum keeps every field readable regardless of option length. */
.import-review-table select {
  min-width: 84px;
}

.import-review-table td.col-security select {
  min-width: 190px;
}

.import-review-table td {
  padding-top: 6px;
  padding-bottom: 6px;
}

.import-review-table tbody tr[data-row] td {
  border-bottom: none;
}

.import-issues-row td {
  padding-top: 0;
  padding-bottom: 8px;
  border-top: none;
  text-align: left;
  font-size: 11.5px;
  color: var(--text-muted);
}

.import-row-excluded {
  opacity: 0.45;
}

.import-issue {
  display: flex;
  align-items: center;
  gap: 5px;
}

.import-issue-error {
  color: var(--delta-negative);
}

.import-issue-warning {
  color: var(--text-muted);
}

.stub-note {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

/* ---------------------------------------------------------------------- */
/* Settings page (Milestone 14) — Demo Mode toggle + tab-visibility matrix */
/* ---------------------------------------------------------------------- */

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.settings-row-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-row-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* A simple iOS-style toggle switch — built from a checkbox so it stays
   keyboard-accessible for free, just visually restyled. */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch-track {
  position: absolute;
  inset: 0;
  background: var(--border-hairline-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.toggle-switch-track::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.toggle-switch input:checked + .toggle-switch-track {
  background: var(--accent, #3987e5);
}

.toggle-switch input:checked + .toggle-switch-track::before {
  transform: translateX(18px);
}

/* Milestone 17: the Settings page's "What counts toward net worth"
   checkbox list — a simple wrapping grid of labeled checkboxes, one per
   asset class. Deliberately plain checkboxes (not the toggle-switch style
   above) since this is a flat multi-select list rather than a single
   on/off setting. */
/* Milestone 23: Settings' "Your accounts" card — lets you rename any
   bank/broker; the same state.brokers list every dropdown, filter pill and
   column header already reads from, so a rename shows up everywhere at
   once. */
.account-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6) var(--space-6);
}

.account-list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: 13.5px;
}

.account-list-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.account-list-name {
  flex: 1;
  color: var(--text-primary);
}

.account-name-input {
  flex: 1;
  background: var(--page-bg);
  border: 1px solid var(--border-hairline-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
}

.account-name-input:focus {
  outline: 2px solid var(--chart-line);
  outline-offset: -1px;
}

.checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  padding: var(--space-5) var(--space-6) var(--space-6);
}

.checkbox-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
  cursor: pointer;
}

.checkbox-list-item input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent, #3987e5);
  cursor: pointer;
}

.visibility-matrix-table th,
.visibility-matrix-table td {
  text-align: center;
  white-space: nowrap;
}

.visibility-matrix-table th.col-security,
.visibility-matrix-table td.col-security {
  text-align: left;
  white-space: normal;
}

.visibility-matrix-table input[type='checkbox'] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent, #3987e5);
}
