:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #8b5cf6;
  --accent: #10b981;        /* emerald — totals / money / done */
  --accent-hover: #059669;
  --warn: #f59e0b;
  --danger: #ef4444;

  --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-accent: linear-gradient(135deg, #10b981 0%, #059669 100%);

  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --white: #ffffff;          /* stays white in BOTH themes (text on colored buttons) */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --surface: #ffffff;        /* solid component background (buttons, slots, menus) */
  --surface-trans: rgba(255, 255, 255, 0.94); /* translucent card / bar background */
  --divider: rgba(15, 23, 42, 0.3);
  --page-bg-1: #f8fafc;
  --page-bg-2: #eef2ff;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.12);

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition: 0.2s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, var(--page-bg-1) 0%, var(--page-bg-2) 100%);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  padding: 24px 16px 120px;
}

.container { max-width: 680px; margin: 0 auto; }

/* Header / footer */
.app-header { text-align: center; margin-bottom: 22px; }
.app-header h1 {
  font-size: 1.9rem; font-weight: 800;
  background: var(--gradient); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; margin-bottom: 6px;
}
.app-header h1 i { -webkit-text-fill-color: var(--primary); }
.tagline { color: var(--text-2); font-size: 1rem; max-width: 520px; margin: 0 auto; }

.app-footer { text-align: center; margin-top: 28px; }
.app-footer a { color: var(--text-3); text-decoration: none; font-size: 0.85rem; transition: color var(--transition); }
.app-footer a:hover { color: var(--primary); }

/* Cards / views */
.card {
  background: var(--surface-trans);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
  padding: 26px;
  margin-bottom: 16px;
  animation: fadeInUp 0.35s ease;
}
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.view.hidden, .hidden { display: none !important; }
.card h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 14px; }
.card h3 { font-size: 1rem; font-weight: 700; margin: 18px 0 10px; }
.center { text-align: center; }
.muted { color: var(--text-2); }
.small { font-size: 0.85rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0.8rem 1.4rem; border: none; border-radius: 50px;
  font-family: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition); text-decoration: none; color: var(--white);
}
.btn-block { width: 100%; }
.btn-primary { background: var(--gradient); box-shadow: var(--shadow-lg); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-xl); }
.btn-accent { background: var(--gradient-accent); box-shadow: var(--shadow-lg); }
.btn-accent:hover { transform: translateY(-2px); box-shadow: var(--shadow-xl); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: var(--surface); color: var(--primary); border: 2px solid var(--primary); padding: 0.55rem 1rem; }
.btn-secondary:hover { background: var(--gray-50); }
.btn-secondary.copied { background: var(--accent); border-color: var(--accent); color: var(--white); }
.btn-ghost { background: transparent; color: var(--primary); border: 2px dashed var(--gray-300); }
.btn-ghost:hover { border-color: var(--primary); background: rgba(99, 102, 241, 0.05); }
.btn-danger { background: var(--surface); color: var(--danger); border: 2px solid var(--danger); padding: 0.5rem 0.9rem; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

/* Inputs */
.field-label { display: block; font-size: 0.88rem; font-weight: 600; color: var(--text-2); margin: 16px 0 6px; }
.text-input, .num-input {
  width: 100%; padding: 0.75rem 0.9rem; border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 1rem;
  background: var(--surface-trans); transition: all var(--transition); color: var(--text);
}
.text-input:focus, .num-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12); }

/* Steps list (home) */
.steps { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 6px 0 22px; }
.steps li { display: flex; align-items: flex-start; gap: 12px; color: var(--text-2); }
.step-num {
  flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--gradient);
  color: var(--white); font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.steps strong { color: var(--text); }

/* Banners */
.banner { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; font-size: 0.9rem; animation: fadeInUp 0.3s ease; }
.banner i { margin-top: 2px; }
.banner-warn { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.35); color: #92611a; }
.banner-info { background: rgba(99, 102, 241, 0.09); border: 1px solid rgba(99, 102, 241, 0.3); color: var(--primary-hover); }
.banner-ok { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: #0a7a57; }
.disclaimer { margin-top: 16px; font-size: 0.82rem; color: var(--text-3); display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }
.disclaimer i { margin-top: 2px; }
.error-text { color: var(--danger); font-size: 0.9rem; margin: 10px 0; }

/* Spinner */
.spinner { width: 42px; height: 42px; margin: 10px auto 16px; border: 4px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-icon { text-align: center; font-size: 2.4rem; color: var(--danger); margin-bottom: 8px; }

/* ---- Verify: editable receipt table ---- */
.edit-item { display: grid; grid-template-columns: 1fr 56px 92px 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.edit-item .num-input, .edit-item .text-input { padding: 0.55rem 0.6rem; font-size: 0.92rem; }
.edit-item .colhead { font-size: 0.72rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.icon-btn { width: 36px; height: 36px; border: none; border-radius: var(--radius-sm); background: var(--gray-100); color: var(--text-3); cursor: pointer; transition: all var(--transition); }
.icon-btn:hover { background: #fee2e2; color: var(--danger); }
.fees-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.fees-grid label { font-size: 0.85rem; color: var(--text-2); font-weight: 600; }
.totals-line { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--gray-200); font-size: 0.95rem; }
.totals-line.grand { font-weight: 800; font-size: 1.1rem; border-top: 2px solid var(--gray-300); margin-top: 4px; padding-top: 10px; }
.receipt-photo { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--gray-200); margin-bottom: 12px; }

/* ---- People editor ---- */
.person-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.person-row .text-input { flex: 1; }
.person-row .host-tag { font-size: 0.7rem; font-weight: 700; color: var(--primary); background: rgba(99,102,241,.1); padding: 3px 8px; border-radius: 50px; }

/* ---- Identify (who are you) ---- */
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 8px 0 4px; }
.name-pick { padding: 14px 12px; border: 2px solid var(--gray-200); border-radius: var(--radius-md); background: var(--surface); font-weight: 600; cursor: pointer; transition: all var(--transition); font-family: inherit; font-size: 0.95rem; color: var(--text); text-align: center; }
.name-pick:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.name-pick.taken { opacity: 0.5; cursor: not-allowed; }
.name-pick:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: none; }
.name-pick.loading { opacity: 1; border-color: var(--primary); color: var(--primary); }
.name-pick.taken:hover { transform: none; box-shadow: none; border-color: var(--gray-200); }
.name-pick .who { display: block; font-size: 0.7rem; color: var(--text-3); font-weight: 500; margin-top: 3px; }

/* ---- Item claim list ---- */
.item-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--divider); }
.item-row:last-child { border-bottom: none; }
.item-main { flex: 1; min-width: 0; }
.item-label { font-weight: 600; }
.item-sub { font-size: 0.82rem; color: var(--text-2); }
.item-claimants { font-size: 0.78rem; color: var(--text-3); margin-top: 3px; }
.chip { display: inline-block; background: var(--gray-100); border-radius: 50px; padding: 2px 8px; margin: 2px 4px 0 0; font-size: 0.74rem; color: var(--text-2); }
.chip.me { background: rgba(99,102,241,.12); color: var(--primary-hover); font-weight: 600; }
.item-control { flex: 0 0 auto; }
.claim-check { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--gray-300); background: var(--surface); cursor: pointer; color: var(--white); transition: all var(--transition); }
.claim-check.on { background: var(--accent); border-color: var(--accent); }
/* Multi-quantity: one tappable slot per physical unit */
.unit-slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.unit-slot { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 10px; border: 2px solid var(--gray-200); background: var(--surface); cursor: pointer; font-size: 0.8rem; color: var(--text-2); font-family: inherit; transition: all var(--transition); }
.unit-slot .slot-n { font-weight: 700; color: var(--text-3); font-size: 0.72rem; }
.unit-slot .slot-price { font-weight: 700; color: var(--text); }
.unit-slot.empty { border-style: dashed; color: var(--text-3); }
.unit-slot.empty:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.unit-slot.taken { background: var(--gray-100); }
.unit-slot.mine { border-color: var(--accent); background: rgba(16,185,129,.10); color: var(--accent-hover); }
.unit-slot.mine .slot-price { color: var(--accent-hover); }
.unit-slot.shared .slot-n::after { content: " ⤬"; }
.unit-slot:disabled { cursor: default; opacity: 0.7; }
/* Multi-quantity counter (mirrors the single-item check on the right) */
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 32px; height: 32px; border-radius: 9px; border: 2px solid var(--gray-200); background: var(--surface); cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--primary); transition: all var(--transition); }
.stepper button:hover:not(:disabled) { border-color: var(--primary); }
.stepper button:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper .count { min-width: 26px; text-align: center; font-weight: 700; }

/* ---- Fee toggles ---- */
.fee-toggle { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.fee-toggle:last-child { border-bottom: none; }
.fee-left { display: flex; align-items: center; gap: 10px; }
.switch { position: relative; width: 44px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--gray-300); border-radius: 50px; transition: var(--transition); cursor: pointer; }
.slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: var(--white); border-radius: 50%; transition: var(--transition); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.fee-amount { font-weight: 700; font-size: 0.92rem; }
.fee-amount.off { color: var(--text-3); text-decoration: line-through; font-weight: 500; }

/* ---- Cover (pay for others) ---- */
.cover-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--gray-100); }
.cover-row:last-child { border-bottom: none; }

/* ---- Totals bar (sticky) ---- */
.totalbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface-trans); backdrop-filter: blur(10px);
  border-top: 1px solid var(--gray-200); box-shadow: 0 -8px 24px rgba(0,0,0,0.06);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.totalbar .tb-label { font-size: 0.8rem; color: var(--text-2); }
.totalbar .tb-amount { font-size: 1.5rem; font-weight: 800; color: var(--accent-hover); line-height: 1.1; }
.totalbar .tb-amount.flash { animation: flashPulse 1.1s ease; }
@keyframes flashPulse { 0% { color: var(--primary); transform: scale(1.06); } 100% { color: var(--accent-hover); transform: scale(1); } }
.delta-note { font-size: 0.75rem; color: var(--primary-hover); margin-top: 2px; }
.tb-inner { max-width: 680px; margin: 0 auto; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tb-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
#tb-done { padding: 11px 20px; white-space: nowrap; }

/* ---- Install footer (home page) ---- */
.install-footer { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: 14px 16px; margin-top: 18px; box-shadow: var(--shadow-sm); }
.install-footer .if-icon { width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto; }
.install-footer .if-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.install-footer .if-text strong { font-size: 0.92rem; }
.install-footer .if-text span { font-size: 0.78rem; color: var(--text-2); line-height: 1.45; }
.install-footer .btn { white-space: nowrap; }

/* ---- Dashboard ---- */
.dash-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.dash-row:last-child { border-bottom: none; }
.dash-name { font-weight: 600; }
.dash-owe { font-weight: 700; }
.pill { font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 50px; }
.pill.not_started { background: var(--gray-100); color: var(--text-3); }
.pill.in_progress { background: rgba(245,158,11,.14); color: #92611a; }
.pill.done { background: rgba(16,185,129,.14); color: #0a7a57; }
.pill.host { background: rgba(99,102,241,.12); color: var(--primary-hover); }

/* ---- Summary ---- */
.summary-person { border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 10px; }
.summary-person .sp-head { display: flex; justify-content: space-between; font-weight: 700; }
.summary-person .sp-line { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-2); padding: 2px 0; }
.split-tag { font-size: 0.64rem; font-weight: 700; color: var(--secondary); background: rgba(139, 92, 246, 0.12); padding: 1px 6px; border-radius: 50px; vertical-align: middle; text-transform: uppercase; letter-spacing: .02em; }
.summary-person .sp-head .pill { margin-left: 6px; }
.sp-line.covered-by { color: var(--accent); font-weight: 600; }
.sp-line .full-orig { color: var(--text-3); font-weight: 400; margin-right: 6px; }
/* keep the amount column right-aligned on one line; let the label wrap instead */
.summary-person .sp-line { align-items: flex-start; gap: 10px; }
.summary-person .sp-line > span:first-child { flex: 1; min-width: 0; }
.summary-person .sp-line > span:last-child { flex: 0 0 auto; white-space: nowrap; text-align: right; }
pre.copybox { white-space: pre-wrap; word-break: break-word; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); padding: 12px; font-size: 0.82rem; font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--text-2); max-height: 240px; overflow: auto; }

/* QR + link */
.qr-wrap { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0; }
.qr-wrap canvas, .qr-wrap img { border-radius: var(--radius-sm); }
.qr-wrap .qr-svg { width: 190px; height: 190px; border-radius: var(--radius-sm); border: 1px solid var(--gray-200); }
.qr-expand { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--gray-200); background: var(--surface); color: var(--primary); cursor: pointer; box-shadow: var(--shadow-sm); font-size: 0.95rem; transition: all var(--transition); flex: 0 0 auto; }
.qr-expand:hover { border-color: var(--primary); }

/* Fullscreen QR — a white sheet in BOTH themes so it scans reliably */
.qr-full { position: fixed; inset: 0; z-index: 90; background: #ffffff; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeInUp 0.2s ease; }
.qr-full .qr-full-box { display: flex; align-items: center; justify-content: center; }
.qr-full .qr-svg { width: min(86vw, 68vh, 460px); height: min(86vw, 68vh, 460px); border: none; }
.qr-full-close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #e2e8f0; background: #f8fafc; color: #1e293b; font-size: 1.15rem; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.link-row { display: flex; gap: 8px; margin-top: 8px; }
.link-row input { flex: 1; padding: 0.6rem 0.8rem; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); font-family: inherit; font-size: 0.85rem; background: var(--surface); color: var(--text-2); }

/* Language toggle */
.lang-toggle { position: fixed; top: 10px; right: 12px; z-index: 70; }
.lang-btn { font-family: inherit; font-size: 0.78rem; font-weight: 700; letter-spacing: .04em; color: var(--text-2); background: var(--surface-trans); border: 1px solid var(--gray-200); border-radius: 50px; padding: 6px 12px; cursor: pointer; box-shadow: var(--shadow-sm); }
.lang-btn::before { content: "🌐 "; }
.lang-menu { position: absolute; top: 112%; right: 0; background: var(--surface); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); overflow: hidden; min-width: 140px; }
.lang-menu button { display: block; width: 100%; text-align: left; padding: 10px 14px; border: none; background: none; font-family: inherit; font-size: 0.9rem; color: var(--text); cursor: pointer; }
.lang-menu button:hover { background: var(--gray-50); }

/* Install help overlay */
.install-help { position: fixed; inset: 0; z-index: 80; background: rgba(15,23,42,0.5); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeInUp 0.25s ease; }
.install-card { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; max-width: 380px; box-shadow: var(--shadow-xl); }
.install-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.install-card p { font-size: 0.9rem; color: var(--text-2); margin-bottom: 10px; }
.install-card .btn { margin-top: 6px; }

/* Connection / reconnect banner */
.conn-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  background: var(--warn); color: #3d2a05; text-align: center;
  padding: 8px 14px; font-size: 0.85rem; font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.conn-banner.offline { background: var(--danger); color: #fff; }

/* Split-among-everyone (host) + locked item */
.lock-tag { font-size: 0.66rem; font-weight: 700; color: var(--accent-hover); background: rgba(16,185,129,.12); padding: 1px 7px; border-radius: 50px; vertical-align: middle; }
.split-all-btn {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  padding: 5px 10px; border-radius: 50px; border: 1px solid var(--gray-300);
  background: var(--surface); color: var(--text-2); transition: all var(--transition);
}
.split-all-btn:hover { border-color: var(--primary); color: var(--primary); }
.split-all-btn.on { background: rgba(16,185,129,.12); border-color: var(--accent); color: var(--accent-hover); }

/* Session top row: change-name left, share toggle right */
.session-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; min-height: 38px; }
.share-fab { width: 38px; height: 38px; margin-left: auto; border-radius: 50%; border: 1px solid var(--gray-200); background: var(--surface); color: var(--primary); cursor: pointer; box-shadow: var(--shadow-sm); font-size: 0.95rem; transition: all var(--transition); flex: 0 0 auto; }
.share-fab:hover { border-color: var(--primary); }
.share-fab.on { background: var(--gradient); color: var(--white); border-color: transparent; }

/* "closes ~Xm" — plain centered text under the last card, not part of the bar */
.closes-note { text-align: center; font-size: 0.8rem; color: var(--text-3); margin: 2px 0 0; }

/* Theme toggle (top-left, mirrors the language toggle) */
.theme-toggle { position: fixed; top: 10px; left: 12px; z-index: 70; }
.theme-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--gray-200); background: var(--surface-trans); color: var(--text-2); cursor: pointer; box-shadow: var(--shadow-sm); font-size: 0.9rem; transition: all var(--transition); }
.theme-btn:hover { color: var(--primary); border-color: var(--primary); }

/* ---- Dark mode ------------------------------------------------------------
   Variable flips first (surfaces, grays, text, divider, page bg), then the few
   hardcoded accent TEXT colors that are too dark to read on dark surfaces. */
html[data-theme="dark"] {
  --text: #e8ebf4;
  --text-2: #a9b2c8;
  --text-3: #78829d;
  --gray-50: #1a2030;
  --gray-100: #232a3c;
  --gray-200: #333d55;
  --gray-300: #475473;
  --surface: #1d2434;
  --surface-trans: rgba(23, 29, 43, 0.94);
  --divider: rgba(255, 255, 255, 0.22);
  --page-bg-1: #0e1119;
  --page-bg-2: #151b2c;
}
html[data-theme="dark"] .card { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
html[data-theme="dark"] .totalbar { box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4); }
html[data-theme="dark"] .btn-danger:hover { background: rgba(239, 68, 68, 0.15); }
html[data-theme="dark"] .icon-btn:hover { background: rgba(239, 68, 68, 0.2); color: #f87171; }
html[data-theme="dark"] .btn-ghost:hover { background: rgba(99, 102, 241, 0.12); }
html[data-theme="dark"] .banner-warn { color: #f3c26b; }
html[data-theme="dark"] .banner-ok { color: #4ade9d; }
html[data-theme="dark"] .banner-info { color: #b6bdf7; }
html[data-theme="dark"] .pill.in_progress { color: #f3c26b; }
html[data-theme="dark"] .pill.done { color: #4ade9d; }
html[data-theme="dark"] .pill.host { color: #b6bdf7; }
html[data-theme="dark"] .chip.me { color: #b6bdf7; }
html[data-theme="dark"] .delta-note { color: #b6bdf7; }
html[data-theme="dark"] .totalbar .tb-amount { color: #34d399; }
html[data-theme="dark"] .lock-tag, html[data-theme="dark"] .split-all-btn.on { color: #34d399; }
html[data-theme="dark"] .unit-slot.mine, html[data-theme="dark"] .unit-slot.mine .slot-price { color: #34d399; }
html[data-theme="dark"] .sp-line.covered-by { color: #34d399; }
html[data-theme="dark"] .split-tag { color: #c4b5fd; }
html[data-theme="dark"] .person-row .host-tag { color: #b6bdf7; }

@media (max-width: 520px) {
  .card { padding: 18px; }
  .app-header h1 { font-size: 1.55rem; }
  .fees-grid { grid-template-columns: 1fr; }
  .edit-item { grid-template-columns: 1fr 48px 80px 32px; }
}
