:root {
  --bg: #08090b;
  --bg2: #0e1013;
  --card: #131519;
  --card-hi: #181b20;
  --line: #1e2126;
  --line2: #2c3037;
  --text: #f5f6f7;
  --dim: #949aa4;
  --faint: #5c626c;
  --accent: #d4ff3a;
  --accent-soft: rgba(212,255,58,0.10);
  --danger: #ff6b6b;
  --danger-soft: rgba(255,107,107,0.10);
  --sans: 'Manrope', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.muted { color: var(--dim); }
.error { color: var(--danger); font-size: 13px; }
input, textarea, select { font-size: 16px; font-family: var(--sans); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft); }
::placeholder { color: var(--faint); }

/* ---------- Gate ---------- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-box { width: 100%; max-width: 340px; text-align: center; }
.gate-box input { width: 100%; margin: 16px 0 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--text); }

/* ---------- Buttons ---------- */
.btn { border: none; border-radius: 11px; padding: 11px 16px; font-size: 14px; font-weight: 700; cursor: pointer; width: 100%; }
.btn-primary { background: var(--accent); color: #08090b; }
.btn-primary:active { transform: scale(0.98); }
.cta { background: var(--accent); color: #08090b; border: none; border-radius: 11px; padding: 9px 16px; font-weight: 700; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.cta:disabled { opacity: .4; }
.ghost { background: transparent; border: 1px solid var(--line2); color: var(--dim); border-radius: 11px; padding: 9px 14px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ghost.danger:hover, .ghost.danger.active { color: var(--danger); border-color: var(--danger); }
.icon-btn { background: transparent; border: none; color: var(--dim); width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--line); color: var(--text); }

/* ---------- Layout ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; padding: 14px 16px 10px; }
.brand { display: flex; align-items: center; gap: 9px; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--accent); box-shadow: 0 0 12px var(--accent); display: inline-block; }
.logo { font-family: var(--mono); font-weight: 600; font-size: 16px; }
.lime { color: var(--accent); }

.tabs { display: flex; gap: 4px; padding: 4px 12px 10px; position: sticky; top: 0; background: rgba(8,9,11,0.9); backdrop-filter: blur(10px); z-index: 15; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: none; border: none; color: var(--dim); padding: 8px 10px; font-size: 13px; font-weight: 600; border-radius: 9px; white-space: nowrap; cursor: pointer; }
.tab.active { background: var(--card); color: var(--accent); }

.content { padding: 16px 14px 70px; max-width: 720px; margin: 0 auto; width: 100%; }

/* ---------- Funnel ---------- */
.section-title { font-family: var(--mono); font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; margin: 18px 0 10px; }
.section-title:first-child { margin-top: 0; }
.funnel-empty { border: 1px dashed var(--line2); border-radius: 12px; padding: 10px 14px; color: var(--faint); font-size: 12.5px; }
.funnel-bar { display: flex; height: 7px; border-radius: 99px; overflow: hidden; background: var(--line); gap: 2px; }
.funnel-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; align-items: center; }
.legend-item { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--dim); text-transform: uppercase; }
.legend-dot { width: 6px; height: 6px; border-radius: 99px; display: inline-block; }

/* ---------- Toolbar / chips ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; flex: 1; min-width: 180px; }
.search-box input { border: none; outline: none; background: transparent; width: 100%; color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11.5px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--dim); cursor: pointer; white-space: nowrap; }
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; transition: border-color .15s; }
.card:hover { border-color: var(--line2); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-title { font-weight: 700; font-size: 15.5px; }
.card-sub { display: flex; align-items: center; gap: 5px; color: var(--dim); font-size: 12.5px; margin-top: 2px; font-family: var(--mono); }
.badge { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding: 5px 10px; border-radius: 99px; white-space: nowrap; flex-shrink: 0; }
.money-row { display: flex; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 10px; font-family: var(--mono); }
.money-item .lbl { font-size: 9px; color: var(--faint); text-transform: uppercase; display: block; }
.card-links { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; font-family: var(--mono); font-size: 12.5px; color: var(--dim); }
.card-links a { color: var(--dim); text-decoration: none; display: flex; align-items: center; gap: 6px; }
.card-notes { color: var(--dim); font-size: 13px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.card-actions { display: flex; gap: 6px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.empty-state { text-align: center; color: var(--faint); padding: 40px 10px; }

/* ---------- Stats ---------- */
.stats-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.stat-card { flex: 1 1 150px; min-width: 150px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat-label { font-family: var(--mono); font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.stat-value { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
.stat-value.accent { color: var(--accent); }
.stat-value.dim { color: var(--dim); }

.dist-row { margin-bottom: 10px; }
.dist-top { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.dist-track { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.dist-fill { height: 100%; }

.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 110px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 14px 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-fill-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.bar-fill { width: 100%; border-radius: 4px; background: var(--line2); display: flex; justify-content: center; }
.bar-fill.current { background: var(--accent); }
.bar-fill span { font-family: var(--mono); font-size: 10px; margin-top: 2px; }
.bar-label { font-family: var(--mono); font-size: 10px; color: var(--faint); }

/* ---------- Sheet / Modal ---------- */
.sheet-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 18px; }
@media (min-width: 640px) { .sheet-overlay { align-items: center; } .sheet { border-radius: 18px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sheet-head h2 { font-size: 17px; font-weight: 700; margin: 0; }
.sheet-body { display: flex; flex-direction: column; gap: 12px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .cta, .sheet-actions .ghost { flex: 1; justify-content: center; }

.field label { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; }
.f-input { width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--text); }
.f-row { display: flex; gap: 10px; }
.f-row > * { flex: 1; }
.status-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.status-opt { font-family: var(--mono); font-size: 11.5px; padding: 7px 11px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--dim); cursor: pointer; }
.status-opt.on { color: #0a0a0a; }
.pay-item { display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.pay-add { display: flex; gap: 8px; }
