/* ── Variables — dark mode (default) ─────────────────────────────────────── */
:root {
  --bg:         #0a0f1e;
  --surface:    #111827;
  --surface2:   #1f2937;
  --surf3:      #2d3748;
  --border:     rgba(255,255,255,.07);
  --accent:     #f59e0b;
  --accent2:    #f97316;
  --accent-dim: rgba(245,158,11,.1);
  --green:      #10b981;
  --green-dim:  rgba(16,185,129,.13);
  --red:        #ef4444;
  --red-dim:    rgba(239,68,68,.1);
  --orange:     #f97316;
  --text:       #f9fafb;
  --text-dim:   #9ca3af;
  --dim:        #6b7280;
  --success:    #10b981;
  --error:      #ef4444;
  --warning:    #f59e0b;
  --radius:     16px;
  --radius-sm:  10px;
  --shadow:     0 4px 20px rgba(0,0,0,.45);
  --shadow-lg:  0 16px 48px rgba(0,0,0,.55);
  --header-h:   58px;
  --nav-h:      74px;
}

/* ── Light mode overrides ────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:         #f1f5f9;
  --surface:    #ffffff;
  --surface2:   #f8fafc;
  --surf3:      #e2e8f0;
  --border:     rgba(0,0,0,.09);
  --accent:     #d97706;
  --accent2:    #ea580c;
  --accent-dim: rgba(217,119,6,.1);
  --green:      #059669;
  --green-dim:  rgba(5,150,105,.1);
  --red:        #dc2626;
  --red-dim:    rgba(220,38,38,.08);
  --orange:     #ea580c;
  --text:       #0f172a;
  --text-dim:   #475569;
  --dim:        #94a3b8;
  --success:    #059669;
  --error:      #dc2626;
  --warning:    #d97706;
  --shadow:     0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
}

[data-theme="light"] #app-header {
  background: rgba(241,245,249,.95);
  border-bottom-color: rgba(0,0,0,.09);
}
[data-theme="light"] .bottom-nav {
  background: rgba(241,245,249,.97);
  border-top-color: rgba(0,0,0,.09);
}
[data-theme="light"] #user-menu {
  background: #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.06);
}
[data-theme="light"] #login-screen::before {
  background: radial-gradient(ellipse at 50% 20%, rgba(217,119,6,.07) 0%, transparent 65%);
}
[data-theme="light"] .login-logo { color: #0f172a; }
[data-theme="light"] .header-logo { color: #0f172a; }
/* balance-card uses amber gradient in both themes — no light override needed */
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="tel"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="email"],
[data-theme="light"] textarea {
  background: #f8fafc;
  border-color: rgba(0,0,0,.12);
}
[data-theme="light"] input:focus,
[data-theme="light"] textarea:focus {
  background: #fff;
  border-color: var(--accent);
}
[data-theme="light"] .history-item { box-shadow: 0 1px 3px rgba(0,0,0,.05); }
[data-theme="light"] .stat-card    { box-shadow: 0 1px 3px rgba(0,0,0,.04); }

/* Theme toggle button */
.theme-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  font-size: 1.1rem;
  line-height: 1;
  transition: background .15s;
  color: var(--text-dim);
}
.theme-btn:hover { background: var(--surface2); }

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

html { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── App shell ───────────────────────────────────────────────────────────── */
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 0.75rem) 0.875rem calc(var(--nav-h) + 0.5rem);
  min-height: 100svh;
}

/* ── Screen transitions ──────────────────────────────────────────────────── */
.screen { display: block; }
.screen.hidden { display: none !important; }
.screen:not(.hidden) { animation: fade-up .22s ease; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ── Connectivity banner ─────────────────────────────────────────────────── */
#offline-banner {
  display: none;
  background: var(--warning);
  color: #000;
  text-align: center;
  padding: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  z-index: 90;
}
body.offline #offline-banner { display: block; }

/* ── Offline queue badge ─────────────────────────────────────────────────── */
#queue-status {
  font-size: 0.78rem;
  color: var(--warning);
  padding: 0.4rem 0;
  display: none;
}
body.has-queued #queue-status { display: block; }

/* ── Fixed header ────────────────────────────────────────────────────────── */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0; z-index: 80;
  height: var(--header-h);
  background: rgba(10,15,30,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}
#app-header.hidden { display: none; }

.header-logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
}
.header-logo span { color: var(--accent); }

.header-right { display: flex; align-items: center; gap: 0.5rem; }

/* Avatar button */
.avatar-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  transition: opacity .2s;
}
.avatar-btn:hover { opacity: .85; }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: .02em;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  user-select: none;
}

/* ── User dropdown menu ──────────────────────────────────────────────────── */
#user-menu {
  position: fixed;
  top: calc(var(--header-h) + 6px);
  right: 0.75rem;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  overflow: hidden;
  animation: drop-in .18s ease;
}
@keyframes drop-in {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
#user-menu.hidden { display: none; }

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.user-menu-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: 0.85rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
#user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.role-badge {
  display: inline-block;
  font-size: 0.65rem;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
#logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: none;
  border: none;
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  text-align: left;
}
#logout-btn:hover { background: var(--red-dim); }
#logout-btn::before { content: '⎋'; font-size: 1rem; }
#install-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  text-align: left;
}
#install-btn:hover { background: rgba(245,158,11,.1); }
#install-btn.hidden { display: none; }

#menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: transparent;
}
#menu-overlay.hidden { display: none; }

/* ── Business switcher (multi-business employment) ────────────────────────── */
.biz-switcher {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 42vw;
  margin: 0 auto 0 0.75rem;
  padding: 0.3rem 0.6rem;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.biz-switcher:hover { background: rgba(245,158,11,.16); }
.biz-switcher.hidden { display: none; }
.biz-switcher-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.biz-switcher-caret { color: var(--accent); font-size: 0.7rem; flex-shrink: 0; }

#biz-menu {
  position: fixed;
  top: calc(var(--header-h) + 6px);
  left: 0.75rem;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  max-width: 88vw;
  overflow: hidden;
  animation: drop-in .18s ease;
}
#biz-menu.hidden { display: none; }
.biz-menu-title {
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.biz-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  text-align: left;
}
.biz-menu-item:last-child { border-bottom: none; }
.biz-menu-item:hover { background: var(--accent-dim); }
.biz-menu-add {
  width: 100%;
  padding: 0.8rem 1rem;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  transition: background .15s;
}
.biz-menu-add:hover { background: var(--accent-dim); }
.biz-menu-check {
  width: 1rem;
  flex-shrink: 0;
  color: var(--accent);
  font-weight: 800;
}
.biz-menu-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.biz-menu-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.biz-menu-role {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

/* ── Fixed bottom nav ────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 80;
  height: var(--nav-h);
  background: rgba(10,15,30,.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 4px 0.5rem calc(4px + env(safe-area-inset-bottom, 0));
  gap: 2px;
}
.bottom-nav.hidden { display: none; }
[data-theme="light"] .bottom-nav { background: rgba(241,245,249,.97); }

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px 5px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: rgba(255,255,255,.52);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: color .2s;
  position: relative;
}
[data-theme="light"] .nav-btn { color: rgba(15,23,42,.45); }

.nav-btn .nav-icon {
  font-size: 1.3rem;
  line-height: 1;
  width: 48px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: background .2s, transform .15s;
}
.nav-btn.active {
  color: var(--accent);
  font-weight: 700;
}
.nav-btn.active .nav-icon {
  background: rgba(245,158,11,.18);
  transform: translateY(-1px);
}
/* Small amber pip under the active label */
.nav-btn.active::after {
  content: '';
  display: block;
  width: 18px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--accent);
  margin-top: 2px;
  opacity: .75;
}
.nav-btn.active::before { display: none; }
.nav-btn:hover:not(.active) { color: rgba(255,255,255,.75); }
.nav-btn:hover:not(.active) .nav-icon { background: rgba(255,255,255,.04); }
[data-theme="light"] .nav-btn:hover:not(.active) { color: rgba(15,23,42,.7); }
[data-theme="light"] .nav-btn:hover:not(.active) .nav-icon { background: rgba(0,0,0,.04); }
[data-theme="light"] .nav-btn.active::after { background: var(--accent); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 5px;
  letter-spacing: .01em;
}

input[type="number"],
input[type="text"],
input[type="tel"],
input[type="password"],
input[type="email"],
textarea {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1rem;
  transition: border-color .2s, background .2s;
  appearance: none;
  font-family: inherit;
  resize: vertical;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(31,41,55,.8);
}

/* ── Password reveal toggle (show/hide what you type) ────────────────────────
   Lets a user confirm their password as they type it, so they don't lock
   themselves out with repeated typos. Applied to the login + register fields. */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 3rem; }          /* room for the eye button */
.pw-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--dim);
  transition: color .15s;
}
.pw-toggle:hover  { color: var(--text); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-sm); }
.pw-toggle .pw-ic-hide { display: none; }
.pw-wrap.revealed .pw-ic-show { display: none; }
.pw-wrap.revealed .pw-ic-hide { display: inline-block; }

/* ── Localized file input ───────────────────────────────────────────────────
   The native <input type="file"> button ("Choisir un fichier" / "Aucun fichier
   choisi") is rendered in the BROWSER's locale, so it shows French even when the
   app is set to English. Hide it and drive it with our own i18n button + filename. */
.file-input {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.file-field { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.file-trigger {
  display: inline-block;
  padding: .5rem .9rem;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: border-color .2s, background .2s;
}
.file-trigger:hover { border-color: var(--accent); }
.file-input:focus-visible + .file-trigger { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-name { font-size: .82rem; color: var(--dim); word-break: break-all; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 0.875rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  letter-spacing: .01em;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #000;
  box-shadow: 0 4px 14px rgba(245,158,11,.3);
}
.btn-primary:hover:not(:disabled) {
  background: #fbbf24;
  box-shadow: 0 6px 20px rgba(245,158,11,.4);
  transform: translateY(-1px);
}
.btn-ghost {
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surf3);
  color: var(--text);
}
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { width: auto; padding: 0.5rem 1rem; font-size: 0.85rem; }

/* ── Status badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-pending { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-paid    { background: rgba(16,185,129,.15);  color: var(--green);   }
.badge-expired { background: rgba(239,68,68,.12);   color: var(--red);     }
.badge-manual  { background: rgba(249,115,22,.15);  color: var(--orange);  }
.badge-cancelled { background: rgba(107,114,128,.15); color: var(--text-dim); }

/* ── Login screen ────────────────────────────────────────────────────────── */
#login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100svh - var(--header-h));
  padding: 2rem 0;
}
#login-screen::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at 50% 20%, rgba(245,158,11,.08) 0%, transparent 65%);
  pointer-events: none;
}
.login-hero {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -.05em;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.login-logo span { color: var(--accent); }
.login-tagline {
  font-size: 0.88rem;
  color: var(--text-dim);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}

/* ── Landing value proposition (below the login card) ─────────────────────── */
.login-benefits {
  width: 100%;
  max-width: 380px;
  margin: 0 auto 2rem;
}
.benefit-hero { text-align: center; margin-bottom: 1.5rem; }
.benefit-hero-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.benefit-hero-sub {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-dim);
}
.benefit-list { display: flex; flex-direction: column; gap: 0.75rem; }
.benefit-item {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.benefit-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent-dim);
}
.benefit-item-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.benefit-item-sub {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-dim);
}
.benefit-cta {
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  margin-top: 1.5rem;
}

/* ── New order screen ────────────────────────────────────────────────────── */
.screen-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}
.screen-subtitle {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

/* Item rows */
.item-row {
  display: grid;
  grid-template-columns: 1fr 52px 96px 32px;   /* name · qty · price · remove */
  gap: 6px;
  margin-bottom: 6px;
  align-items: center;
}
.item-row input {
  font-size: 0.88rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
}
.remove-item {
  width: 32px; height: 32px;
  border: none;
  background: var(--red-dim);
  color: var(--red);
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.remove-item:hover { background: rgba(239,68,68,.2); }
/* When an item on a running tab was added: a small caption under its row so a disputed
   "I only drank 4" can be settled by seeing WHEN each line landed. */
.item-time {
  grid-column: 1 / -1;
  margin: -2px 0 2px 2px;
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: .01em;
}

/* Merchant-facing tools-fee status on the wallet (covered / accruing heads-up / suspended). */
.toolsfee-card {
  border-radius: 12px;
  padding: .8rem 1rem;
  margin-top: .9rem;
  font-size: .82rem;
  line-height: 1.45;
}
.toolsfee-card .tf-title { font-weight: 700; margin-bottom: .25rem; }
.toolsfee-card .tf-body  { opacity: .92; }
.toolsfee-card.ok    { background: var(--surface-2); color: var(--text-dim); }
.toolsfee-card.warn  { background: rgba(245,158,11,.12); color: #f59e0b; border: 1px solid rgba(245,158,11,.3); }
.toolsfee-card.gated { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.toolsfee-card .tf-pay {
  margin-top: .6rem;
  padding: .5rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
}
.toolsfee-card .tf-pay:disabled { opacity: .6; cursor: default; }

/* Tools-fee soft gate: premium tools suspended until fees are settled. */
.gated-banner {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: 10px;
  padding: .7rem .9rem;
  margin-bottom: .9rem;
  font-size: .82rem;
  line-height: 1.45;
}

/* ── Inventory / stock table ─────────────────────────────────────────────── */
.inv-row {
  display: grid;
  grid-template-columns: 1fr 60px 52px 46px 60px;   /* item · bought · sold · lost · left */
  gap: 6px;
  align-items: center;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.inv-row.inv-head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-dim);
  font-weight: 600;
}
.inv-row .inv-num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-row .inv-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row .inv-left { font-weight: 700; }
.inv-row .inv-low { color: var(--red); }

/* ── Profit per item (gross margin) ──────────────────────────────────────── */
.mg-row {
  display: grid;
  grid-template-columns: 1fr 44px 84px 92px;   /* item · sold · cost/u · profit */
  gap: 6px;
  align-items: center;
  padding: 0.55rem 0.2rem;
  font-size: 0.88rem;
}
.mg-row.mg-head {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--border);
}
.mg-item { border-bottom: 1px solid var(--border); }
.mg-row.mg-tap { cursor: pointer; }
.mg-row .mg-num { text-align: right; font-variant-numeric: tabular-nums; }
.mg-name { display: flex; flex-direction: column; overflow: hidden; }
.mg-name .mg-sub { color: var(--text-dim); font-size: 0.72rem; white-space: nowrap; }
.mg-pos { color: var(--green); font-weight: 700; }
.mg-neg { color: var(--red); font-weight: 700; }
.mg-pos small, .mg-neg small { font-weight: 400; opacity: .8; }
.mg-notset { color: var(--text-dim); font-style: italic; font-size: .78rem; }
.mg-src {
  display: block; font-size: 0.6rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-dim); font-weight: 400;
}
.mg-warn {
  color: var(--red); font-size: 0.72rem; padding: 0 0.2rem 0.4rem;
}
.mg-editor { padding: 0.2rem 0.2rem 0.7rem; }
.mg-basis { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 0.5rem; }
.mg-bt {
  flex: 1 1 calc(50% - 3px); min-width: 70px;   /* 4 bases wrap to a 2x2 grid on a phone */
  padding: 0.4rem 0.3rem; font-size: 0.76rem; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); border-radius: 8px; cursor: pointer;
}
.mg-bt.on { border-color: var(--accent); background: var(--accent); color: #000; font-weight: 600; }
.mg-manual { margin-bottom: 0.5rem; }
.mg-manual-lbl { display: block; font-size: 0.74rem; color: var(--text-dim); margin-bottom: 0.2rem; }
.mg-cost-input { width: 100%; }
.mg-composite { margin-bottom: 0.5rem; }
.mg-comp-hint { font-size: 0.74rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.mg-comp-row { display: grid; grid-template-columns: 1fr 90px 30px; gap: 6px; margin-bottom: 0.4rem; align-items: center; }
.mg-comp-del {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  border-radius: 8px; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0.35rem 0;
}
.mg-comp-add {
  border: none; background: none; color: var(--accent); cursor: pointer;
  font-size: 0.8rem; padding: 0.2rem 0; font-weight: 600;
}
.mg-comp-total { font-size: 0.82rem; margin-top: 0.35rem; }
.mg-comp-total-n { font-variant-numeric: tabular-nums; }
.mg-err { color: var(--error); font-size: 0.78rem; margin-top: 0.4rem; }
.mg-sum { padding: 0.2rem 0 0.7rem; }
.mg-sum-main { font-size: 1rem; }
.mg-sum-sub { color: var(--text-dim); font-size: 0.74rem; margin-top: 0.2rem; }
.mg-sum-warn { color: var(--red); font-size: 0.74rem; margin-top: 0.3rem; }

/* ── QR screen ───────────────────────────────────────────────────────────── */
#qr-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
}
#qr-screen.hidden { display: none !important; }

.qr-receipt-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-align: center;
}
.qr-amount-big {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.04em;
  line-height: 1;
}
.qr-unit { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.5rem; }

/* Pulsing QR wrap */
.qr-stage {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.qr-ring {
  position: absolute;
  inset: -10px;
  border-radius: 20px;
  border: 2px solid var(--accent);
  animation: qr-pulse 2.2s ease-in-out infinite;
  pointer-events: none;
}
.qr-ring.paid {
  border-color: var(--green);
  animation: none;
  opacity: 1;
}
@keyframes qr-pulse {
  0%, 100% { opacity: .25; transform: scale(1); }
  50%       { opacity: .8;  transform: scale(1.025); }
}

/* Payment phase indicator: "processing" (customer has submitted) reads distinct
   from the default "waiting" so the gérant isn't confused during Orange lag. */
#payment-status-indicator.is-processing {
  color: var(--accent);
  font-weight: 600;
}

#qr-container {
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  display: inline-block;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

/* Status row */
.qr-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.qr-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-blink 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes dot-blink {
  0%, 100% { opacity: .3; }
  50%       { opacity: 1; }
}

/* Share buttons */
.share-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 50px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.share-btn:hover {
  background: var(--surf3);
  color: var(--text);
  border-color: var(--accent);
}
.cancel-link {
  background: none;
  border: none;
  color: var(--dim);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: color .15s;
  display: block;
}
.cancel-link:hover { color: var(--red); }

/* Multi-item purchase rows */
.pu-item-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem;
  margin-bottom: 0.6rem;
  background: var(--surface);
}
.pu-item-row .pu-i-name,
.pu-item-row .pu-i-cat,
.pu-item-row .ex-i-label,
.pu-item-row .ex-i-cat { width: 100%; margin-bottom: 0.4rem; }
.pu-i-numrow {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.pu-i-numrow label {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.pu-i-numrow input { width: 100%; min-width: 0; }
.pu-i-remove {
  background: none;
  border: none;
  color: var(--dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  flex: 0 0 auto;
  align-self: center;
}
.pu-i-remove:hover { color: var(--error); }
.pu-i-linetotal {
  text-align: right;
  font-size: 0.8rem;
  margin-top: 0.4rem;
}
.pu-i-linetotal .pu-i-total { font-weight: 700; }
.pu-list-item { margin-bottom: 0.3rem; }
.pu-line-detail { font-size: 0.75rem; padding: 0.1rem 0 0.35rem 0.5rem; line-height: 1.6; }

/* Floating return-to-top button.
   Sits ABOVE the WhatsApp button, which owns the bottom-right slot. The offset is the
   WhatsApp pill's height (~44px) plus a gap — keep them in sync if either changes. */
.scroll-top-btn {
  position: fixed;
  right: 1rem;
  bottom: calc(var(--nav-h, 60px) + 1rem + 56px);
  z-index: 900;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #111;
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.28);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* "Update available" banner — shown when a new app version is deployed */
.update-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  padding-top: max(0.6rem, env(safe-area-inset-top));
  background: var(--accent);
  color: #111;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.update-banner-btn {
  background: #111;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Customer details on the sales form — always visible, grouped under a label */
.customer-section {
  position: relative;
  margin: 0.25rem 0 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
/* Repeat-customer suggestion dropdown + returning flag */
.cust-suggest {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 0.35rem;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.cust-suggest-item {
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}
.cust-suggest-item:last-child { border-bottom: none; }
.cust-suggest-item:active,
.cust-suggest-item:hover { background: var(--accent-dim); }
.cust-suggest-sub { font-size: 0.75rem; color: var(--text-dim); }
.cust-returning {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 0.5rem;
}
.form-section-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

/* USSD fallback — collapsed */
.ussd-details {
  width: 100%;
}
.ussd-details summary {
  font-size: 0.78rem;
  color: var(--dim);
  cursor: pointer;
  padding: 0.4rem 0;
  list-style: none;
  text-align: center;
}
.ussd-details summary::-webkit-details-marker { display: none; }
.ussd-details[open] summary { color: var(--accent2); margin-bottom: 0.75rem; }
.ussd-fallback {
  background: rgba(249,115,22,.06);
  border: 1px dashed rgba(249,115,22,.3);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.82rem;
  margin-top: 0.5rem;
}
.ussd-fallback h4 {
  color: var(--accent2);
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.ussd-fallback p { color: var(--text-dim); }
.ussd-code {
  font-family: monospace;
  font-size: 1.1rem;
  color: var(--text);
  background: var(--surface2);
  border-radius: 6px;
  padding: 3px 9px;
  display: inline-block;
  margin: 3px 0;
}

/* ── Paid screen ─────────────────────────────────────────────────────────── */
#paid-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100svh - var(--header-h) - var(--nav-h));
}
#paid-screen.hidden { display: none !important; }

#paid-panel {
  text-align: center;
  padding: 2rem 1.5rem;
  width: 100%;
}
.paid-ring-wrap {
  margin: 0 auto 1.25rem;
  width: 90px; height: 90px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.paid-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2.5px solid var(--green);
  animation: paid-ring .5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.paid-icon-inner {
  font-size: 2.6rem;
  animation: paid-pop .45s .1s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes paid-ring {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes paid-pop {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}
.paid-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 0.25rem;
}
.amount-display {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.04em;
  line-height: 1;
}
.amount-unit { font-size: 0.9rem; color: var(--text-dim); margin-bottom: 1rem; }
.paid-note {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 0.75rem;
  line-height: 1.6;
}

/* ── Receipt items (QR + paid screens) ──────────────────────────────────── */
.receipt-items {
  text-align: left;
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin: 0.5rem 0 0.25rem;
}
.receipt-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}
.receipt-item .item-label { color: var(--text-dim); }
.receipt-item .item-price-col { color: var(--text); white-space: nowrap; margin-left: 0.5rem; }
.receipt-item.receipt-discount .item-label,
.receipt-item.receipt-discount .item-price-col { color: var(--green, #16a34a); font-weight: 600; }
.receipt-total {
  display: flex;
  justify-content: space-between;
  padding-top: 6px; margin-top: 4px;
  border-top: 1px solid var(--border);
  font-weight: 700; color: var(--accent);
}

/* ── History screen ──────────────────────────────────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  flex-wrap: wrap;               /* a long action label (e.g. "+ Nouvel article") wraps instead of clipping */
  margin-bottom: 1rem;
}

.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.25rem;
}
.history-item:hover { background: var(--surface2); border-color: rgba(255,255,255,.12); }
.history-left { flex: 1; min-width: 0; }
.history-right { flex-shrink: 0; text-align: right; }
.history-date    { font-size: 0.73rem; color: var(--dim); margin-bottom: 3px; }
.history-summary { font-size: 0.85rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-amount  { font-size: 1rem; font-weight: 700; color: var(--accent); margin-bottom: 4px; }

.history-detail {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.history-detail-row {
  display: flex; justify-content: space-between;
  font-size: 0.85rem; padding: 3px 0; color: var(--text-dim);
}
.history-detail-row span:last-child { color: var(--text); white-space: nowrap; margin-left: 0.5rem; }
.history-detail-total {
  border-top: 1px solid var(--border);
  margin-top: 4px; padding-top: 6px;
  font-weight: 700;
}
.history-detail-total span { color: var(--accent) !important; }
.history-receipt-btn {
  margin-top: 10px; width: 100%;
  padding: 9px 12px;
  background: var(--surface-2, #f3f4f6);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .85rem; font-weight: 600;
  cursor: pointer;
}
.history-receipt-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.history-cancel-btn {
  margin-top: 10px; width: 100%;
  padding: 9px 12px;
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 8px;
  font-size: .85rem; font-weight: 600;
  cursor: pointer;
}
.history-cancel-btn:hover:not(:disabled) { background: var(--red); color: #fff; }
.history-cancel-btn:disabled { opacity: .6; cursor: default; }

/* Recent purchase/expense rows: amount + a small delete (🗑) control. */
.cost-row-right { display: inline-flex; align-items: center; gap: .5rem; }
.cost-del-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: .95rem; line-height: 1; padding: 2px 4px; border-radius: 6px;
  opacity: .55; transition: opacity .15s, background .15s;
}
.cost-del-btn:hover { opacity: 1; background: rgba(239,68,68,.12); }
.cost-view-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: .95rem; line-height: 1; padding: 2px 4px; border-radius: 6px;
  opacity: .6; transition: opacity .15s, background .15s;
}
.cost-view-btn:hover { opacity: 1; background: var(--accent-dim); }
.cost-clip { opacity: .5; font-size: .9rem; padding: 2px; }

/* ── Recent purchases / expenses — polished card rows (history-row language) ── */
/* A compact 2-up summary strip, mirroring the stats screen's stat-cards. */
.cost-strip { grid-template-columns: repeat(2, 1fr); margin-bottom: 0.75rem; }

.cost-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.45rem;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.cost-item-exp { border-left-color: var(--orange, #f97316); }

.cost-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; flex-shrink: 0;
  background: var(--accent-dim); color: var(--accent);
}
.cost-item-exp .cost-icon { background: rgba(249,115,22,.12); color: var(--orange, #f97316); }

.cost-body { flex: 1; min-width: 0; }
.cost-title {
  font-size: 0.875rem; font-weight: 600; color: var(--text);
  margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cost-meta {
  font-size: 0.72rem; color: var(--dim);
  display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap;
}
.cost-meta .cost-dot { opacity: .5; }

.cost-right { text-align: right; flex-shrink: 0; display: flex; align-items: center; gap: 0.4rem; }
.cost-amount {
  font-size: 0.95rem; font-weight: 700; color: var(--text);
  letter-spacing: -.02em; white-space: nowrap;
}
.cost-amount small { font-size: 0.6rem; color: var(--dim); font-weight: 600; margin-left: 2px; }

/* Multi-line breakdown, indented under the row. */
.cost-lines {
  flex: 0 0 100%;
  margin-top: 0.5rem; padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.76rem; color: var(--text-dim); line-height: 1.65;
}
.cost-lines .cost-line { display: flex; justify-content: space-between; gap: 0.75rem; }
.cost-lines .cost-line span:last-child { color: var(--text); white-space: nowrap; }

/* ── Payroll ─────────────────────────────────────────────────────────────── */
.pr-due { font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  color: var(--green); background: var(--green-dim); padding: 1px 7px; border-radius: 999px; }
.pr-run-row { display: flex; align-items: center; gap: .6rem; padding: .6rem .2rem;
  border-bottom: 1px solid var(--border); cursor: pointer; }
.pr-run-row:last-of-type { border-bottom: none; }
.pr-run-row input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
/* The optional per-employee bonus field — a real number input, not the 18px checkbox. */
.pr-run-row input.pr-run-bonus { width: 84px; height: auto; accent-color: initial;
  padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: .82rem; text-align: right; cursor: text; }
.pr-run-name { flex: 1; font-size: .9rem; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-run-amt { font-size: .88rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.pr-run-summary { margin-top: .75rem; padding-top: .6rem; border-top: 1px solid var(--border);
  font-size: .9rem; color: var(--text-dim); }
.pr-run-summary strong { color: var(--accent); }

/* ── Purchases form + team controls ──────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
@media (max-width: 420px) { .form-row { grid-template-columns: 1fr; } }
.role-select { font-size: .8rem; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface, #fff); color: var(--text); }
.btn-deact { margin-left: 6px; padding: 4px 10px; font-size: .78rem; font-weight: 600; border: 1.5px solid var(--border); border-radius: 6px; background: #fff; color: var(--text-dim); cursor: pointer; }
.btn-deact:hover { border-color: var(--error); color: var(--error); }

/* ── Wallet tabs (Balance / Stats) ───────────────────────────────────────── */
.wallet-tabs { display: flex; gap: 6px; margin-bottom: 1rem; background: var(--surface-2, #f1f5f9); padding: 4px; border-radius: 10px; }
.wallet-tab { flex: 1; padding: 9px; border: none; background: transparent; border-radius: 7px; font-size: .9rem; font-weight: 700; color: var(--text-dim); cursor: pointer; }
.wallet-tab.active { background: var(--surface, #fff); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ── Stats / Analytics ───────────────────────────────────────────────────── */
.stats-split { display: flex; gap: 10px; margin-bottom: 1.5rem; }
.split-item { flex: 1; display: flex; align-items: center; gap: 6px; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: .85rem; }
.split-item strong { margin-left: auto; color: var(--text); }
.split-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.split-dot.momo { background: #ffcc00; }
.split-dot.cash { background: #16a34a; }
/* P&L / bilan card */
.pnl-card { background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 1.5rem; }
.pnl-card .trend-head { margin-bottom: .5rem; }
.pnl-range-btn { background: none; border: 1px solid var(--border); color: var(--text-dim); border-radius: 8px; padding: 3px 10px; font-size: .75rem; cursor: pointer; }
.pnl-range-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.pnl-row { display: flex; justify-content: space-between; align-items: center; font-size: .88rem; padding: 7px 0; border-bottom: 1px solid var(--border); }
.pnl-row span { color: var(--text-dim); }
.pnl-row strong { font-weight: 700; color: var(--text); }
.pnl-row .pnl-pos { color: #16a34a; }
.pnl-row .pnl-neg { color: var(--error); }
.pnl-net { border-bottom: none; margin-top: 4px; padding-top: 10px; }
.pnl-net span { color: var(--text); font-weight: 700; font-size: .95rem; }
.pnl-net strong { font-size: 1.1rem; font-weight: 800; }
.pnl-hint { font-size: .78rem; margin: .35rem 0 0; }
.stats-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 1.5rem; }
.stat-box { background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.stat-box-label { font-size: .64rem; text-transform: uppercase; letter-spacing: .06em; color: var(--dim, #64748b); margin-bottom: 5px; }
.stat-box-val { font-size: 1.1rem; font-weight: 800; color: var(--accent); letter-spacing: -.02em; line-height: 1; }
.stats-section-title { font-size: .82rem; font-weight: 700; color: var(--text-dim); margin: 0 0 .6rem; text-transform: uppercase; letter-spacing: .03em; }
.stats-trend-wrap { margin-bottom: 1.5rem; }
.trend-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.trend-head .stats-section-title { margin: 0; }
.trend-range { display: inline-flex; gap: 3px; background: var(--surface-2, #f1f5f9); padding: 3px; border-radius: 8px; }
.trend-range-btn { border: none; background: transparent; color: var(--text-dim); font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 6px; cursor: pointer; }
.trend-range-btn.active { background: var(--surface, #fff); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.trend-peak { font-size: .72rem; color: var(--text-dim); margin-bottom: 2px; }
.trend-peak strong { color: var(--text); }
.stats-trend { display: flex; align-items: flex-end; gap: 3px; height: 96px; padding-top: 4px; border-bottom: 1px solid var(--border); }
.stats-trend .bar { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 3px; transition: opacity .15s; }
.stats-trend .bar.empty { background: var(--border); opacity: .5; }
.stats-trend .bar:hover { filter: brightness(1.1); }
.trend-labels { display: flex; justify-content: space-between; margin-top: 4px; font-size: .68rem; color: var(--text-dim); }
.stats-trend .bar { cursor: pointer; }
.stats-trend .bar.selected { background: #b45309; }
.stats-trend .bar.selected.empty { background: var(--text-dim); }
.trend-day-detail { margin-top: .9rem; }
.trend-day-detail .tdd-head { font-size: .82rem; font-weight: 700; margin-bottom: .4rem; }
.trend-day-detail .tdd-head span { color: var(--accent); }
.trend-day-detail .tdd-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: .86rem; }
.trend-day-detail .tdd-row:last-child { border-bottom: none; }
.trend-day-detail .tdd-qty { color: var(--text-dim); margin-left: 6px; font-weight: 600; }
.trend-day-detail .tdd-val { font-weight: 700; color: var(--accent); white-space: nowrap; }
.trend-day-detail .tdd-empty { font-size: .82rem; color: var(--text-dim); padding: .4rem 0; }
.stats-tops { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

/* Ranked rows (top items, staff leaderboard) — polished card rows with a circular
   rank badge, matching the recent-cost cards so the whole tab reads as one system. */
.rank-list { list-style: none; padding: 0; margin: 0; }
.rank-item {
  display: flex; align-items: center; gap: 0.65rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.55rem 0.7rem;
  margin-bottom: 0.4rem;
}
.rank-item:last-child { margin-bottom: 0; }
.rank-badge {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 800;
  background: var(--accent-dim); color: var(--accent);
}
/* Top three get a warm-metal tint; medals render as glyphs on a soft disc. */
.rank-badge.rank-1 { background: rgba(245,158,11,.18); color: #f59e0b; }
.rank-badge.rank-2 { background: rgba(148,163,184,.20); color: #94a3b8; }
.rank-badge.rank-3 { background: rgba(180,83,9,.18);  color: #c2762e; }
.rank-name {
  flex: 1; min-width: 0; font-size: 0.86rem; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rank-name .rank-sub { color: var(--dim); font-weight: 500; font-size: 0.76rem; }
.rank-val { font-weight: 700; color: var(--accent); white-space: nowrap; font-size: 0.88rem; letter-spacing: -.02em; }
.rank-val small { font-size: 0.6rem; color: var(--dim); font-weight: 600; margin-left: 2px; }
.rank-empty { list-style: none; color: var(--dim); font-size: 0.85rem; padding: 0.4rem 0; }

/* Staff drill-down: tap a leaderboard row to expand that member's sales. */
.rank-clickable { cursor: pointer; }
.rank-clickable:hover { border-color: var(--accent); }
.rank-chevron { color: var(--dim); font-weight: 700; flex-shrink: 0; margin-left: .1rem; }
.rank-detail {
  list-style: none;
  margin: -0.15rem 0 0.5rem; padding: 0.5rem 0.7rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.staff-sale-head { font-size: 0.76rem; font-weight: 700; color: var(--dim); margin-bottom: 0.45rem; }
.staff-sale-row {
  display: flex; align-items: baseline; gap: 0.6rem; justify-content: space-between;
  padding: 0.35rem 0; border-top: 1px solid var(--border);
}
.staff-sale-row:first-of-type { border-top: none; }
.staff-sale-desc { flex: 1; min-width: 0; font-size: 0.82rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.staff-sale-date { display: block; font-size: 0.7rem; color: var(--dim); margin-top: 1px; }
.staff-sale-amt { font-weight: 700; color: var(--accent); white-space: nowrap; font-size: 0.82rem; }
.staff-sale-amt small { font-size: 0.58rem; color: var(--dim); font-weight: 600; margin-left: 2px; }

@media (max-width: 480px) { .stats-cards { grid-template-columns: repeat(2, 1fr); } .stats-tops { grid-template-columns: 1fr; } }

/* ── Wallet / Balance ────────────────────────────────────────────────────── */
.balance-card {
  background: linear-gradient(135deg, #78350f 0%, #92400e 25%, #b45309 55%, #d97706 82%, #f59e0b 100%);
  border: none;
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 12px 40px rgba(120,53,15,.4), 0 4px 12px rgba(0,0,0,.3);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.balance-card::before {
  content: '';
  position: absolute; top: -50px; right: -50px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.14) 0%, transparent 70%);
  pointer-events: none;
}
.balance-card::after {
  content: '';
  position: absolute; bottom: -20px; left: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,0,0,.12) 0%, transparent 70%);
  pointer-events: none;
}
.balance-label {
  font-size: 0.72rem;
  color: rgba(255,255,255,.7);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}
.balance-amount {
  font-size: 3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.04em;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.balance-unit { font-size: 0.85rem; color: rgba(255,255,255,.72); margin-bottom: 1.25rem; }
.balance-note { font-size: 0.7rem; color: rgba(255,255,255,.5); margin-top: 0.75rem; }

/* Card-acceptance hint on the create-sale form. */
.pay-methods-note {
  font-size: 0.76rem;
  color: var(--dim);
  line-height: 1.35;
  margin: 0.25rem 0 0.85rem;
  padding: 0.55rem 0.7rem;
  background: rgba(26, 86, 219, .07);
  border: 1px solid rgba(26, 86, 219, .18);
  border-radius: 8px;
}

.carrier-row { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.carrier-pill {
  display: flex; align-items: center; gap: 0.4rem;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
}
.carrier-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.carrier-name { color: rgba(255,255,255,.75); }
.carrier-amount { font-weight: 700; color: #fff; margin-left: 0.15rem; }
.balance-card .btn {
  border-color: rgba(255,255,255,.3);
  color: rgba(255,255,255,.85);
  background: rgba(0,0,0,.15);
}
.balance-card .btn:hover { background: rgba(0,0,0,.28); color: #fff; }

/* Carrier toggle */
.carrier-toggle { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
.carrier-btn {
  flex: 1; padding: 0.65rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text-dim);
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: all .18s;
}
.carrier-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Settings — payout phone ─────────────────────────────────────────────── */
.payout-carrier-block { margin-bottom: 0.5rem; }
.payout-carrier-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 0.6rem;
}
.payout-status {
  font-size: 0.72rem; padding: 2px 8px;
  border-radius: 999px; font-weight: 600;
}
.payout-status.verified { background: var(--green-dim); color: var(--green); }
.payout-status.pending  { background: rgba(245,158,11,.12); color: var(--warning); }

/* ── Stats strip ─────────────────────────────────────────────────────────── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.75rem;
  text-align: center;
}
.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
  margin-bottom: 0.35rem;
}
.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.02em;
  line-height: 1;
}
.stat-unit {
  font-size: 0.6rem;
  color: var(--dim);
  margin-top: 2px;
}

/* ── History — redesigned transaction rows ───────────────────────────────── */
.history-date-group {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--dim);
  padding: 0.6rem 0 0.35rem;
}

.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.45rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.history-item:hover { background: var(--surface2); }
.history-item.status-paid    { border-left-color: var(--green); }
.history-item.status-pending { border-left-color: var(--accent); }
.history-item.status-expired { border-left-color: var(--red); }
.history-item.status-manual  { border-left-color: var(--orange); }
.history-item.status-cancelled { border-left-color: var(--text-dim); opacity: .72; }

.txn-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  font-weight: 700;
}
.txn-icon-paid    { background: var(--green-dim);  color: var(--green); }
.txn-icon-pending { background: var(--accent-dim); color: var(--accent); }
.txn-icon-expired { background: var(--red-dim);    color: var(--red); }
.txn-icon-manual  { background: rgba(249,115,22,.1); color: var(--orange); }
.txn-icon-cancelled { background: rgba(107,114,128,.12); color: var(--text-dim); }

.txn-body { flex: 1; min-width: 0; }
.txn-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.txn-meta {
  font-size: 0.72rem;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.txn-carrier {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.txn-carrier-mtn    { background: rgba(255,204,0,.15); color: #ffd700; }
.txn-carrier-orange { background: rgba(255,102,0,.15); color: #ff7020; }

.txn-right {
  text-align: right;
  flex-shrink: 0;
}
.txn-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}
.txn-amount-paid { color: var(--green); }
.txn-unit-small { font-size: 0.65rem; color: var(--dim); }

.history-detail {
  flex: 0 0 100%;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}
.history-detail-row {
  display: flex; justify-content: space-between;
  font-size: 0.85rem; padding: 3px 0; color: var(--text-dim);
}
.history-detail-row span:last-child { color: var(--text); white-space: nowrap; margin-left: 0.5rem; }
.history-detail-total {
  border-top: 1px solid var(--border);
  margin-top: 4px; padding-top: 6px;
  font-weight: 700;
}
.history-detail-total span { color: var(--accent) !important; }

/* ── Wallet stats ────────────────────────────────────────────────────────── */
.wallet-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.wallet-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.wallet-stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--dim);
  margin-bottom: 0.3rem;
}
.wallet-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.wallet-stat-unit { font-size: 0.65rem; color: var(--dim); margin-top: 1px; }

/* ── Team management ─────────────────────────────────────────────────────── */
.team-member {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.team-member:last-child { border-bottom: none; }
.team-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  color: var(--text-dim);
  flex-shrink: 0;
}
.team-info { flex: 1; min-width: 0; }
.team-name { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.team-email { font-size: 0.72rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-actions { flex-shrink: 0; }
.btn-promote {
  font-size: 0.73rem;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
}
.btn-promote:hover { border-color: var(--accent); color: var(--accent); }
.btn-promote.is-owner { color: var(--dim); border-color: transparent; }
.btn-promote.is-owner:hover { border-color: var(--red); color: var(--red); }

/* ── Empty / loading states ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: .4; }
.empty-state-text { color: var(--dim); font-size: 0.9rem; }

/* ── Helpers ─────────────────────────────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.text-dim { color: var(--text-dim); font-size: 0.85rem; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; }

/* Running-tab chips on the sale screen */
.tabs-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.tab-chip {
  display: flex; flex-direction: column; align-items: flex-start;
  border: 1.5px solid var(--border, #e2e8f0); border-radius: 10px;
  padding: .5rem .7rem; background: var(--surface, #fff); cursor: pointer;
  min-width: 8rem; transition: border-color .15s, background .15s; text-align: left;
}
.tab-chip:hover { border-color: var(--accent, #f59e0b); }
.tab-chip .tab-chip-name { font-weight: 600; font-size: .84rem; }
.tab-chip .tab-chip-total { font-size: .78rem; color: var(--accent, #f59e0b); font-weight: 700; }
.tab-chip .tab-chip-meta { font-size: .7rem; color: var(--text-dim, #64748b); }
.tabs-fee-hint {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  margin-top: .5rem; font-size: .72rem; color: var(--text-dim, #64748b);
}
.tabs-fee-hint .tabs-fee-count {
  font-weight: 700; white-space: nowrap;
  padding: .1rem .45rem; border-radius: 999px;
  background: var(--surface-2, #f1f5f9); color: var(--text-dim, #64748b);
}
.tabs-fee-hint .tabs-fee-count.over {
  background: rgba(245, 158, 11, .15); color: var(--accent, #f59e0b);
}

/* Incoming customer orders (menu self-order queue) — a claimable card per order. */
.incoming-count {
  font-weight: 800; font-size: .72rem; white-space: nowrap;
  padding: .12rem .5rem; border-radius: 999px;
  background: rgba(245, 158, 11, .15); color: var(--accent, #f59e0b);
}
#incoming-list { flex-direction: column; }
.incoming-card {
  width: 100%; border: 1.5px solid var(--accent, #f59e0b); border-radius: 12px;
  padding: .7rem .8rem; background: var(--surface, #fff);
  display: flex; align-items: center; gap: .7rem;
}
.incoming-card .ic-body { flex: 1; min-width: 0; }
.incoming-card .ic-head { display: flex; align-items: baseline; gap: .5rem; }
.incoming-card .ic-name { font-weight: 700; font-size: .92rem; }
.incoming-card .ic-ref {
  font-size: .68rem; font-weight: 700; letter-spacing: .05em;
  color: var(--accent, #f59e0b); background: var(--surface-2, #f1f5f9);
  padding: .05rem .4rem; border-radius: 999px;
}
.incoming-card .ic-items { font-size: .76rem; color: var(--text-dim, #64748b); margin-top: .2rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.incoming-card .ic-total { font-size: .78rem; color: var(--accent, #f59e0b); font-weight: 700; margin-top: .15rem; }
.incoming-card .ic-claim {
  flex-shrink: 0; border: none; border-radius: 10px; cursor: pointer;
  background: var(--accent, #f59e0b); color: #0a0f1e; font-weight: 800;
  font-size: .82rem; padding: .55rem .9rem;
}
.incoming-card .ic-claim:disabled { opacity: .55; }

/* ── POS display (new-order screen) ─────────────────────────────────────── */
/* ── Carrier (MoMo network) status ───────────────────────────────────────── */
.carrier-status { padding: 0.75rem 1rem 0; }
.carrier-status.hidden { display: none; }
.carrier-chips { display: flex; gap: 0.5rem; justify-content: center; }
.carrier-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}
.carrier-chip b { font-weight: 700; font-size: 0.72rem; }
.cchip-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
/* States (set via data-state on the chip) */
.carrier-chip[data-state="operational"] .cchip-dot { background: #22c55e; }
.carrier-chip[data-state="operational"] b { color: #22c55e; }
.carrier-chip[data-state="slow"] .cchip-dot { background: #f59e0b; animation: cpulse 1.4s ease-in-out infinite; }
.carrier-chip[data-state="slow"] b { color: #f59e0b; }
.carrier-chip[data-state="down"] { border-color: var(--red); }
.carrier-chip[data-state="down"] .cchip-dot { background: var(--red); }
.carrier-chip[data-state="down"] b { color: var(--red); }
@keyframes cpulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.carrier-warn {
  margin-top: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(245,158,11,.12);
  border: 1px solid rgba(245,158,11,.35);
  color: var(--text);
  font-size: 0.78rem;
  text-align: center;
}
.carrier-warn.hidden { display: none; }
.carrier-warn.down {
  background: var(--red-dim);
  border-color: var(--red);
}

.pos-display {
  text-align: center;
  padding: 1.5rem 1rem 1rem;
}
.pos-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}
.pos-amount {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.04em;
  line-height: 1;
  transition: all .15s;
}
.pos-amount.has-value { color: var(--text); }
.pos-unit {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
  font-weight: 600;
}
.pos-discount {
  margin-top: .4rem;
  font-size: .8rem;
  font-weight: 700;
  color: var(--green, #16a34a);
}

/* ── Settings menu navigation ────────────────────────────────────────────── */
.settings-menu {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.settings-menu-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.85rem 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  position: relative;
  transition: background .15s;
  text-align: left;
}

.settings-menu-item:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 3.6rem;
  right: 0;
  height: 1px;
  background: var(--border);
}

.settings-menu-item:hover  { background: rgba(255,255,255,.04); }
.settings-menu-item:active { background: rgba(255,255,255,.08); }
[data-theme="light"] .settings-menu-item:hover  { background: rgba(0,0,0,.04); }
[data-theme="light"] .settings-menu-item:active { background: rgba(0,0,0,.08); }

.settings-menu-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.si-amber  { background: rgba(245,158,11,.18); }
.si-indigo { background: rgba(99,102,241,.18); }
.si-green  { background: rgba(16,185,129,.18); }
.si-red    { background: rgba(239,68,68,.18); }

.settings-menu-text  { flex: 1; min-width: 0; }
.settings-menu-label { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.settings-menu-sub   { font-size: 0.75rem; color: var(--text-dim); margin-top: 1px; }

/* Legal / SLA panel body (in-app Service Agreement section) */
.legal-body { font-size: 0.84rem; color: var(--text-dim); line-height: 1.6; }
.legal-body strong { color: var(--text); font-weight: 600; }
.legal-body ul { margin: 0.3rem 0 0.3rem 1.05rem; }
.legal-body li { margin-bottom: 0.3rem; }
.legal-body p  { margin-bottom: 0.5rem; }
.legal-body a  { color: var(--accent); }

.settings-menu-chevron {
  color: var(--text-dim);
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}

/* Settings sub-panel header */
.settings-panel-hdr {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.35rem 0.6rem 0.35rem 0;
  border-radius: 6px;
  flex-shrink: 0;
  transition: opacity .15s;
}
.back-btn:hover { opacity: .7; }

.settings-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

/* ── Withdrawal how-to block ─────────────────────────────────────────────── */
.howto-block {
  background: rgba(245,158,11,.07);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.howto-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.howto-steps { display: flex; flex-direction: column; gap: 0.6rem; }

.howto-step {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.howto-step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.howto-step-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 0.82rem;
}

.howto-step-body strong {
  color: var(--text);
  font-weight: 600;
}

.howto-step-body span {
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.45;
}

.howto-note {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(245,158,11,.15);
}

.howto-note a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ── Receipt download button ─────────────────────────────────────────────── */
.receipt-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 50px;
  background: var(--green-dim);
  border: 1px solid var(--green);
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  margin-top: 0.75rem;
}
.receipt-download-btn:hover {
  background: var(--green);
  color: #fff;
}

/* ── Print / receipt ─────────────────────────────────────────────────────── */
#receipt-print { display: none; }
#report-print { display: none; }

/* Report controls (date range + print) — on-screen only, above the stat cards. */
.report-controls { margin-bottom: 1rem; }
.report-dates { display: flex; gap: .5rem; margin-bottom: .5rem; }
.report-date { flex: 1; display: flex; flex-direction: column; gap: .2rem; font-size: .72rem; color: var(--text-dim); }
.report-date input { width: 100%; padding: .45rem .5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: .85rem; }
.report-controls #print-report-btn { width: 100%; }

@media print {
  /* Hide everything except the active printable (receipt by default) */
  body > *  { display: none !important; }
  /* The WhatsApp button is nested inside a wrapper div, so `body > *` does not reach it.
     Without this it would print on every customer receipt. */
  .wa-fab { display: none !important; }
  #receipt-print {
    display: block !important;
    position: fixed;
    inset: 0;
    background: #fff;
    color: #000;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    padding: 12mm 8mm;
    line-height: 1.6;
  }
  /* When printing a monthly report, swap the receipt for the report */
  body.print-report #receipt-print { display: none !important; }
  body.print-report #report-print {
    display: block !important;
    position: fixed; inset: 0; background: #fff; color: #000;
    font-family: 'Segoe UI', system-ui, sans-serif; font-size: 12px;
    padding: 16mm 14mm; line-height: 1.5;
  }
  #report-print .rpt-biz { font-size: 18px; font-weight: 700; text-transform: uppercase; }
  #report-print .rpt-meta { font-size: 10px; color: #555; margin-bottom: 14px; }
  #report-print .rpt-title { font-size: 14px; font-weight: 700; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 12px; }
  #report-print .rpt-subtitle { font-size: 12px; font-weight: 700; margin: 18px 0 6px; }
  #report-print .rpt-table { width: 100%; border-collapse: collapse; }
  #report-print .rpt-table td { padding: 5px 0; border-bottom: 1px solid #ddd; font-size: 12px; }
  #report-print .rpt-table td:last-child { text-align: right; font-weight: 700; }
  #report-print .rpt-table tr.total td { border-top: 2px solid #000; border-bottom: none; font-weight: 700; font-size: 13px; }
  /* Itemized detail: date · description · signed amount. Narrow dated rows. */
  #report-print .rpt-detail td { font-size: 11px; padding: 3px 0; }
  #report-print .rpt-detail .rpt-date { width: 42px; color: #555; font-weight: 400; white-space: nowrap; }
  #report-print .rpt-detail td:nth-child(2) { font-weight: 400; padding-left: 8px; }
  #report-print .rpt-detail .rpt-amt { white-space: nowrap; }
  #report-print .rpt-foot { margin-top: 22px; font-size: 9px; color: #888; text-align: center; }

  .rcp-logo {
    font-family: sans-serif;
    font-size: 8px;
    color: #999;
    text-align: center;
    margin-bottom: 4px;
  }
  .rcp-biz-name {
    font-family: sans-serif;
    font-size: 15px;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
  }
  .rcp-biz-meta {
    font-family: sans-serif;
    font-size: 9px;
    text-align: center;
    color: #444;
    line-height: 1.5;
    margin-bottom: 4px;
  }
  .rcp-divider {
    border: none;
    border-top: 1px dashed #aaa;
    margin: 6px 0;
  }
  .rcp-row {
    display: flex;
    justify-content: space-between;
    margin: 3px 0;
    font-size: 11px;
  }
  .rcp-row .label { flex: 1; }
  .rcp-row .price { white-space: nowrap; margin-left: 4px; text-align: right; }
  .rcp-total-row {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 13px;
    margin: 4px 0;
  }
  .rcp-footer {
    font-family: sans-serif;
    font-size: 9px;
    color: #555;
    line-height: 1.7;
    margin-top: 4px;
  }
  .rcp-footer .ref { font-family: monospace; color: #000; }
  .rcp-brand {
    text-align: center;
    font-family: sans-serif;
    font-size: 8px;
    color: #bbb;
    margin-top: 8px;
  }
}

/* ── Terms-of-Service modal (signup) ──────────────────────────────────────── */
.tos-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.tos-modal.hidden { display: none; }
.tos-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); max-width: 520px; width: 100%;
  max-height: 85vh; display: flex; flex-direction: column; padding: 1.25rem;
}
.tos-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .35rem; }
.tos-head h3 { font-size: 1.05rem; margin: 0; }
.tos-close { background: none; border: none; color: var(--dim); font-size: 1.1rem; cursor: pointer; padding: .25rem .4rem; }
.tos-body { overflow-y: auto; font-size: .84rem; line-height: 1.6; color: var(--text-dim, var(--dim)); flex: 1; }
.tos-body h4 { font-size: .9rem; color: var(--text); margin: .9rem 0 .25rem; }
.tos-body .tos-intro { color: var(--dim); }
.tos-box .btn { margin-top: 1rem; flex-shrink: 0; }

/* ── Business verification (Tier 2 KYB) ──────────────────────────────────────
   Shown in place of the sale screen while a business is locked for collections. */
.kyb-lead { font-size: .9rem; line-height: 1.65; color: var(--text-dim); margin: 0 0 1rem; }
.kyb-warn { color: var(--red); font-weight: 600; }
.kyb-reason {
  font-size: .87rem; line-height: 1.55; margin: 0 0 1.2rem;
  padding: .7rem .85rem; border-radius: 8px;
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 35%, transparent);
}
.kyb-subtitle { font-size: .95rem; margin: 1.4rem 0 .3rem; color: var(--text); }
.kyb-hint { font-size: .78rem; color: var(--text-dim); margin: 0 0 .8rem; }
.kyb-docs { display: grid; gap: .55rem; margin-bottom: 1.3rem; }
.kyb-doc {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .8rem; border: 1px solid var(--border); border-radius: 8px;
}
.kyb-doc-label { flex: 1; font-size: .85rem; font-weight: 500; }
.kyb-doc-state { font-size: .75rem; color: var(--text-dim); white-space: nowrap; }
.kyb-doc.done { border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.kyb-doc.done .kyb-doc-state { color: var(--green); font-weight: 600; }
.kyb-doc input[type="file"] { display: none; }
.kyb-doc .kyb-pick {
  font-size: .76rem; font-weight: 600; padding: .4rem .7rem; cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px; background: transparent;
  color: var(--accent);
}
.kyb-doc .kyb-pick:disabled { opacity: .45; cursor: not-allowed; }

/* ── Floating WhatsApp support button (logged-in businesses) ──────────────────
   Owns the bottom-right slot, clear of the bottom nav. .scroll-top-btn stacks above it.
   WhatsApp brand green is fixed in both themes — it is a brand mark, not a theme colour.
   The global `@media print { body > * { display: none } }` rule already keeps it off
   printed receipts, since this is a direct child of <body>. */
.wa-fab {
  position: fixed;
  right: 1rem;
  bottom: calc(var(--nav-h, 60px) + 1rem);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1rem;
  border-radius: 999px;
  background: #25D366;
  color: #fff;
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  transition: transform .15s ease, filter .15s ease;
}
.wa-fab:hover { filter: brightness(1.06); transform: translateY(-1px); }
.wa-fab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.wa-fab.hidden { display: none; }
.wa-fab-icon { font-size: 1.15rem; line-height: 1; }

/* Narrow phones: collapse to a round icon so the pill never crowds the nav.
   Fixed square box — padding alone leaves an ellipse, since the emoji is wider than tall. */
@media (max-width: 380px) {
  .wa-fab {
    width: 48px; height: 48px; padding: 0;
    justify-content: center; border-radius: 50%;
  }
  .wa-fab span:not(.wa-fab-icon) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wa-fab { transition: none; }
  .wa-fab:hover { transform: none; }
}

/* ── KYB: track chooser, activity intake, prohibited-activities declaration ──── */
.kyb-tracks { display: grid; gap: .55rem; margin-bottom: 1.2rem; }
.kyb-track {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .8rem .9rem; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.kyb-track:hover { border-color: var(--accent); }
.kyb-track input { margin-top: .2rem; flex: none; }
.kyb-track-body { display: flex; flex-direction: column; gap: .15rem; }
.kyb-track-body b { font-size: .88rem; font-weight: 600; color: var(--text); }
.kyb-track-body small { font-size: .78rem; color: var(--text-dim); line-height: 1.45; }
.kyb-track:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

#kyb-registered-fields.hidden { display: none; }

.kyb-prohibited {
  margin: 0 0 1rem; padding: .7rem .9rem .7rem 2rem;
  border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--red) 8%, transparent);
  font-size: .82rem; line-height: 1.75; color: var(--text-dim);
}
.kyb-prohibited li { margin: 0; }

.kyb-decl-check {
  display: flex; align-items: flex-start; gap: .6rem;
  font-size: .84rem; line-height: 1.55; color: var(--text);
  margin-bottom: 1.3rem; cursor: pointer;
}
.kyb-decl-check input { margin-top: .2rem; flex: none; width: auto; }

#kyb-form textarea { resize: vertical; min-height: 72px; }
#kyb-form select { width: 100%; }

/* Withdrawal fee summary — the owner sees the net BEFORE approving the OTP. */
.w-fee-summary {
  background: var(--surface-2, rgba(127, 127, 127, .08));
  border-radius: 8px;
  padding: .75rem .9rem;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.w-fee-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .2rem 0;
}
.w-fee-summary strong { font-variant-numeric: tabular-nums; }
.w-fee-summary .w-fee-net {
  border-top: 1px solid var(--border, rgba(127, 127, 127, .25));
  margin-top: .35rem;
  padding-top: .45rem;
}
.w-fee-summary .w-fee-net strong { color: var(--success, #16a34a); }

/* An optional KYB document must not look like an outstanding task. */
.kyb-doc.optional:not(.done) { opacity: .85; }
.kyb-doc.optional:not(.done) .kyb-doc-state { color: var(--text-dim); }

/* Owner-ID group: front + back, OR one combined PDF. */
.kyb-id-group {
  border: 1px solid var(--border, rgba(127,127,127,.25));
  border-radius: 10px;
  padding: .75rem;
  margin: .35rem 0;
}
.kyb-id-group.done { border-color: var(--success, #16a34a); }
.kyb-id-head { margin-bottom: .5rem; }
.kyb-id-title { font-weight: 600; }
.kyb-id-hint { font-size: .8rem; color: var(--text-dim, #6b7280); margin-top: .15rem; }
/* "or" divider between the two-sided path and the combined path. */
.kyb-id-or {
  display: flex; align-items: center; text-align: center;
  color: var(--text-dim, #6b7280); font-size: .78rem; margin: .5rem 0;
}
.kyb-id-or::before, .kyb-id-or::after {
  content: ""; flex: 1; height: 1px;
  background: var(--border, rgba(127,127,127,.25));
}
.kyb-id-or span { padding: 0 .6rem; text-transform: uppercase; letter-spacing: .05em; }

/* ── Menu catalog: POS section (price-zone) toggle + Menu tab list ────────────── */
.zone-toggle { display: flex; flex-wrap: wrap; gap: .4rem; }
.zone-btn {
  padding: .45rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text-dim); font-size: .85rem; font-weight: 600; cursor: pointer;
}
.zone-btn.active {
  background: var(--accent-dim); border-color: var(--accent); color: var(--accent);
}

.menu-item {
  display: flex; align-items: center; gap: .6rem; justify-content: space-between;
  padding: .7rem .85rem; margin-bottom: .5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.menu-item-off { opacity: .55; }
.menu-item-main { min-width: 0; }
.menu-item-name { font-weight: 600; font-size: .95rem; }
.menu-item-meta { color: var(--text-dim); font-size: .78rem; margin-top: .15rem; }
.menu-item-actions { display: flex; gap: .3rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
/* Three actions (Edit · Hide · Delete) crowd the price text on a phone — drop them onto their
   own full-width row below the item name/price when the row is narrow. */
@media (max-width: 520px) {
  .menu-item { flex-wrap: wrap; }
  .menu-item-main { flex: 1 1 auto; }
  .menu-item-actions { flex-basis: 100%; margin-top: .4rem; }
}
.menu-badge {
  font-size: .68rem; font-weight: 600; color: var(--text-dim);
  background: var(--surface2); border-radius: 999px; padding: .1rem .5rem; margin-left: .3rem;
}
.menu-price-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.menu-zone-name { min-width: 5.5rem; font-size: .85rem; font-weight: 600; color: var(--text-dim); }
.menu-zone-price { flex: 1; }
.menu-active-row { display: flex; align-items: center; gap: .5rem; font-size: .88rem; cursor: pointer; }
.menu-active-row input { width: auto; }

/* Menu item thumbnails + editor photo preview */
.menu-thumb {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
  background: var(--surface2); border: 1px solid var(--border);
}
.menu-thumb-empty { display: flex; align-items: center; justify-content: center; font-size: 1.1rem; opacity: .5; }
.menu-photo-row { display: flex; align-items: center; gap: .8rem; }
.menu-photo-preview {
  width: 72px; height: 72px; border-radius: 10px; object-fit: cover;
  border: 1px solid var(--border); background: var(--surface2);
}
.menu-photo-actions { display: flex; flex-direction: column; gap: .35rem; }

/* Menu section sub-tabs (view each menu) + editor section chips (which menus an item is in) */
.menu-section-tabs {
  display: flex; gap: .4rem; margin-bottom: 1rem; overflow-x: auto; padding-bottom: .2rem;
}
.menu-tab {
  padding: .4rem .95rem; border-radius: 999px; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  font-size: .85rem; font-weight: 600;
}
.menu-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.menu-section-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.menu-chip {
  padding: .4rem .9rem; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px dashed var(--border); background: var(--surface2); color: var(--text-dim);
  font-size: .85rem; font-weight: 600;
}
.menu-chip.active {
  background: var(--accent-dim); border-style: solid; border-color: var(--accent); color: var(--accent);
}
.menu-appears { font-size: .76rem; color: var(--text-dim); margin: .5rem 0 0; }
.menu-appears-warn { color: var(--accent); }
#menu-f-desc { resize: vertical; min-height: 3.2rem; font: inherit; }

/* Sections editor (manager+): current sections as removable chips + add row */
.menu-zones-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.menu-zone-tag {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .3rem .3rem .7rem; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--border);
  font-size: .82rem; font-weight: 600;
}
.menu-zone-x {
  border: none; background: transparent; color: var(--text-dim); cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 0 .25rem; border-radius: 999px;
}
.menu-zone-x:hover { color: var(--error); }
.menu-zone-add-row { display: flex; gap: .5rem; align-items: center; }
.menu-zone-add-row input { flex: 1; }

/* ── Charts tab (premium, manager+) ──────────────────────────────────────────
   Hand-rolled SVG/CSS charts. Reuses the app tokens so light/dark theme for free. */
.charts-controls { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.charts-range-btn, .chart-metric-btn {
  border: none; background: transparent; color: var(--text-dim);
  font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 6px; cursor: pointer;
}
.charts-range-btn.active, .chart-metric-btn.active {
  background: var(--surface, #fff); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem; margin-bottom: 1rem;
}
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.chart-head .stats-section-title { margin: 0; }
.stats-section-title.sub { font-size: .78rem; margin: 1rem 0 .5rem; color: var(--text-dim); }
.charts-select {
  width: 100%; margin-bottom: .75rem; padding: .5rem .6rem;
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; font-size: .85rem; font-weight: 600;
}
.charts-select.compact { width: auto; margin-bottom: 0; padding: .35rem .5rem; font-size: .78rem; }
.chart-canvas { min-height: 32px; }
.chart-total { font-size: .78rem; margin-top: .4rem; text-align: right; }
.chart-empty-mini { font-size: .8rem; color: var(--dim); text-align: center; padding: 1rem 0; }

/* Line/area chart */
.chart-line-svg { width: 100%; height: 96px; display: block; overflow: visible; }
.cl-area { fill: var(--accent-dim); stroke: none; }
.cl-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* Horizontal bars */
.hbars { display: flex; flex-direction: column; gap: .5rem; }
.hbar-row { display: grid; grid-template-columns: 40% 1fr auto; align-items: center; gap: .5rem; }
.hbar-label { font-size: .8rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { background: var(--bg); border-radius: 6px; height: 10px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; transition: width .3s ease; }
.hbar-val { font-size: .74rem; color: var(--text-dim); font-weight: 600; white-space: nowrap; }

/* Customer tiles + new/returning split */
.charts-cust-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1rem; }
.charts-cust-tiles .stat-box-val { font-size: 1rem; }
.newret-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--bg); margin-bottom: .5rem; }
.newret-seg { height: 100%; }
.newret-seg.newret-new { background: var(--accent); }
.newret-seg.newret-ret { background: var(--green); }
.newret-legend { display: flex; gap: 1rem; font-size: .76rem; color: var(--text-dim); }
.nr-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.nr-dot.new { background: var(--accent); }
.nr-dot.ret { background: var(--green); }
.charts-note { font-size: .72rem; margin-top: .75rem; line-height: 1.5; }

/* Premium soft-gate panel */
.charts-gated { text-align: center; padding: 2.5rem 1rem; }
.charts-gated-icon { font-size: 2.2rem; margin-bottom: .5rem; }
.charts-gated-title { font-weight: 800; font-size: 1.05rem; margin-bottom: .35rem; }

@media (max-width: 420px) {
  .charts-cust-tiles { grid-template-columns: repeat(2, 1fr); }
  .hbar-row { grid-template-columns: 38% 1fr auto; }
}

/* ── Charts phase 3: custom range, CSV, donut, period delta ─────────────────── */
.charts-custom-dates { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.chart-csv {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  font-size: .7rem; font-weight: 700; padding: 3px 10px; border-radius: 6px;
  cursor: pointer; margin-top: .7rem;
}
.chart-csv:hover { color: var(--accent); border-color: var(--accent); }

.delta { font-weight: 700; font-size: .74rem; white-space: nowrap; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--dim); }
.delta-lbl { color: var(--dim); font-weight: 500; }

.donut-wrap { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.donut-svg { width: 118px; height: 118px; flex-shrink: 0; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: .4rem; min-width: 140px; }
.donut-leg { display: flex; align-items: center; gap: .5rem; font-size: .82rem; }
.donut-leg i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-leg span { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-leg b { color: var(--text-dim); font-weight: 700; font-size: .76rem; }

/* ── Customer opt-in consent + charts locked state ───────────────────────────── */
.charts-locked { text-align: center; padding: 1.5rem 1rem; color: var(--text-dim); font-size: .92rem; }
.charts-locked-msg { font-size: .8rem; margin-top: .45rem; line-height: 1.5; }

/* ── Charts: product-trend axis (value scale + date labels) ──────────────────── */
.chart-trend {
  display: grid; grid-template-columns: auto 1fr;
  grid-template-areas: "scale plot" ". xlabels";
  column-gap: 8px; row-gap: 4px; align-items: stretch;
}
.chart-scale {
  grid-area: scale; display: flex; flex-direction: column; justify-content: space-between;
  font-size: .64rem; color: var(--dim); text-align: right; padding: 2px 0; white-space: nowrap;
}
.chart-plot { grid-area: plot; min-width: 0; }
.chart-x-labels {
  grid-area: xlabels; display: flex; justify-content: space-between;
  font-size: .64rem; color: var(--dim);
}
