/* ═══════════════════════════════════════════════════════
   Dividr – design system  (complete)
   ═══════════════════════════════════════════════════════ */

/* ── Tokens: Dark ── */
:root, [data-theme="dark"] {
  --bg:        #0f1117;
  --bg2:       #161922;
  --surf:      #1c2030;
  --surf2:     #232840;
  --surf3:     #2c3250;
  --bord:      #2e3450;
  --bord2:     #3d4568;
  --text:      #f0f2ff;
  --text1:     #f0f2ff;
  --text2:     #9ba3c7;
  --text3:     #5a6285;
  --accent:    #22c55e;
  --accent2:   #16a34a;
  --accentBg:  rgba(34,197,94,.12);
  --accentBord:rgba(34,197,94,.3);
  --danger:    #ef4444;
  --dangerBg:  rgba(239,68,68,.12);
  --dangerBord:rgba(239,68,68,.3);
  --warn:      #f59e0b;
  --warnBg:    rgba(245,158,11,.12);
  --warnBord:  rgba(245,158,11,.3);
  --info:      #3b82f6;
  --shadow:    0 4px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.7);
  --rad:       14px;
  --rad-sm:    8px;
  --rad-xs:    6px;
}

/* ── Tokens: Light ── */
[data-theme="light"] {
  --bg:        #f4f6fb;
  --bg2:       #eef0f7;
  --surf:      #ffffff;
  --surf2:     #f8f9fc;
  --surf3:     #eef0f7;
  --bord:      #e2e5f0;
  --bord2:     #d0d4e8;
  --text:      #111827;
  --text1:     #111827;
  --text2:     #4b5680;
  --text3:     #9ba3bf;
  --accent:    #16a34a;
  --accent2:   #15803d;
  --accentBg:  rgba(22,163,74,.1);
  --accentBord:rgba(22,163,74,.3);
  --danger:    #dc2626;
  --dangerBg:  rgba(220,38,38,.08);
  --dangerBord:rgba(220,38,38,.25);
  --warn:      #d97706;
  --warnBg:    rgba(217,119,6,.1);
  --warnBord:  rgba(217,119,6,.3);
  --info:      #2563eb;
  --shadow:    0 2px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Sora', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Splash ── */
.splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  gap: 32px;
}
.splash-logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 800; color: #fff;
  box-shadow: 0 0 0 6px var(--accentBg);
}
.logo-text { font-size: 2rem; font-weight: 800; letter-spacing: -.5px; }
.splash-spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--bord2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout shell ── */
#app { display: flex; flex-direction: column; min-height: 100dvh; }

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--surf);
  border-bottom: 1px solid var(--bord);
  padding: 0 16px;
  height: 56px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow);
}
.topbar-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; }
.topbar-icon {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; color: #fff;
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ── Auth button ── */
.auth-btn-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--rad-sm);
  background: var(--surf2);
  border: 1.5px solid var(--bord2);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  position: relative;
  overflow: hidden;
}
.auth-btn-wrap:hover { background: var(--surf3); border-color: var(--accent); }
.auth-btn-wrap .fa-user { font-size: .95rem; color: var(--text2); }
.auth-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  background: var(--accent);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .5px;
  font-family: inherit;
}

/* ── Bottom nav ── */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--surf);
  border-top: 1px solid var(--bord);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  max-width: 600px;
  left: 50%; transform: translateX(-50%);
  width: 100%;
}
.bnav-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  background: none; border: none;
  color: var(--text3);
  font-size: .67rem; font-weight: 600;
  transition: color .15s;
}
.bnav-btn .bni { font-size: 1.1rem; line-height: 1; }
.bnav-btn.on { color: var(--accent); }
.bnav-btn.on .bni { color: var(--accent); }

/* ── Main content ── */
.main-content {
  flex: 1;
  padding: 16px 14px 90px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* ── View switching ── */
.view { display: none; }
.view.on { display: block; }

/* ── Cards ── */
.card {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--rad);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.card-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 14px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: var(--rad-sm);
  font-family: 'Sora', sans-serif; font-size: .88rem; font-weight: 700;
  padding: 11px 18px;
  transition: opacity .15s, transform .1s;
  white-space: nowrap; cursor: pointer;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-secondary { background: var(--surf2); color: var(--text); border: 1px solid var(--bord2); }
.btn-secondary:hover { background: var(--surf3); }
.btn-danger    { background: var(--dangerBg); color: var(--danger); border: 1px solid var(--dangerBord); }
.btn-ghost     { background: none; color: var(--text2); }
.btn-ghost:hover { color: var(--text); }
.btn-icon      { width: 36px; height: 36px; padding: 0; border-radius: var(--rad-sm); font-size: 1rem; }
.btn-full      { width: 100%; }
.btn-sm        { font-size: .78rem; padding: 7px 13px; }
.btn-lg        { font-size: 1rem; padding: 14px 22px; }

/* ── Form elements ── */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-size: .78rem; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.label-hint { font-weight: 400; color: var(--text3); font-size: .75em; margin-left: 4px; }
.input {
  width: 100%;
  background: var(--surf2); border: 1.5px solid var(--bord2);
  border-radius: var(--rad-sm); color: var(--text);
  font-family: 'Sora', sans-serif; font-size: .9rem; font-weight: 500;
  padding: 11px 13px; outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text3); font-weight: 400; }
.input-row { display: flex; gap: 8px; }
.input-row .field { flex: 1; }

/* ── Utilities ── */
.hidden { display: none !important; }
.mono { font-family: 'JetBrains Mono', monospace; }

/* ── Section header ── */
.sec-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 0 8px;
}
.sec-hdr-title {
  font-size: .7rem; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text3);
  white-space: nowrap;
}
.sec-hdr-line { flex: 1; height: 1px; background: var(--bord); }
.sec-hdr-count {
  font-size: .65rem; font-family: 'JetBrains Mono', monospace;
  color: var(--text3); background: var(--surf2);
  border-radius: 99px; padding: 2px 8px;
}

/* ── Person avatar ── */
.p-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -.5px;
  font-size: .65rem;
}
.p-avatar--xs { width: 22px; height: 22px; font-size: .58rem; }
.p-avatar--sm { width: 28px; height: 28px; font-size: .65rem; }
.p-avatar--md { width: 36px; height: 36px; font-size: .78rem; }
.p-avatar--lg { width: 48px; height: 48px; font-size: .9rem; }
.p-avatar--xl { width: 64px; height: 64px; font-size: 1.2rem; }

/* ── Person chips ── */
.person-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.pchip {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 99px; padding: 5px 12px 5px 5px;
  font-size: .78rem; font-weight: 700; cursor: pointer;
  border: 2px solid transparent; transition: all .15s;
  user-select: none;
}
.pchip.active { box-shadow: 0 0 0 3px rgba(255,255,255,.12); }

/* ── Item cards ── */
.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-card {
  background: var(--surf);
  border: 1.5px solid var(--bord);
  border-left: 4px solid var(--bord2);
  border-radius: var(--rad);
  overflow: hidden;
  transition: border-color .2s;
}
.item-card.done    { border-color: var(--accentBord); border-left-color: var(--accent); }
.item-card.partial { border-color: var(--warnBord);   border-left-color: var(--warn); }

/* Item header strip */
.item-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--bord);
  background: var(--surf2);
}
.item-header-left {
  display: flex; align-items: center; gap: 7px;
  flex: 1; min-width: 0;
}
.item-header-right {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.item-qty-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surf3); border-radius: 5px;
  padding: 2px 7px; font-size: .65rem; font-weight: 700;
  color: var(--text3); font-family: 'JetBrains Mono', monospace; flex-shrink: 0;
  min-width: 28px;
}
.item-done .item-qty-badge   { background: var(--accentBg); color: var(--accent); }
.item-partial .item-qty-badge { background: var(--warnBg); color: var(--warn); }
.item-name {
  font-weight: 700; font-size: .9rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-status {
  display: inline-flex; align-items: center; border-radius: 5px;
  padding: 2px 7px; font-size: .64rem; font-weight: 700;
  font-family: 'JetBrains Mono', monospace; flex-shrink: 0;
}
.item-status.open { background: var(--warnBg); border: 1px solid var(--warnBord); color: var(--warn); }
.item-status.done { background: var(--accentBg); border: 1px solid var(--accentBord); color: var(--accent); }
.item-price { font-family: 'JetBrains Mono', monospace; text-align: right; flex-shrink: 0; }
.item-price .per  { font-size: .63rem; color: var(--text3); display: block; }
.item-price .line { font-size: .86rem; font-weight: 600; display: block; }

/* claim bar */
.claim-bar { height: 3px; display: flex; }
.claim-seg { height: 100%; transition: flex .25s; }
.claim-seg-empty { background: var(--surf3); }

/* claim chips (who claimed what) */
.claim-chips {
  padding: 8px 14px 4px;
  display: flex; flex-wrap: wrap; gap: 5px;
}

/* claim controls */
.claim-controls { padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.cc-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 8px; transition: background .1s;
}
.cc-row.active { background: rgba(255,255,255,.04); }
.cc-name { flex: 1; font-size: .79rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-stepper {
  display: flex; align-items: center;
  background: var(--surf2); border: 1.5px solid var(--bord2); border-radius: 9px; overflow: hidden;
}
.cc-btn {
  width: 32px; height: 30px; background: none; border: none;
  color: var(--text); font-size: 1.15rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; transition: background .1s;
}
.cc-btn:active { background: var(--surf3); }
.cc-btn:disabled { color: var(--text3); cursor: default; }
.cc-count {
  width: 26px; text-align: center;
  font-family: 'JetBrains Mono', monospace; font-size: .85rem;
}
.cc-amount {
  font-family: 'JetBrains Mono', monospace; font-size: .76rem;
  color: var(--text3); width: 54px; text-align: right; flex-shrink: 0;
}
.cc-amount.has { color: var(--text); font-weight: 600; }
.split-btn {
  font-size: .62rem; font-weight: 700;
  background: var(--surf3); border: 1px solid var(--bord2);
  border-radius: var(--rad-xs); padding: 3px 8px; color: var(--text2);
  transition: all .1s; white-space: nowrap; flex-shrink: 0;
}
.split-btn:hover { border-color: var(--info); color: var(--info); }

/* ── Join modal person cards ── */
.join-section-label {
  font-size: .7rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text3);
  margin-bottom: 8px;
}
.join-persons { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.join-person-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--surf2);
  border: 1.5px solid var(--bord2);
  border-radius: var(--rad-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.join-person-card:hover {
  border-color: var(--accent);
  background: var(--accentBg);
}
.join-person-card:active { transform: scale(.98); }
.join-person-name {
  flex: 1;
  font-weight: 700;
  font-size: .9rem;
}
.join-person-arrow {
  color: var(--text3);
  font-size: .8rem;
}
.join-new-toggle {
  margin-top: 4px;
}
.join-new-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--bord);
}

/* ── Per-person overzicht ── */
.pv-card {
  background: var(--surf); border: 1.5px solid var(--bord);
  border-radius: var(--rad); overflow: hidden; margin-bottom: 10px;
}
.pv-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px; border-bottom: 1px solid var(--bord);
}
.pv-name { flex: 1; font-size: .95rem; font-weight: 800; }
.pv-total { font-family: 'JetBrains Mono', monospace; font-size: .98rem; font-weight: 600; }
.pv-items { padding: 4px 0; }
.pv-item-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 15px; border-bottom: 1px solid var(--bord);
  font-size: .83rem;
}
.pv-item-row:last-child { border-bottom: none; }
.pv-item-qty { font-family: 'JetBrains Mono', monospace; font-size: .72rem; color: var(--text3); width: 26px; text-align: right; flex-shrink: 0; }
.pv-item-name { flex: 1; font-weight: 600; }
.pv-item-price { font-family: 'JetBrains Mono', monospace; font-size: .82rem; }
.pv-empty { padding: 14px 15px; color: var(--text3); font-size: .83rem; font-style: italic; }
.pv-no-one { text-align: center; padding: 48px 20px; color: var(--text3); }
.pv-no-one .ni { font-size: 3rem; margin-bottom: 10px; }

/* Overzicht action buttons */
.pv-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--bord);
  flex-wrap: wrap;
}
.pv-wa-btn,
.pv-copy-btn,
.pv-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--rad-sm);
  font-size: .78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.pv-wa-btn {
  background: #25D366; color: #fff; flex: 1; justify-content: center;
}
.pv-wa-btn:hover { background: #1ebe5d; }
.pv-copy-btn {
  background: var(--surf2); color: var(--text2); border-color: var(--bord); flex: 1; justify-content: center;
}
.pv-copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.pv-share-btn {
  background: var(--surf2); color: var(--text2); border-color: var(--bord); padding: 8px 12px;
}
.pv-share-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Footer bar ── */
.footer-bar {
  position: fixed; bottom: 57px; left: 0; right: 0; z-index: 50;
  background: var(--surf);
  border-top: 1px solid var(--bord);
  padding: 10px 16px 12px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  max-width: 600px;
  left: 50%; transform: translateX(-50%);
  width: 100%;
}
.footer-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.footer-label { font-size: .7rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text3); }
.footer-pill {
  display: flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace; font-size: .78rem;
  background: var(--surf2); border: 1px solid var(--bord2);
  border-radius: 99px; padding: 4px 10px; margin-left: auto;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); transition: background .4s; }
.status-dot.ok { background: var(--accent); box-shadow: 0 0 8px var(--accentBg); }
.prog-bar { height: 4px; background: var(--surf3); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.prog-fill { height: 100%; background: linear-gradient(90deg, var(--info), var(--accent)); border-radius: 99px; transition: width .4s ease; }
.footer-detail { display: none; margin-top: 10px; border-top: 1px solid var(--bord); padding-top: 8px; }
.footer-detail.on { display: block; }
.f-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px; border-bottom: 1px solid var(--bord); }
.f-row:last-child { border-bottom: none; }
.f-row-name { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: .83rem; }
.f-row-dot { width: 8px; height: 8px; border-radius: 50%; }
.f-row-amt { font-family: 'JetBrains Mono', monospace; font-size: .86rem; }
.f-row.unass .f-row-name, .f-row.unass .f-row-amt { color: var(--warn); }
.f-row.grand { padding-top: 7px; margin-top: 3px; border-top: 1px solid var(--bord2); }
.f-row.grand .f-row-name { color: var(--text2); }
.f-row.grand .f-row-amt { color: var(--accent); font-size: .92rem; }

/* ── Modals ── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.75); z-index: 500;
  align-items: flex-end; justify-content: center;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.overlay.on { display: flex; }
.modal {
  background: var(--surf); border: 1px solid var(--bord2);
  border-radius: var(--rad) var(--rad) 0 0;
  padding: 24px 18px calc(28px + env(safe-area-inset-bottom));
  width: 100%; max-width: 520px;
  animation: slideUp .22s ease;
  max-height: 92dvh;
  overflow-y: auto;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-title { font-size: 1.15rem; font-weight: 800; margin-bottom: 6px; }
.modal-sub { font-size: .84rem; color: var(--text2); margin-bottom: 18px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ── Home screen ── */
.home-hero { text-align: center; padding: 40px 20px 28px; }
.home-hero-icon {
  width: 72px; height: 72px; border-radius: 22px;
  background: var(--accent); color: #fff;
  font-size: 2.5rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  box-shadow: 0 0 0 10px var(--accentBg);
}
.home-hero h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.home-hero p  { color: var(--text2); font-size: .9rem; line-height: 1.6; }
.home-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.home-secondary { text-align: center; font-size: .83rem; color: var(--text3); margin-top: 14px; }
.home-secondary a { color: var(--accent); font-weight: 600; }

/* ── Share screen ── */
.qr-wrap { display: flex; justify-content: center; padding: 20px 0; }
.qr-wrap img { border-radius: var(--rad-sm); border: 4px solid var(--surf3); }
.session-url {
  display: flex; align-items: center; gap: 8px;
  background: var(--surf2); border: 1px solid var(--bord2);
  border-radius: var(--rad-sm); padding: 10px 13px;
  font-family: 'JetBrains Mono', monospace; font-size: .8rem;
  color: var(--text2); margin-bottom: 10px;
}
.session-url span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-btn {
  flex-shrink: 0; background: none; border: none;
  font-size: .75rem; font-weight: 700; color: var(--accent); font-family: 'Sora', sans-serif;
  padding: 3px 8px;
}
.share-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}
.share-action-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 14px 8px;
  background: var(--surf2); border: 1.5px solid var(--bord);
  border-radius: var(--rad); cursor: pointer; font-family: inherit;
  text-decoration: none; transition: background .15s, border-color .15s; color: var(--text2);
}
.share-action-btn:hover { background: var(--surf); border-color: var(--accent); color: var(--accent); }
.sab-icon { font-size: 1.2rem; line-height: 1; display: flex; align-items: center; justify-content: center; }
.sab-label { font-size: .75rem; font-weight: 700; letter-spacing: .3px; }
#shareTextArea { min-height: 220px; resize: vertical; line-height: 1.6; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 100px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--surf2); border: 1px solid var(--bord2);
  border-radius: 99px; padding: 10px 16px;
  font-size: .83rem; font-weight: 700; white-space: nowrap;
  box-shadow: var(--shadow-lg); z-index: 600;
  transition: opacity .25s, transform .25s; opacity: 0; pointer-events: none;
}
.toast.on { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }

/* ── Theme toggle ── */
.theme-btn {
  width: 36px; height: 36px; border-radius: var(--rad-sm);
  background: var(--surf2); border: 1px solid var(--bord2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer; transition: background .15s; color: var(--text2);
}
.theme-btn:hover { background: var(--surf3); }

/* ── Sync badge ── */
.sync-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: .6rem;
  color: var(--text3); padding: 3px 8px;
  background: var(--surf2); border-radius: 99px;
  border: 1px solid var(--bord);
}
.sync-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.sync-dot.busy { background: var(--warn); animation: blink .8s infinite; }
.sync-dot.err  { background: var(--danger); }
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:.2; } }

/* ── Empty states ── */
.empty { text-align: center; padding: 36px 20px; color: var(--text3); }
.empty .ei { font-size: 2.5rem; margin-bottom: 10px; }
.empty p { font-size: .88rem; line-height: 1.6; }

/* ── Auth forms ── */
.auth-wrap { max-width: 380px; margin: 40px auto; padding: 0 16px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-switch { text-align: center; font-size: .83rem; color: var(--text3); margin-top: 16px; }
.auth-switch a { color: var(--accent); font-weight: 700; }
.divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.divider hr { flex: 1; border: none; border-top: 1px solid var(--bord); }
.divider span { font-size: .75rem; color: var(--text3); white-space: nowrap; }

/* ── Account page ── */
.acc-header { text-align: center; padding: 20px 0 4px; }
.acc-back { display: block; text-align: left; margin-bottom: 16px !important; font-size: .8rem; color: var(--text3); }
.acc-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 1.4rem; font-weight: 700; letter-spacing: 1px; margin-bottom: 10px;
}
.acc-name  { font-size: 1.1rem; font-weight: 700; color: var(--text1); margin-bottom: 2px; }
.acc-email { font-size: .8rem; color: var(--text3); margin-bottom: 16px; }
.acc-tabs {
  display: flex; gap: 6px;
  padding: 4px 0 16px;
  border-bottom: 1.5px solid var(--bord);
  margin-bottom: 16px;
}
.acc-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 8px 4px;
  background: none; border: 1.5px solid transparent;
  border-radius: var(--rad-sm); cursor: pointer;
  color: var(--text3); font-family: inherit; font-size: .72rem; font-weight: 600;
  transition: color .15s, background .15s, border-color .15s;
}
.acc-tab:hover { background: var(--surf2); color: var(--text2); }
.acc-tab.active { background: var(--accentBg); border-color: var(--accentBord); color: var(--accent); }
.acc-tab-icon { font-size: 1rem; }
.acc-tab-label { letter-spacing: .3px; }
.acc-card { margin-bottom: 14px; }
.acc-loading { text-align: center; padding: 32px 16px; color: var(--text3); font-size: .85rem; }
.acc-error  { color: var(--danger); font-size: .85rem; padding: 12px 0; }
.acc-add-btn { margin-bottom: 14px; }

/* ── Session history ── */
.hist-card {
  background: var(--surf); border: 1.5px solid var(--bord);
  border-left: 4px solid var(--bord2);
  border-radius: var(--rad); padding: 14px 16px; margin-bottom: 10px;
  transition: border-color .15s, background .15s;
}
.hist-card.hist-active { cursor: pointer; border-left-color: var(--accent); }
.hist-card.hist-active:hover { border-color: var(--accentBord); background: var(--surf2); }
.hist-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hist-left { flex: 1; min-width: 0; }
.hist-title { font-size: .9rem; font-weight: 700; color: var(--text1); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-meta  { font-size: .76rem; color: var(--text3); }
.hist-sep   { margin: 0 5px; opacity: .4; }
.hist-right { text-align: right; flex-shrink: 0; }
.hist-total { font-family: 'JetBrains Mono', monospace; font-size: .95rem; font-weight: 700; color: var(--text1); margin-bottom: 4px; }
.hist-badge { display: inline-block; font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; letter-spacing: .3px; text-transform: uppercase; }
.hist-badge--active  { background: var(--accentBg); color: var(--accent); }
.hist-badge--expired { background: var(--surf2); color: var(--text3); }
.hist-cta { margin-top: 8px; font-size: .75rem; font-weight: 600; color: var(--accent); text-align: right; }

/* ── Contact cards ── */
.contact-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surf); border: 1.5px solid var(--bord);
  border-radius: var(--rad); padding: 12px 14px; margin-bottom: 8px;
  transition: border-color .15s;
}
.contact-card:hover { border-color: var(--bord2); }
.contact-avatar {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surf2); color: var(--text2); font-size: .8rem; font-weight: 700; letter-spacing: .5px;
}
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: .88rem; font-weight: 700; color: var(--text1); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-sub  { font-size: .74rem; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-sub.mono { font-family: 'JetBrains Mono', monospace; }
.contact-actions { display: flex; gap: 2px; flex-shrink: 0; }

/* ── OCR ── */
.ocr-view-header { display: flex; align-items: center; gap: 12px; padding: 14px 0 16px; border-bottom: 1px solid var(--bord); margin-bottom: 16px; position: sticky; top: 56px; background: var(--bg); z-index: 10; }
.ocr-scan-wrap { position: relative; width: 88px; height: 88px; border-radius: 18px; background: var(--accentBg); border: 2px solid var(--accentBord); overflow: hidden; flex-shrink: 0; }
.ocr-scan-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; }
.ocr-scan-line { position: absolute; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); box-shadow: 0 0 10px var(--accent); animation: scanMove 1.5s ease-in-out infinite; }
@keyframes scanMove { 0%{top:4%;opacity:0} 8%{opacity:1} 92%{opacity:1} 100%{top:96%;opacity:0} }
.ocr-dots { display: flex; gap: 8px; }
.ocr-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .3; animation: dotPulse 1.2s ease-in-out infinite; }
.ocr-dot:nth-child(2) { animation-delay: .2s; }
.ocr-dot:nth-child(3) { animation-delay: .4s; }
@keyframes dotPulse { 0%,100%{opacity:.3;transform:scale(1)} 50%{opacity:1;transform:scale(1.35)} }
.ocr-error { color: var(--danger); background: var(--dangerBg); border: 1px solid var(--dangerBord); border-radius: var(--rad-sm); padding: 12px 14px; font-size: .85rem; margin-top: 8px; }
.ocr-warn  { color: var(--warn);   background: var(--warnBg);   border: 1px solid var(--warnBord);   border-radius: var(--rad-sm); padding: 12px 14px; font-size: .85rem; margin-top: 8px; }

/* ── Responsive ── */
@media (min-width: 600px) {
  .main-content { padding: 24px 24px 100px; }
  .topbar { padding: 0 24px; }
}
