:root {
  --primary: #12372a;
  --primary-2: #1f5b45;
  --accent: #f8c537;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #17231f;
  --muted: #66736e;
  --line: #dde5e1;
  --danger: #c24135;
  --danger-bg: #fff0ee;
  --success: #15803d;
  --success-bg: #ecfdf3;
  --warn: #b7791f;
  --warn-bg: #fff8e1;
  --radius: 10px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; cursor: pointer; }
input, select, textarea { cursor: auto; }
h1, h2 { font-weight: 900; }

/* ── App shell ── */
.app {
  min-height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  min-height: 100vh;
  background: var(--primary);
  color: white;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: var(--accent); color: var(--primary); display: grid; place-items: center; font-weight: 900; font-size: 19px; flex: 0 0 auto; }
.brand-title { font-size: 20px; font-weight: 900; line-height: 1; }
.brand-subtitle { color: #b7d2c8; font-size: 12px; margin-top: 2px; }

.nav { display: grid; gap: 4px; }
.nav button { border: 0; color: #c5ddd6; background: transparent; border-radius: 9px; padding: 10px 12px; text-align: left; font-weight: 700; font-size: 14px; }
.nav button.active, .nav button:hover { background: rgba(255,255,255,0.12); color: white; }

.sidebar-card { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-card p { font-size: 13px; color: #c5ddd6; }
.sidebar-role { margin-top: 2px; }
.sidebar-logout { margin-top: 10px; width: 100%; border: 1px solid rgba(255,255,255,0.2); color: white; background: transparent; border-radius: 8px; padding: 8px; font-size: 13px; font-weight: 700; }
.sidebar-logout:hover { background: rgba(255,255,255,0.1); }

.main { min-width: 0; padding: 24px; }
.main-inner { max-width: 1100px; margin: 0 auto; width: 100%; }

.bottom-nav { display: none; }

/* ── Login ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }

.login-screen { width: 100%; max-width: 480px; }

.login-brand { text-align: center; margin-bottom: 32px; }
.login-mark { width: 64px; height: 64px; border-radius: 20px; background: var(--primary); color: var(--accent); font-size: 28px; font-weight: 900; display: grid; place-items: center; margin: 0 auto 14px; }
.login-title { font-size: 30px; color: var(--primary); margin-bottom: 4px; }
.login-sub { color: var(--muted); font-size: 16px; }

.staff-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }

.staff-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 12px; border: 2px solid var(--line); border-radius: 14px; background: white; transition: border-color 0.15s, box-shadow 0.15s; }
.staff-card:hover { border-color: var(--primary-2); box-shadow: 0 4px 16px rgba(18,55,42,0.12); }
.staff-av { width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: var(--accent); font-size: 22px; font-weight: 900; display: grid; place-items: center; }
.staff-name { font-weight: 800; color: var(--primary); font-size: 14px; text-align: center; }
.staff-role-tag { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

.pin-pad { text-align: center; }
.hidden { display: none !important; }

.pin-who { font-size: 18px; font-weight: 800; color: var(--primary); margin-bottom: 16px; }

.pin-dots { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: transparent; transition: background 0.1s; }
.dot.filled { background: var(--primary); border-color: var(--primary); }

.pin-error { color: var(--danger); font-size: 13px; font-weight: 700; margin-bottom: 10px; }

.pin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px auto; max-width: 260px; }
.pin-key { border: 1px solid var(--line); border-radius: 12px; background: white; font-size: 22px; font-weight: 700; height: 62px; color: var(--primary); transition: background 0.1s; }
.pin-key:hover { background: #f0f7f4; }
.pin-key:active { background: #e2f0eb; }
.pin-empty { border-color: transparent; background: transparent; cursor: default; }
.pin-back { margin-top: 8px; width: 100%; max-width: 260px; }

/* ── Topbar & header ── */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { color: var(--primary); font-size: 26px; }
.topbar p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.pill { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }

/* ── Grid ── */
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ── Card ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 12px rgba(18,55,42,0.05); }

/* ── Stat card ── */
.stat { display: grid; gap: 4px; text-align: left; }
.stat span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.stat strong { color: var(--primary); font-size: 24px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tappable { border: 0; cursor: pointer; text-align: left; transition: box-shadow 0.15s; }
.tappable:hover { box-shadow: 0 4px 20px rgba(18,55,42,0.12); }

/* ── Section title ── */
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 10px; }
.section-title.compact { margin: 0 0 12px; }
.section-title h2 { color: var(--primary); font-size: 17px; }

/* ── Form ── */
.form { display: grid; gap: 12px; }
.form-row { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }

input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; color: var(--text); padding: 10px 12px; outline: 0; font-size: 14px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); background: white; }
textarea { resize: vertical; min-height: 72px; }

/* ── Buttons ── */
.btn { border: 0; border-radius: 8px; padding: 10px 16px; background: var(--primary); color: white; font-weight: 800; font-size: 14px; }
.btn.ghost { background: white; color: var(--primary); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f5f7fb; }
.btn.secondary { background: var(--accent); color: var(--primary); }
.btn.danger { background: var(--danger); color: white; }

/* ── Toolbar ── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── List & item ── */
.list { display: grid; gap: 8px; }
.item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.item-title { font-weight: 800; color: var(--primary); font-size: 14px; }
.item-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ── Row action buttons ── */
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; flex-shrink: 0; }
.act-btn { border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--primary); padding: 5px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.act-btn:hover { background: #f0f7f4; }
.act-btn.red { color: var(--danger); }
.act-btn.red:hover { background: var(--danger-bg); border-color: var(--danger); }

/* ── Badge ── */
.badge { display: inline-flex; border-radius: 999px; padding: 4px 9px; background: #edf4f1; color: var(--primary); font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.success { background: var(--success-bg); color: var(--success); }

/* ── Empty state ── */
.empty { color: var(--muted); text-align: center; padding: 22px; font-size: 14px; }

/* ── Setup card ── */
.setup-card { margin-bottom: 14px; }
.setup-list { display: grid; gap: 8px; }
.setup-step { display: flex; gap: 10px; align-items: flex-start; text-align: left; background: #fbfcfd; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.setup-step span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #edf4f1; color: var(--primary); font-weight: 900; flex: 0 0 auto; }
.setup-step strong { color: var(--primary); font-size: 14px; }
.setup-step p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.setup-step.done span { background: var(--success-bg); color: var(--success); }

/* ── Dashboard ── */
.dash-grid { margin-top: 4px; }
.dash-col { display: flex; flex-direction: column; gap: 0; }
.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 4px; }
.quick-btn { border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--primary); padding: 12px; font-weight: 800; font-size: 13px; }
.quick-btn:hover { background: #f0f7f4; border-color: var(--primary-2); }

/* ── PIN warning banner ── */
.pin-warning-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--danger);
  flex-wrap: wrap;
}
.pin-warning-banner strong { color: var(--danger); }

/* ── Ad box ── */
.ad-box { border: 1px dashed #b7c4bf; background: #fbfcfd; color: var(--muted); text-align: center; padding: 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* ── Logo ── */
.logo-preview { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: #f1f5f3; }

/* ── Sell screen ── */
.sell-warning { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--danger-bg); border: 1px solid var(--danger); border-radius: var(--radius); padding: 13px 16px; margin-bottom: 14px; font-weight: 700; color: var(--danger); font-size: 14px; }

.sell-layout { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }

.sell-products { display: flex; flex-direction: column; gap: 12px; }

.cat-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-chip { border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); padding: 5px 13px; font-size: 12px; font-weight: 700; }
.cat-chip.active, .cat-chip:hover { background: var(--primary); color: white; border-color: var(--primary); }

.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }

.product-card { display: flex; flex-direction: column; gap: 3px; padding: 13px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: white; text-align: left; transition: border-color 0.1s, background 0.1s; }
.product-card:hover:not(:disabled) { border-color: var(--primary-2); background: #f0f7f4; }
.product-card:active:not(:disabled) { background: #e2f0eb; }
.product-card.out-of-stock { opacity: 0.42; cursor: not-allowed; }
.pc-name { font-weight: 900; font-size: 13px; color: var(--primary); line-height: 1.3; }
.pc-price { font-weight: 800; font-size: 15px; color: var(--primary-2); }
.pc-stock { font-size: 11px; color: var(--muted); font-weight: 600; }

.sell-panel { display: flex; flex-direction: column; gap: 0; }

.cart-ttl { color: var(--primary); font-size: 19px; }

.cart-list { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; min-height: 48px; }

.cart-line { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.ci-name { font-weight: 700; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-total { font-weight: 800; font-size: 13px; color: var(--primary); white-space: nowrap; }

.qty-ctrl { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty-btn { border: 0; background: #f5f7fb; color: var(--primary); font-size: 17px; font-weight: 900; width: 32px; height: 32px; display: grid; place-items: center; }
.qty-btn:hover { background: #e2f0eb; }
.qty-val { width: 30px; text-align: center; font-weight: 800; font-size: 13px; }
.rm-btn { padding: 5px 7px; font-size: 15px; }

.pay-panel { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }

.customer-row { border-radius: 8px; }
.customer-row.credit-mode { background: var(--warn-bg); border: 1px solid var(--warn); padding: 10px; }
.customer-row.credit-mode label { color: var(--warn); }

.change-display { min-height: 0; }
.change-pos { background: var(--success-bg); border: 1px solid var(--success); color: var(--success); border-radius: 8px; padding: 10px 12px; font-weight: 700; font-size: 14px; }
.change-neg { background: var(--danger-bg); border: 1px solid var(--danger); color: var(--danger); border-radius: 8px; padding: 10px 12px; font-weight: 700; font-size: 14px; }

.complete-btn { background: var(--accent); color: var(--primary); font-size: 14px; font-weight: 900; padding: 13px; }
.complete-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Receipt modal ── */
.receipt-overlay { position: fixed; inset: 0; background: rgba(18,55,42,0.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.receipt-modal { background: white; border-radius: 18px; width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(18,55,42,0.25); font-family: 'Courier New', Courier, monospace; }
/* On-screen preview widths — match physical paper so owner sees the real layout */
.receipt-modal--58mm { max-width: 280px; }   /* 58mm ≈ 220px + a little breathing room */
.receipt-modal--80mm { max-width: 380px; }   /* 80mm ≈ 302px + breathing room */

/* Receipt header (shop identity) */
.rcpt-header { background: var(--primary); border-radius: 18px 18px 0 0; padding: 22px 20px 18px; text-align: center; }
.rcpt-logo { width: 70px; height: 70px; border-radius: 14px; object-fit: cover; margin: 0 auto 10px; display: block; border: 3px solid rgba(255,255,255,0.2); }
.rcpt-shop-initial { width: 70px; height: 70px; border-radius: 14px; background: var(--accent); color: var(--primary); font-size: 28px; font-weight: 900; display: grid; place-items: center; margin: 0 auto 10px; font-family: Inter, sans-serif; }
.rcpt-shop-name { font-size: 20px; font-weight: 900; color: white; font-family: Inter, sans-serif; line-height: 1.1; }
.rcpt-shop-type { font-size: 12px; color: rgba(255,255,255,0.65); margin-top: 3px; font-family: Inter, sans-serif; }
.rcpt-shop-contact { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.rcpt-shop-contact span { font-size: 12px; color: rgba(255,255,255,0.8); font-family: Inter, sans-serif; }

/* Receipt body */
.rcpt-body { padding: 16px 20px 0; }
.rcpt-dashed { border: none; border-top: 2px dashed #dde5e1; margin: 12px 0; }
.rcpt-ref { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 2px; }

/* Items table */
.rcpt-items { display: grid; gap: 6px; margin: 4px 0; }
.rcpt-item { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: 13px; }
.rcpt-item-name { color: var(--text); }
.rcpt-item-qty { color: var(--muted); font-size: 12px; }
.rcpt-item-price { text-align: right; font-weight: 700; white-space: nowrap; color: var(--primary); }

/* Totals */
.rcpt-row { display: flex; justify-content: space-between; font-size: 13px; gap: 8px; padding: 2px 0; }
.rcpt-total-row { font-size: 16px; font-weight: 900; color: var(--primary); padding: 6px 0; }
.rcpt-change-row strong { color: var(--success); font-size: 14px; }
.rcpt-discount { color: var(--success); }
.rcpt-credit { color: var(--warn); font-weight: 700; }
.rcpt-paid-row { color: var(--muted); font-size: 12px; }

/* Footer */
.rcpt-footer { text-align: center; padding: 14px 20px 20px; }
.rcpt-thank { font-size: 13px; font-weight: 700; color: var(--primary); font-family: Inter, sans-serif; margin-bottom: 6px; }
.rcpt-served { font-size: 11px; color: var(--muted); font-family: Inter, sans-serif; }
.rcpt-id { font-size: 10px; color: #c8d4ce; margin-top: 6px; letter-spacing: 0.08em; }

/* Actions (screen only) */
.rcpt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 20px 20px; }
.rcpt-success-chip { display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--success-bg); color: var(--success); border-radius: 999px; padding: 6px 14px; font-size: 12px; font-weight: 800; margin: 12px 20px 0; font-family: Inter, sans-serif; }

/* ── Stock ── */
.expect-label { color: var(--muted); font-weight: 400; font-style: normal; font-size: 12px; }

/* ── Customers ── */
.debt-summary { display: flex; flex-direction: column; justify-content: center; }
.debt-label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; margin-bottom: 6px; }
.debt-big { font-size: 36px; font-weight: 900; color: var(--primary); line-height: 1; }
.debt-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ── Reports ── */
.tab-bar { display: flex; gap: 4px; margin-bottom: 18px; background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; }
.tab-btn { border: 0; border-radius: 7px; background: transparent; color: var(--muted); padding: 8px 14px; font-weight: 700; font-size: 13px; flex: 1; }
.tab-btn.active { background: var(--primary); color: white; }
.tab-btn:hover:not(.active) { background: #f0f7f4; color: var(--primary); }

.sales-list { display: grid; gap: 0; }
.sale-item { border-bottom: 1px solid var(--line); }
.sale-item:last-child { border-bottom: 0; }
.sale-summary { display: flex; align-items: center; gap: 10px; padding: 12px 4px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.sale-summary::-webkit-details-marker { display: none; }
.sale-amt { font-weight: 900; font-size: 15px; color: var(--primary); white-space: nowrap; }
.sale-info { color: var(--muted); font-size: 12px; flex: 1; min-width: 0; }
.sale-detail { background: #f9fbfa; border-radius: 8px; padding: 12px; margin: 0 0 10px; display: grid; gap: 7px; }
.sale-row { display: flex; justify-content: space-between; font-size: 13px; gap: 8px; }
.sale-sep { border-top: 1px dashed var(--line); }
.sale-total-row { font-size: 14px; }
.muted-row { color: var(--muted); font-size: 12px; }
.discount-row { color: var(--success); }

/* ── Shift cards ── */
.shift-card { margin-bottom: 10px; }
.shift-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.shift-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; background: #f9fbfa; border-radius: 8px; padding: 12px; }
.shift-stats div { display: flex; flex-direction: column; gap: 2px; }
.shift-stats span { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.shift-stats strong { font-size: 14px; color: var(--primary); }
.shift-note { margin-top: 10px; font-size: 13px; color: var(--muted); font-style: italic; }
.c-success { color: var(--success) !important; }
.c-danger { color: var(--danger) !important; }

/* ── Staff ── */
.role-guide { background: #f5f7fb; border-radius: 8px; padding: 10px 12px; display: grid; gap: 4px; }
.role-guide p { font-size: 12px; color: var(--muted); }
.role-guide strong { color: var(--primary); }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 20px; right: 16px; display: grid; gap: 8px; z-index: 200; pointer-events: none; width: 280px; }
.toast { padding: 12px 16px; border-radius: 10px; font-weight: 700; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,0.15); animation: slideIn 0.25s ease; }
.toast-success { background: var(--primary); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-warn { background: var(--warn); color: white; }

@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Modals (confirm / input) ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(18,55,42,0.45); display: flex; align-items: center; justify-content: center; z-index: 150; padding: 16px; }
.modal-box { background: white; border-radius: 16px; padding: 24px; width: 100%; max-width: 340px; box-shadow: 0 16px 40px rgba(18,55,42,0.2); }
.modal-msg { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 16px; }
.modal-input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 15px; margin-bottom: 14px; outline: 0; }
.modal-input:focus { border-color: var(--primary-2); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── Login footer / hints ── */
.login-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  margin-top: 8px;
}
.login-hint {
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--warn-bg);
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 6px 10px;
}
.login-hint strong { color: var(--warn); }
.login-sep { color: var(--line); font-size: 14px; }

/* ── v3 Auth screens ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}

.auth-screen {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.welcome-screen {
  align-items: center;
  text-align: center;
  gap: 0;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.auth-brand.small {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.auth-mark {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: var(--primary);
  color: var(--accent);
  font-size: 30px;
  font-weight: 900;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.auth-mark.small {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  font-size: 18px;
}

.auth-title {
  font-size: 26px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1.1;
}
.auth-brand.small .auth-title { font-size: 20px; }

.auth-sub {
  color: var(--muted);
  font-size: 15px;
}

/* Welcome buttons */
.welcome-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 32px;
}

.welcome-primary {
  font-size: 16px;
  padding: 14px;
  background: var(--primary);
  color: white;
}

.welcome-ghost {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.2;
}

.welcome-hint {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  display: block;
}

.welcome-footer {
  color: var(--muted);
  font-size: 12px;
  margin-top: 24px;
}

/* Auth form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
}

.auth-submit {
  padding: 13px;
  font-size: 15px;
  width: 100%;
  background: var(--primary);
  color: white;
}

.auth-back {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  text-align: left;
  padding: 0;
  width: fit-content;
}
.auth-back:hover { color: var(--primary); }

.auth-switch {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
  font-size: 13px;
  padding: 0;
  text-decoration: underline;
}

/* 6-box shop code entry */
.code-boxes {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.code-box {
  width: 46px;
  height: 58px;
  border: 2px solid var(--line);
  border-radius: 10px;
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  color: var(--primary);
  background: white;
  outline: 0;
  caret-color: var(--primary);
  transition: border-color 0.15s;
  padding: 0;
}
.code-box:focus { border-color: var(--primary); }

/* Theme picker */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.theme-swatch {
  border: 3px solid transparent;
  border-radius: 12px;
  padding: 14px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.theme-swatch:hover { transform: translateY(-2px); }
.theme-swatch.selected { border-color: white; box-shadow: 0 0 0 2px var(--text); }

.theme-accent {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
}

.theme-name {
  font-size: 11px;
  font-weight: 800;
  color: rgba(255,255,255,0.9);
  text-align: center;
  line-height: 1;
}

/* Ad banner (top of dashboard / reports) */
.ad-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 14px;
}

.ad-label {
  font-size: 10px;
  font-weight: 900;
  color: #b7791f;
  background: #ffe082;
  border-radius: 4px;
  padding: 2px 5px;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.ad-text {
  flex: 1;
  font-size: 12px;
  color: #92610a;
}

.ad-upgrade {
  border: 1px solid #b7791f;
  border-radius: 6px;
  background: white;
  color: #b7791f;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  flex-shrink: 0;
}

/* Shop code card on dashboard */
.shop-code-card {
  text-align: center;
  background: var(--primary);
  border-radius: var(--radius);
  padding: 16px;
  color: white;
}

.shop-code-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.65);
  margin-bottom: 6px;
}

.shop-code-num {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--accent);
  line-height: 1;
}

.shop-code-hint {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin-top: 6px;
}

/* ── Shop code (settings tab) ── */
.shopcode-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--primary);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.shopcode-display {
  flex: 1;
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-family: monospace;
  line-height: 1;
}
.shopcode-reveal-btn {
  color: rgba(255,255,255,0.8) !important;
  border-color: rgba(255,255,255,0.3) !important;
  font-size: 13px;
  padding: 6px 14px;
  flex-shrink: 0;
}
.shopcode-reveal-btn:hover { background: rgba(255,255,255,0.12) !important; }
.shopcode-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.shopcode-actions .btn { flex: 1; }
.danger-ghost { color: var(--danger) !important; border-color: var(--danger) !important; }
.danger-ghost:hover { background: #fef2f2 !important; }
.printer-warn {
  background: #fff3e0;
  border: 1px solid #ffb74d;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: #5d3a00;
  line-height: 1.5;
  margin-bottom: 14px;
}

.shopcode-warning {
  background: #fff8e1;
  border: 1px solid #ffd54f;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: #6d4c00;
  line-height: 1.5;
}

/* ── Date filter bar ── */
.date-filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.df-btn { border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); padding: 5px 14px; font-size: 12px; font-weight: 700; }
.df-btn.active, .df-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ── CSV export button ── */
.export-btn { border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--primary); padding: 6px 13px; font-size: 12px; font-weight: 700; }
.export-btn:hover { background: #f0f7f4; }

/* ── Offline banner ── */
.offline-banner { display: none; background: var(--warn-bg); border: 1px solid var(--warn); border-radius: 8px; padding: 8px 14px; margin-bottom: 14px; font-size: 13px; font-weight: 700; color: var(--warn); }
body.offline .offline-banner { display: flex; align-items: center; gap: 8px; }

/* ── Desktop enhancements ── */
@media (min-width: 821px) {
  .sell-layout { grid-template-columns: 1fr 360px; }
  .sell-panel { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .app { grid-template-columns: 260px minmax(0, 1fr); }
  .main { padding: 28px 36px; }
  .main-inner { max-width: 1280px; }
  .topbar h1 { font-size: 30px; }
  .stat strong { font-size: 28px; }
  .quick-actions { grid-template-columns: repeat(4, 1fr); }
  .sell-layout { grid-template-columns: 1fr 400px; }
  .card { padding: 20px; }
}

@media (min-width: 1200px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1440px) {
  .app { grid-template-columns: 280px minmax(0, 1fr); }
  .main { padding: 32px 48px; }
  .main-inner { max-width: 1500px; }
  .sell-layout { grid-template-columns: 1fr 440px; }
}

/* ── Print ── */
@media print {
  /* Hide chrome, keep the DOM tree intact so receipt renders */
  .sidebar, .bottom-nav, .offline-banner, .toast-container,
  .rcpt-actions, .rcpt-success-chip { display: none !important; }

  .app { display: block !important; }
  .main { padding: 0 !important; }

  /* Hide all direct children of main-inner except the receipt */
  .main-inner > * { display: none !important; }
  .main-inner > .receipt-overlay { display: block !important; }

  /* Receipt layout for print — fills the @page size exactly */
  .receipt-overlay {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    display: block !important;
  }
  .receipt-modal,
  .receipt-modal--58mm,
  .receipt-modal--80mm {
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    font-size: 11pt !important;
  }
  .rcpt-header { border-radius: 0 !important; }
  /* Reduce padding on print so content fills the narrow paper */
  .rcpt-body { padding: 8px 6px 0 !important; }
  .rcpt-footer { padding: 8px 6px 12px !important; }
  .rcpt-actions { display: none !important; }
}

/* ── Sync badge ── */
.sync-status-row { margin: 6px 0 0; min-height: 18px; }
.sync-badge {
  display: none;
  background: var(--accent);
  color: var(--primary);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
  letter-spacing: 0.3px;
}
.sync-badge.visible { display: inline-block; }

/* ── Camera scanner overlay ── */
.scan-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
  padding: 16px;
}
.scan-modal {
  background: #111;
  border-radius: 16px;
  overflow: hidden;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.scan-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.scan-title { color: white; font-weight: 700; font-size: 15px; }
.scan-close {
  background: rgba(255,255,255,0.1); border: 0; color: white;
  border-radius: 50%; width: 30px; height: 30px;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.scan-close:hover { background: rgba(255,255,255,0.2); }
.scan-viewport {
  position: relative; aspect-ratio: 1;
  background: #000; overflow: hidden;
}
.scan-viewport video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame {
  position: absolute; inset: 20%;
  border: none;
}
.scan-corner {
  position: absolute; width: 24px; height: 24px;
  border-color: var(--accent); border-style: solid;
}
.scan-corner.tl { top:0; left:0; border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.scan-corner.tr { top:0; right:0; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.scan-corner.bl { bottom:0; left:0; border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.scan-corner.br { bottom:0; right:0; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }
.scan-laser {
  position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: laser 2s ease-in-out infinite;
}
@keyframes laser {
  0%,100% { top: 10%; }
  50% { top: 90%; }
}
.scan-hint {
  position: absolute; bottom: 8px; left: 0; right: 0;
  text-align: center; color: rgba(255,255,255,0.75);
  font-size: 12px; font-weight: 600;
}
.scan-note {
  padding: 12px 16px;
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  text-align: center;
}

/* ── Mobile ── */
@media (max-width: 820px) {
  .app { display: block; padding-bottom: 96px; }

  .sidebar { position: static; min-height: auto; border-radius: 0 0 16px 16px; padding: 14px 16px 12px; }
  .sidebar .nav, .sidebar-card { display: none; }

  .main { padding: 14px; }

  .topbar h1 { font-size: 22px; }

  .grid.two, .grid.three, .form-row { grid-template-columns: 1fr; }

  .sell-layout { grid-template-columns: 1fr; }

  .product-grid { grid-template-columns: repeat(2, 1fr); }

  .shift-stats { grid-template-columns: repeat(2, 1fr); }

  .quick-actions { grid-template-columns: repeat(2, 1fr); }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 10px; right: 10px; bottom: 16px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(18,55,42,0.16);
    z-index: 30;
    overflow: hidden;
  }
  .bottom-nav button { border: 0; background: transparent; padding: 10px 4px 11px; color: var(--muted); font-size: 11px; font-weight: 800; }
  .bottom-nav button.active { color: var(--primary); }

  .toast-container { bottom: 90px; right: 12px; left: 12px; width: auto; }

  .cart-line { grid-template-columns: minmax(0,1fr) auto auto auto; }

  .staff-picker { grid-template-columns: repeat(2, 1fr); }

  .tab-bar { overflow-x: auto; flex-wrap: nowrap; }
  .tab-btn { white-space: nowrap; }
}
