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

:root {
  --bg:         #f4f5f7;
  --surface:    #ffffff;
  --surface2:   #f0f2f5;
  --border:     #e3e6ef;
  --accent:     #2563eb;
  --success:    #059669;
  --warn:       #d97706;
  --danger:     #dc2626;
  --text:       #111827;
  --text-muted: #6b7280;
  --radius:     10px;
  --font:       'Segoe UI', system-ui, sans-serif;
  --topbar-h:   56px;
  --shadow:     0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10);
}

html, body {
  height: 100%; overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── Utility ──────────────────────────────────────────────── */
.hidden { display: none !important; }

.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-ok   { background: #d1fae5; color: #065f46; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-err  { background: #fee2e2; color: #991b1b; }
.badge-paid { background: #dbeafe; color: #1e40af; border-radius: 4px; font-size: 11px; padding: 2px 8px; }
.badge-fulfilled { background: #f3f4f6; color: #374151; border: 1px solid var(--border); border-radius: 4px; font-size: 11px; padding: 2px 8px; }

.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-top: 10px; background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }



/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius); border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: inherit; transition: all .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #b91c1c; }
.btn-ghost   { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface2); }
.btn-lg  { padding: 13px 24px; font-size: 16px; }
.btn-sm  { padding: 6px 12px; font-size: 13px; }
.btn-xs  { padding: 3px 8px;  font-size: 11px; }
.btn-block { width: 100%; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; font-weight: 500; }
input[type=text], input[type=number], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 11px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 15px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
textarea { resize: vertical; }

/* ══════════════════════════════════════════════════════════════
   SESSION GATE
   ══════════════════════════════════════════════════════════════ */
.gate {
  display: flex; align-items: flex-start; justify-content: center;
  min-height: 100vh; background: var(--bg);
  overflow-y: auto; padding: 20px 0;
}
.gate-card {
  background: var(--surface); border-radius: 16px;
  padding: 40px 48px; width: 420px; max-width: 95vw;
  box-shadow: var(--shadow-md);
  text-align: center;
}
@media (max-width: 480px) {
  .gate { align-items: flex-start; padding: 16px 0; }
  .gate-card { padding: 24px 20px; }
}
.gate-logo { font-size: 64px; margin-bottom: 12px; }
.gate-card h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.gate-sub { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }
.gate-card .form-group { text-align: left; }
.gate-sync { margin-top: 20px; }

/* ══════════════════════════════════════════════════════════════
   TOP BAR
   ══════════════════════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-menu-btn {
  background: none; border: none; cursor: pointer; font-size: 18px;
  color: var(--text-muted); padding: 4px 6px; border-radius: 6px;
  transition: background .15s;
}
.topbar-menu-btn:hover { background: var(--surface2); }
.topbar-logo { font-size: 15px; font-weight: 700; white-space: nowrap; color: var(--text); }
.topbar-session-info { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.topbar-left  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-center { flex: 1; }
.topbar-right  { display: flex; align-items: center; gap: 10px; flex-shrink: 0; justify-content: flex-end; }

.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 0 12px;
}
.search-bar-icon { font-size: 15px; color: var(--text-muted); }
.search-bar input {
  flex: 1; border: none; background: transparent; padding: 9px 0;
  font-size: 14px; color: var(--text);
}
.search-bar input:focus { outline: none; }
.search-bar input::placeholder { color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════
   POS BODY
   ══════════════════════════════════════════════════════════════ */
.pos-screen { display: flex; flex-direction: column; height: 100vh; }
.pos-body {
  display: flex; flex: 1; margin-top: var(--topbar-h); overflow: hidden;
}

/* ── Left panel ───────────────────────────────────────────── */
.left-panel {
  flex: 1; display: flex; flex-direction: column;
  border-right: 1px solid var(--border); overflow: hidden;
  position: relative; background: var(--bg);
}
.screen {
  position: absolute; inset: 0; display: flex;
  flex-direction: column; overflow: hidden;
}
.screen.hidden { display: none !important; }

/* ── Home screen ──────────────────────────────────────────── */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px; padding: 20px; flex: 1; overflow-y: auto;
  align-content: start;
}
.qa-tile {
  background: var(--surface); border-radius: 12px;
  padding: 20px 16px; cursor: pointer;
  display: flex; flex-direction: column; gap: 12px;
  border: 1px solid var(--border);
  transition: transform .1s, box-shadow .1s; min-height: 100px;
}
.qa-tile:hover  { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.qa-tile:active { transform: scale(.97); }
.qa-tile-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.qa-tile-label { font-size: 14px; font-weight: 600; color: var(--text); }

.qa-blue   { border-top: 3px solid #2563eb; } .qa-blue   .qa-tile-icon { background: #dbeafe; }
.qa-green  { border-top: 3px solid #059669; } .qa-green  .qa-tile-icon { background: #d1fae5; }
.qa-amber  { border-top: 3px solid #d97706; } .qa-amber  .qa-tile-icon { background: #fef3c7; }
.qa-violet { border-top: 3px solid #7c3aed; } .qa-violet .qa-tile-icon { background: #ede9fe; }
.qa-rose   { border-top: 3px solid #e11d48; } .qa-rose   .qa-tile-icon { background: #ffe4e6; }
.qa-teal   { border-top: 3px solid #0891b2; } .qa-teal   .qa-tile-icon { background: #cffafe; }

.home-status-bar {
  padding: 10px 20px; background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; gap: 24px; font-size: 13px; color: var(--text-muted);
}
.home-status-bar strong { color: var(--text); }

/* ── Screen header / back nav ─────────────────────────────── */
.screen-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}
.screen-back {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  color: var(--accent); font-size: 15px; font-weight: 500; padding: 4px 0;
}
.screen-back:hover { opacity: .75; }
.screen-title { font-size: 15px; font-weight: 600; flex: 1; color: var(--text); }
.screen-action {
  color: var(--accent); font-size: 14px; font-weight: 500;
  background: none; border: none; cursor: pointer;
}
.screen-action:hover { opacity: .75; }
.screen-search-wrap {
  padding: 10px 14px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.screen-search-wrap .search-bar { background: var(--bg); }

/* ── Products list ────────────────────────────────────────── */
.product-list { flex: 1; overflow-y: auto; background: var(--surface); }
.product-list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
.product-list-item:hover { background: var(--surface2); }
.product-list-thumb {
  width: 44px; height: 60px; object-fit: cover;
  border-radius: 4px; background: var(--bg);
  border: 1px solid var(--border); flex-shrink: 0;
}
.product-list-thumb-ph {
  width: 44px; height: 60px; border-radius: 4px;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0; color: var(--border);
}
.product-list-info  { flex: 1; min-width: 0; }
.product-list-title { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.4; }
.product-list-author { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.product-list-category { font-size: 11px; color: var(--accent); margin-top: 1px; }
.product-list-stock { font-size: 12px; color: var(--success); margin-top: 2px; }
.product-list-stock.out { color: var(--danger); }

/* Out-of-stock product row (search results - dimmed) */
.product-list-item.oos { opacity: 0.45; cursor: default; }
.product-list-item.oos:hover { background: inherit; }

/* POS toast notification */
.pos-toast {
  position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 13px; z-index: 9999; opacity: 0; transition: opacity 0.2s;
  pointer-events: none; white-space: nowrap;
}
.pos-toast.show { opacity: 1; }
.pos-toast.pos-toast-warn { background: #92400e; }
.pos-toast.pos-toast-ok   { background: #065f46; }

/* Refunded badge + warn button */
.badge-refunded { background: #fef3c7; color: #92400e; font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.btn-warn { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.product-list-right { text-align: right; flex-shrink: 0; }
.product-list-price  { font-size: 14px; font-weight: 600; color: var(--text); }
.product-list-link   { font-size: 12px; color: var(--accent); margin-top: 4px; cursor: pointer; }

/* ── Product detail ───────────────────────────────────────── */
.product-detail-scroll { flex: 1; overflow-y: auto; background: var(--bg); padding-bottom: 64px; }
.product-detail-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.product-detail-img {
  width: 60px; height: 80px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--border);
}
.product-detail-img-ph {
  width: 60px; height: 80px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: var(--border);
}
.product-detail-name { font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--text); }
.product-detail-sku  { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.detail-section-title {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  padding: 12px 16px 4px; text-transform: uppercase; letter-spacing: .5px;
  background: var(--surface);
}
.inventory-table { background: var(--surface); width: 100%; }
.inv-head {
  display: grid; grid-template-columns: 1fr 1fr 60px;
  padding: 8px 16px 6px; border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.inv-row {
  display: grid; grid-template-columns: 1fr 1fr 60px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text);
}
.inv-qty-low { color: var(--danger); font-weight: 700; }
.inv-qty-ok  { color: var(--text); font-weight: 600; }
.add-to-cart-row {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; background: var(--surface);
  border-top: 1px solid var(--border); cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--text);
  transition: background .1s; position: absolute; bottom: 0; left: 0; right: 0;
}
.add-to-cart-row:hover { background: var(--surface2); }

/* ── Orders list ──────────────────────────────────────────── */
.order-list { flex: 1; overflow-y: auto; background: var(--surface); }
.order-list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
.order-list-item:hover { background: var(--surface2); }
.order-list-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: #fee2e2; display: flex; align-items: center;
  justify-content: center; font-size: 20px; flex-shrink: 0;
}
.order-list-info  { flex: 1; min-width: 0; }
.order-list-ref   { font-size: 14px; font-weight: 500; color: var(--text); }
.order-list-date  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.order-list-right { text-align: right; flex-shrink: 0; }
.order-list-amount { font-size: 14px; font-weight: 600; color: var(--text); }
.order-list-badges { display: flex; gap: 4px; justify-content: flex-end; margin-top: 4px; }

/* ── Order filter tabs ────────────────────────────────────── */
.order-filter-tabs { display: flex; gap: 8px; padding: 12px; overflow-x: auto; border-bottom: 1px solid var(--border); background: #fafafa; }
.filter-btn {
  flex: 0 0 auto; padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.filter-btn:hover { background: var(--surface2); }
.filter-btn-active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Order detail ─────────────────────────────────────────── */
.order-detail-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.order-detail-body {
  display: grid; grid-template-columns: 1fr 1fr;
  flex: 1; overflow: hidden;
}
.order-detail-left {
  border-right: 1px solid var(--border); overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.order-detail-right { overflow-y: auto; }
.order-summary-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; text-align: center;
}
.order-brand-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: #fee2e2; display: inline-flex; align-items: center;
  justify-content: center; font-size: 26px; margin-bottom: 10px;
}
.order-ref  { font-size: 17px; font-weight: 700; color: var(--text); }
.order-date { font-size: 13px; color: var(--text-muted); margin: 4px 0 10px; }
.order-status-row { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
.order-totals-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
}
.order-total-line {
  display: flex; justify-content: space-between;
  font-size: 14px; padding: 5px 0; color: var(--text-muted);
}
.order-total-line strong { color: var(--text); font-weight: 700; }
.order-action-btns { display: flex; flex-direction: column; gap: 8px; }
.order-action-btn {
  padding: 12px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--accent); text-align: center; transition: background .1s;
}
.order-action-btn:hover { background: var(--surface2); }
.order-detail-section { border-bottom: 1px solid var(--border); background: var(--surface); }
.order-detail-sec-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; font-size: 14px; font-weight: 600; color: var(--text);
}
.order-detail-sec-header .sec-link { color: var(--accent); font-weight: 400; font-size: 13px; }
.order-items-thumbs { display: flex; gap: 8px; padding: 0 16px 14px; }
.order-item-thumb {
  width: 48px; height: 64px; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--border);
}
.quick-action-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s; font-size: 14px;
}
.quick-action-row:hover { background: var(--surface2); }
.qa-row-icon  { font-size: 17px; width: 24px; text-align: center; color: var(--text-muted); }
.qa-row-label { flex: 1; font-weight: 500; color: var(--text); }
.qa-row-chevron { color: var(--text-muted); }

/* ── Cart panel (right) ───────────────────────────────────── */
.cart-panel {
  width: 450px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--surface); overflow: hidden;
}
.cart-top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.cart-more-actions {
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; background: none; border: none;
}
.cart-more-actions:hover { color: var(--text); }
.cart-clear-btn {
  color: var(--danger); font-size: 13px; font-weight: 500;
  background: none; border: none; cursor: pointer;
}
.cart-clear-btn:hover { opacity: .75; }

.add-customer-btn {
  margin: 10px 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface2); cursor: pointer; font-size: 14px;
  color: var(--text-muted); font-weight: 500; transition: all .15s;
}
.add-customer-btn:hover { border-color: var(--accent); color: var(--accent); background: #eff6ff; }
.member-row-light {
  display: flex; align-items: center; justify-content: space-between;
  background: #dbeafe; border-left: 3px solid var(--accent);
  padding: 8px 12px; margin: 0 12px 4px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--accent);
}
.member-row-light button { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; }

.cart-items { flex: 1; overflow-y: auto; }
.cart-empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); gap: 10px;
}
.cart-empty-icon { font-size: 48px; opacity: .25; }
.cart-empty-text { font-size: 14px; }

.cart-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.cart-row-cover {
  width: 36px; height: 50px; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--border); flex-shrink: 0;
}
.cart-row-cover-ph {
  width: 36px; height: 50px; border-radius: 4px;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; color: var(--border);
}
.cart-row-info { flex: 1; min-width: 0; }
.cart-row-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.cart-row-price { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cart-row-qty   { display: flex; align-items: center; gap: 6px; }
.qty-btn {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .1s;
}
.qty-btn:hover { background: var(--border); }
.qty-val { font-size: 14px; font-weight: 700; min-width: 22px; text-align: center; color: var(--text); }
.cart-row-line { min-width: 68px; text-align: right; font-weight: 600; font-size: 13px; color: var(--text); }
.cart-row-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 17px; padding: 4px; transition: color .15s; }
.cart-row-remove:hover { color: var(--danger); }

.cart-footer { flex-shrink: 0; border-top: 1px solid var(--border); }
.cart-totals { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 14px; color: var(--text-muted);
}
.total-row span:last-child { font-weight: 600; color: var(--text); }
.total-final {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 17px; font-weight: 700; padding-top: 10px;
  border-top: 1px solid var(--border); margin-top: 6px; color: var(--text);
}
.total-final span:last-child { color: var(--success); }

/* ── Payment section ──────────────────────────────────────── */
.payment-section { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.payment-methods { display: flex; gap: 6px; margin-bottom: 12px; }
.pay-btn {
  flex: 1; padding: 9px 6px; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.pay-btn:hover { border-color: var(--accent); color: var(--accent); }
.pay-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.quick-cash { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.quick-btn {
  padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: 12px;
  cursor: pointer; font-weight: 600; transition: background .15s;
}
.quick-btn:hover { background: var(--border); }
.change-display {
  font-size: 15px; font-weight: 600; text-align: center;
  padding: 10px; background: #d1fae5; border-radius: var(--radius);
  margin-bottom: 10px; color: #065f46;
}

.cart-bottom-bar {
  display: flex; align-items: center;
  padding: 11px 14px; gap: 10px;
  background: var(--surface);
}
.cart-summary-text { flex: 1; font-size: 13px; color: var(--text-muted); font-weight: 500; }
.btn-charge-main {
  flex-shrink: 0; padding: 10px 22px;
  background: var(--success); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 700; cursor: pointer; transition: background .15s;
}
.btn-charge-main:hover { background: #047857; }
.btn-charge-main:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon  { font-size: 48px; margin-bottom: 12px; opacity: .4; }

/* ══════════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════════ */
.modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-box {
  position: relative; background: var(--surface);
  border-radius: 14px; padding: 28px 32px; width: 420px; max-width: 95vw;
  box-shadow: 0 24px 64px rgba(0,0,0,.15);
}
.modal-box h3 { margin-bottom: 18px; font-size: 18px; color: var(--text); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Receipt */
.receipt-box { width: 420px; }
.receipt-content {
  font-family: Arial, sans-serif; font-size: 12px;
  padding: 14px; background: #fff; color: #000;
  border: 1px solid var(--border); border-radius: 6px;
  max-height: 55vh; overflow-y: auto; margin-bottom: 10px; line-height: 1.5;
}
.receipt-actions { display: flex; gap: 10px; }

/* Receipt HTML elements */
.rcpt-header { text-align: center; font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.rcpt-subheader { text-align: center; font-size: 11px; color: #444; margin: 1px 0; }
.rcpt-hr { border: none; border-top: 1px dashed #999; margin: 5px 0; }
.rcpt-hr-thick { border-top: 2px solid #000; }
.rcpt-meta { font-size: 11px; margin: 3px 0; }
.rcpt-meta div { margin: 1px 0; }
.rcpt-items { margin: 3px 0; }
.rcpt-item { display: flex; justify-content: space-between; align-items: flex-start; margin: 4px 0; font-size: 11px; gap: 8px; }
.rcpt-item-name { flex: 1; min-width: 0; }
.rcpt-item-sub { font-size: 10px; color: #555; margin-top: 1px; }
.rcpt-item-price { text-align: right; white-space: nowrap; font-size: 11px; }
.rcpt-totals { margin: 3px 0; }
.rcpt-row { display: flex; justify-content: space-between; font-size: 12px; margin: 2px 0; }
.rcpt-row-total { font-weight: 700; font-size: 15px; margin: 5px 0; border-top: 1px solid #ccc; padding-top: 4px; }
.rcpt-thanks { text-align: center; font-weight: 600; font-size: 13px; margin-top: 6px; }
.rcpt-thanks-sub { text-align: center; font-size: 11px; color: #555; margin-top: 2px; }

/* ── Member / discount / history modals ──────────────────── */
.discount-type-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.discount-type-btn {
  flex: 1; padding: 6px; border: 1.5px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--text-muted); cursor: pointer; font-size: 13px; transition: all .15s;
}
.discount-type-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.member-results { max-height: 220px; overflow-y: auto; margin-top: 8px; }
.member-result-row { padding: 10px 12px; border-radius: 6px; cursor: pointer; border-bottom: 1px solid var(--border); }
.member-result-row:hover { background: var(--surface2); }
.member-result-name { font-weight: 600; font-size: 14px; color: var(--text); }
.member-result-sub  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.history-modal-box { width: 560px; max-height: 80vh; display: flex; flex-direction: column; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.history-header h3 { margin: 0; }
.history-list { overflow-y: auto; flex: 1; }
.history-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; }
.history-voided { opacity: .5; }
.history-item-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.history-ref { font-family: monospace; font-size: 11px; color: var(--text-muted); flex: 1; }
.history-total { font-weight: 700; color: var(--success); }
.history-item-mid { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.history-items-list { font-size: 12px; color: var(--text-muted); }
.history-date-row { display: flex; align-items: center; gap: 6px; }
.history-date-input { border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 13px; color: var(--text); }
.history-item-actions { display: flex; gap: 8px; margin-top: 6px; }
.receipt-code-badge { font-family: monospace; font-size: 11px; font-weight: 700; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.receipt-qr-wrap { text-align: center; padding: 10px 0 4px; }
.receipt-qr-wrap img { display: inline-block; border: 4px solid #fff; border-radius: 4px; }

/* ── Universal Search Screen ──────────────────────────────── */
.search-tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--border); }
.search-tab {
  flex: 1; padding: 8px 4px; border: none; border-bottom: 2px solid transparent;
  background: none; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer;
  border-radius: 4px 4px 0 0; transition: color .15s, border-color .15s;
}
.search-tab.active  { color: var(--primary); border-bottom-color: var(--primary); }
.search-tab:hover:not(.active) { color: var(--text); }
.search-tab-content { overflow-y: auto; flex: 1; }

/* ── Report Modal ─────────────────────────────────────────── */
.report-modal-box { width: 640px; max-height: 85vh; display: flex; flex-direction: column; padding: 20px; }
.report-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.report-header h3 { margin: 0; }
.report-period-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.report-period-btn {
  flex: 1; padding: 8px; border: 1px solid var(--border); background: var(--surface2);
  border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-muted);
  transition: all .15s;
}
.report-period-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.report-date-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; }
.report-date-row label { color: var(--text-muted); }
.report-content { overflow-y: auto; flex: 1; }
.report-actions { display: flex; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 8px; }

/* Report content styles */
.rpt-title       { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 2px; }
.rpt-period      { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 16px; }
.rpt-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.rpt-kpi         { background: var(--surface2); border-radius: 8px; padding: 12px; text-align: center; }
.rpt-kpi-val     { font-size: 22px; font-weight: 700; color: var(--primary); }
.rpt-kpi-lbl     { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rpt-section-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 6px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.rpt-pay-breakdown { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.rpt-pay-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.rpt-items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rpt-items-table th { text-align: left; padding: 6px 8px; border-bottom: 2px solid var(--border); background: var(--surface2); font-weight: 600; color: var(--text-muted); font-size: 11px; }
.rpt-items-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.rpt-items-table tbody tr:hover { background: var(--surface2); }
.rpt-footer { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 16px; padding-top: 8px; border-top: 1px dashed var(--border); }

/* ── Custom Sale Screen ────────────────────────────────────── */
.custom-sale-form-only {
  padding: 16px; overflow-y: auto; display: flex; flex-direction: column;
  flex: 1; gap: 0;
}
.custom-sale-form-only .form-group { margin-bottom: 12px; }
.custom-sale-form-only label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.custom-sale-form-only input[type=checkbox] { cursor: pointer; }
.required { color: var(--danger); }
.error-text { color: var(--danger); font-size: 11px; display: block; margin-top: 2px; }

.qty-controls {
  display: grid; grid-template-columns: 50px 1fr 50px; gap: 8px; align-items: center;
}
.qty-btn {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface2); color: var(--text); cursor: pointer; font-size: 16px; font-weight: 600;
  transition: all .15s;
}
.qty-btn:hover { background: #e3e6ef; }
.qty-input {
  text-align: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600;
}

.qa-orange { --tile-bg: #fed7aa; --tile-text: #92400e; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1200px) { .cart-panel { width: 380px; } .quick-actions-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1100px) { .cart-panel { width: 350px; } .quick-actions-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) {
  .pos-body { flex-direction: column; }
  .left-panel, .cart-panel { width: 100%; flex-shrink: 0; height: 50%; }
  .cart-panel { border-top: 1px solid var(--border); }
  .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
  .order-detail-body { grid-template-columns: 1fr; }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Print (receipt / window.print() fallback) ─────────────── */
@media print {
  @page { size: 80mm auto; margin: 4mm 3mm; }

  body > *:not(#receipt-modal):not(#report-modal) { display: none !important; }
  #receipt-modal { display: block !important; position: static !important; background: none !important; }
  #report-modal  { display: block !important; position: static !important; background: none !important; }
  .modal-backdrop { display: none !important; }
  .modal-box {
    position: static !important; width: 100% !important; max-width: 100% !important;
    padding: 0 !important; box-shadow: none !important; border-radius: 0 !important;
    background: #fff !important;
  }
  .receipt-actions, .report-actions, .report-header, .report-period-tabs, .report-date-row { display: none !important; }

  #receipt-content {
    max-height: none !important; overflow: visible !important;
    border: none !important; padding: 0 !important; margin: 0 !important;
    font-family: Arial, sans-serif !important;
    font-size: 10pt !important; line-height: 1.45 !important;
    color: #000 !important; background: #fff !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .rcpt-header { font-size: 12pt !important; }
  .rcpt-subheader { font-size: 8pt !important; color: #333 !important; }
  .rcpt-meta { font-size: 9pt !important; }
  .rcpt-item, .rcpt-item-price { font-size: 9pt !important; }
  .rcpt-item-sub { font-size: 8pt !important; }
  .rcpt-row { font-size: 10pt !important; }
  .rcpt-row-total { font-size: 12pt !important; }
  .rcpt-thanks { font-size: 11pt !important; }
  .rcpt-thanks-sub { font-size: 9pt !important; color: #444 !important; }

  #receipt-qr-wrap { text-align: center !important; margin-top: 4mm !important; }

  /* Report print layout */
  #report-modal .report-modal-box { width: 100% !important; max-height: none !important; overflow: visible !important; }
  #report-content { max-height: none !important; overflow: visible !important; }
  .rpt-kpi-val   { font-size: 18pt !important; }
  .rpt-items-table { width: 100% !important; }
}


