/* PharmaMaster - responsive PWA styles (light/dark, LTR/RTL via logical properties) */
:root {
  --bg: #f3f6f9;
  --surface: #ffffff;
  --bg-card: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #0d9488;
  --primary-600: #0f766e;
  --primary-soft: #ccfbf1;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --yellow: #a16207;
  --yellow-soft: #fef9c3;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 195px;
  --topbar-h: 54px;
  --font: "Segoe UI", "Tahoma", "Noto Sans Arabic", "Noto Sans", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0a1120;
  --surface: #111a2d;
  --surface-2: #152038;
  --surface-3: #1b2844;
  --text: #e5ebf5;
  --muted: #8ea0bd;
  --border: #23314f;
  --primary: #14b8a6;
  --primary-600: #2dd4bf;
  --primary-soft: rgba(20, 184, 166, .16);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .15);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .14);
  --yellow: #fde047;
  --yellow-soft: rgba(253, 224, 71, .12);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, .14);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, .15);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
svg.ic { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: Consolas, "Courier New", monospace; letter-spacing: .02em; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: end; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.spacer { flex: 1; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ------------------------------------------------------------------ boot / login */
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 20% 10%, var(--primary-soft), transparent 45%), var(--bg); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 30px 26px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #0d9488, #0e7490); display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.brand-logo svg { width: 24px; height: 24px; stroke-width: 2.6; }
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: .01em; }
.demo-creds { margin-top: 16px; background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .84rem; }
.demo-creds button { margin: 3px; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 12px; gap: 6px; z-index: 40; }
.sidebar .brand { padding: 4px 8px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 600; cursor: pointer; transition: background .15s; }
.nav-link:hover { background: var(--surface-3); }
.nav-link.active { background: var(--primary-soft); color: var(--primary-600); }
.nav-link .badge { margin-inline-start: auto; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.main { min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar { position: sticky; top: 0; z-index: 35; height: var(--topbar-h); flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 1.08rem; }
.menu-btn { display: none; }
.content { padding: 10px; flex: 1; width: 100%; max-width: 100%; margin: 0 auto; min-width: 0; overflow-y: auto; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--success-soft); color: var(--success); cursor: pointer; border: 0; font-family: inherit; }
.status-chip.offline { background: var(--danger-soft); color: var(--danger); }
.status-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.bottom-nav { display: none; }
.scrim { display: none; }

/* ------------------------------------------------------------------ components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 14px; }
.grid.kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi .value { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .8rem; color: var(--muted); }
.kpi .kpi-ic { position: absolute; inset-inline-end: 14px; top: 14px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.kpi.danger .kpi-ic { background: var(--danger-soft); color: var(--danger); }
.kpi.warning .kpi-ic { background: var(--warning-soft); color: var(--warning); }
.kpi.info .kpi-ic { background: var(--info-soft); color: var(--info); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; transition: transform .05s, background .15s, border-color .15s; white-space: nowrap; user-select: none; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-600); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 5px 9px; font-size: .82rem; border-radius: 8px; }
.btn.lg { padding: 13px 18px; font-size: 1.02rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px; }
.btn.active { background: var(--primary-soft); color: var(--primary-600); border-color: var(--primary); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: .8rem; font-weight: 650; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--surface); }
.input.lg { padding: 13px 14px; font-size: 1.05rem; }
.input-group { display: flex; gap: 6px; align-items: stretch; }
.input-group .input { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: .74rem; font-weight: 700; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.amber { background: var(--warning-soft); color: var(--warning); }
.badge.yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.blue { background: var(--info-soft); color: var(--info); }
.badge.teal { background: var(--primary-soft); color: var(--primary-600); }
.badge.solid-red { background: var(--danger); color: #fff; }

.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .78rem; }
.tbl th, .tbl td { padding: 5px 5px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { background: var(--surface-2); font-size: .72rem; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); position: sticky; top: 0; z-index: 1; line-height: 1.25; }
.tbl select.input { font-size: .76rem; padding: 3px 5px !important; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tfoot td { font-weight: 800; background: var(--surface-2); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; background: var(--surface-2); padding: 5px; border-radius: 12px; border: 1px solid var(--border); }
.tab { flex: 1; min-width: 90px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 10px; border-radius: 9px; cursor: pointer; font-weight: 700; color: var(--muted); border: 0; background: transparent; font: inherit; }
.tab.active { background: var(--surface); color: var(--primary-600); box-shadow: var(--shadow); }

.alert-box { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 11px; background: var(--info-soft); color: var(--info); font-weight: 600; font-size: .9rem; }
.alert-box.warn { background: var(--warning-soft); color: var(--warning); }
.alert-box.danger { background: var(--danger-soft); color: var(--danger); }

/* ------------------------------------------------------------------ modal / toast */
.modal-back { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); animation: pop .18s; }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.toasts { position: fixed; bottom: 18px; inset-inline-end: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(380px, calc(100vw - 36px)); }
.toast { background: var(--text); color: var(--surface); padding: 11px 14px; border-radius: 11px; box-shadow: var(--shadow); font-weight: 600; display: flex; gap: 8px; align-items: center; animation: pop .2s; }
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.warn { background: var(--warning); color: #111; }

/* ------------------------------------------------------------------ POS */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; align-items: start; }
.pos-search, .inv-search, .sticky-search-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 16px rgba(15, 23, 42, .08);
}
.smart-search-wrap { position: relative; }
.smart-dd {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline: 0;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .18);
  max-height: 410px;
  overflow-y: auto;
}
.smart-dd.hidden { display: none; }
.smart-dd-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .08s;
}
.smart-dd-item:last-child { border-bottom: 0; }
.smart-dd-item:hover, .smart-dd-item.active { background: var(--primary-soft); }
.smart-dd-item.smart-dd-add { background: var(--surface-2); color: var(--primary-600); font-weight: 700; }
.smart-dd-item.smart-dd-add.active, .smart-dd-item.smart-dd-add:hover { background: var(--primary-soft); }
.smart-dd-main { min-width: 0; flex: 1; }
.smart-dd-brand { font-weight: 750; font-size: .95rem; line-height: 1.3; }
.smart-dd-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; font-size: .78rem; color: var(--muted); }
.smart-dd-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.unit-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: .73rem;
  color: var(--muted);
}
mark.hl {
  background: #fef08a;
  color: #0f172a;
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 800;
}
.scan-hint { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); margin-top: 8px; }
.scan-hint .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 var(--success); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.drug-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 14px; }
.drug-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .05s; }
.drug-card:hover { border-color: var(--primary); }
.drug-card:active { transform: scale(.99); }
.drug-card.oos { opacity: .78; border-style: dashed; cursor: default; }
.drug-card .name { font-weight: 750; }
.drug-card .generic { font-size: .8rem; color: var(--muted); }
.drug-card .price { font-weight: 800; color: var(--primary-600); }
.alt-box { margin-top: 4px; padding: 8px; border-radius: 9px; background: var(--warning-soft); }
.alt-box .alt { display: flex; justify-content: space-between; gap: 6px; padding: 5px 6px; border-radius: 7px; cursor: pointer; font-size: .84rem; font-weight: 650; color: var(--text); }
.alt-box .alt:hover { background: var(--surface); }
.cart { position: sticky; top: 0; display: flex; flex-direction: column; max-height: calc(100vh - var(--topbar-h) - 24px); padding: 0; }
.cart-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.cart-lines { overflow: auto; flex: 1; padding: 6px 10px; min-height: 120px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 6px; border-bottom: 1px dashed var(--border); }
.cart-line:last-child { border-bottom: 0; }
.cart-line .ln-name { font-weight: 700; }
.cart-line .ln-meta { font-size: .78rem; color: var(--muted); }
.cart-line .ln-ctrl { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.qty button { width: 32px; height: 32px; border: 0; background: var(--surface-2); color: var(--text); font-size: 1.1rem; cursor: pointer; font-weight: 800; }
.qty input { width: 48px; height: 32px; border: 0; text-align: center; background: var(--surface); color: var(--text); font: inherit; font-weight: 700; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.seg button { padding: 6px 10px; border: 0; background: var(--surface-2); color: var(--muted); font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }
.seg button.on { background: var(--primary); color: #fff; }
.cart-foot { border-top: 1px solid var(--border); padding: 12px 16px; display: flex; flex-direction: column; gap: 9px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.totals-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.totals-row.grand { font-size: 1.3rem; font-weight: 850; }
.pay-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay-box { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.pay-box .big { font-size: 1.3rem; font-weight: 850; }
.quick-cash { display: flex; gap: 6px; flex-wrap: wrap; }
.receipt-preview { background: #fff; color: #000; border-radius: 10px; padding: 10px; max-height: 50vh; overflow: auto; border: 1px solid var(--border); }

/* ------------------------------------------------------------------ dashboard */
.chart { width: 100%; height: 220px; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: middle; }
.alert-list { display: flex; flex-direction: column; gap: 6px; max-height: 330px; overflow: auto; }
.alert-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.alert-item .grow div:first-child { font-weight: 700; }
.tier-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tier-tabs .btn { gap: 6px; }
.pay-bars { display: flex; flex-direction: column; gap: 10px; }
.pay-bar { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; font-size: .86rem; }
.pay-bar .track { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.pay-bar .fill { height: 100%; border-radius: 99px; }

/* ------------------------------------------------------------------ camera */
#qr-reader { width: 100%; border-radius: 12px; overflow: hidden; background: #000; min-height: 240px; }
#qr-reader video { border-radius: 12px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; transform: translateX(-105%); transition: transform .22s; box-shadow: var(--shadow); }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  .shell.drawer-open .sidebar { transform: none; }
  .shell.drawer-open .scrim { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .content { padding: 12px 12px 86px; }
  .topbar { padding: 0 10px; }
  .bottom-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; inset-inline: 0; z-index: 45; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; font-weight: 700; color: var(--muted); padding: 4px; border-radius: 10px; }
  .bottom-nav a.active { color: var(--primary-600); background: var(--primary-soft); }
  .bottom-nav svg.ic { width: 21px; height: 21px; }
  .pos { grid-template-columns: 1fr; }
  .pos-search, .cart { position: static; max-height: none; }
  .cart-lines { max-height: none; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .toasts { bottom: 84px; }
  .hide-sm { display: none !important; }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .value { font-size: 1.15rem; }
  .kpi .kpi-ic { display: none; }
  .drug-grid { grid-template-columns: 1fr 1fr; }
  .modal-back { padding: 0; place-items: end stretch; }
  .modal { width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .modal.wide { width: 100%; }
  .pay-split { grid-template-columns: 1fr; }
  .topbar h1 { font-size: .98rem; }
  .hide-xs { display: none !important; }
}

/* ------------------------------------------------------------------ print */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  body { background: #fff; color: #000; }
  #print-area { display: block !important; }
}
.receipt { font-family: "Segoe UI", Tahoma, Arial, sans-serif; color: #000; background: #fff; }
.receipt.thermal { width: 76mm; padding: 2mm 2mm 6mm; font-size: 11.5px; margin: 0 auto; }
.receipt.thermal h2 { font-size: 15px; text-align: center; }
.receipt.thermal .c { text-align: center; }
.receipt.thermal hr { border: 0; border-top: 1px dashed #000; margin: 5px 0; }
.receipt.thermal table { width: 100%; border-collapse: collapse; }
.receipt.thermal td, .receipt.thermal th { padding: 2px 0; vertical-align: top; text-align: start; font-size: 11px; }
.receipt.thermal .r { text-align: end; }
.receipt.thermal .tot { font-size: 14px; font-weight: 800; }
.receipt.a4 { width: 100%; max-width: 186mm; margin: 0 auto; font-size: 12.5px; }
.receipt.a4 .head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #0d9488; padding-bottom: 12px; margin-bottom: 14px; gap: 20px; }
.receipt.a4 h1 { font-size: 22px; color: #0d9488; }
.receipt.a4 table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.receipt.a4 th { background: #f1f5f9; text-align: start; padding: 8px; border-bottom: 2px solid #cbd5e1; font-size: 11.5px; }
.receipt.a4 td { padding: 7px 8px; border-bottom: 1px solid #e2e8f0; }
.receipt.a4 .r { text-align: end; }
.receipt.a4 .totals { width: 300px; margin-inline-start: auto; }
.receipt.a4 .totals td { border: 0; padding: 4px 8px; }
.receipt.a4 .totals .grand td { font-size: 16px; font-weight: 800; border-top: 2px solid #0d9488; }
.receipt.a4 .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; margin-bottom: 8px; }
.receipt.a4 .foot { margin-top: 30px; border-top: 1px solid #cbd5e1; padding-top: 10px; text-align: center; color: #475569; font-size: 11px; }
.receipt.a4 .sign { display: flex; justify-content: space-between; margin-top: 50px; }
.receipt.a4 .sign div { border-top: 1px solid #000; width: 180px; text-align: center; padding-top: 4px; }

/* ------------------------------------------------------------------ Shelf Map & Ops */
.loc-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 7px; font-size: .74rem; font-weight: 700; background: var(--info-soft); color: var(--info); }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 12px; }
.shelf-cell { background: var(--surface-2); border: 2px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; transition: border-color .15s, background .15s, transform .08s; display: flex; flex-direction: column; gap: 6px; }
.shelf-cell:hover { border-color: var(--primary); }
.shelf-cell.active { border-color: var(--primary); background: var(--primary-soft); }
.shelf-cell.drag-over { border-style: dashed; border-color: var(--warning); background: var(--warning-soft); transform: scale(1.01); }
.drag-item { cursor: grab; }
.drag-item:active { cursor: grabbing; }
