:root {
  --teal-dark: #0B3D9C;
  --teal: #1976D2;
  --teal-light: rgba(25,118,210,0.10);
  --teal-border: rgba(25,118,210,0.55);
  --bg: #F5F7FB;
  --card: #ffffff;
  --text: #1F2937;
  --text-soft: #6B7280;
  --text-mute: #9CA3AF;
  --line: #E5E7EB;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.06);
  --shadow-md: 0 6px 24px rgba(15,23,42,0.10);
  --radius: 14px;
  --radius-sm: 10px;

  /* Dark shell (mobile block) */
  --shell-bg: #06080d;
  --glass-bg: rgba(255,255,255,0.04);
  --glass-bg-strong: rgba(255,255,255,0.07);
  --glass-border: rgba(255,255,255,0.09);
  --on-dark: #e0e0e0;
  --on-dark-soft: rgba(255,255,255,0.55);
  --on-dark-mute: rgba(255,255,255,0.30);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--shell-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.6; }

/* ---------- Boot / loaders ---------- */
.boot-splash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--shell-bg);
  color: white;
}
.boot-logo-plate {
  background: #fff;
  padding: 18px 28px;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.boot-logo-img { display: block; width: 220px; height: auto; }
.boot-sub { opacity: 0.55; font-size: 13px; }
.spinner, .spinner.big, .spinner-sm {
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: rgba(255,255,255,0.95);
  animation: spin 0.8s linear infinite;
  width: 22px; height: 22px;
}
.spinner.big { width: 36px; height: 36px; border-width: 4px; }
.spinner-sm {
  width: 14px; height: 14px; border-width: 2px;
  border-color: rgba(0,0,0,0.15);
  border-top-color: rgba(0,0,0,0.55);
}
.btn-google .spinner-sm,
.btn-apple .spinner-sm { border-color: rgba(255,255,255,0.3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Chatdrop-style app shell ---------- */
.app-container {
  position: relative;
  min-height: 100vh;
  width: 100%;
  display: flex;
  /* background image is set on <body> via setRandomBackground() */
}
.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  min-height: 100vh;
}
.center-side {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The "phone screen" card in the center */
.extension-placeholder {
  width: 450px;
  height: 90vh;
  max-height: 90vh;
  background: rgba(255,255,255,0.96);
  border-radius: 24px;
  overflow: hidden;
  box-shadow:
    0 24px 60px rgba(0,0,0,0.35),
    0 0 0 1px rgba(255,255,255,0.4);
  display: flex;
  flex-direction: column;
  color: var(--text);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ---------- Back button (top-left, circular) ---------- */
.back-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: #1F2937;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 50;
  transition: transform 0.15s ease, background 0.15s ease;
}
.back-btn:hover { transform: translateX(-2px); background: #fff; }
.back-btn .material-icons { font-size: 22px; }

/* ---------- Sidebar (left edge, vertically centered, hover-expand) ---------- */
.right-side {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  z-index: 100;
  width: 0;
  background: transparent;
}
.page-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  padding: 10px;
  height: 56px;
  background: rgba(240,240,245,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: none;
  text-decoration: none;
  color: #333;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  border-radius: 0;
  position: relative;
  box-shadow: 2px 0 12px rgba(0,0,0,0.10);
  transition: gap 0.8s ease, padding-right 0.8s ease, background 0.15s ease, border-radius 0.8s ease, box-shadow 0.3s ease;
}
.page-btn + .page-btn { border-top: 1px solid rgba(0,0,0,0.08); }
.right-side > .page-btn:first-child { border-radius: 0 16px 0 0; box-shadow: 0 -4px 12px rgba(0,0,0,0.10); }
.right-side > .page-btn:last-child  { border-radius: 0 0 16px 0; box-shadow: 0 4px 12px rgba(0,0,0,0.10); }
.page-btn:active { background: rgba(200,210,230,0.97); }
.page-btn:hover {
  background: rgba(230,235,245,0.97);
  gap: 12px;
  padding-right: 20px;
  border-radius: 0 16px 16px 0;
  box-shadow: 4px 2px 20px rgba(0,0,0,0.15);
}
.right-side > .page-btn:first-child:hover,
.right-side > .page-btn:last-child:hover { border-radius: 0 16px 16px 0; }

.page-btn .material-icons {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(21,101,192,0.10);
  border-radius: 12px;
  color: #1565C0;
  flex-shrink: 0;
  transition: color 0.3s, background 0.3s;
}
.page-btn:hover .material-icons { color: #0D47A1; }

.btn-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 1.0s ease, opacity 0.8s ease;
}
.page-btn:hover .btn-label { max-width: 220px; opacity: 1; }

.page-btn.delete-btn { color: #c62828; }
.page-btn.delete-btn .material-icons {
  background: rgba(198,40,40,0.10);
  color: #c62828;
}
.page-btn.delete-btn:hover .material-icons { color: #b71c1c; }

/* ---------- Inner card content (kept from mobile-app-faithful view) ---------- */
.wc-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.wc-pane.wc-body {
  overflow-y: auto;
  padding: 14px 16px 22px;
  background: var(--bg);
}
.wc-pane.wc-center {
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
}
.wc-center-sub { color: var(--text-soft); font-size: 13px; }
.spinner.big.dark {
  border-color: rgba(11,61,156,0.15);
  border-top-color: var(--teal);
}

/* Mobile-app-style header */
.wc-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 8px;
  background: linear-gradient(135deg, var(--teal-dark), var(--teal));
  color: white;
  flex-shrink: 0;
  min-width: 0;
}
.wc-hdr-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.wc-hdr-user {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.95;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.wc-hdr-signout {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.wc-hdr-signout:hover { background: rgba(255,255,255,0.25); }
.wc-hdr-signout .material-icons { font-size: 20px; }

.chip-row-hdr {
  margin: 0 -14px;
  padding: 1px 14px 6px;
  scrollbar-color: rgba(255,255,255,0.65) rgba(255,255,255,0.18);
}
.chip-row-hdr::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.18);
  border-radius: 4px;
}
.chip-row-hdr::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.65); }
.chip-row-hdr::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.9); }
.chip-row-hdr .chip {
  padding: 4px 9px;
  font-size: 11.5px;
  gap: 5px;
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.92);
}
.chip-row-hdr .chip.selected {
  background: white;
  border-color: white;
  box-shadow: 0 0 0 1.5px var(--chip-accent, var(--teal)) inset;
}
.chip-row-hdr .chip .chip-check {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-width: 1.25px;
}
.chip-row-hdr .chip .chip-dot { width: 7px; height: 7px; }
.chip-row-hdr .chip .cat-icon { font-size: 12.5px; }
.chip-row-hdr .chip .chip-plate { font-size: 9.5px; padding: 1px 4px; }

/* ---------- Sign-in card (matches chatdrop appbar sign-in) ---------- */
.signin-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  padding: 20px;
  background: white;
  text-align: center;
}
.signin-logo {
  width: 160px;
  height: 160px;
  margin-bottom: 24px;
}
.signin-wordmark {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 40px;
  margin: 0 auto;
  height: 50px;
  width: auto;
  object-fit: contain;
}
.signin-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.signin-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}
.signin-qr a {
  display: block;
  padding: 8px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  line-height: 0;
}
.signin-qr img { display: block; }
.signin-qr-label {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(15,20,34,0.65);
  margin-top: 8px;
  letter-spacing: 0.2px;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 220px;
  padding: 12px 0;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  color: white;
  margin: 6px auto;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.btn:hover:not(:disabled) { filter: brightness(0.95); }
.btn:active:not(:disabled) { filter: brightness(0.9); }
.btn-google { background-color: #4285f4; }
.btn-apple  { background-color: #000; }

/* ---------- Mobile block (phone users) ---------- */
.mobile-block {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: var(--shell-bg);
  overflow: hidden;
}
.mobile-block::before {
  content: '';
  position: fixed;
  top: -30%; left: -20%;
  width: 80%; height: 80%;
  background: radial-gradient(circle, rgba(56,120,223,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.mb-card {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 30px 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--on-dark);
  box-shadow: 0 22px 60px rgba(0,0,0,0.5);
}
.mb-icon {
  width: 80px; height: 80px;
  border-radius: 20px;
  margin: 0 auto 14px;
  display: block;
  box-shadow: 0 10px 26px rgba(56,120,223,0.30), 0 2px 6px rgba(0,0,0,0.4);
}
.mb-title { font-size: 24px; font-weight: 800; color: #fff; letter-spacing: -0.3px; margin-bottom: 14px; }
.mb-headline { font-size: 16px; font-weight: 600; color: rgba(255,255,255,0.85); margin-bottom: 10px; }
.mb-text { color: var(--on-dark-soft); font-size: 13px; line-height: 1.6; margin-bottom: 18px; }
.mb-text.small { font-size: 12px; margin-bottom: 0; color: var(--on-dark-mute); }
.mb-cta {
  display: inline-block;
  background: rgba(56,120,223,0.18);
  border: 1px solid rgba(56,120,223,0.32);
  color: #6ba3f7;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 14px;
}
.mb-cta:hover { background: rgba(56,120,223,0.28); }
.mb-or { color: rgba(255,255,255,0.25); font-size: 11.5px; margin: 6px 0 12px; }
.mono { font-family: ui-monospace, Menlo, monospace; }

/* ---------- Sections / chips / receipts (inner card content) ---------- */
.section { margin-bottom: 18px; min-width: 0; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.3px;
}
.count {
  display: inline-block;
  background: var(--teal-light);
  color: var(--teal-dark);
  padding: 1px 7px;
  border-radius: 9px;
  font-size: 11px;
  margin-left: 6px;
}
.warmup-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-soft);
}
.warmup-track {
  width: 120px;
  height: 4px;
  background: var(--teal-light);
  border-radius: 999px;
  overflow: hidden;
}
.warmup-fill {
  height: 100%;
  background: var(--teal);
  transition: width 160ms linear;
}
.warmup-label {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.link-btn {
  background: none;
  border: none;
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px;
}
.link-btn:disabled { color: var(--text-mute); }

.chip-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  /* `scroll` (vs `auto`) reserves the gutter so the bar is always visible —
     no auto-hiding on macOS/iOS, no layout jump when content overflows. */
  overflow-x: scroll;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.35) rgba(0,0,0,0.08);
  margin: 0 -16px;
  padding: 2px 16px 6px;
}
.chip-row::-webkit-scrollbar {
  height: 8px;
  -webkit-appearance: none;
}
.chip-row::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.08);
  border-radius: 4px;
}
.chip-row::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.35);
  border-radius: 4px;
}
.chip-row::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.55); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #F3F4F6;
  color: var(--text-soft);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.chip.selected {
  background: color-mix(in srgb, var(--chip-accent, var(--teal)) 12%, white);
  color: var(--text);
  border-color: var(--chip-accent, var(--teal));
}
.chip .chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chip-accent, var(--teal)); }
.chip .cat-icon { font-size: 14px; line-height: 1; }
.chip .chip-check {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1.5px solid var(--text-mute);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: white;
  flex: 0 0 14px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chip.selected .chip-check {
  background: var(--chip-accent, var(--teal));
  border-color: var(--chip-accent, var(--teal));
}
.chip .chip-plate {
  font-size: 10.5px;
  color: var(--text-mute);
  background: rgba(0,0,0,0.05);
  padding: 1px 5px;
  border-radius: 5px;
}

.list-section { margin-top: 4px; }
.rcpt-list { display: flex; flex-direction: column; gap: 8px; }
.rcpt-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rcpt-card:hover { border-color: var(--teal-border); box-shadow: 0 2px 8px rgba(11,61,156,0.08); }
/* Alternating row colors: bright grey + bright blue. */
.rcpt-list .rcpt-card:nth-child(odd)  { background: #F1F5F9; border-color: #F1F5F9; }
.rcpt-list .rcpt-card:nth-child(even) { background: #7DD3FC; border-color: #7DD3FC; }
.rcpt-list .rcpt-card:nth-child(odd):hover,
.rcpt-list .rcpt-card:nth-child(even):hover { filter: brightness(0.96); border-color: var(--teal-border); }
.rcpt-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.rcpt-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-mute);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.rcpt-icon-btn:hover:not(:disabled) {
  background: rgba(11,61,156,0.06);
  color: var(--teal-dark);
  border-color: var(--teal-border);
}
.rcpt-icon-btn:disabled { opacity: 0.5; cursor: default; }
.rcpt-icon-btn .spinner-sm { width: 14px; height: 14px; }
.rcpt-avatar {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.rcpt-mid { flex: 1; min-width: 0; }
.rcpt-cat { font-size: 14px; font-weight: 600; color: var(--text); text-transform: capitalize; }
.rcpt-sub1 { font-size: 12px; color: var(--text-soft); margin-top: 1px; }
.rcpt-sub2 {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rcpt-amt { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; color: var(--teal-dark); }
.rcpt-total { font-weight: 700; font-size: 14px; }
.empty {
  text-align: center;
  color: var(--text-mute);
  padding: 28px 16px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  font-size: 13px;
}

/* ---------- Footer bar (range + totals + export) ---------- */
.wc-foot {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: white;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.range-picker { position: relative; }
.range-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #F3F4F6;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 11.5px;
  color: var(--text-soft);
  font-weight: 600;
}
.range-btn:hover { background: #E5E7EB; }
.range-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15,23,42,0.18);
  padding: 6px;
  min-width: 160px;
  z-index: 50;
}
.range-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}
.range-menu-item:hover { background: var(--teal-light); }
.range-menu-item.active {
  background: var(--teal-light);
  color: var(--teal-dark);
  font-weight: 600;
}

.totals-pill {
  justify-self: center;
  background: var(--teal-light);
  border: 1px solid rgba(11,61,156,0.25);
  border-radius: 20px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.totals-pill.empty { opacity: 0.6; }
.totals-pill-amt {
  font-size: 18px;
  font-weight: 800;
  color: var(--teal-dark);
  letter-spacing: -0.3px;
}
.totals-pill-sep { color: var(--teal-dark); opacity: 0.4; margin-right: 6px; font-weight: 400; }

.foot-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--teal-dark);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(11,61,156,0.30);
}
.foot-export-btn:hover { background: #093180; }
.foot-export-btn:active { transform: translateY(1px); }

/* ---------- Receipt detail / export dialog (legacy modal-backdrop) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9000;
  animation: fade 0.15s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card);
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.30);
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.modal-head-text { flex: 1; min-width: 0; }
.modal-title { font-weight: 600; font-size: 15px; }
.modal-sub { font-size: 12px; color: var(--text-soft); margin-top: 1px; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(0,0,0,0.05);
  font-size: 18px;
  color: var(--text-soft);
}
.modal-close:hover { background: rgba(0,0,0,0.10); }
.modal-x-corner {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.06);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.12s ease;
}
.modal-x-corner:hover { background: rgba(0,0,0,0.12); }
.modal { position: relative; }
.modal.receipt-modal,
.modal.export-modal { border-radius: 18px; }
.receipt-modal .modal-head { padding-right: 52px; }
.export-head { padding-right: 52px; }
.modal-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.modal-body { overflow-y: auto; padding: 16px; }
.privacy-frame {
  display: block;
  width: 100%;
  height: 70vh;
  border: none;
  border-radius: 12px;
  background: white;
}
.modal-amount { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.modal-total { font-size: 30px; font-weight: 700; color: var(--text); }
.modal-cur { font-size: 13px; color: var(--text-soft); letter-spacing: 0.6px; }
.modal-note {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.modal-note-label {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.modal-img-wrap {
  position: relative;
  min-height: 200px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.modal-img { max-width: 100%; max-height: 60vh; display: block; object-fit: contain; }
.modal-img-missing { padding: 32px 16px; color: var(--text-mute); font-size: 13px; }
.modal-img-pending { padding: 32px 16px; }
.modal-img-pending .spinner { border-color: rgba(0,0,0,0.1); border-top-color: var(--teal); }
.modal-img-pending.overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center;
}
.modal-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  font-size: 12px;
}
.modal-meta > div { display: flex; justify-content: space-between; gap: 12px; }
.modal-meta .k { color: var(--text-mute); }
.modal-meta .v { color: var(--text); text-align: right; }
.modal-meta .v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; }

.export-modal { max-width: 480px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.export-body { padding: 16px 18px; }
.export-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.export-section-label.inline { margin-bottom: 0; }
.export-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  margin-bottom: 6px;
}
.export-format-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.export-format-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: #F3F4F6;
  border: 1.5px solid transparent;
  border-radius: 12px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}
.export-format-pill .export-format-icon { font-size: 18px; line-height: 1; }
.export-format-pill:hover { background: #E5E7EB; }
.export-format-pill.active {
  background: var(--teal-light);
  border-color: var(--teal);
  color: var(--teal-dark);
}
.export-range-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.export-range-pill {
  padding: 7px 12px;
  background: #F3F4F6;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}
.export-range-pill:hover { background: #E5E7EB; }
.export-range-pill.active {
  background: var(--teal-light);
  border-color: var(--teal);
  color: var(--teal-dark);
}
.export-car-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
}
.export-car-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.export-car-row:hover { background: var(--teal-light); }
.export-car-row.checked { background: rgba(25,118,210,0.06); }
.export-car-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--teal-dark); }
.export-car-dot { width: 10px; height: 10px; border-radius: 50%; }
.export-car-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.export-car-plate {
  font-size: 11px;
  color: var(--text-mute);
  background: rgba(0,0,0,0.05);
  padding: 1px 6px;
  border-radius: 5px;
}

/* ---------- Sidebar modals (chatdrop-style overlay) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10000;
  animation: fade 0.15s ease-out;
}
.modal-content {
  background: rgba(250,250,252,0.97);
  border-radius: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  padding: 30px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,0.30);
  color: var(--text);
  overflow: hidden;
}
.modal-content.wide { max-width: 620px; }
.modal-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.modal-head-row h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: #0B1733;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.modal-head-row h2 .material-icons {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(21,101,192,0.10);
  color: #1565C0;
  font-size: 22px;
}
.modal-x {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.06);
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}
.modal-x:hover { background: rgba(0,0,0,0.10); color: var(--text); }
.modal-scroll {
  overflow-y: auto;
  padding-right: 4px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}
.modal-scroll p { margin: 0 0 12px; }
.modal-scroll h3 {
  font-size: 14px;
  font-weight: 700;
  color: #0B1733;
  margin: 16px 0 8px;
}
.modal-scroll ul, .modal-scroll ol { margin: 0 0 12px; padding-left: 22px; }
.modal-scroll li { margin-bottom: 6px; color: var(--text); }
.modal-scroll a { color: var(--teal); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Modal: Share */
.share-options { display: flex; flex-direction: column; gap: 8px; }
.share-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background 0.15s ease;
  width: 100%;
}
.share-opt:hover { background: #f5f5f5; }
.share-opt.copied { background: #e8f5e9; }
.share-opt-icon {
  width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.share-snack {
  margin-top: 12px;
  padding: 10px 12px;
  background: #E8F5E9;
  color: #2E7D32;
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
}

/* Modal: Get App */
.get-app-qr {
  display: flex;
  justify-content: center;
  margin: 8px 0 16px;
}
.get-app-qr img {
  padding: 10px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}
.get-app-row { display: flex; gap: 10px; justify-content: center; }
.store-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}
.store-pill svg { flex-shrink: 0; }
.store-pill.ios {
  background: #000;
  color: white;
}
.store-pill.ios:hover { background: #1a1a1a; }
.store-pill.android {
  background: rgba(61,160,75,0.10);
  border-color: rgba(61,160,75,0.32);
  color: #2e7d32;
}
.store-pill.android:hover { background: rgba(61,160,75,0.18); }

/* Modal: Support */
.support-email-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #F3F4F6;
  border-radius: 10px;
  margin-bottom: 12px;
}
.support-email-row .mono { flex: 1; font-size: 13px; color: var(--text); font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
.support-email-row .btn-primary { padding: 8px 14px; font-size: 13px; }
.support-email-row .btn-primary .material-icons { font-size: 18px; }
.support-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  padding: 14px 4px;
  font-size: 13px;
}

/* Modal: Accessibility */
.a11y-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.a11y-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  background: #F3F4F6;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}
.a11y-row.on { background: var(--teal-light); border-color: var(--teal); color: var(--teal-dark); }
.a11y-switch {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: rgba(0,0,0,0.15);
  position: relative;
  transition: background 0.15s ease;
}
.a11y-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  transition: left 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.a11y-row.on .a11y-switch { background: var(--teal); }
.a11y-row.on .a11y-switch::after { left: 18px; }

/* Modal: Delete Account */
.delete-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #F3F4F6;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 12.5px;
}
.delete-meta > div { display: flex; justify-content: space-between; gap: 12px; }
.delete-meta span:first-child { color: var(--text-mute); }
.delete-meta .mono { font-family: ui-monospace, Menlo, monospace; color: var(--text); }
.delete-err {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FCA5A5;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  margin-top: 8px;
}
.delete-hint {
  color: var(--text-soft);
  font-size: 13px;
  margin-top: 4px;
}
.delete-signin { gap: 10px; margin: 12px 0 6px; }

/* ---------- Buttons (shared with both modal systems) ---------- */
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-primary {
  background: var(--teal-dark);
  color: white;
  box-shadow: 0 4px 12px rgba(11,61,156,0.25);
}
.btn-primary:hover { background: #093180; }
.btn-primary:disabled { background: var(--text-mute); box-shadow: none; }
.btn-primary .spinner-sm { border-color: rgba(255,255,255,0.3); border-top-color: #fff; }
.btn-secondary {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}
.btn-secondary:hover { background: rgba(0,0,0,0.10); }
.btn-danger {
  background: #DC2626;
  color: white;
  box-shadow: 0 4px 12px rgba(220,38,38,0.25);
}
.btn-danger:hover { background: #B91C1C; }
.btn-danger:disabled { background: #FCA5A5; box-shadow: none; }
.btn-danger .spinner-sm { border-color: rgba(255,255,255,0.3); border-top-color: #fff; }
.btn-primary.block, .btn-secondary.block, .btn-danger.block {
  width: 100%;
  padding: 12px 16px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1F2937;
  color: white;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  z-index: 20000;
  cursor: pointer;
  max-width: 90vw;
}
.toast.error { background: #DC2626; }

/* ---------- Accessibility classes (set by AccessibilityModal) ---------- */
body.high-contrast { filter: contrast(1.2); }
body.large-text { font-size: 17px; }
body.large-text .signin-tag,
body.large-text .rcpt-cat,
body.large-text .section-title { font-size: 1.08em; }
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  transition-duration: 0.01ms !important;
}
body.dyslexia-font {
  font-family: 'Comic Sans MS', 'OpenDyslexic', sans-serif !important;
}
body.underline-links a { text-decoration: underline !important; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .right-side { gap: 6px; }
  .page-btn { height: 48px; }
  .page-btn .material-icons { width: 32px; height: 32px; font-size: 18px; }
}
@media (max-width: 720px) {
  .extension-placeholder { width: 100%; max-width: 100%; height: auto; min-height: 80vh; }
  .main-content { padding: 80px 16px 24px; }
  .back-btn { top: 14px; left: 14px; width: 40px; height: 40px; }
  .modal-content { padding: 22px; border-radius: 22px; }
}
