/* Retail POS — practical retail UI */

:root {
  --ink: #1c1917;
  --ink-soft: #44403c;
  --muted: #78716c;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;
  --bg: #f5f2ed;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --brand: #0f3d2e;
  --brand-2: #1a5c45;
  --accent: #c45c26;
  --accent-soft: #f3e0d4;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --warn: #a16207;
  --warn-bg: #fef3c7;
  --err: #b91c1c;
  --err-bg: #fee2e2;
  --info: #1e3a5f;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.06);
  --radius: 8px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

.app-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* Fixed sidebar so page scroll never reveals cream bg beside/under nav */
.sidebar {
  width: var(--sidebar-w);
  background: var(--brand);
  color: #f5f5f4;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  height: 100vh;
  height: 100dvh;
  flex-shrink: 0;
  z-index: 50;
  overflow: hidden;
}
.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.brand-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 6px;
  font-size: 13px;
}
.sidebar-brand strong { display: block; font-size: 14px; }
.sidebar-brand small { color: rgba(255,255,255,0.65); font-size: 12px; }
.sidebar-nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sidebar-nav a {
  color: rgba(255,255,255,0.82);
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: rgba(255,255,255,0.14); color: #fff; }
.sidebar-foot {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  background: var(--brand);
}
.user-chip strong { display: block; font-size: 13px; color: #fff; }
.user-chip span { font-size: 12px; color: rgba(255,255,255,0.6); }
.btn-sidebar-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.08);
  color: #fff !important;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none !important;
}
.btn-sidebar-logout:hover {
  background: rgba(255,255,255,0.18);
  color: #fff !important;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.45);
  z-index: 45;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  background: var(--bg);
  min-height: 100vh;
  transition: margin-left 0.2s ease, width 0.2s ease;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 650; flex: 1; min-width: 0; }
.topbar-right { color: var(--muted); font-size: 13px; white-space: nowrap; }
.content { padding: 20px; }
.sidebar-toggle { display: inline-flex !important; }

/* Desktop/tablet: collapse with Menu button */
.sidebar {
  transition: transform 0.2s ease;
  transform: translateX(0);
}
body.nav-collapsed .sidebar {
  transform: translateX(-100%);
}
body.nav-collapsed .main-wrap {
  margin-left: 0;
  width: 100%;
}
body.nav-collapsed .sidebar-backdrop.show {
  display: none; /* no overlay needed when desktop-collapsed */
}

.flash {
  margin: 12px 20px 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
}
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--err); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  padding: 9px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { background: var(--brand-2); color: #fff; text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn-accent { background: var(--accent); }
.btn-accent:hover { filter: brightness(0.95); background: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-lg { padding: 12px 16px; font-size: 15px; }
.btn-block { width: 100%; }

.input, .select, textarea.input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}
.input:focus, .select:focus, textarea.input:focus {
  outline: 2px solid rgba(26, 92, 69, 0.25);
  border-color: var(--brand-2);
}
.input-lg { padding: 12px 14px; font-size: 16px; }
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-row label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2 { margin: 0; font-size: 15px; font-weight: 650; }
.card-body { padding: 16px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th, table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
table.data th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 650;
}
table.data tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  background: var(--surface-2);
  color: var(--ink-soft);
}
.badge-ok, .badge-success, .badge-synced { background: var(--ok-bg); color: var(--ok); }
.badge-err, .badge-failed { background: var(--err-bg); color: var(--err); }
.badge-warn, .badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-pos { background: #e0e7ff; color: #3730a3; }
.badge-shopify { background: #dcfce7; color: #166534; }
.badge-woocommerce { background: #e0f2fe; color: #075985; }
.badge-manual { background: #f3e8ff; color: #6b21a8; }
.badge-manual { background: #f3e8ff; color: #6b21a8; }
.badge-muted { background: var(--line); color: var(--muted); }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; }

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at top left, rgba(196, 92, 38, 0.12), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(15, 61, 46, 0.14), transparent 45%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 12px 40px rgba(28, 25, 23, 0.08);
}
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card .sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }

.pos-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.85fr);
  gap: 16px;
  min-height: calc(100vh - 120px);
}
.pos-left, .pos-right {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.pos-toolbar {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pos-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pos-results { padding: 8px; overflow: auto; flex: 1; }
.pos-empty, .empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.product-hit {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.product-hit:hover { border-color: var(--brand-2); background: #f7fbf9; }
.product-hit .name { font-weight: 650; }
.product-hit .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.product-hit .price { font-weight: 700; white-space: nowrap; }

.cart-header, .pos-cart-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cart-header h2, .pos-cart-header h2 { margin: 0; font-size: 15px; }
.cart-items, .pos-cart { flex: 1 1 auto; overflow: auto; padding: 8px; min-height: 0; }
.cart-summary {
  border-top: 1px solid var(--line);
  padding: 12px 14px 16px;
  background: var(--surface-2);
  flex-shrink: 0;
}
.cart-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
}
.cart-line .title { font-weight: 650; font-size: 14px; }
.cart-line .meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; font-size: 12px; color: var(--muted); }
.cart-line .line-total { font-weight: 700; white-space: nowrap; }
.qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.qty-controls button {
  width: 28px; height: 28px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
}
.cart-line .remove {
  border: 0;
  background: transparent;
  color: var(--err);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 0;
  margin-top: 4px;
}
.cart-line input.price-edit {
  width: 88px;
  padding: 4px 6px;
  font-size: 12px;
}
.line-disc-controls {
  display: flex;
  gap: 4px;
  align-items: center;
  margin: 4px 0;
}
.line-disc-controls .select,
.line-disc-controls .input {
  width: auto;
  min-width: 0;
  padding: 4px 6px;
  font-size: 12px;
}
.line-disc-controls .select { width: 52px; }
.line-disc-controls .input { width: 72px; }
.line-disc-controls .disc-amt {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: 14px;
}
.summary-row.total { font-size: 18px; font-weight: 750; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.pay-methods {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.pay-methods button {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 650;
  padding: 10px 6px;
}
.pay-methods button.active {
  border-color: var(--brand);
  background: #e8f2ed;
  color: var(--brand);
}
.cash-tender { margin-top: 8px; display: none; }
.cash-tender.show { display: block; }

/* —— Billing: single-screen POS (no page scroll) —— */
body.page-pos {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}
body.page-pos .main-wrap {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
body.page-pos .topbar {
  flex-shrink: 0;
  padding: 8px 14px;
  position: static;
}
body.page-pos .topbar h1 { font-size: 16px; }
body.page-pos .topbar-right .topbar-date { display: none; }
body.page-pos .flash {
  flex-shrink: 0;
  margin: 8px 12px 0;
  padding: 8px 12px;
}
body.page-pos .content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 10px;
  overflow: hidden;
}
.pos-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pos-chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.pos-chrome-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.pos-chrome-meta strong { font-size: 14px; }
.pos-chrome-meta .muted { font-size: 12px; }
.pos-chrome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}
body.page-pos .pos-shell {
  flex: 1;
  min-height: 0;
  height: 100%;
  gap: 10px;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 380px);
}
body.page-pos .pos-toolbar {
  flex-shrink: 0;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}
body.page-pos .pos-toolbar #posSearch {
  flex: 1;
  min-width: 0;
}
body.page-pos .pos-toolbar .btn {
  flex-shrink: 0;
  white-space: nowrap;
}
body.page-pos .pos-results {
  padding: 6px;
  overscroll-behavior: contain;
}
body.page-pos .product-hit {
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 6px;
}
body.page-pos .product-hit .name { font-size: 13px; }
body.page-pos .pos-empty {
  padding: 20px 12px;
  font-size: 13px;
}
body.page-pos .cart-header {
  padding: 8px 12px;
}
body.page-pos .cart-items {
  padding: 6px;
  overscroll-behavior: contain;
}
body.page-pos .cart-line {
  padding: 8px;
  margin-bottom: 6px;
}
body.page-pos .cart-line .title { font-size: 13px; }
body.page-pos .cart-summary {
  padding: 8px 10px 10px;
}
body.page-pos .summary-row {
  padding: 2px 0;
  font-size: 13px;
}
body.page-pos .summary-row.total {
  font-size: 17px;
  margin-top: 4px;
  padding-top: 6px;
}
body.page-pos .pay-methods {
  margin: 8px 0;
  gap: 6px;
}
body.page-pos .pay-methods button {
  padding: 8px 4px;
  font-size: 12px;
}
body.page-pos #btnCheckout {
  margin-top: 4px;
  padding: 12px 14px;
}
.pos-customer-row {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 6px;
  margin-bottom: 6px;
}
.pos-discount-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.pos-discount-row label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 4.5rem;
}
.pos-discount-row .input,
.input-sm {
  padding: 6px 8px;
  font-size: 13px;
}
.pos-discount-row .input { flex: 1; min-width: 0; }
body.page-pos .cash-tender { margin-top: 4px; }
body.page-pos .form-row { margin-bottom: 0; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px; }
.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.toast-wrap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  min-width: 240px;
  max-width: 360px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }

.progress-bar {
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--brand-2);
  width: 0;
  transition: width 0.25s ease;
}

.receipt-page {
  background: #e7e5e4;
  padding: 20px;
  margin: 0;
}
.receipt-actions {
  text-align: center;
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.receipt {
  width: 72mm;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  padding: 8px 6px 12px;
  font-family: "Courier New", Courier, ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.25;
  color: #000;
  box-sizing: border-box;
}
.receipt .r-header { margin-bottom: 2px; }
.receipt .r-store {
  text-align: center;
  margin: 0 0 3px;
  font-size: 16px;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0.02em;
}
.receipt h2 { text-align: center; margin: 0 0 4px; font-size: 14px; }
.receipt .center { text-align: center; }
.receipt .r-meta { font-size: 11px; color: #222; line-height: 1.3; }
.receipt .r-sep {
  margin: 5px 0;
  font-size: 11px;
  line-height: 1;
  letter-spacing: -0.5px;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-align: center;
  width: 100%;
}
.receipt hr { display: none; }
/* Tables: reliable left/right columns on mobile thermal print (flex often collapses) */
.receipt table.r-row {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 1px 0;
}
.receipt table.r-row td {
  padding: 0;
  vertical-align: top;
  font-size: inherit;
  font-family: inherit;
  color: #000;
}
.receipt table.r-row td.r-l { text-align: left; width: 42%; word-break: break-word; }
.receipt table.r-row td.r-r { text-align: right; width: 58%; white-space: nowrap; }
.receipt .r-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #000;
  margin: 2px 0 4px;
  font-weight: 700;
}
.receipt .r-item { margin-bottom: 6px; }
.receipt .r-item-name { font-weight: 700; font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
.receipt .r-variant { font-weight: 400; color: #222; }
.receipt .r-sku { font-size: 10px; color: #333; margin: 0 0 1px; }
.receipt .r-total td { font-weight: 700; font-size: 13px; padding-top: 2px; }
.receipt .r-channel { font-size: 10px; color: #222; }
.receipt .r-logo { text-align: center; margin-bottom: 4px; }
.receipt .r-logo img {
  max-width: 42mm;
  max-height: 18mm;
  width: auto;
  height: auto;
  object-fit: contain;
}
.receipt .r-line-disc td { font-size: 10px; color: #333; }
.receipt .r-terms {
  margin-top: 6px;
  font-size: 9px;
  line-height: 1.3;
  color: #333;
  text-align: center;
  white-space: pre-wrap;
}
.receipt .mono { font-family: inherit; }

.toolbar-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Compact filter bars — dates/selects must NOT stretch full width */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filters-bar .input,
.filters-bar .select,
.filters-bar .btn {
  width: auto;
  max-width: none;
}
.filters-bar .filter-q {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 280px;
  width: auto !important;
}
.filters-bar .filter-date {
  flex: 0 0 9.5rem;
  width: 9.5rem !important;
  max-width: 9.5rem;
  min-width: 9.5rem;
}
.filters-bar .filter-select {
  flex: 0 0 auto;
  width: 9.5rem !important;
  max-width: 11rem;
  min-width: 8rem;
}
.filters-bar .btn {
  flex: 0 0 auto;
}

@media (max-width: 980px) {
  /* Phone: drawer overlay — closed until Menu opens it */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 8px 0 24px rgba(0,0,0,0.18);
  }
  body.nav-open .sidebar {
    transform: translateX(0) !important;
  }
  body.nav-open .sidebar-backdrop.show,
  body.nav-open .sidebar-backdrop {
    display: block !important;
  }
  /* Ignore desktop collapsed class on phones */
  body.nav-collapsed .sidebar {
    transform: translateX(-100%);
  }
  body.nav-collapsed.nav-open .sidebar {
    transform: translateX(0) !important;
  }
  body.nav-collapsed .main-wrap,
  .main-wrap {
    margin-left: 0;
    width: 100%;
  }
  .pos-shell { grid-template-columns: 1fr; min-height: auto; }
  body.page-pos {
    overflow: auto;
    height: auto;
  }
  body.page-pos .main-wrap {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  body.page-pos .content {
    overflow: visible;
    height: auto;
  }
  body.page-pos .pos-page {
    height: auto;
  }
  body.page-pos .pos-shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100dvh - 120px);
  }
  body.page-pos .pos-left {
    flex: 1 1 auto;
    min-height: 36vh;
    max-height: 42vh;
  }
  body.page-pos .pos-right {
    flex: 1 1 auto;
    min-height: 48vh;
  }
  body.page-pos .pos-toolbar {
    flex-wrap: wrap;
  }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .pay-methods { grid-template-columns: repeat(2, 1fr); }
  .pos-left { min-height: 42vh; }
  .pos-right { min-height: auto; }
  .content { padding: 14px; }
  .topbar { padding: 12px 14px; }
  .topbar-right .topbar-date { display: none; }
  .pos-customer-row { grid-template-columns: 1fr 1fr; }
  .pos-chrome-actions { margin-left: 0; width: 100%; }
  .filters-bar .filter-q {
    flex: 1 1 100%;
    max-width: none;
    width: 100% !important;
  }
}

@media (max-width: 560px) {
  .auth-card { padding: 20px 16px; }
  .stat .value { font-size: 18px; }
  table.data th, table.data td { padding: 8px; font-size: 13px; }
  .filters-bar .filter-date,
  .filters-bar .filter-select {
    flex: 1 1 calc(50% - 8px);
    width: auto !important;
    min-width: 0;
    max-width: none;
  }
}

@media print {
  .no-print { display: none !important; }
  @page {
    margin: 0;
    size: auto;
  }
  html, body, body.receipt-page {
    width: 100% !important;
    min-width: 100% !important;
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .receipt {
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 100% !important;
    margin: 0 !important;
    padding: 1mm 2mm 3mm !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .receipt table.r-row { width: 100% !important; }
  .receipt .r-sep { color: #000 !important; width: 100% !important; }
}
