:root {
  --bg: #0b0d12;
  --panel: #161922;
  --panel2: #1c2030;
  --border: #262b3a;
  --text: #e6e8ee;
  --muted: #9098ab;
  --accent: #6366f1;
  --pos: #22c55e;
  --neg: #ef4444;
  --invest: #3b82f6;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: #818cf8; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
pre.raw-row { background: var(--panel2); border-radius: 6px; padding: 10px; overflow: auto; font-size: 12px; max-height: 280px; }

.topnav {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex; align-items: center; gap: 24px;
  position: sticky; top: 0; z-index: 10;
}
.topnav .brand { font-size: 16px; font-weight: 700; color: var(--text); }
.nav-links { display: flex; gap: 16px; margin-left: auto; }
.nav-links a { color: var(--muted); }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links .logout { color: #f87171; }
.nav-links .change-pwd { color: #fcd34d; }

.default-pwd-banner {
  background: #3a2a16;
  color: #fcd34d;
  border: 1px solid #6b4d1a;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}
.default-pwd-banner a { color: #fde68a; text-decoration: underline; }

.pwd-form { max-width: 420px; display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.pwd-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.pwd-form input { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; font-size: 14px; }
.pwd-form button { background: var(--accent); color: white; border: none; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-size: 14px; align-self: flex-start; }
.ok { background: #14331e; color: #86efac; padding: 10px 12px; border-radius: 6px; margin: 10px 0; font-size: 13px; }

main { padding: 22px 24px 50px; max-width: 1400px; margin: 0 auto; }
h1 { margin: 0 0 4px; font-size: 22px; }
h2 { margin: 28px 0 10px; font-size: 16px; color: #cbd5e1; }
h3 { margin: 20px 0 8px; font-size: 14px; color: #cbd5e1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: 12.5px; }
.back { color: var(--muted); }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 14px 0 20px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.kpi-label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 22px; font-weight: 600; margin-top: 4px; }
.kpi-value-sm { font-size: 14px; font-weight: 600; margin-top: 4px; color: var(--muted); }
.kpi-spend .kpi-value { color: var(--neg); }
.kpi-income .kpi-value { color: var(--pos); }
.kpi-invest .kpi-value { color: var(--invest); }

table.data-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.data-table th, .data-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--panel2); font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: rgba(99,102,241,0.05); }
.data-table.compact th, .data-table.compact td { padding: 6px 10px; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-family: SFMono-Regular, Consolas, monospace; font-size: 13px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.row-dup { opacity: 0.45; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; background: var(--panel2); color: var(--muted); }
.pill-expense { background: #3b1f1f; color: #fca5a5; }
.pill-income { background: #14331e; color: #86efac; }
.pill-investment { background: #1b2540; color: #93c5fd; }
.pill-transfer { background: #2b1f44; color: #c4b5fd; }
.pill-cc_payment { background: #2b1f44; color: #c4b5fd; }
.pill-refund { background: #14331e; color: #86efac; }
.pill-fee { background: #3a2a16; color: #fcd34d; }
.pill-atm_withdrawal { background: #2c2418; color: #facc15; }
.pill-savings { background: #1b2540; color: #93c5fd; }
.pill-credit_card { background: #2b1f44; color: #c4b5fd; }

.chart-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px; height: 360px; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; align-items: center; }
.filter-bar input, .filter-bar select, .filter-bar button {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font-size: 13px;
}
.filter-bar button { background: var(--accent); color: white; border-color: var(--accent); cursor: pointer; }
.filter-bar input[type="search"] { min-width: 260px; }
.filter-bar .inline { display: flex; align-items: center; gap: 4px; }

.summary-row { display: flex; gap: 18px; margin: 6px 0 12px; color: var(--muted); font-size: 13px; }
.summary-row strong { color: var(--text); }
.pagination { margin: 16px 0; display: flex; gap: 14px; align-items: center; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.txn-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
.txn-grid form label { display: block; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.txn-grid form label.inline { display: flex; align-items: center; gap: 6px; }
.txn-grid form input, .txn-grid form select, .txn-grid form textarea {
  width: 100%; background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; margin-top: 4px;
}
.txn-grid form button { background: var(--accent); color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; }

.note { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.note-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.note-ai { border-left: 3px solid var(--accent); }
.note-user { border-left: 3px solid var(--pos); }
.note-body { white-space: pre-wrap; }

textarea { width: 100%; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-family: inherit; font-size: 13px; }
button { background: var(--accent); color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; }
button:hover { opacity: 0.92; }

.chat-box { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px; max-height: 500px; overflow-y: auto; margin: 10px 0; }
.chat-box.big { max-height: 600px; min-height: 400px; }
.chat-msg { margin-bottom: 12px; }
.chat-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.chat-body { white-space: pre-wrap; padding: 10px 12px; border-radius: 8px; max-width: 80%; }
.chat-user .chat-body { background: #1d2a4a; border: 1px solid #2a3d6e; margin-left: auto; }
.chat-assistant .chat-body { background: var(--panel2); border: 1px solid var(--border); }
.chat-msg.pending .chat-body { opacity: 0.55; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; }
.chat-form button { padding: 10px 22px; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f172a, #1e293b); }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 30px 36px; min-width: 320px; }
.login-card h1 { font-size: 24px; margin: 0; }
.login-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.login-card input { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px; font-size: 14px; }
.login-card button { padding: 10px 14px; font-size: 14px; }
.warn { background: #3a2a16; color: #fcd34d; padding: 10px 12px; border-radius: 6px; margin: 10px 0; font-size: 12.5px; }
.err { background: #3b1f1f; color: #fca5a5; padding: 10px 12px; border-radius: 6px; margin: 10px 0; font-size: 13px; }

.footer { padding: 14px 24px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; }
.inline-form { display: flex; gap: 8px; margin: 8px 0 16px; }
.inline-form input, .inline-form select { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px; }

/* ---- Date range picker (added 2026-05-16) ---- */
.range-bar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-bottom: 18px;
  font-size: 13px;
}
.range-bar label { display: inline-flex; align-items: center; gap: 6px; }
.range-bar select, .range-bar input[type="date"], .range-bar input[type="text"] {
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 4px 7px; font: inherit;
}
.range-bar button {
  background: var(--accent); color: white; border: 0;
  padding: 5px 12px; border-radius: 5px; cursor: pointer;
}
.range-bar .range-label { margin-left: auto; }
.range-bar .range-or { color: var(--muted); }

/* ---- Bulk reclassify bar on /review ---- */
.bulk-bar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 10px 0 14px;
  font-size: 13px;
}
.bulk-bar select, .bulk-bar input[type="text"] {
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 4px 7px; font: inherit;
}
.bulk-bar button {
  background: var(--accent); color: white; border: 0;
  padding: 5px 12px; border-radius: 5px; cursor: pointer;
}

.add-handle {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 10px 0; font-size: 13px;
}
.add-handle input[type="text"] {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 4px 7px; font: inherit; min-width: 200px;
}
.add-handle button {
  background: var(--accent); color: white; border: 0;
  padding: 5px 12px; border-radius: 5px; cursor: pointer;
}
.del-handle {
  background: transparent; color: #f87171;
  border: 1px solid #f87171; border-radius: 4px;
  padding: 2px 8px; cursor: pointer; font-size: 11.5px;
}

/* ---- Creative pages (added 2026-05-16) ---- */
/* Used by trip_detail, timeline, amazon, splitwise pages. Dark-theme aware. */

.hero-band {
  position: relative;
  border-radius: 18px;
  padding: 30px 34px 26px;
  margin: 6px 0 22px;
  color: #fff;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}
.hero-band::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 0% 0%, rgba(255,255,255,0.18), transparent 55%),
              radial-gradient(80% 60% at 100% 100%, rgba(0,0,0,0.35), transparent 60%);
  pointer-events: none;
}
.hero-band > * { position: relative; z-index: 1; }
.hero-band .hero-emoji { font-size: 64px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4)); }
.hero-band h1 { color: #fff; margin: 10px 0 4px; font-size: 30px; letter-spacing: -0.01em; }
.hero-band .hero-sub { opacity: 0.95; font-size: 15px; }
.hero-band .hero-meta { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.hero-band .hero-stat {
  background: rgba(255,255,255,0.16);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
}
.hero-band .hero-stat strong { font-weight: 700; }
.hero-band .hero-stat .ico { font-size: 16px; }
.hero-band .hero-money {
  position: absolute; right: 28px; top: 24px;
  text-align: right;
}
.hero-band .hero-money .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.8; }
.hero-band .hero-money .amt { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.hero-band .hero-money .sub { font-size: 12px; opacity: 0.85; margin-top: 2px; }

.member-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  font-size: 13px;
}
.member-chip .avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.4);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #1a1a1a;
}

.glass-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 14px 0;
  position: relative;
}
.glass-panel.accent { border-left: 4px solid var(--accent); }
.glass-panel h2,
.glass-panel h3 { margin-top: 0; }

.dual-panels {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr));
  gap: 14px; margin: 14px 0;
}

.info-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.info-card .ic-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.info-card .ic-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.info-card .ic-line { font-size: 13.5px; color: var(--text); line-height: 1.55; }
.info-card .ic-line .muted { color: var(--muted); }

.highlight-quote {
  border-left: 4px solid var(--accent);
  background: rgba(99,102,241,0.05);
  padding: 12px 14px;
  border-radius: 8px;
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.55;
}

.cat-bar-row {
  display: grid; grid-template-columns: 120px 1fr 90px;
  gap: 10px; align-items: center;
  margin: 6px 0;
  font-size: 13px;
}
.cat-bar-row .cb-label { color: var(--text); }
.cat-bar-row .cb-bar {
  height: 14px; background: var(--panel2); border-radius: 7px; overflow: hidden;
  position: relative;
}
.cat-bar-row .cb-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  border-radius: 7px;
  min-width: 4px;
}
.cat-bar-row.confirmed .cb-fill { background: linear-gradient(90deg, #22c55e, #4ade80); }
.cat-bar-row.estimated .cb-fill { background: linear-gradient(90deg, #f59e0b, #fbbf24); opacity: 0.85; }
.cat-bar-row.purchase .cb-fill { background: linear-gradient(90deg, #ff9900, #ffb74a); }
.cat-bar-row .cb-val {
  text-align: right; color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
}
.cat-bar-row .cb-val strong { color: var(--text); }

.contributor-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
}
.contributor-card .avatar-lg {
  width: 56px; height: 56px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  flex-shrink: 0;
}
.contributor-card .avatar-papa  { background: linear-gradient(135deg,#f97316,#fb923c); }
.contributor-card .avatar-kaka  { background: linear-gradient(135deg,#0ea5e9,#38bdf8); }
.contributor-card .avatar-govind{ background: linear-gradient(135deg,#10b981,#34d399); }
.contributor-card .avatar-keshav{ background: linear-gradient(135deg,#a855f7,#c084fc); }
.contributor-card .ct-name { font-size: 16px; font-weight: 700; }
.contributor-card .ct-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.contributor-card .ct-bar { margin-top: 8px; height: 10px; background: var(--panel2); border-radius: 6px; overflow: hidden; position: relative; }
.contributor-card .ct-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  border-radius: 6px;
}
.contributor-card .ct-fill.est {
  background: repeating-linear-gradient(45deg, rgba(245,158,11,0.85) 0 6px, rgba(251,191,36,0.85) 6px 12px);
}
.contributor-card .ct-amt { font-size: 18px; font-weight: 700; color: var(--text); margin-top: 6px; }

/* Vertical timeline rail for day-by-day / life timeline */
.story-rail {
  position: relative;
  padding-left: 36px;
  margin: 18px 0;
}
.story-rail::before {
  content: "";
  position: absolute;
  left: 14px; top: 4px; bottom: 4px;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), transparent 95%);
  border-radius: 2px;
}
.story-rail .node {
  position: relative;
  margin-bottom: 22px;
}
.story-rail .node::before {
  content: "";
  position: absolute;
  left: -29px; top: 8px;
  width: 14px; height: 14px;
  background: var(--bg);
  border: 3px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.18);
}
.story-rail .node .day-pill {
  display: inline-block;
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.story-rail .node h3 { margin: 4px 0; font-size: 15px; color: var(--text); }

.event-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 6px;
}
.event-card .ec-line {
  display: grid;
  grid-template-columns: minmax(90px, 0.6fr) 1fr minmax(90px, 0.7fr);
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
  font-size: 13px;
  align-items: center;
}
.event-card .ec-line:last-child { border-bottom: none; }
.event-card .ec-line .ec-desc { color: var(--text); }
.event-card .ec-line .ec-desc .sub { color: var(--muted); font-size: 11.5px; display: block; }
.event-card .ec-line .ec-amt {
  text-align: right;
  font-family: SFMono-Regular, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.spend-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) 2fr;
  gap: 20px;
  align-items: center;
  background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(168,85,247,0.05));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  margin: 14px 0 22px;
}
.spend-summary .big-amt { font-size: 44px; font-weight: 700; letter-spacing: -0.02em; color: #fff; }
.spend-summary .big-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.cat-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
}
.cat-tag strong { font-weight: 700; }

/* Amazon-specific */
.amazon-hero {
  background: linear-gradient(135deg, #232f3e 0%, #ff9900 130%);
}
.recip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.recip-card {
  background: linear-gradient(180deg, rgba(255,153,0,0.10), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-left: 4px solid #ff9900;
  border-radius: 10px;
  padding: 12px 14px;
}
.recip-card.self  { border-left-color: #22c55e; background: linear-gradient(180deg, rgba(34,197,94,0.10), rgba(255,255,255,0.02)); }
.recip-card.family { border-left-color: #6366f1; background: linear-gradient(180deg, rgba(99,102,241,0.10), rgba(255,255,255,0.02)); }
.recip-card.friend { border-left-color: #f97316; background: linear-gradient(180deg, rgba(249,115,22,0.10), rgba(255,255,255,0.02)); }
.recip-card .rc-name { font-weight: 700; font-size: 14px; }
.recip-card .rc-count { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.recip-card .rc-addr { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.recip-card .rc-badge {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel2);
  color: var(--muted);
  margin-top: 6px;
}
.recip-card.self    .rc-badge { background: rgba(34,197,94,0.18);  color: #86efac; }
.recip-card.family  .rc-badge { background: rgba(99,102,241,0.18); color: #c7d2fe; }
.recip-card.friend  .rc-badge { background: rgba(249,115,22,0.18); color: #fdba74; }

.year-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.year-card {
  background: linear-gradient(180deg, rgba(255,153,0,0.08), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.year-card .y-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.year-card .y-num { font-size: 22px; font-weight: 700; margin: 2px 0; }
.year-card .y-orders { font-size: 12px; color: var(--muted); }
.year-card .y-bar { height: 6px; background: var(--panel2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.year-card .y-fill { height: 100%; background: linear-gradient(90deg, #ff9900, #ffb74a); border-radius: 4px; }

/* Splitwise pages */
.sw-self-row { background: linear-gradient(90deg, rgba(99,102,241,0.18), transparent 70%) !important; }

/* Items table on trip detail */
.item-pill {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 3px 2px 0;
  border-radius: 6px;
  background: var(--panel2);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text);
}
.item-pill.est { background: rgba(245,158,11,0.15); color: #fcd34d; border-color: rgba(245,158,11,0.3); }
/* ---- guess flag badge (auto:guess tag) ---- */
.guess-flag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(255,200,80,.15), rgba(255,140,40,.18));
  border: 1px solid rgba(255,180,60,.55);
  color: #ffc36b;
  text-transform: lowercase;
  letter-spacing: .02em;
  vertical-align: middle;
}

/* ---- tables.js enhancement: sort + filter + CSV download ---- */
.dt-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0 6px;
  flex-wrap: wrap;
}
.dt-toolbar .dt-filter {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px; font-size: 12.5px;
  min-width: 220px;
}
.dt-toolbar .dt-filter:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.dt-toolbar .dt-counter { font-size: 11.5px; color: var(--muted); }
.dt-toolbar .dt-csv {
  background: var(--panel2); color: var(--muted); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 10px; font-size: 11.5px; cursor: pointer;
  margin-left: auto;
}
.dt-toolbar .dt-csv:hover { color: var(--text); border-color: var(--accent); }

.data-table th.dt-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}
.data-table th.dt-sortable:hover { color: var(--text); }
.data-table th.dt-sortable.dt-sorted { color: var(--accent); }
.data-table th .dt-sort-ind {
  display: inline-block; min-width: 12px; font-size: 10px; margin-left: 2px;
  color: var(--accent);
}

/* ---------------- Funding-routing page ---------------- */
.funding-diagram {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 22px;
  margin: 12px 0 24px;
}
.funding-diagram .node {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  min-width: 220px;
  text-align: center;
}
.funding-diagram .node-title { font-weight: 700; font-size: 15px; }
.funding-diagram .node-sub   { font-size: 11px; line-height: 1.3; margin-top: 3px; }
.funding-diagram .node-stat  { font-size: 13px; margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--border); }
.funding-diagram .node-source { border-color: #fbbf24; background: #1f1a0a; align-self: center; }
.funding-diagram .node-union  { border-color: #ef4444; }
.funding-diagram .node-icici  { border-color: #3b82f6; }
.funding-diagram .node-cc     { border-color: #a855f7; }
.funding-diagram .node-invest { border-color: #22c55e; }

.funding-diagram .row-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.funding-diagram .flow-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 4px 0; }
.funding-diagram .flow-col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.funding-diagram .arrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--border); background: var(--panel2);
}
.funding-diagram .arrow-amt { font-weight: 700; }
.funding-diagram .arrow-spend  { border-color: #ef4444; color: #fca5a5; }
.funding-diagram .arrow-invest { border-color: #22c55e; color: #86efac; }
.funding-diagram .arrow-cc     { border-color: #a855f7; color: #d8b4fe; }
.funding-diagram .arrow-clawback { border-color: #f59e0b; color: #fde68a; background: #2a1f08; }
.funding-diagram .arrow-untracked { border-color: #6b7280; color: #d1d5db; border-style: dashed; }

.row-untracked { background: #1a1208; }
.row-untracked td { border-top-color: #3a2a16; }

.pill-user { background: #1e3a5f; color: #bfdbfe; }
.pill-ai   { background: #1f3d2a; color: #bbf7d0; }

.note-form textarea {
  width: 100%; background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  font-family: inherit; font-size: 14px; resize: vertical;
}
.note-form .note-actions { margin-top: 8px; display: flex; gap: 10px; align-items: center; }
.note-form button {
  background: var(--accent); color: white; border: 0;
  padding: 8px 16px; border-radius: 6px; font-weight: 600; cursor: pointer;
}
.note-form button:disabled { opacity: 0.5; cursor: wait; }
.note-form button:hover { filter: brightness(1.1); }
#aiBtn { background: #16a34a; }

.notes-timeline { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.note-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
}
.note-card.note-ai { border-color: #15803d; background: #0e1a14; }
.note-card .note-meta {
  display: flex; gap: 10px; align-items: center;
  font-size: 11px; margin-bottom: 6px;
}
.note-card .note-meta .pill {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
}
.note-card .note-body { white-space: pre-wrap; font-size: 13.5px; }
.note-card .note-del {
  margin-left: auto; background: transparent; border: 0; color: var(--muted);
  cursor: pointer; font-size: 14px;
}
.note-card .note-del:hover { color: #ef4444; }

@media (max-width: 768px) {
  .funding-diagram .row-row,
  .funding-diagram .flow-cols { grid-template-columns: 1fr; }
}

/* ===========================================================================
   /funding v2 — Sankey-style flow diagram with clickable expand boxes
   =========================================================================== */
.flow-diagram { display: flex; flex-direction: column; gap: 6px; margin: 18px 0; }

.flow-row { display: grid; gap: 16px; }
.flow-row-source   { grid-template-columns: 1fr; max-width: 720px; margin: 0 auto; }
.flow-row-2cols    { grid-template-columns: 1fr 1fr; }
.flow-row-6cols    { grid-template-columns: repeat(6, 1fr); }

.fnode {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; background: rgba(255,255,255,0.02);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s;
  position: relative;
}
.fnode-clickable { cursor: pointer; }
.fnode-clickable:hover {
  transform: translateY(-2px); background: rgba(255,255,255,0.05);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.fnode-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fnode-title { font-weight: 700; font-size: 14px; }
.fnode-drill { font-size: 10px; color: var(--muted); }
.fnode-sub { font-size: 11px; line-height: 1.35; margin-top: 2px; }
.fnode-amt { font-size: 22px; font-weight: 800; margin-top: 6px; }
.fnode-detail { margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--border); font-size: 12px; }
.fnode-d-row { display: flex; justify-content: space-between; padding: 2px 0; gap: 8px; }
.fnode-d-row .num { color: var(--text); }

.fnode-source     { border-color: #fbbf24; background: #1f1a0a; }
.fnode-source .fnode-amt { color: #fcd34d; }
.fnode-spend      { border-color: #ef4444; }
.fnode-spend .fnode-amt { color: #fca5a5; }
.fnode-invest     { border-color: #22c55e; }
.fnode-invest .fnode-amt { color: #86efac; }
.fnode-card       { border-color: #a855f7; background: rgba(168,85,247,0.04); }
.fnode-card .fnode-amt { color: #d8b4fe; }
.fnode-leaf-spend { border-color: #f97316; border-left-width: 4px; }
.fnode-leaf-cc    { border-color: #a855f7; border-left-width: 4px; }
.fnode-leaf-invest { border-color: #22c55e; border-left-width: 4px; }
.fnode-leaf-shuffle { border-color: #6b7280; border-style: dashed; opacity: 0.85; }

.flow-arrows { display: grid; gap: 16px; padding: 2px 0; }
.flow-arrows.two-cols { grid-template-columns: 1fr 1fr; }
.flow-arrows.six-cols { grid-template-columns: repeat(6, 1fr); }
.flow-arrows.cc-arrows { grid-template-columns: 1fr 1fr; max-width: 70%; margin: 0 auto; }
.flow-arrow {
  border-top: 2px solid var(--border);
  border-left: 2px solid transparent; border-right: 2px solid transparent;
  padding: 8px 8px 6px; text-align: center; font-size: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent);
  position: relative;
}
.flow-arrow::after {
  content: '▼'; position: absolute; bottom: -10px;
  left: 50%; transform: translateX(-50%); color: var(--border); font-size: 12px;
}
.flow-arrow .fa-label { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.flow-arrow .fa-amt   { display: block; font-weight: 700; font-size: 14px; margin-top: 2px; }
.flow-arrow-spend  { border-top-color: #ef4444; }
.flow-arrow-spend  .fa-amt { color: #fca5a5; }
.flow-arrow-spend::after { color: #ef4444; }
.flow-arrow-invest { border-top-color: #22c55e; }
.flow-arrow-invest .fa-amt { color: #86efac; }
.flow-arrow-invest::after { color: #22c55e; }
.flow-arrow-invest-bold { border-top-color: #22c55e; border-top-width: 3px; }
.flow-arrow-invest-bold .fa-amt { color: #4ade80; }
.flow-arrow-invest-bold::after { color: #22c55e; }
.flow-arrow-cc { border-top-color: #a855f7; }
.flow-arrow-cc .fa-amt { color: #d8b4fe; }
.flow-arrow-cc::after { color: #a855f7; }
.flow-arrow-shuffle { border-top-style: dashed; border-top-color: #6b7280; }
.flow-arrow-shuffle .fa-amt { color: #d1d5db; }
.flow-arrow-shuffle::after { color: #6b7280; }

.flow-clawback {
  margin: 6px 0; padding: 8px 14px;
  border: 1px solid #fbbf24; border-radius: 10px;
  background: rgba(251,191,36,0.08);
  display: flex; gap: 10px; justify-content: space-between;
  flex-wrap: wrap; font-size: 13px;
}
.flow-clawback a { color: #fcd34d; }

/* Drill panel ---------------------------------------------------------- */
.drill-panel {
  margin: 18px 0; border: 1px solid var(--border); border-radius: 12px;
  background: rgba(255,255,255,0.03); padding: 0; overflow: hidden;
}
.drill-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: rgba(251,191,36,0.08);
  border-bottom: 1px solid var(--border);
}
.drill-head h3 { margin: 0; font-size: 16px; }
.drill-close {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 4px 10px; cursor: pointer;
}
.drill-close:hover { background: rgba(255,255,255,0.05); }
.drill-body { padding: 14px 16px; }
.drill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.drill-bar-row {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr 100px;
  gap: 10px; align-items: center; padding: 4px 0; font-size: 12.5px;
}
.dbr-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dbr-bar { height: 14px; background: rgba(255,255,255,0.04); border-radius: 7px; overflow: hidden; }
.dbr-fill { height: 100%; background: linear-gradient(90deg, #fbbf24, #f97316); border-radius: 7px; }
.dbr-val { text-align: right; }

@media (max-width: 900px) {
  .flow-row-6cols, .flow-arrows.six-cols { grid-template-columns: 1fr 1fr; }
  .drill-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .flow-row-2cols, .flow-row-6cols, .flow-arrows.two-cols,
  .flow-arrows.six-cols, .flow-arrows.cc-arrows { grid-template-columns: 1fr; }
}
