/* ─── Import Font ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Design Tokens ───────────────────────────────────────────────────────── */
:root {
  --bg: #111827;
  --bg2: #1f2937;
  --bg3: #374151;
  --card: #1f2937;
  --card2: #374151;
  --border: rgba(255,255,255,0.08);
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --accent-glow: rgba(59,130,246,0.3);
  --green: #26a69a;
  --green-dim: rgba(38,166,154,0.15);
  --orange: #f59e0b;
  --orange-dim: rgba(245,158,11,0.15);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.15);
  --purple: #8b5cf6;
  --text: #f9fafb;
  --text2: #9ca3af;
  --text3: #6b7280;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 64px;
  --header-h: 60px;
}

[data-theme="light"] {
  --bg: #d2e0f0;
  --bg2: #ffffff;
  --bg3: #f1f5f9;
  --card: #ffffff;
  --card2: #f8fafc;
  --border: #d1dbe5;
  --text: #1e293b;
  --text2: #64748b;
  --text3: #94a3b8;
  --accent: #2563eb;
  --accent2: #1d4ed8;
  --accent-glow: rgba(37,99,235,0.15);
  --purple: #7c3aed;
  --green: #26a69a;
  --green-dim: #e2f5f1;
  --shadow: 0 4px 12px rgba(0,0,0,0.03);
}

/* ─── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; height: 100vh; height: -webkit-fill-available; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
input, select, button, textarea { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }
a { text-decoration: none; color: inherit; }

/* ─── App Shell ───────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  transform: translateZ(0);
  background: var(--bg);
  overflow: hidden;
}

/* ─── Top App Bar ─────────────────────────────────────────────────────────── */
#app-bar {
  min-height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-left: 16px;
  padding-right: 16px;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
#app-bar .app-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
#app-bar .app-title { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
#app-bar .app-subtitle { font-size: 11px; color: var(--text2); }
#app-bar .theme-toggle {
  margin-left: auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
  transition: background 0.2s;
}
#app-bar .theme-toggle:hover { background: var(--accent); color: #fff; }
#app-bar .theme-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ─── Main Content ────────────────────────────────────────────────────────── */
#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 0;
  scroll-behavior: smooth;
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}
#main-content::-webkit-scrollbar { display: none; /* Safari and Chrome */ }

/* ─── Bottom Nav ──────────────────────────────────────────────────────────── */
#bottom-nav {
  min-height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 16px;
  border-radius: 12px;
  color: var(--text3);
  transition: all 0.2s;
  min-width: 60px;
  position: relative;
}
.nav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s; }
.nav-item span { font-size: 10px; font-weight: 500; }
.nav-item.active { color: var(--accent2); }
.nav-item.active svg { transform: scale(1.1); }
.nav-item.active::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 32px; height: 3px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
}
.nav-item--fab {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff !important;
  border-radius: 50%;
  width: 50px; height: 50px;
  box-shadow: 0 4px 20px var(--accent-glow);
  padding: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.nav-item--fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px var(--accent-glow); }
.nav-item--fab svg { width: 24px; height: 24px; }
.nav-item--fab span { display: none; }

/* ─── Page ────────────────────────────────────────────────────────────────── */
.page { padding-bottom: 16px; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 4px 12px;
}
.page-header h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.date-badge {
  font-size: 12px; color: var(--text2);
  background: var(--bg3); padding: 4px 10px; border-radius: 20px;
}

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 13px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 14px;
}

/* ─── KPI Grid ────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 12px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
  transition: transform 0.15s;
}
.kpi-card:active { transform: scale(0.97); }
.kpi-card::before {
  content: ''; position: absolute; inset: 0;
  opacity: 0.06; border-radius: var(--radius);
}
.kpi-primary::before { background: var(--accent); }
.kpi-green::before { background: var(--green); }
.kpi-purple::before { background: var(--purple); }
.kpi-orange::before { background: var(--orange); }
.kpi-icon { margin-bottom: 6px; }
.kpi-icon svg { width: 20px; height: 20px; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.kpi-primary .kpi-icon svg { stroke: var(--accent2); }
.kpi-green .kpi-icon svg { stroke: var(--green); }
.kpi-purple .kpi-icon svg { stroke: var(--purple); }
.kpi-orange .kpi-icon svg { stroke: var(--orange); }
.kpi-value { font-size: 17px; font-weight: 800; letter-spacing: -0.5px; line-height: 1; }
.kpi-label { font-size: 11px; color: var(--text2); font-weight: 500; }

/* ─── Bar Chart ───────────────────────────────────────────────────────────── */
.chart-card { padding-bottom: 12px; }
.bar-chart {
  display: flex; align-items: flex-end; gap: 6px;
  height: 100px; padding: 0 4px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.bar-fill {
  width: 100%; min-height: 3px;
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  border-radius: 4px 4px 0 0;
  transition: height 0.6s cubic-bezier(.23,1,.32,1);
  cursor: default;
}
.bar-label { font-size: 10px; color: var(--text2); }

/* ─── Rank Rows ───────────────────────────────────────────────────────────── */
.rank-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.rank-row:last-child { border-bottom: none; }
.rank-num { font-size: 11px; font-weight: 700; color: var(--accent2); width: 22px; flex-shrink: 0; }
.rank-name { flex: 1; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-bar-wrap { flex: 1; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.rank-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--purple)); border-radius: 3px; transition: width 0.6s ease; }
.rank-qty { font-size: 11px; color: var(--text2); }
.rank-value { font-size: 13px; font-weight: 700; color: var(--text); flex-shrink: 0; }

/* ─── Company Cards ───────────────────────────────────────────────────────── */
.company-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.company-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; align-items: flex-start; gap: 12px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.company-card:hover { border-color: var(--accent); }
.company-card:active { transform: scale(0.98); }
.company-avatar {
  width: 44px; height: 44px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff;
}
.company-info { flex: 1; min-width: 0; }
.company-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.company-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.company-total { font-size: 12px; color: var(--text2); }
.company-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  background: var(--bg3); color: var(--text2);
  padding: 2px 7px; border-radius: 20px;
}
.badge--discount { background: var(--green-dim); color: var(--green); }
.badge--savings { background: var(--orange-dim); color: var(--orange); font-size: 12px; padding: 4px 10px; }
.hidden { display: none !important; }

/* ─── Search Bar ──────────────────────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar svg { width: 16px; height: 16px; stroke: var(--text3); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.search-bar input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 14px; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text2); text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.form-group input, .form-group select {
  width: 100%; background: var(--bg3); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  color: var(--text); font-size: 15px; outline: none;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  -webkit-appearance: none; appearance: none;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow);
}
.form-group input::placeholder { color: var(--text3); }
.hint { font-size: 11px; color: var(--green); margin-top: 4px; display: block; }
.select-wrapper { position: relative; }
.select-wrapper::after {
  content: '▾'; position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%); color: var(--text2); pointer-events: none; font-size: 12px;
}
.select-wrapper select { padding-right: 36px; }
.form-row { display: flex; gap: 10px; }
.form-row .btn { flex: 1; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; }
.form-section { border-left: 3px solid var(--accent); }
.section-label {
  font-size: 11px; font-weight: 700; color: var(--accent2);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 14px;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px; border-radius: 14px;
  font-size: 15px; font-weight: 700; letter-spacing: 0.3px;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff; box-shadow: 0 4px 16px var(--accent-glow);
}
.btn--primary:hover { box-shadow: 0 6px 24px var(--accent-glow); }
.btn--ghost { background: var(--bg3); color: var(--text2); }
.btn--ghost:hover { color: var(--text); }
.btn--outline { background: transparent; border: 1px solid var(--border); color: var(--text2); width: 100%; }
.btn--outline:hover { border-color: var(--accent); color: var(--accent2); }
.btn--outline svg { stroke: currentColor; }
.btn--full { width: 100%; }
.btn--icon {
  width: 42px; height: 42px; padding: 0;
  border-radius: 12px; background: var(--bg3); color: var(--text2);
}
.btn--icon:hover { background: var(--accent); color: #fff; }
.btn--icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn--sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn--sm.btn--icon { width: 30px; height: 30px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 4px; }

/* ─── Floating Action Button ──────────────────────────────────────────────── */
.floating-action-button {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--accent-glow);
  z-index: 50;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.floating-action-button:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px var(--accent-glow);
}
.floating-action-button svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Item Rows ───────────────────────────────────────────────────────────── */
.item-row {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
  margin-bottom: 10px; animation: fadeIn 0.15s ease;
}
.item-row-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.item-label { font-size: 12px; font-weight: 700; color: var(--accent2); text-transform: uppercase; letter-spacing: 0.5px; }
.item-calc {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text2);
  background: var(--bg3); border-radius: 6px; padding: 6px 10px;
  margin-top: 6px;
}
.item-calc:empty { display: none; }
.text-green { color: var(--green); font-weight: 600; }

/* ─── Summary Card ────────────────────────────────────────────────────────── */
.summary-card { background: linear-gradient(135deg, var(--card), var(--card2)); }
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; font-size: 14px;
}
.summary-total { font-size: 18px; font-weight: 800; }
.summary-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ─── History ─────────────────────────────────────────────────────────────── */
.filters-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  margin-bottom: 16px;
}
.date-range-picker {
  display: flex; align-items: center; gap: 8px;
}
.date-input-wrap {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.date-input-wrap label {
  font-size: 10px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px;
}
.date-input-wrap input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 6px;
  color: var(--text); font-size: 12px; outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.2s;
  min-width: 0;
}
.date-input-wrap input:focus { border-color: var(--accent); }
.date-sep {
  color: var(--text3); padding-top: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.date-sep svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ─── Settings List ───────────────────────────────────────────────────────── */
.settings-list {
  background: var(--card);
  margin: 0 -12px 24px -12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.settings-item {
  display: flex; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  color: #1f2937;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
  background: var(--card);
}
[data-theme="dark"] .settings-item { color: #f9fafb; }
.settings-item:last-child { border-bottom: none; }
.settings-item:active { background: var(--bg3); }
.settings-item .settings-icon {
  width: 22px; height: 22px;
  stroke: #64748b; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  margin-right: 16px;
  flex-shrink: 0;
}
.settings-item .settings-label { flex: 1; display: flex; align-items: center; gap: 8px; }
.settings-item .settings-chevron {
  width: 16px; height: 16px;
  stroke: #cbd5e1; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.settings-badge {
  background: #ef233c; color: #fff;
  font-size: 10px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
  letter-spacing: 0.5px;
}
.settings-value {
  color: #64748b; font-size: 13px; font-weight: 600; margin-right: 8px;
}

/* ─── Auth ────────────────────────────────────────────────────────────────── */
.auth-card {
  background: var(--card);
  padding: 32px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  text-align: center;
  max-width: 400px;
  width: 100%;
}
.auth-icon { font-size: 48px; margin-bottom: 16px; }
.auth-card h2 { margin: 0 0 8px; }
.auth-card p { color: var(--text3); font-size: 14px; margin: 0; line-height: 1.4; }
.input-with-prefix {
  display: flex; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.input-with-prefix .prefix {
  background: var(--card2); padding: 12px 14px; color: var(--text3); font-weight: 600; border-right: 1px solid var(--border);
}
.input-with-prefix input { border: none; background: transparent; flex: 1; }
.input-with-prefix input:focus { outline: none; }

/* ─── Custom Dropdown ─────────────────────────────────────────────────────── */
.custom-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  padding: 6px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.custom-dropdown.hidden { display: none; }
.dropdown-item {
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.dropdown-item:hover, .dropdown-item:active { background: var(--card2); }

.group-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 10px 4px 6px;
}
.group-name { font-size: 14px; font-weight: 700; }
.group-stats { display: flex; gap: 4px; flex-wrap: wrap; }

.purchase-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px; overflow: hidden;
}
.purchase-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer;
  transition: background 0.15s;
}
.purchase-header:hover { background: var(--card2); }
.purchase-date {
  display: flex; align-items: center; gap: 6px; flex: 1;
  font-size: 12px; color: var(--text2);
}
.purchase-date svg { width: 14px; height: 14px; stroke: var(--text3); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.purchase-amounts { text-align: right; }
.amount-final { display: block; font-size: 15px; font-weight: 800; }
.discount-tag { font-size: 10px; color: var(--green); font-weight: 600; }
.chevron {
  width: 16px; height: 16px; stroke: var(--text3); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0; transition: transform 0.2s;
}
.purchase-card.open .chevron { transform: rotate(180deg); }
.purchase-details { display: none; padding: 0 14px 12px; }
.purchase-card.open .purchase-details { display: block; animation: fadeIn 0.15s ease; }

.items-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px; margin-bottom: 10px;
}
.items-table th {
  text-align: left; padding: 6px 4px;
  color: var(--text2); font-weight: 600; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
}
.items-table td { padding: 7px 4px; border-bottom: 1px solid var(--border); }
.items-table tr:last-child td { border-bottom: none; }
.purchase-footer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text2);
  padding-top: 8px; border-top: 1px solid var(--border);
}

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end;
  animation: fadeIn 0.15s ease;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--card); border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 16px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(.23,1,.32,1);
}
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h2 { font-size: 18px; font-weight: 800; }

/* ─── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 48px 24px; text-align: center;
  color: var(--text3);
}
.empty-state svg {
  width: 48px; height: 48px; stroke: var(--text3); fill: none;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ─── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 500;
  padding: 10px 20px; border-radius: 24px;
  box-shadow: var(--shadow); z-index: 200;
  opacity: 0; transition: all 0.25s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error { border-color: var(--red); color: var(--red); }
.toast--success { border-color: var(--green); color: var(--green); }

/* ─── Responsive (Desktop preview) ───────────────────────────────────────── */
@media (min-width: 600px) {
  body { display: flex; align-items: center; justify-content: center; background: #060610; }
  #app { width: 480px; border-radius: 40px; height: 92vh; box-shadow: 0 0 0 8px #1a1a30, var(--shadow); }
}

/* ─── Toggle Switch ───────────────────────────────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg3);
  transition: .3s;
  border-radius: 22px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background-color: var(--text2);
  transition: .3s;
  border-radius: 50%;
}
input:checked + .toggle-slider {
  background-color: var(--accent);
}
input:checked + .toggle-slider:before {
  transform: translateX(18px);
  background-color: #fff;
}
