/* ============================================================
   UltraPlaner — dark-first design system
   Fonts: Manrope (display) + Inter (body) via Google Fonts
   ============================================================ */

:root {
  --bg:          #0b0c12;
  --warm:        #15131e;
  --surface:     #14151f;
  --card:        #1a1b27;
  --card2:       #1f2030;
  --border:      rgba(255,255,255,0.07);
  --border2:     rgba(255,255,255,0.12);
  --text:        #edecf8;
  --muted:       #7a7b96;
  --muted2:      #5a5b72;
  --accent:      #9178ff;
  --accent-glow: rgba(145,120,255,0.28);
  --accent-soft: rgba(145,120,255,0.12);
  --green:       #5fd68e;
  --green-soft:  rgba(95,214,142,0.13);
  --red:         #ff7585;
  --red-soft:    rgba(255,117,133,0.13);
  --blue:        #6ab4ff;
  --blue-soft:   rgba(106,180,255,0.13);
  --yellow:      #f4d07a;
  --yellow-soft: rgba(244,208,122,0.12);
  color-scheme: dark;
}

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

/* Root must also clamp horizontally: with overflow-x only on body the html
   element stays the horizontal scroll container and rubber-bands on iOS. */
html {
  width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y pinch-zoom;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
svg { display: block; }
::selection { background: rgba(145,120,255,0.35); }

/* ── App shell ── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--warm);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 14px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; gap: 11px; align-items: center; margin-bottom: 20px; padding: 0 6px 18px; border-bottom: 1px solid var(--border); }
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: radial-gradient(circle at 50% 40%, rgba(145,120,255,0.22), #0f1018 70%);
  border: 1px solid rgba(255,255,255,0.09);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(145,120,255,0.22);
}
.brand-mark svg { display: block; width: 21px; height: 21px; }
.brand strong { display: block; font-size: 14px; font-weight: 700; font-family: 'Manrope', sans-serif; }
.brand span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }

.sidebar-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted2);
  padding: 0 8px; margin-bottom: 6px;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav button {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px; border-radius: 10px;
  background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500;
  width: 100%; text-align: left;
  transition: background 0.15s, color 0.15s;
}
.side-nav button:hover { background: var(--accent-soft); color: var(--text); }
.side-nav button.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-icon { display: flex; align-items: center; }
.nav-icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 14px; border-top: 1px solid var(--border); }
.sidebar-tip {
  background: var(--accent-soft); border: 1px solid rgba(145,120,255,0.18);
  border-radius: 14px; padding: 14px; font-size: 12px;
}
.sidebar-tip > span { font-size: 20px; display: block; margin-bottom: 8px; }
.sidebar-tip strong { display: block; font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.sidebar-tip p { font-size: 11px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.sidebar-voice {
  width: 100%; background: var(--accent); color: #fff;
  border-radius: 8px; padding: 8px 10px;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; gap: 6px; justify-content: center;
}
.sidebar-voice span { display: flex; }
.sidebar-voice svg { width: 14px; height: 14px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.settings-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px;
  background: transparent; color: var(--muted);
  font-size: 12px; width: 100%; text-align: left;
}
.settings-link span { display: flex; }
.settings-link svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.settings-link:hover { color: var(--text); background: var(--accent-soft); }

.profile { display: flex; align-items: center; gap: 9px; padding: 6px 4px; }
.avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  background: var(--accent-soft); border: 1px solid rgba(145,120,255,0.3);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--accent);
}
.profile strong { display: block; font-size: 12px; font-weight: 700; }
.profile span { display: block; font-size: 10px; color: var(--muted); }
.profile-dots { margin-left: auto; color: var(--muted); font-size: 18px; }

/* ── Main ── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.breadcrumbs strong { color: var(--text); font-weight: 600; }
.slash { opacity: 0.35; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.today-pill {
  font-size: 11px; color: var(--muted);
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 9px;
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid rgba(145,120,255,0.2);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn span { display: flex; }
.mobile-settings { display: none; }

.content {
  flex: 1;
  padding: 28px 32px 80px;
  max-width: 980px; width: 100%; margin: 0 auto;
}

/* ── Page head ── */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 22px;
  padding-bottom: 18px; border-bottom: 1px solid var(--border);
}
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted2); margin-bottom: 5px; }
.page-head h1 {
  font-family: 'Manrope', sans-serif;
  font-size: 26px; font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.1; color: var(--text);
}
.page-head p { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.head-date {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted);
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; white-space: nowrap; flex-shrink: 0;
}
.head-date svg { width: 12px; height: 12px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.section-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

/* ── Demo banner ── */
.demo-banner {
  background: rgba(255,170,50,0.07); border: 1px solid rgba(255,180,50,0.18);
  border-radius: 10px; padding: 10px 14px;
  font-size: 11px; color: rgba(255,200,80,0.85);
  margin-bottom: 16px;
}

/* ── Home hero banner ── */
.hero {
  background: var(--warm);
  padding: 18px 18px 14px;
  margin-bottom: 14px;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(145,120,255,0.18) 0%, transparent 70%);
  right: -20px; top: -30px; pointer-events: none;
}
.hero-day {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 2px;
  position: relative; z-index: 1;
}
.hero-date {
  font-family: 'Manrope', sans-serif;
  font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
  color: #fff; margin-bottom: 4px;
  position: relative; z-index: 1;
}
.hero-sub {
  font-size: 13px; color: var(--muted);
  position: relative; z-index: 1;
}
.hero-sub b { color: rgba(255,255,255,0.75); font-weight: 600; }

/* Voice result inline */
.voice-result-inline {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--accent-soft); border: 1px solid rgba(145,120,255,0.2);
  border-radius: 13px; padding: 12px 14px; margin-bottom: 16px;
}
.voice-result-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(145,120,255,0.2); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.voice-result-mark svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.voice-result-inline div { flex: 1; min-width: 0; }
.voice-result-inline small { display: block; font-size: 9px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted2); text-transform: uppercase; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-result-inline strong { font-size: 12px; color: var(--text); font-weight: 600; }
.voice-result-inline button { background: transparent; color: var(--muted); flex-shrink: 0; margin-left: auto; display: flex; }
.voice-result-inline button svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Text capture */
.text-capture {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 13px; margin-bottom: 18px; overflow: hidden;
}
.text-capture summary {
  font-size: 11px; color: var(--muted); cursor: pointer;
  padding: 11px 16px; list-style: none;
}
.text-capture summary::after { content: '⌄'; float: right; font-size: 14px; line-height: 1; color: var(--muted2); }
.text-capture[open] summary::after { content: '⌃'; }
.capture-form { display: flex; gap: 8px; padding: 0 14px 14px; }
.capture-form input {
  flex: 1; background: var(--card2); border: 1px solid var(--border2);
  border-radius: 10px; padding: 9px 12px;
  color: var(--text); font-size: 12px; outline: none;
}
.capture-form input:focus { border-color: var(--accent); }
.capture-form input::placeholder { color: var(--muted); }
.capture-form button {
  background: var(--accent); color: #fff; border-radius: 10px;
  padding: 9px 14px; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
}
.capture-form button svg { width: 13px; height: 13px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Stat grid ── */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 22px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 15px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 12px; right: 12px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent);
}
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.stat-top > span { font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted2); }
.stat-icon {
  width: 26px; height: 26px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.red   { background: var(--red-soft);   color: var(--red); }
.stat-icon.blue  { background: var(--blue-soft);  color: var(--blue); }
.stat-icon.purple{ background: var(--accent-soft);color: var(--accent); }
.stat-value {
  font-family: 'Manrope', sans-serif;
  font-size: 22px; font-weight: 800; letter-spacing: -0.03em;
  line-height: 1; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }
.stat-foot { font-size: 10px; color: var(--muted2); margin-top: 5px; }

/* ── Finance summary ── */
.finance-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 20px; }
.finance-summary .stat-card { min-height: 0; }

/* ── Panels ── */
.section-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; margin-bottom: 16px; }
.sub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.wide-panel { grid-column: span 2; }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 15px 16px 12px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-family: 'Manrope', sans-serif; font-size: 14px; font-weight: 700; color: var(--text); }
.panel-head p { font-size: 11px; color: var(--muted); margin-top: 3px; }
.text-link { background: transparent; font-size: 11px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }

/* ── Entry rows ── */
.entry-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.entry-row:last-child { border-bottom: none; }
.task-done { opacity: 0.45; }
.task-done .entry-info strong { text-decoration: line-through; }

.entry-symbol {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.entry-symbol svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.entry-symbol.expense { background: var(--red-soft);    color: var(--red); }
.entry-symbol.income  { background: var(--green-soft);  color: var(--green); }
.entry-symbol.task    { background: var(--blue-soft);   color: var(--blue); }
.entry-symbol.idea    { background: var(--yellow-soft); color: var(--yellow); }

.task-check { width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; border-radius: 5px; }

.entry-info { flex: 1; min-width: 0; }
.entry-info strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.entry-info span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-note { font-size: 11px; line-height: 1.45; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }

.entry-amount { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; }
.entry-amount.positive { color: var(--green); }
.entry-amount.negative { color: var(--red); }

.entry-actions { display: flex; gap: 4px; }
.tiny-btn {
  width: 26px; height: 26px; border-radius: 7px;
  background: transparent; border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.tiny-btn:hover { background: var(--card2); color: var(--text); }
.tiny-btn svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Empty ── */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 16px; text-align: center; }
.empty-icon {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--card2); display: flex; align-items: center; justify-content: center;
  margin-bottom: 2px;
}
.empty-icon svg { width: 20px; height: 20px; stroke: var(--muted2); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty strong { font-size: 13px; color: var(--text); }
.empty p { font-size: 12px; color: var(--muted); }

.loading { text-align: center; color: var(--muted); padding: 80px 16px; font-size: 13px; }

/* ── Ideas ── */
.idea-card {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; margin-top: 0;
}
.quote { font-size: 28px; line-height: 0.8; color: var(--accent); opacity: 0.4; font-family: Georgia, serif; margin-bottom: 6px; }
.idea-card p { font-size: 13px; color: var(--text); line-height: 1.4; }
.idea-card footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.idea-card span { font-size: 10px; color: var(--muted2); }

/* ── Filter pills ── */
.filter-pills { display: flex; gap: 6px; padding: 12px 16px 8px; flex-wrap: wrap; }
.filter-pills button {
  padding: 6px 12px; border-radius: 10px; font-size: 11px; font-weight: 600;
  background: var(--card2); border: 1px solid var(--border); color: var(--muted);
}
.filter-pills button.active { background: var(--accent-soft); border-color: rgba(145,120,255,0.28); color: var(--accent); }

/* ── Month picker ── */
.month-picker {
  background: var(--card2); border: 1px solid var(--border2);
  border-radius: 10px; padding: 7px 10px; color: var(--text);
  font-size: 12px; color-scheme: dark;
}

/* ── Analytics ── */
.analytics-grid { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 16px; margin-bottom: 16px; }
.category-row { padding: 8px 16px; }
.category-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text); margin-bottom: 5px; }
.category-meta span:last-child { font-size: 10px; color: var(--muted); }
.bar-track { height: 5px; background: var(--card2); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #c4b0ff); border-radius: 3px; }
.legend { display: flex; gap: 14px; padding: 12px 16px 6px; font-size: 11px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { display: block; width: 10px; height: 10px; border-radius: 3px; }
.chart-wrap { display: flex; align-items: flex-end; gap: 3px; height: 100px; padding: 8px 16px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 1px; min-width: 4px; height: 100%; }
.chart-bar { width: 100%; border-radius: 2px 2px 0 0; min-height: 2px; }
.chart-bar.income { background: #b7f581; opacity: 0.85; }
.chart-bar.expense { background: #a68dff; opacity: 0.85; }
.chart-days { display: flex; justify-content: space-between; padding: 5px 16px 10px; font-size: 9px; color: var(--muted2); }

/* ── Settings ── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.settings-card h2 { font-family: 'Manrope', sans-serif; font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.settings-card p { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.settings-card label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin: 14px 0 5px; }
.settings-card select { width: 100%; background: var(--card2); border: 1px solid var(--border2); border-radius: 10px; padding: 9px 12px; color: var(--text); font-size: 13px; color-scheme: dark; }
.setting-status { font-size: 12px; color: var(--green); font-weight: 600; padding: 5px 0; }
.setting-status.off { color: var(--muted); }
.shortcut-box { background: var(--card2); border: 1px solid var(--border2); border-radius: 10px; padding: 11px 13px; font-size: 11px; font-family: monospace; color: var(--text); word-break: break-all; margin-top: 7px; line-height: 1.5; }
.steps { padding-left: 16px; }
.steps li { font-size: 12px; color: var(--muted); line-height: 1.8; }
.steps b { color: var(--text); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px;
  font-size: 12px; font-weight: 700;
}
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #a890ff; }
.btn-secondary { background: var(--card2); border: 1px solid var(--border2); color: var(--text); }
.btn-secondary:hover { background: var(--card); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { background: var(--red-soft); color: var(--red); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72);
  backdrop-filter: blur(5px); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 20px; padding: 22px;
  width: 100%; max-width: 440px;
  max-height: calc(100vh - 40px); overflow-y: auto;
}
.modal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-top h2 { font-family: 'Manrope', sans-serif; font-size: 16px; font-weight: 800; color: var(--text); }
.modal-close {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--card2); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.modal-close svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.form-grid { display: flex; flex-direction: column; gap: 14px; }
.type-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; }
.type-option {
  padding: 9px 4px; border-radius: 10px; font-size: 11px; font-weight: 600;
  background: var(--card2); border: 1px solid var(--border);
  color: var(--muted); text-align: center; cursor: pointer;
}
.type-option.active { background: var(--accent-soft); border-color: rgba(145,120,255,0.3); color: var(--accent); }
.type-option:disabled { opacity: 0.45; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .field select {
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 10px; padding: 9px 12px;
  color: var(--text); font-size: 13px; width: 100%;
  font-family: inherit; outline: none; color-scheme: dark;
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { min-height: 80px; resize: vertical; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* ── Voice overlay ── */
.voice-backdrop { align-items: flex-end; padding: 0; }
.voice-dialog {
  background: var(--warm); border: 1px solid var(--border2);
  border-radius: 24px 24px 0 0; padding: 30px 24px 36px;
  width: 100%; max-width: 480px;
  text-align: center; position: relative;
}
.voice-close {
  position: absolute; top: 15px; right: 15px;
  width: 28px; height: 28px; background: var(--card2);
  border-radius: 8px; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.voice-close svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.voice-ring {
  width: 80px; height: 80px; border-radius: 26px;
  background: var(--accent-soft); border: 2px solid rgba(145,120,255,0.28);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.voice-ring svg { width: 34px; height: 34px; stroke: var(--accent); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.voice-ring.is-recording {
  background: rgba(255,117,133,0.1); border-color: rgba(255,117,133,0.35);
  animation: voicePulse 1.4s ease-in-out infinite;
}
.voice-ring.is-recording svg { stroke: var(--red); }
@keyframes voicePulse { 0%,100%{box-shadow:0 0 0 0 rgba(255,117,133,0.25)} 50%{box-shadow:0 0 0 14px rgba(255,117,133,0)} }
.voice-state { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; color: var(--muted2); margin-bottom: 8px; }
.voice-dialog h2 { font-family: 'Manrope', sans-serif; font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.voice-dialog p { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0 auto; max-width: 300px; }
.voice-transcript { font-style: italic; color: var(--muted); font-size: 12px; }
.voice-dialog-actions { margin-top: 20px; display: flex; justify-content: center; }

/* ── Toast ── */
#toast-root { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 200; pointer-events: none; white-space: nowrap; }
.toast {
  background: var(--card2); border: 1px solid var(--border2); border-radius: 12px;
  padding: 11px 18px; font-size: 13px; color: var(--text);
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  animation: toastIn 0.2s ease;
}
.toast.error { background: var(--red-soft); border-color: rgba(255,117,133,0.3); color: var(--red); }
@keyframes toastIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }

/* ── Stats grid (home) ── */
.stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 12px;
}
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px;
}
.stat-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.stat-name { font-size: 11px; color: var(--muted); font-weight: 600; }
.stat-dot {
  width: 7px; height: 7px; border-radius: 50%;
}
.stat-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.stat-dot.blue  { background: var(--blue);  box-shadow: 0 0 6px var(--blue); }
.stat-dot.red   { background: var(--red);   box-shadow: 0 0 6px var(--red); }
.stat-num {
  font-family: 'Manrope', sans-serif;
  font-size: 20px; font-weight: 800; letter-spacing: -0.02em;
  line-height: 1; margin-bottom: 4px;
}
.stat-num.pos { color: var(--green); }
.stat-num.neg { color: var(--red); }
.stat-num.acc { color: var(--accent); }
.stat-foot { font-size: 10px; color: var(--muted); }

/* ── Voice wrap ── */
.voice-wrap { margin-bottom: 12px; }
.voice-btn {
  width: 100%;
  background: var(--accent-soft);
  border: 1px solid rgba(145,120,255,0.2);
  border-radius: 16px;
  padding: 13px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  position: relative; overflow: hidden;
  text-align: left;
}
.voice-btn::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(145,120,255,0.35) 50%, transparent 95%);
}
.voice-orb {
  width: 38px; height: 38px; flex-shrink: 0;
  background: var(--accent); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.voice-orb svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.voice-copy { flex: 1; min-width: 0; }
.voice-copy strong { display: block; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.voice-copy span { font-size: 11px; color: var(--muted); }
.voice-badge {
  flex-shrink: 0;
  background: rgba(145,120,255,0.18); color: var(--accent);
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 4px 7px; border-radius: 6px;
}

/* ── Sections ── */
.section { margin-bottom: 16px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px; margin-bottom: 8px;
}
.section-title { font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 700; color: var(--text); }
.section-more { font-size: 12px; color: var(--accent); font-weight: 600; background: none; padding: 0; }

/* ── Entry list ── */
.entries { background: var(--card); border-radius: 16px; overflow: hidden; }
.entry {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.entry:last-child { border-bottom: none; }
.entry-ico {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1;
}
.entry-ico.ex { background: var(--red-soft); }
.entry-ico.in { background: var(--green-soft); }
.entry-ico.tk { background: var(--blue-soft); }
.entry-ico.id { background: var(--accent-soft); }
.entry-body { flex: 1; min-width: 0; }
.entry-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-meta { font-size: 11px; color: var(--muted); margin-top: 1px; }
.entry-val { font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.entry-val.ex { color: var(--red); }
.entry-val.in { color: var(--green); }
.entry-val.tk { color: var(--muted); font-size: 11px; }

/* ── Finance hero ── */
.finance-hero {
  background: var(--warm);
  padding: 10px 18px 18px;
  margin-bottom: 0;
  position: relative; overflow: hidden;
}
.fh-top-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px; flex-wrap: wrap;
}
.fh-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.fh-actions { display: flex; align-items: center; gap: 8px; }
.fh-balance {
  font-family: 'Manrope', sans-serif;
  font-size: 36px; font-weight: 800; letter-spacing: -0.04em; line-height: 1;
  margin-bottom: 4px;
}
.fh-balance.pos { color: var(--green); }
.fh-balance.neg { color: var(--red); }
.fh-month { font-size: 11px; color: var(--muted); }

/* ── Filter pills ── */
.pills {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 10px 18px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.pill {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 14px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  cursor: pointer;
}
.pill.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: rgba(145,120,255,0.3);
}

/* ── Mobile nav ── */
.mobile-nav { display: none; }

/* ── Splash screen ── */
.splash-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  transition: opacity 0.4s ease;
}
.splash-screen.fade-out { opacity: 0; pointer-events: none; }
.splash-mark {
  animation: splash-pulse 1.6s ease-in-out infinite;
}
@keyframes splash-pulse {
  0%,100% { transform: scale(1); filter: drop-shadow(0 0 18px rgba(145,120,255,0.5)); }
  50% { transform: scale(1.06); filter: drop-shadow(0 0 32px rgba(145,120,255,0.8)); }
}
.splash-name {
  font-family: 'Manrope', sans-serif;
  font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.02em;
}
.splash-msg { font-size: 13px; color: var(--muted); }

/* ── Calendar picker ── */
.cal-wrap {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
}
.cal-sheet {
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 20px 18px max(24px,env(safe-area-inset-bottom,24px));
  width: 100%; max-width: 480px;
}
.cal-sheet-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.cal-sheet-title { font-family: 'Manrope',sans-serif; font-size: 16px; font-weight: 800; }
.cal-close-btn { background: var(--card2); border: none; border-radius: 50%; width: 30px; height: 30px; color: var(--muted); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cal-mode-tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--warm); border-radius: 10px; padding: 3px; }
.cal-mode-tab { flex: 1; padding: 7px; border-radius: 8px; font-size: 13px; font-weight: 600; background: transparent; color: var(--muted); border: none; cursor: pointer; transition: all 0.15s; }
.cal-mode-tab.active { background: var(--card); color: var(--text); }
.cal-nav-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-nav-btn { width: 36px; height: 36px; background: var(--card2); border: none; border-radius: 10px; color: var(--text); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cal-nav-label { font-weight: 700; font-size: 14px; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; text-align: center;
}
.cal-dow { font-size: 10px; font-weight: 700; color: var(--muted); padding: 4px 0; text-transform: uppercase; letter-spacing: 0.06em; }
.cal-dow:nth-child(6),.cal-dow:nth-child(7) { color: var(--accent); }
.cal-day {
  aspect-ratio: 1; border: none; background: transparent; color: var(--text);
  border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.cal-day:hover { background: var(--accent-soft); }
.cal-day.from,.cal-day.to { background: var(--accent); color: #fff; font-weight: 700; }
.cal-day.in-range { background: rgba(145,120,255,0.18); border-radius: 0; }
.cal-day.from { border-radius: 8px 0 0 8px; }
.cal-day.to { border-radius: 0 8px 8px 0; }
.cal-day.from.to { border-radius: 8px; }
.cal-day.today { outline: 1.5px solid var(--accent); }
.cal-hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }
.cal-month-input { width: 100%; background: var(--card2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 15px; color: var(--text); font-family: inherit; }
.period-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer;
}
.period-btn svg { width: 14px; height: 14px; stroke: var(--accent); fill: none; stroke-width: 2; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {
  .sidebar { width: 220px; }
  .content { padding: 22px 24px 80px; }
  .topbar { padding: 0 22px; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 850px) {
  .sidebar { display: none; }
  .topbar { display: none; }
  .content { padding: 0 14px 100px; max-width: 100%; }
  /* Floating settings button */
  .mobile-settings {
    position: fixed; top: max(12px, env(safe-area-inset-top,12px)); right: 14px;
    z-index: 30; display: flex !important;
    width: 36px; height: 36px;
    background: rgba(26,27,39,0.85); backdrop-filter: blur(8px);
    border: 1px solid var(--border); border-radius: 11px;
  }
  .page-head { flex-wrap: wrap; }
  .page-head h1 { font-size: 22px; }
  .head-date { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 16px; }
  .finance-summary { grid-template-columns: 1fr 1fr; }
  .finance-summary .stat-card:last-child { grid-column: span 2; }
  .section-grid, .analytics-grid { grid-template-columns: 1fr; }
  .sub-grid { grid-template-columns: 1fr 1fr; }
  .wide-panel { grid-column: span 1; }
  .settings-grid { grid-template-columns: 1fr; }
  .hero { margin-left: -14px; margin-right: -14px; padding: 16px 18px 14px; }
  .finance-hero { margin-left: -14px; margin-right: -14px; padding-left: 18px; padding-right: 18px; }
  .pills { margin-left: -14px; margin-right: -14px; }
  #toast-root { bottom: 88px; }

  /* Mobile nav bar */
  .mobile-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 10px 8px max(18px, env(safe-area-inset-bottom, 18px));
    z-index: 50;
    backdrop-filter: blur(20px);
  }

  /* Tab buttons */
  .mobile-nav .nav-tab {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: transparent; padding: 0; min-width: 44px;
  }
  .mobile-nav .nav-tab .nav-tab-icon {
    width: 30px; height: 30px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
  }
  .mobile-nav .nav-tab svg {
    width: 18px; height: 18px; fill: none;
    stroke: rgba(255,255,255,0.45);
    stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  }
  .mobile-nav .nav-tab .nav-fill { fill: currentColor; stroke: none; opacity: 0.15; }
  .mobile-nav .nav-tab.active svg { stroke: #fff; }
  .mobile-nav .nav-tab.active .nav-fill { opacity: 0.3; }
  .mobile-nav .nav-tab.active .nav-tab-icon { background: rgba(255,255,255,0.1); }
  .mobile-nav .nav-tab > span {
    font-size: 9px; font-weight: 600; letter-spacing: 0.02em;
    color: rgba(255,255,255,0.4);
  }
  .mobile-nav .nav-tab.active > span { color: rgba(255,255,255,0.9); }

  /* Center voice button — purple square with white dot + ring */
  .mobile-nav .nav-mic {
    width: 46px; height: 46px;
    background: linear-gradient(145deg, #a88fff, #7c5df0);
    border-radius: 14px;
    border: none;
    display: flex; align-items: center; justify-content: center;
    margin-top: -18px;
    flex-shrink: 0;
    box-shadow: 0 6px 20px rgba(145,120,255,0.5), inset 0 1px 0 rgba(255,255,255,0.18);
    cursor: pointer;
  }
  .mobile-nav .nav-mic::after {
    content: '';
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 2.5px transparent, 0 0 0 5px rgba(255,255,255,0.4);
    display: block;
  }
}

@media (max-width: 600px) {
  .content { padding: 0 12px 100px; }
  .stat-grid { gap: 8px; }
  .stat-value { font-size: 18px; }
  .sub-grid { grid-template-columns: 1fr; }
  .page-head .section-actions .btn { padding: 7px 10px; font-size: 11px; }
  .today-pill { display: none; }
  .finance-summary { grid-template-columns: 1fr; }
  .finance-summary .stat-card:last-child { grid-column: span 1; }
  .modal { padding: 18px; }
}
