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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #273447;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #1a56db;
  --accent-hover: #1d4ed8;
  --up: #22c55e;
  --down: #ef4444;
  --gold: #f59e0b;
  --radius: 12px;
}

body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }

/* ---- LOGIN ---- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 60% 40%, #1e3a6e 0%, #0f172a 70%);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%; max-width: 380px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5);
}

.login-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.1rem; font-weight: 600;
  margin-bottom: 1.8rem; color: var(--text);
}

.login-card h2 {
  font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem;
}

/* ── Stock search autocomplete ── */
.stock-suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 200;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.stock-sug-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.6rem 0.9rem; cursor: pointer; transition: background 0.1s;
}
.stock-sug-item:hover, .stock-sug-item.active { background: var(--surface); }
.sug-sym { font-weight: 700; font-size: 0.9rem; min-width: 90px; color: var(--text); }
.sug-name { flex: 1; font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-ex { font-size: 0.7rem; font-weight: 700; padding: 2px 7px;
  background: rgba(99,102,241,0.15); color: #a5b4fc;
  border-radius: 20px; flex-shrink: 0; }

.alert-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.05em; }
.field input {
  width: 100%; padding: 0.65rem 0.85rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.95rem;
  outline: none; transition: border-color 0.2s;
}
.field input:focus { border-color: var(--accent); }

.btn-primary {
  width: 100%; margin-top: 0.5rem;
  padding: 0.75rem; background: var(--accent);
  color: white; border: none; border-radius: 8px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }

/* ---- NAVBAR ---- */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: 60px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1rem; font-weight: 700;
}

.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-user { font-size: 0.85rem; color: var(--text-muted); }

.btn-logout {
  padding: 0.4rem 0.85rem; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-muted); font-size: 0.82rem;
  text-decoration: none; transition: all 0.2s;
}
.btn-logout:hover { border-color: var(--down); color: var(--down); }

/* ---- DASHBOARD ---- */
.dash-body { background: var(--bg); min-height: 100vh; }

.dash-main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem;
}

.dash-header h1 { font-size: 1.5rem; font-weight: 700; }

.dash-meta { display: flex; align-items: center; gap: 1rem; font-size: 0.8rem; color: var(--text-muted); }

.btn-refresh {
  padding: 0.4rem 0.85rem; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 0.82rem; cursor: pointer;
  transition: all 0.2s;
}
.btn-refresh:hover { border-color: var(--accent); color: var(--accent); }
.btn-refresh:disabled { opacity: 0.5; cursor: default; }

/* ---- SECTIONS ---- */
.section { margin-bottom: 2.5rem; }

.section-title {
  font-size: 0.85rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  margin-bottom: 1rem;
}

.section-sub { font-size: 0.75rem; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-muted); }

/* ---- CARDS ---- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem 1.5rem;
  position: relative; overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}
.card:hover { border-color: #475569; transform: translateY(-1px); }

.card-gold { border-top: 3px solid var(--gold-color, var(--gold)); }

.card-label {
  font-size: 0.78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted);
  margin-bottom: 1rem;
}

.card-rows { display: flex; flex-direction: column; gap: 0.5rem; }

.rate-row {
  display: flex; align-items: baseline; justify-content: space-between;
}

.rate-period { font-size: 0.8rem; color: var(--text-muted); }

.rate-value {
  font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.rate-row.secondary .rate-value { font-size: 1rem; font-weight: 500; color: #cbd5e1; }

.gold-val { color: var(--gold); }

.rate-change {
  font-size: 0.78rem; font-weight: 600; margin-top: 0.4rem;
}

.change-up { color: var(--up); }
.change-down { color: var(--down); }

.card-unit {
  font-size: 0.7rem; color: var(--text-muted);
  margin-top: 0.8rem; text-align: right;
}

.gold-note {
  margin-top: 0.75rem; font-size: 0.75rem; color: var(--text-muted);
}

/* ---- CURRENCY CARDS ---- */
.rate-big {
  font-size: 2rem; font-weight: 700; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; margin: 0.5rem 0 0.25rem;
}

.derived-tag {
  font-size: 0.65rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
  background: var(--surface2); border-radius: 4px; padding: 1px 5px;
  vertical-align: middle; margin-left: 4px;
}

.dash-source {
  font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem;
}

/* ---- GOLD TABLE ---- */
.gold-table-wrap {
  overflow-x: auto; border-radius: var(--radius);
  border: 1px solid var(--border);
}

.gold-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.9rem;
}

.gold-table thead tr {
  background: var(--surface2);
}

.gold-table th {
  padding: 0.7rem 1rem; text-align: right;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  white-space: nowrap;
}

.gold-table th:first-child { text-align: left; }

.gold-table td {
  padding: 0.75rem 1rem; text-align: right;
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.gold-table td:first-child { text-align: left; }

.gold-table tbody tr:hover { background: var(--surface2); }

.col-latest { color: var(--gold); font-weight: 700; }
.rate-highlight { color: var(--gold) !important; font-weight: 700; }

.gold-table .up   { color: var(--up); font-weight: 600; }
.gold-table .down { color: var(--down); font-weight: 600; }
.gold-table .pct  { font-size: 0.75em; opacity: 0.8; }

.col-carat { min-width: 150px; }
.col-yest  { color: var(--text-muted); }
.col-change { min-width: 120px; }

/* ---- NAV BACK ---- */
.nav-back {
  color: var(--text-muted); text-decoration: none; font-size: 0.85rem;
  font-weight: 500; transition: color 0.2s;
}
.nav-back:hover { color: var(--text); }
.nav-divider { color: var(--border); margin: 0 0.6rem; }

/* ---- HOME HUB ---- */
.home-header { margin-bottom: 2rem; }
.home-header h1 { font-size: 1.7rem; font-weight: 700; }
.home-sub { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.3rem; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.module-card {
  display: flex; align-items: center; gap: 1.2rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem 1.5rem;
  text-decoration: none; color: var(--text);
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
  cursor: pointer;
}
.module-card:hover {
  border-color: var(--accent); transform: translateY(-2px);
  background: var(--surface2);
}
.module-soon { opacity: 0.5; cursor: default; pointer-events: none; }
.module-soon:hover { transform: none; border-color: var(--border); background: var(--surface); }

.module-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.module-info { flex: 1; min-width: 0; }
.module-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; }
.module-desc  { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }

.module-arrow { font-size: 1.3rem; color: var(--text-muted); flex-shrink: 0; }
.module-card:hover .module-arrow { color: var(--accent); }

.module-soon-badge {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 2px 10px; color: var(--text-muted); flex-shrink: 0;
}

/* ---- SETUP BOX (Finance page) ---- */
.setup-box {
  max-width: 680px; margin: 2rem auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem 2.5rem;
}
.setup-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.setup-box h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; }
.setup-box > p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

.setup-steps {
  padding-left: 1.4rem; display: flex; flex-direction: column; gap: 1rem;
}
.setup-steps li { font-size: 0.9rem; line-height: 1.6; }
.setup-steps strong { color: var(--text); }
.setup-steps code {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px; font-size: 0.82rem;
}
.setup-steps a { color: var(--accent); }

.setup-note {
  margin-top: 1.5rem; font-size: 0.82rem; color: var(--text-muted);
  background: var(--surface2); border-radius: 8px; padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
}

/* ---- SHEET TABLE ---- */
.sheet-table-wrap {
  overflow-x: auto; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.sheet-table {
  width: 100%; border-collapse: collapse; font-size: 0.88rem;
}
.sheet-table thead tr { background: var(--surface2); }
.sheet-table th {
  padding: 0.65rem 1rem; text-align: left;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); white-space: nowrap;
}
.sheet-table td {
  padding: 0.65rem 1rem; border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sheet-table tbody tr:hover { background: var(--surface2); }
.col-income  { color: #4ade80; }
.col-expense { color: #f87171; }
.col-savings { color: #4ade80; }
.col-return  { color: #60a5fa; }
.text-right  { text-align: right !important; }

.total-row td { border-top: 2px solid var(--border) !important; background: var(--surface2); }

.badge {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
}
.badge-paid    { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-pending { background: rgba(251,191,36,0.15); color: #fbbf24; }

.badge-amount {
  font-size: 0.75rem; font-weight: 500; color: var(--text-muted);
  background: var(--surface2); border-radius: 4px; padding: 2px 8px;
  margin-left: 0.5rem; vertical-align: middle;
}

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.sub-section-title {
  font-size: 0.82rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ---- FOOTER ---- */
.dash-footer {
  text-align: center; padding: 1.5rem;
  font-size: 0.75rem; color: #475569;
  border-top: 1px solid var(--border);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
  .dash-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .cards-grid { grid-template-columns: 1fr; }
  .navbar { padding: 0 1rem; }
  .nav-user { display: none; }
}

/* ═══════════════ FINANCE: editable cells, breakdown popup, toast ═══════════════ */

.muted { color: var(--text-muted); }
.row-ref { font-size: 0.7rem; margin-left: 0.4rem; opacity: 0.6; }

.section-ref {
  font-size: 0.68rem; font-weight: 500; letter-spacing: 0.02em;
  text-transform: none; color: var(--text-muted);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 7px; margin-left: 0.6rem;
  vertical-align: middle; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.section-note {
  font-size: 0.82rem; line-height: 1.55; color: var(--text-muted);
  max-width: 76ch; margin: -0.4rem 0 1rem;
}
.section-note strong { color: var(--text); font-weight: 600; }

.section-foot {
  font-size: 0.75rem; color: var(--text-muted); margin-top: 0.7rem;
}
.section-foot code, .section-note code {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; font-size: 0.72rem;
}

/* Legend */
.legend {
  display: flex; flex-wrap: wrap; gap: 1.4rem;
  font-size: 0.76rem; color: var(--text-muted);
  margin: -0.6rem 0 1.6rem;
}
.legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.legend-swatch { pointer-events: none; }

/* ── Cells ── */
.cell {
  display: inline-block; border-radius: 5px;
  padding: 2px 6px; margin: -2px -6px;
  font-variant-numeric: tabular-nums;
  transition: background 0.12s, box-shadow 0.12s;
}
.cell-empty { color: var(--text-muted); opacity: 0.45; }

.cell.editable { cursor: text; border-bottom: 1px dashed transparent; }
.cell.editable:hover {
  background: rgba(26,86,219,0.16);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,0.45);
}

.cell.calc { cursor: pointer; color: var(--text); }
.cell.calc:hover {
  background: rgba(245,158,11,0.14);
  box-shadow: inset 0 0 0 1px rgba(245,158,11,0.4);
}

.fx, .fx-inline {
  font-size: 0.72em; color: var(--gold);
  margin-left: 4px; font-style: italic; font-weight: 700;
}
.fx-inline { margin: 0 1px; }

.cell.flash { animation: cellFlash 1.2s ease-out; }
@keyframes cellFlash {
  0%   { background: rgba(34,197,94,0.45); }
  100% { background: transparent; }
}

.cell-input {
  width: 100%; min-width: 80px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--accent); border-radius: 5px;
  padding: 2px 6px; font: inherit; text-align: right;
  font-variant-numeric: tabular-nums;
}
.cell-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(26,86,219,0.35); }
.saving { color: var(--text-muted); font-size: 0.8rem; font-style: italic; }

/* ── Add-expense control ── */
.cc-table .th-input, .cc-table .td-input { width: 190px; }
.cc-name { font-weight: 600; }

.add-expense { display: flex; gap: 6px; }
.add-expense input {
  flex: 1; min-width: 0;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 8px; font: inherit; font-size: 0.85rem; text-align: right;
  font-variant-numeric: tabular-nums;
}
.add-expense input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(26,86,219,0.3);
}
.add-expense input::-webkit-outer-spin-button,
.add-expense input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.add-expense input[type=number] { -moz-appearance: textfield; }

.btn-add {
  background: var(--accent); color: #fff;
  border: none; border-radius: 6px;
  padding: 5px 12px; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: background 0.12s;
}
.btn-add:hover:not(:disabled) { background: var(--accent-hover); }
.btn-add:disabled { opacity: 0.5; cursor: default; }

/* ── Formula breakdown modal ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(2,6,23,0.72);
  display: none; align-items: center; justify-content: center;
  padding: 1.5rem; backdrop-filter: blur(3px);
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 460px;
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.35rem; }
.modal-head code {
  display: block; font-size: 0.7rem; color: var(--text-muted);
  word-break: break-all; line-height: 1.4;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1rem; cursor: pointer; padding: 2px 6px; border-radius: 5px;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

.fx-terms { list-style: none; overflow-y: auto; padding: 0.5rem 0.6rem; }
.fx-terms li {
  display: grid; grid-template-columns: 26px 18px 1fr auto;
  align-items: center; gap: 0.5rem;
  padding: 0.42rem 0.65rem; border-radius: 6px;
  font-size: 0.85rem;
}
.fx-terms li:nth-child(odd) { background: rgba(255,255,255,0.025); }
.fx-n   { color: var(--text-muted); font-size: 0.7rem; text-align: right; }
.fx-op  { color: var(--gold); font-weight: 700; text-align: center; }
.fx-expr{ font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; color: var(--text-muted); }
.fx-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.fx-none { color: var(--text-muted); font-style: italic; display: block !important; }

.fx-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.8rem 1.25rem; border-top: 1px solid var(--border);
  background: var(--surface2); border-radius: 0 0 var(--radius) var(--radius);
  font-size: 0.9rem;
}
.fx-total strong { font-variant-numeric: tabular-nums; font-size: 1.02rem; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(140%);
  z-index: 80; max-width: min(90vw, 520px);
  padding: 0.7rem 1.1rem; border-radius: 8px;
  font-size: 0.85rem; font-weight: 500;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  opacity: 0; transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.ok  { background: #14532d; border: 1px solid #22c55e; color: #bbf7d0; }
.toast.err { background: #450a0a; border: 1px solid #ef4444; color: #fecaca; }

@media (max-width: 720px) {
  .cc-table .th-input, .cc-table .td-input { width: auto; }
  .legend { gap: 0.8rem; }
}

/* ─── LOGIN: Remember Me ─────────────────────────────────────────── */
.field-remember { margin: 0.75rem 0 1rem; }
.remember-label {
  display: flex; align-items: center; gap: 0.55rem;
  font-size: 0.85rem; color: var(--text-muted); cursor: pointer;
}
.remember-label input[type=checkbox] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--accent);
}

/* ─── FINANCE PAGE ───────────────────────────────────────────────── */

.fin-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.fin-page-header h1 { font-size: 1.5rem; font-weight: 700; }

/* Summary strip */
.fin-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.fin-sum-card {
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative; overflow: hidden;
}
.fin-sum-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
}
.fin-sum-red::before   { background: var(--down); }
.fin-sum-green::before { background: var(--up); }
.fin-sum-blue::before  { background: var(--accent); }
.fin-sum-gold::before  { background: var(--gold); }

.fin-sum-icon  { font-size: 1.4rem; margin-bottom: 0.5rem; }
.fin-sum-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.4rem; }
.fin-sum-value { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fin-sum-sub   { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.35rem; }

/* Section header with inline button */
.section-title {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.btn-add-section {
  font-size: 0.75rem; font-weight: 600; padding: 3px 10px;
  background: rgba(26,86,219,0.15); border: 1px solid rgba(26,86,219,0.4);
  color: var(--accent); border-radius: 20px; cursor: pointer;
  transition: all 0.15s;
}
.btn-add-section:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Navbar expense button */
.btn-exp-nav {
  padding: 0.4rem 0.9rem; background: var(--accent); color: #fff;
  border: none; border-radius: 6px; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-exp-nav:hover { background: var(--accent-hover); }

/* CC cards grid */
.cc-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.cc-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
  border-top: 3px solid var(--accent);
  transition: border-color 0.2s, transform 0.15s;
}
.cc-card:hover { transform: translateY(-1px); border-color: #475569; border-top-color: var(--accent); }

.cc-card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.8rem;
}
.cc-card-name { font-size: 0.88rem; font-weight: 700; color: var(--text); }

.btn-cc-add {
  font-size: 0.72rem; font-weight: 600;
  padding: 3px 9px;
  background: rgba(26,86,219,0.12); color: var(--accent);
  border: 1px solid rgba(26,86,219,0.35); border-radius: 20px;
  cursor: pointer; transition: all 0.15s;
}
.btn-cc-add:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.cc-card-amount { margin-bottom: 0.5rem; }
.cc-amt-label { display: block; font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.2rem; }
.cc-amt-value { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--down); }

.cc-card-total {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 0.5rem; margin-top: 0.5rem;
}
.cc-card-total strong { color: var(--text); font-variant-numeric: tabular-nums; }

.cc-card-dates {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 0.74rem; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 0.5rem; margin-top: 0.5rem;
}

.cc-total-bar {
  display: flex; gap: 2rem; flex-wrap: wrap;
  font-size: 0.85rem; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.75rem 1rem;
  margin-top: 0.5rem;
}
.cc-total-bar strong { color: var(--text); }

/* Invest section */
.fin-invest-section { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 2rem; }

/* ── Add Expense Modal ── */
.exp-modal { max-width: 420px; }

.exp-modal-body { padding: 1.1rem 1.25rem; }

.exp-modal-lbl {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.6rem;
}

.exp-card-selector {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.exp-card-btn {
  padding: 0.45rem 0.85rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-muted); font-size: 0.82rem;
  cursor: pointer; transition: all 0.15s; font-weight: 500;
}
.exp-card-btn:hover { border-color: var(--accent); color: var(--accent); }
.exp-card-btn.selected {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}

/* Multi-row expense items */
.exp-row {
  display: grid; grid-template-columns: 1fr 110px auto;
  gap: 0.5rem; align-items: center;
  margin-bottom: 0.5rem;
}
.exp-desc-input, .exp-row-amount {
  width: 100%; padding: 0.55rem 0.75rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.92rem;
  outline: none; transition: border-color 0.2s;
}
.exp-row-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.exp-desc-input:focus, .exp-row-amount:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,86,219,0.2); }
.exp-row-amount::-webkit-outer-spin-button,
.exp-row-amount::-webkit-inner-spin-button { -webkit-appearance: none; }
.exp-row-amount[type=number] { -moz-appearance: textfield; }

.btn-exp-row-x {
  background: none; border: none; color: var(--text-muted);
  font-size: 0.9rem; cursor: pointer; padding: 4px 7px;
  border-radius: 6px; transition: all 0.15s; flex-shrink: 0;
}
.btn-exp-row-x:hover { background: rgba(239,68,68,0.15); color: var(--down); }

.btn-add-exp-row {
  display: block; margin-top: 0.5rem;
  background: none; border: 1px dashed var(--border);
  border-radius: 8px; color: var(--text-muted); font-size: 0.82rem;
  cursor: pointer; padding: 0.4rem 0.85rem; width: 100%;
  transition: all 0.15s;
}
.btn-add-exp-row:hover { border-color: var(--accent); color: var(--accent); }

.exp-total-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.85rem; padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem; color: var(--text-muted);
}
.exp-total-bar strong { font-size: 1rem; color: var(--text); font-variant-numeric: tabular-nums; }

/* Legacy single-amount input kept for any other uses */
.exp-amount-row { display: flex; gap: 0.75rem; align-items: flex-end; }
.exp-amount-input {
  width: 100%; padding: 0.65rem 0.85rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 1.1rem;
  font-weight: 600; font-variant-numeric: tabular-nums;
  outline: none; transition: border-color 0.2s;
}
.exp-amount-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,86,219,0.2); }
.exp-amount-input::-webkit-outer-spin-button,
.exp-amount-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.exp-amount-input[type=number] { -moz-appearance: textfield; }

.modal-foot {
  display: flex; justify-content: flex-end; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 0 0 var(--radius) var(--radius);
}

.btn-exp-cancel {
  padding: 0.55rem 1rem; background: transparent;
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-muted); font-size: 0.88rem; cursor: pointer;
  transition: all 0.15s;
}
.btn-exp-cancel:hover { border-color: var(--text-muted); color: var(--text); }

@media (max-width: 600px) {
  .fin-summary { grid-template-columns: 1fr 1fr; }
  .cc-cards-grid { grid-template-columns: 1fr; }
  .btn-exp-nav { display: none; }
  .fin-page-header { flex-direction: column; gap: 0.5rem; }
}

/* ═══════════════════════════════════════════════════════
   EQUITY PAGE
   ═══════════════════════════════════════════════════════ */

.eq-up   { color: var(--up); }
.eq-down { color: var(--down); }

.eq-empty {
  text-align: center;
  padding: 5rem 1rem;
  color: var(--text-muted);
}
.eq-empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.eq-empty h2   { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.eq-empty p    { font-size: 0.9rem; }

.eq-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap;
}
.eq-page-header h1 { font-size: 1.5rem; font-weight: 700; }

.eq-header-right { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

.eq-search-wrap {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.45rem 0.85rem;
  transition: border-color 0.2s;
}
.eq-search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,86,219,0.15); }
.eq-search-icon { color: var(--text-muted); flex-shrink: 0; }
.eq-search-wrap input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 0.88rem; width: 180px;
}
.eq-search-wrap input::placeholder { color: var(--text-muted); }

/* ── Dashboard summary ── */
.eq-dashboard {
  display: flex; flex-direction: column; gap: 1.25rem;
  margin-bottom: 2rem;
}

.eq-stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
}
.eq-stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.eq-stat-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.eq-stat-val   { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.eq-stat-sub   { font-size: 0.82rem; font-weight: 600; }

.eq-pl-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.eq-pl-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
}
.eq-pl-head {
  font-size: 0.85rem; font-weight: 700; margin-bottom: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.eq-up-txt   { color: var(--up); }
.eq-down-txt { color: var(--down); }
.eq-pl-list  { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.eq-pl-list li { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; }
.pl-name   { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-val    { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; font-size: 0.8rem; }
.pl-none, .eq-pl-loading { color: var(--text-muted); font-size: 0.82rem; }

.eq-overview-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
}
.eq-overview-chart-wrap { height: 220px; }

/* ── Stock grid (2 columns) ── */
.eq-stock-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 900px) { .eq-stock-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .eq-stat-strip { grid-template-columns: 1fr 1fr; } .eq-pl-row { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .eq-stat-strip { grid-template-columns: 1fr 1fr; } }

/* Legacy single-col list (keep for compat) */
.eq-stock-list { display: flex; flex-direction: column; gap: 2rem; }

/* ── Stock Card ── */
.eq-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.eq-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 1.25rem 1.5rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface2) 0%, var(--surface) 100%);
  cursor: pointer; user-select: none;
}
.eq-card-header:hover { background: linear-gradient(135deg, #2d3f56 0%, #243040 100%); }

.eq-card-actions {
  display: flex; align-items: center; gap: 0.15rem;
  flex-shrink: 0; margin-left: 0.5rem;
}

/* Minimized state */
.eq-card.eq-minimized .eq-card-header { border-bottom: none; }
.eq-card.eq-minimized .eq-card-body { display: none; }

.eq-stock-meta { flex: 1; min-width: 0; }

.eq-stock-title {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.eq-stock-name {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em;
}
.eq-exchange-badge {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; padding: 2px 8px;
  background: rgba(99,102,241,0.2); border: 1px solid rgba(99,102,241,0.4);
  color: #a5b4fc; border-radius: 20px; flex-shrink: 0;
}
/* Price + change + fullname all on one row, wrapping on mobile */
.eq-price-fullname-row {
  display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap;
  margin-bottom: 0.15rem;
}
/* Legacy eq-price-row kept for backward compat */
.eq-price-row {
  display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 0.25rem;
}
.eq-price {
  font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.eq-change { font-size: 0.9rem; font-weight: 600; }
.eq-stock-fullname { font-size: 0.75rem; color: var(--text-muted); }

.btn-eq-minimize {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.1rem; cursor: pointer; padding: 4px 8px; border-radius: 6px;
  flex-shrink: 0; transition: all 0.15s; line-height: 1;
}
.btn-eq-minimize:hover { background: rgba(99,102,241,0.15); color: #a5b4fc; }

.btn-eq-remove {
  background: none; border: none; color: var(--text-muted);
  font-size: 1rem; cursor: pointer; padding: 4px 8px; border-radius: 6px;
  flex-shrink: 0; transition: all 0.15s;
}
.btn-eq-remove:hover { background: rgba(239,68,68,0.15); color: var(--down); }

/* ── Chart Section ── */
.eq-chart-section {
  padding: 1rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.eq-period-tabs {
  display: flex; gap: 0.3rem; margin-bottom: 0.85rem; flex-wrap: wrap;
}
.eq-period-btn {
  padding: 0.3rem 0.7rem;
  background: transparent; border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-muted); font-size: 0.78rem;
  font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.eq-period-btn:hover { border-color: var(--accent); color: var(--accent); }
.eq-period-btn.active {
  background: var(--accent); border-color: var(--accent);
  color: #fff;
}

.eq-chart-wrap {
  position: relative;
  height: 220px;
}
.eq-chart-msg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.85rem;
}
#eq-chart-wrap canvas { height: 220px !important; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.eq-loading-pulse { animation: pulse 1.2s ease-in-out infinite; }

/* ── Holdings ── */
.eq-holdings {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.eq-section-label {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.eq-hld-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
}
.eq-hld-item {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.65rem 0.85rem;
}
.eq-hld-label {
  display: block; font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: 0.25rem;
}
.eq-hld-val {
  display: block; font-size: 0.95rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.eq-hld-pnl .eq-hld-val { font-size: 1rem; }

/* ── News ── */
.eq-news-section {
  padding: 1.1rem 1.5rem 1.25rem;
}
.eq-news-list {
  list-style: none; display: flex; flex-direction: column; gap: 0.6rem;
}
.eq-news-item {
  padding: 0.65rem 0.85rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px;
}
.eq-news-title {
  display: block; font-size: 0.875rem; font-weight: 500;
  color: var(--text); text-decoration: none; line-height: 1.4;
  margin-bottom: 0.3rem;
}
.eq-news-title:hover { color: var(--accent); }
.eq-news-meta {
  display: flex; gap: 0.75rem; font-size: 0.72rem; color: var(--text-muted);
}
.eq-news-pub { font-weight: 600; }
.eq-news-loading, .eq-news-empty {
  font-size: 0.83rem; color: var(--text-muted); padding: 0.5rem 0;
}

@media (max-width: 600px) {
  .eq-card-header { padding: 1rem; }
  .eq-chart-section, .eq-holdings, .eq-news-section { padding: 1rem; }
  .eq-hld-grid { grid-template-columns: repeat(3, 1fr); }
  .eq-price { font-size: 1.3rem; }
}

/* ═══════════════════════════════════════════════════════
   ACCOUNT MENU (all pages)
   ═══════════════════════════════════════════════════════ */
.user-menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px 3px 3px;
  color: var(--text); font-size: 0.85rem; cursor: pointer;
  transition: border-color 0.15s;
}
.user-chip:hover, .user-menu.open .user-chip { border-color: var(--accent); }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-initial {
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 0.85rem;
  background: linear-gradient(135deg, #6366f1, #1a56db);
}
.user-caret { font-size: 0.7rem; color: var(--text-muted); }
.user-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  min-width: 240px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 16px 40px rgba(0,0,0,0.5); overflow: hidden;
}
.user-menu.open .user-dropdown { display: block; }
.user-dd-head { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.user-dd-head strong { font-size: 0.9rem; }
.user-dd-head span { font-size: 0.78rem; color: var(--text-muted); word-break: break-all; }
.user-dropdown a { display: block; padding: 0.65rem 1rem; color: var(--text); text-decoration: none; font-size: 0.86rem; }
.user-dropdown a:hover { background: var(--surface2); }
.user-dropdown .user-dd-signout { color: #fca5a5; border-top: 1px solid var(--border); }

@media (max-width: 600px) {
  .user-first, .user-caret { display: none; }
  .user-chip { padding: 3px; }
  .nav-right { gap: 0.5rem; }
}

/* ═══════════════════════════════════════════════════════
   GOOGLE SIGN-IN
   ═══════════════════════════════════════════════════════ */
.login-card:has(.login-setup) { max-width: 480px; }
.login-sub { color: var(--text-muted); font-size: 0.9rem; margin: -1rem 0 1.5rem; }
.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  padding: 0.75rem 1rem; background: #fff; color: #1f1f1f;
  border: 1px solid #dadce0; border-radius: 8px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s;
}
.btn-google:hover { background: #f8fafc; box-shadow: 0 2px 12px rgba(0,0,0,0.3); }
.login-remember { margin-top: 1rem; }
.login-foot { margin-top: 1.25rem; font-size: 0.78rem; color: var(--text-muted); text-align: center; }
.login-setup {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 1rem 1.1rem; font-size: 0.85rem; line-height: 1.5;
}
.login-setup ol { padding-left: 1.1rem; margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; color: var(--text-muted); }
.login-setup em { color: var(--text); font-style: normal; font-weight: 600; }
.login-setup code {
  padding: 0.1rem 0.35rem; background: var(--surface2); border-radius: 4px;
  font-size: 0.78rem; color: var(--text);
}
.login-setup code.uri { display: block; margin-top: 0.3rem; padding: 0.3rem 0.5rem; font-size: 0.75rem; word-break: break-all; }
.login-setup a { color: var(--accent); }

/* ═══════════════════════════════════════════════════════
   ADMIN: MANAGE ACCESS
   ═══════════════════════════════════════════════════════ */
.admin-main { max-width: 860px; }
.admin-add {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 2rem;
}
.admin-add .section-title { margin-bottom: 0.8rem; }
.admin-add-form { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.admin-add-form input, .admin-add-form select {
  padding: 0.55rem 0.8rem; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.9rem; outline: none;
}
.admin-add-form input { flex: 1; min-width: 220px; }
.admin-add-form input:focus, .admin-add-form select:focus { border-color: var(--accent); }
.admin-add-form .btn-exp-nav:disabled { opacity: 0.6; cursor: default; }
.admin-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.7rem; line-height: 1.5; }

.admin-list { display: flex; flex-direction: column; gap: 0.6rem; }
.admin-user {
  display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.75rem 1rem;
}
.admin-user .user-avatar { width: 38px; height: 38px; font-size: 1rem; }
.admin-user-info { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 1px; }
.admin-user-info strong { font-size: 0.92rem; }
.admin-user-info > span { font-size: 0.78rem; color: var(--text-muted); word-break: break-all; }
.admin-user-meta { font-size: 0.75rem; color: var(--text-muted); min-width: 170px; }
.admin-user-actions { display: flex; gap: 0.4rem; }
.role-badge {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 20px;
}
.role-admin  { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.35); }
.role-member { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.35); }
.btn-ghost {
  padding: 0.35rem 0.75rem; background: transparent; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-muted); font-size: 0.78rem; cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.btn-ghost.danger:hover { border-color: var(--down); color: var(--down); }

/* ═══════════════════════════════════════════════════════
   FINANCE: tiles and popups
   ═══════════════════════════════════════════════════════ */
.fin-sum-click { cursor: pointer; transition: transform 0.15s, border-color 0.2s; }
.fin-sum-click:hover, .fin-sum-click:focus-visible { transform: translateY(-2px); border-color: #475569; outline: none; }

.cc-card { cursor: pointer; display: flex; flex-direction: column; }
.cc-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cc-card .cc-amt-value { margin-bottom: 0.15rem; }
.cc-card-meta {
  font-size: 0.74rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cc-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  margin-top: auto; padding-top: 0.6rem; border-top: 1px solid var(--border);
  font-size: 0.72rem; color: var(--text-muted);
}
.cc-card-total + .cc-card-foot, .cc-card-meta + .cc-card-foot { margin-top: 0.6rem; }

.due-badge {
  font-size: 0.66rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap;
  background: rgba(148,163,184,0.12); color: var(--text-muted);
}
.due-badge.due-near { background: rgba(245,158,11,0.15); color: #fbbf24; }
.due-badge.due-soon { background: rgba(239,68,68,0.15); color: #fca5a5; }

#fxModal { z-index: 70; }
.fx-label { font-size: 0.85rem; color: var(--text); }

.pop-lg { max-width: 680px; max-height: 88vh; }
.pop-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.pop-body { overflow-y: auto; padding: 1.1rem 1.25rem 1.25rem; }

.cc-pop .modal-head { align-items: center; }
.cc-pop-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.cc-pop-body { overflow-y: auto; padding: 1.1rem 1.25rem; flex: 1; min-height: 0; }
.cc-pop-head h3 { font-size: 1.2rem; font-weight: 800; }
.cc-pop-dates {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem;
  margin-top: 0.35rem; font-size: 0.8rem; color: var(--text-muted);
}
.cc-pop-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem; margin: 1rem 0 1.2rem;
}
.cc-pop-stats > div {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.7rem 0.85rem; display: flex; flex-direction: column; gap: 0.25rem;
}
.cc-pop-stats span { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.cc-pop-stats strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.cc-pop-sub {
  display: flex; align-items: baseline; gap: 0.5rem; margin: 0.2rem 0 0.5rem;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
}
.cc-pop-sub .muted { font-weight: 400; text-transform: none; letter-spacing: 0; }

.cc-items, .cc-parts, .cc-overview { list-style: none; }
.cc-items { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 1.2rem; }
.cc-items li {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.8rem; font-size: 0.86rem; border-bottom: 1px solid rgba(51,65,85,0.6);
}
.cc-items li:last-child { border-bottom: none; }
.cc-items li:nth-child(even) { background: rgba(255,255,255,0.02); }
.cc-items li.fresh { animation: cellFlash 1.8s ease-out; }
.cc-item-n { font-size: 0.7rem; color: var(--text-muted); text-align: right; }
.cc-item-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-item-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.cc-items .cc-items-empty { display: block; color: var(--text-muted); font-style: italic; text-align: center; padding: 1rem; }

.cc-parts { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.3rem 0.85rem; }
.cc-parts li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.4rem 0; font-size: 0.84rem; border-bottom: 1px dashed rgba(51,65,85,0.8);
}
.cc-parts li:last-child { border-bottom: none; }
.cc-parts li span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }

.cc-overview { display: flex; flex-direction: column; gap: 0.5rem; }
.cc-overview li {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.65rem 0.85rem; cursor: pointer; transition: border-color 0.15s;
}
.cc-overview li:hover, .cc-overview li:focus-visible { border-color: var(--accent); outline: none; }
.cc-ov-top { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9rem; font-weight: 600; }
.cc-ov-top strong { font-variant-numeric: tabular-nums; }
.cc-ov-bar { height: 6px; background: var(--surface2); border-radius: 4px; margin: 0.45rem 0 0.35rem; overflow: hidden; }
.cc-ov-bar div { height: 100%; background: linear-gradient(90deg, #1a56db, #6366f1); border-radius: 4px; }
.cc-ov-sub { font-size: 0.72rem; color: var(--text-muted); }

.cc-pop-add {
  border-top: 1px solid var(--border); background: var(--surface2);
  padding: 0.9rem 1.25rem 0.8rem; border-radius: 0 0 var(--radius) var(--radius);
}
.cc-pop-add[hidden] { display: none; }
.cc-add-title {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin-bottom: 0.6rem;
}
.cc-add-title span { color: var(--text); }
#ccAddRows { max-height: 26vh; overflow-y: auto; }
.cc-add-actions { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.4rem; }
.cc-add-actions .btn-add-exp-row { width: auto; margin-top: 0; }
.cc-add-total { margin-left: auto; font-size: 0.85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.btn-inline { width: auto; margin-top: 0; padding: 0.55rem 1.4rem; }
.btn-inline:disabled { opacity: 0.6; cursor: default; }
.cc-add-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.5rem; }

.inv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.inv-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; cursor: pointer; display: flex; flex-direction: column; gap: 0.6rem;
  transition: transform 0.15s, border-color 0.2s;
}
.inv-tile:hover, .inv-tile:focus-visible { transform: translateY(-2px); border-color: #475569; outline: none; }
.inv-top {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
}
.inv-icon { font-size: 1.1rem; }
.inv-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.inv-value small { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); margin-left: 0.25rem; }
.inv-split { display: flex; flex-direction: column; gap: 0.3rem; }
.inv-split-row { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.84rem; color: var(--text-muted); }
.inv-split-row strong { color: var(--text); font-variant-numeric: tabular-nums; }
.inv-progress { height: 8px; background: var(--surface2); border-radius: 5px; overflow: hidden; }
.inv-progress div { height: 100%; background: linear-gradient(90deg, #059669, #22c55e); border-radius: 5px; }
.inv-progress-label { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-muted); }
.inv-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.inv-chip {
  font-size: 0.75rem; padding: 3px 10px; border-radius: 20px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted);
}
.inv-chip strong { color: var(--text); margin-left: 0.35rem; }
.inv-more { font-size: 0.75rem; color: var(--accent); margin-top: auto; }

@media (max-width: 600px) {
  .modal-backdrop { padding: 0.5rem; align-items: flex-end; }
  .pop-lg { max-height: 94vh; }
  .cc-pop-stats { grid-template-columns: 1fr 1fr; }
  .cc-add-actions { flex-wrap: wrap; }
  .exp-row { grid-template-columns: 1fr 90px auto; }
}
