:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --line: #dfe6f1;
  --blue: #1264d8;
  --blue-2: #0b4bad;
  --cyan: #0891b2;
  --green: #059669;
  --red: #dc2626;
  --amber: #d97706;
  --shadow: 0 16px 40px rgba(15, 23, 42, .08);
}

body.dark {
  --bg: #121722;
  --panel: #1b2332;
  --text: #edf2ff;
  --muted: #a6b0c2;
  --line: #2d384c;
  --blue: #60a5fa;
  --blue-2: #3b82f6;
  --shadow: 0 16px 36px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Tahoma, Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(18, 100, 216, .08), transparent 280px),
    var(--bg);
  color: var(--text);
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 8px; padding: 10px 14px; background: var(--blue); color: #fff; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
button:hover { background: var(--blue-2); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel);
  color: var(--text);
  min-height: 42px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(18, 100, 216, .14); border-color: var(--blue); }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
th { color: var(--muted); font-size: 12px; }
.hidden { display: none !important; }
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(23, 105, 224, .16), transparent 35%),
    linear-gradient(315deg, rgba(5, 150, 105, .10), transparent 32%),
    #eef3f9;
}
.login-panel {
  width: min(980px, 100%);
  min-height: 590px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--panel);
  border: 1px solid rgba(223, 230, 241, .9);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(17, 24, 39, .16);
}
.login-hero {
  position: relative;
  padding: 42px;
  color: white;
  background:
    linear-gradient(160deg, rgba(17, 24, 39, .92), rgba(23, 105, 224, .82)),
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.18), transparent 28%);
  display: grid;
  align-content: center;
  gap: 18px;
}
.login-hero::after {
  content: "";
  position: absolute;
  inset-inline-start: 36px;
  bottom: 36px;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
}
.login-hero h1 { margin: 0; font-size: 44px; line-height: 1.25; }
.login-hero p { margin: 0; max-width: 390px; color: #dbeafe; font-size: 18px; line-height: 1.8; }
.login-hero footer { align-self: end; color: #cbd5e1; font-size: 13px; z-index: 1; }
.login-metrics { display: flex; flex-wrap: wrap; gap: 10px; z-index: 1; }
.login-metrics span { border: 1px solid rgba(255,255,255,.24); background: rgba(255,255,255,.08); padding: 8px 12px; border-radius: 8px; }
.login-card {
  padding: 46px;
  display: grid;
  align-content: center;
  gap: 18px;
}
.login-card h2 { margin: 0 0 8px; font-size: 30px; }
.login-card p { margin: 0; color: var(--muted); line-height: 1.7; }
.login-card input { min-height: 48px; background: #f8fafc; border-color: #d7e0ee; }
.login-card input:focus { outline: 3px solid rgba(23, 105, 224, .16); border-color: var(--blue); }
.login-card button { min-height: 50px; font-weight: 800; font-size: 16px; }
.login-card button:disabled { opacity: .7; cursor: wait; }
.brand-mark, .logo { display: grid; place-items: center; background: var(--blue); color: white; border-radius: 8px; font-weight: 800; }
.brand-mark { width: 72px; height: 72px; font-size: 26px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); z-index: 1; }
#loginError { color: var(--red); min-height: 20px; font-weight: 700; }
.app { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, #0f172a, #172033); color: #e5eefb; padding: 18px; display: grid; grid-template-rows: auto 1fr auto auto auto; gap: 18px; box-shadow: 12px 0 34px rgba(15, 23, 42, .18); }
.side-brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.side-brand > div:nth-child(2) { min-width: 0; flex: 1; }
.side-brand strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-brand .logo { width: 48px; height: 48px; overflow: hidden; }
.side-brand img { width: 100%; height: 100%; object-fit: cover; }
.side-brand strong, .side-brand span { display: block; }
.side-brand span, .sidebar footer { color: #a7b1c2; font-size: 12px; }
#nav { display: grid; gap: 8px; align-content: start; }
#nav button, .secret { width: 100%; text-align: right; background: transparent; color: #dbe7f6; border: 1px solid transparent; display: flex; gap: 10px; justify-content: flex-start; min-height: 44px; }
#nav button.active, #nav button:hover, .secret:hover { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.16); box-shadow: inset 3px 0 0 var(--blue); }
.drawer-close, .drawer-overlay, .menu-btn, .drawer-session { display: none; }
main { min-width: 0; }
.topbar { height: 78px; padding: 0 24px; display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,.86); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 4; }
body.dark .topbar { background: rgba(27, 35, 50, .88); }
.topbar-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-identity > div { min-width: 0; }
.topbar h2 { margin: 0 0 4px; font-size: 22px; }
.topbar span { color: var(--muted); }
.top-actions { display: flex; gap: 10px; align-items: center; }
.ghost, .icon-btn { background: transparent; color: var(--text); border: 1px solid var(--line); }
.notification-btn { position: relative; width: 42px; height: 42px; padding: 0; font-weight: 900; }
.badge { position: absolute; top: -7px; inset-inline-start: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--red); color: white; font-size: 12px; display: grid; place-items: center; border: 2px solid var(--panel); }
.notification-panel { position: fixed; top: 88px; inset-inline-end: 22px; width: min(420px, calc(100vw - 44px)); max-height: calc(100vh - 110px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 24px 70px rgba(15,23,42,.22); z-index: 8; padding: 16px; }
.notification-panel h4 { margin: 14px 0 8px; }
.alert-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.alert-summary div { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(18,100,216,.06); }
.alert-summary strong, .alert-summary span { display: block; }
.alert-summary span { color: var(--muted); font-size: 12px; margin-top: 4px; }
.view { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.view > *, .grid > * { min-width: 0; }
.grid { display: grid; gap: 14px; min-width: 0; }
.cards { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.dashboard-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card, .panel { background: var(--panel); border: 1px solid rgba(223, 230, 241, .9); border-radius: 8px; box-shadow: var(--shadow); }
.card { padding: 18px; position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--blue), var(--cyan)); }
.card small { color: var(--muted); }
.card strong { display: block; margin-top: 8px; font-size: 24px; }
.panel { padding: 18px; overflow: auto; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.barcode-options { align-items: end; }
.barcode-options .check { display: flex; grid-template-columns: none; align-items: center; gap: 9px; min-height: 42px; }
.barcode-options .check input { width: 18px; min-height: 18px; height: 18px; accent-color: var(--blue); }
.barcode-preview { min-height: 190px; padding: 20px; display: grid; place-items: center; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #eef2f7; }
.barcode-preview .barcode-label { width: 50mm; height: 30mm; padding: 1mm; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; border: 1px solid #cbd5e1; background: #fff; color: #000; box-shadow: 0 8px 22px rgba(15,23,42,.12); text-align: center; }
.barcode-preview .barcode-store-name { font: 900 10px/1 Arial, sans-serif; letter-spacing: .03em; }
.barcode-preview .barcode-product-name { display: block; width: 100%; margin-top: .35mm; font-size: 11px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barcode-preview .barcode-svg { display: block; width: 100%; height: 12mm; margin: .35mm 0 .2mm; }
.barcode-preview .barcode-human { font: 8px/1 Arial, sans-serif; letter-spacing: .08em; }
.barcode-preview .barcode-price { margin-top: .35mm; font-size: 13px; line-height: 1; font-weight: 900; }
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
.table-scroll table { width: max-content; min-width: 100%; }
.compact-data table { width: 100%; }
.action-table th:last-child, .action-table td:last-child { position: sticky; left: 0; z-index: 1; background: var(--panel); box-shadow: 1px 0 0 var(--line); }
.action-table th:last-child { z-index: 2; }
.danger { background: var(--red); }
.success { background: var(--green); }
.warn { background: var(--amber); }
.muted { color: var(--muted); }
.text-red { color: var(--red); }
.alert-grid, .report-split { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.alert-panel { box-shadow: none; }
.alert-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.alert-line:last-child { border-bottom: 0; }
.alert-line strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-line span { padding: 5px 8px; border-radius: 8px; font-weight: 700; white-space: nowrap; }
.alert-line.stock span { color: var(--amber); background: rgba(217, 119, 6, .12); }
.alert-line.credit span { color: var(--red); background: rgba(220, 38, 38, .10); }
.users-shell { min-height: calc(100vh - 126px); }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.user-card { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(18,100,216,.05), transparent), var(--panel); border-radius: 8px; padding: 16px; display: grid; gap: 10px; }
.user-card strong, .user-card span { display: block; }
.user-card span, .user-card p { color: var(--muted); margin: 0; }
.status-on, .status-off { justify-self: start; border-radius: 999px; padding: 5px 10px; font-weight: 800; }
.status-on { color: var(--green); background: rgba(5,150,105,.12); }
.status-off { color: var(--red); background: rgba(220,38,38,.10); }
.permissions-box { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: rgba(18,100,216,.04); }
.permission-group { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.permission-group h4 { margin: 0 0 10px; }
.check-row { display: flex; grid-template-columns: none; align-items: center; gap: 10px; color: var(--text); padding: 8px 0; }
.check-row input { width: 18px; min-height: 18px; height: 18px; accent-color: var(--blue); }
.maintenance-shell { min-height: calc(100vh - 126px); }
.maintenance-tabs { display: flex; gap: 10px; margin: 18px 0 12px; border-bottom: 1px solid var(--line); }
.maintenance-tabs button { background: transparent; color: var(--muted); border-radius: 8px 8px 0 0; border: 1px solid transparent; border-bottom: 0; }
.maintenance-tabs button.active { color: var(--blue); background: rgba(18,100,216,.08); border-color: var(--line); font-weight: 800; }
.maintenance-table td:last-child { min-width: 250px; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 92px; padding: 6px 9px; border-radius: 999px; color: var(--amber); background: rgba(217,119,6,.12); font-size: 12px; font-weight: 800; }
.status-pill.ready { color: var(--blue); background: rgba(18,100,216,.12); }
.status-pill.done { color: var(--green); background: rgba(5,150,105,.12); }
.pos { display: grid; grid-template-columns: 1fr 390px; gap: 16px; align-items: start; }
.category-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.category-tabs button { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.category-tabs button.active { color: white; background: var(--blue); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.product-tile { min-height: 120px; background: var(--panel); color: var(--text); border: 1px solid var(--line); display: grid; align-content: space-between; text-align: right; }
.product-tile strong { font-size: 15px; }
.product-tile span { color: var(--muted); }
.product-tile .tile-price { color: var(--blue); font-weight: 700; }
.product-tile .tile-price small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.product-tile:hover, .product-tile:focus-visible {
  background: rgba(18, 100, 216, .08);
  color: var(--text);
  border-color: var(--blue);
  box-shadow: 0 6px 18px rgba(18, 100, 216, .14);
  transform: translateY(-1px);
}
.product-tile:focus-visible { outline: 3px solid rgba(18, 100, 216, .18); outline-offset: 2px; }
.product-tile:active { background: rgba(18, 100, 216, .14); color: var(--text); transform: translateY(0); }
.product-tile:hover > strong, .product-tile:hover > small,
.product-tile:focus-visible > strong, .product-tile:focus-visible > small,
.product-tile:active > strong, .product-tile:active > small { color: var(--text); }
body.dark .product-tile:hover, body.dark .product-tile:focus-visible { background: rgba(96, 165, 250, .12); }
body.dark .product-tile:active { background: rgba(96, 165, 250, .18); }
.pos-search { margin: 0 0 14px; padding: 12px; border: 1px solid rgba(18,100,216,.24); border-inline-start: 4px solid var(--blue); border-radius: 8px; background: rgba(18,100,216,.045); }
.pos-search input { font-size: 16px; min-height: 48px; }
.pos-search small { color: var(--muted); }
.registered-customer-fields { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(18,100,216,.04); }
.customer-summary { grid-column: 1 / -1; min-height: 58px; display: grid; gap: 3px; align-content: center; padding: 10px 12px; border-inline-start: 4px solid var(--blue); background: rgba(18,100,216,.06); }
.customer-summary strong, .customer-summary span, .customer-summary small { display: block; }
.row-actions { display: flex; flex-wrap: nowrap; gap: 6px; }
.row-actions button { white-space: nowrap; padding: 8px 10px; }
.account-search { max-width: 360px; margin-bottom: 12px; }
.empty-state, .loading-state, .error-state { margin: 12px 0; padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line); background: rgba(107,114,128,.04); }
.missing-product { grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; }
.missing-product p { margin: 0; }
.form-error { min-height: 20px; margin: 0; color: var(--red); font-weight: 700; }
.full-field { grid-column: 1 / -1; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.qty { display: flex; gap: 6px; align-items: center; }
.qty button { width: 32px; height: 32px; padding: 0; }
.cart-quantity-label { width: 78px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px; margin: 0; padding: 3px 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.cart-quantity-label span { color: var(--muted); font-size: 11px; }
.cart-quantity-label input { width: 100%; min-width: 0; height: 28px; padding: 2px; border: 0; text-align: center; background: transparent; }
.cart-quantity-label input.invalid { color: var(--red); outline: 2px solid var(--red); border-radius: 4px; }
.meter-product-check { margin-bottom: 14px; padding: 12px; border: 1px solid rgba(18,100,216,.25); border-radius: 8px; background: rgba(18,100,216,.05); font-weight: 800; }
.unit-badge, .return-status { display: inline-block; color: var(--blue); font-weight: 800; }
.return-status.full { color: var(--red); }
.return-status.partial { color: #b56a00; }
.receipt-actions.with-return { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.return-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 10px; }
.return-dialog-head h3 { margin: 0 0 4px; }
.return-items { display: grid; gap: 8px; margin: 14px 0; }
.return-item { display: grid; grid-template-columns: auto minmax(0, 1fr) 110px; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(107,114,128,.035); }
.return-item > input[type="checkbox"] { width: 20px; height: 20px; }
.return-item > span { display: grid; gap: 3px; }
.return-item small { color: var(--muted); }
.return-estimate { display: grid; gap: 8px; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.return-estimate > div { display: flex; justify-content: space-between; gap: 10px; }
.return-estimate .final { padding-top: 8px; border-top: 1px solid var(--line); color: var(--red); font-size: 17px; }
.receipt-returns { display: grid; gap: 1.5mm; margin-top: 4mm; padding: 2.5mm 0; border-top: .4mm dotted #000; border-bottom: .4mm dotted #000; }
.receipt-returns > div { display: flex; justify-content: space-between; gap: 4mm; }
.totals { display: grid; gap: 8px; margin: 12px 0; }
.totals div { display: flex; justify-content: space-between; }
.totals .final { font-size: 24px; font-weight: 800; color: var(--blue); }
.remaining-total { align-items: center; padding-top: 8px; border-top: 1px solid var(--line); }
.remaining-total span small { display: block; max-width: 230px; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.remaining-total > strong { color: var(--red); }
dialog { width: min(900px, 94vw); max-width: 94vw; max-height: 94vh; border: 0; border-radius: 8px; padding: 0; overflow: hidden; background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgba(6, 12, 24, .55); }
.modal-card { width: 100%; min-width: 0; max-height: 94vh; padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; overflow: auto; box-sizing: border-box; }
.modal-card > * { min-width: 0; }
.close { justify-self: start; width: 36px; height: 36px; padding: 0; background: transparent; color: var(--text); border: 1px solid var(--line); }
.receipt-dialog-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; min-width: 0; }
.receipt-dialog-head > div:first-child { display: grid; gap: 4px; }
.receipt-dialog-head strong { font-size: 18px; }
.receipt-dialog-head small { color: var(--muted); }
.receipt-preview-switch { width: min(100%, 300px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.receipt-preview-switch.two-options { grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(100%, 230px); }
.receipt-preview-switch button { min-width: 0; padding: 8px 10px; }
.receipt-preview-switch button.active { color: #fff; background: #111827; border-color: #111827; }
.receipt-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.receipt-actions.two-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.receipt-actions button { min-width: 0; }
.receipt-preview {
  width: 100%;
  max-width: 100%;
  background: #e9e7e2;
  color: #000;
  padding: clamp(14px, 4vw, 32px);
  border: 1px solid #d4d0c8;
  direction: rtl;
  overflow: auto;
}
.sales-receipt {
  --receipt-rule: #000;
  width: min(100%, 180mm);
  margin: 0 auto;
  padding: 8mm 9mm 7mm;
  background: #fff;
  color: #000;
  direction: rtl;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .11);
}
.receipt--normal { width: 180mm; }
.receipt--thermal58 { width: 58mm; padding: 3mm; font-size: 10.5px; }
.receipt--thermal58 .receipt-brand-lockup { gap: 2mm; min-height: 16mm; }
.receipt--thermal58 .receipt-brand-rule { width: 9mm; }
.receipt--thermal58 .receipt-brand-mark { width: 8.5mm; height: 8.5mm; font-size: 9px; }
.receipt--thermal58 .receipt-brand-logo { max-width: 27mm; max-height: 16mm; }
.receipt--thermal58 .receipt-masthead h1 { font-size: 16px; }
.receipt--thermal58 .receipt-title-block { margin: 3.5mm 0 2mm; padding: 1.8mm 0; }
.receipt--thermal58 .receipt-meta { grid-template-columns: 1fr; margin-bottom: 2mm; }
.receipt--thermal58 .receipt-meta div { padding: .8mm 0; }
.receipt--thermal58 .receipt-items { margin-top: 2mm; }
.receipt--thermal58 .receipt-item { padding: 1.8mm 0; }
.receipt--thermal58 .receipt-item-math { gap: 2mm; }
.receipt--thermal58 .receipt-line-total { min-width: 18mm; }
.receipt--thermal58 .receipt-totals { margin-top: 2.5mm; }
.receipt--thermal58 .receipt-payment-status { margin: 2.5mm auto; }
.receipt--thermal58 .receipt-footer { margin-top: 3mm; }
.receipt--thermal58 .receipt-cut { margin-top: 4mm; }
.receipt--thermal80 { width: 80mm; padding: 4mm; font-size: 12px; }
.receipt--thermal80 .receipt-masthead h1 { font-size: 19px; }
.receipt--thermal80 .receipt-meta { gap: 0 5mm; }
.receipt--thermal80 .receipt-line-total { min-width: 23mm; }
.sales-receipt *, .sales-receipt *::before, .sales-receipt *::after { box-sizing: border-box; }
.receipt-numeric { font-variant-numeric: tabular-nums lining-nums; }
.receipt-masthead { text-align: center; }
.receipt-brand-lockup { display: flex; align-items: center; justify-content: center; gap: 3mm; min-height: 22mm; }
.receipt-brand-rule { width: 13mm; border-top: .45mm solid var(--receipt-rule); }
.receipt-brand-mark { width: 10mm; height: 10mm; display: grid; place-items: center; border: .55mm solid var(--receipt-rule); font-size: 11px; font-weight: 900; letter-spacing: .04em; direction: ltr; }
.receipt-brand-logo { display: block; max-width: 38mm; max-height: 22mm; object-fit: contain; filter: grayscale(1) contrast(1.25); }
.receipt-masthead h1 { margin: 1.5mm 0 0; font-size: 21px; line-height: 1.25; font-weight: 900; overflow-wrap: anywhere; }
.receipt-contact, .receipt-address { margin: 1mm auto 0; max-width: 130mm; }
.receipt-contact { direction: ltr; font-weight: 700; }
.receipt-address { font-size: .92em; }
.receipt-title-block { display: flex; align-items: center; justify-content: space-between; gap: 4mm; margin: 5mm 0 3mm; padding: 2.3mm 0; border-top: .4mm dotted var(--receipt-rule); border-bottom: .4mm dotted var(--receipt-rule); }
.receipt-title-block p { margin: 0; font-size: 1.12em; font-weight: 900; }
.receipt-invoice-number { white-space: nowrap; font-size: 1.05em; }
.receipt-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8mm; margin: 0 0 3mm; }
.receipt-meta div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2mm; padding: 1.1mm 0; border-bottom: .25mm dotted #555; break-inside: avoid; }
.receipt-meta dt, .receipt-meta dd { margin: 0; }
.receipt-meta dt { font-weight: 700; }
.receipt-meta dt::after { content: ":"; }
.receipt-meta dd { min-width: 0; text-align: left; overflow-wrap: anywhere; }
.receipt-meta dd.receipt-numeric { direction: ltr; }
.receipt-items { margin-top: 3mm; border-top: .55mm solid var(--receipt-rule); }
.receipt-items-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4mm; padding: 1.6mm 0; border-bottom: .55mm solid var(--receipt-rule); font-size: .88em; font-weight: 900; }
.receipt-item { padding: 2.2mm 0; border-bottom: .35mm dotted #333; break-inside: avoid; page-break-inside: avoid; }
.receipt-item-name { display: grid; grid-template-columns: 6mm minmax(0, 1fr); gap: 1.5mm; align-items: start; }
.receipt-item-index { width: 5mm; height: 5mm; display: grid; place-items: center; border: .3mm solid var(--receipt-rule); font-size: .78em; font-weight: 800; line-height: 1; direction: ltr; }
.receipt-item-name strong { min-width: 0; overflow-wrap: anywhere; word-break: normal; }
.receipt-item-math { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4mm; align-items: baseline; margin-top: 1.2mm; padding-inline-start: 7.5mm; }
.receipt-equation, .receipt-line-total { white-space: nowrap; }
.receipt-equation { text-align: left; font-size: .9em; }
.receipt-line-total { min-width: 25mm; text-align: left; font-size: 1.02em; }
.sales-receipt small { font-size: .78em; font-weight: inherit; white-space: nowrap; }
.receipt-totals { display: grid; gap: 0; margin-top: 3mm; border-top: .55mm solid var(--receipt-rule); border-bottom: 1.2mm double var(--receipt-rule); break-inside: avoid; page-break-inside: avoid; }
.receipt-totals > div { display: flex; justify-content: space-between; gap: 4mm; padding: 1.1mm 0; }
.receipt-totals strong { white-space: nowrap; }
.receipt-grand-total { margin-top: .7mm; padding: 2mm 0 !important; border-top: 1.2mm double var(--receipt-rule); font-size: 1.3em; font-weight: 900; }
.receipt-payment-status { margin: 3mm auto; padding: 2mm 3mm; border: .55mm solid var(--receipt-rule); text-align: center; break-inside: avoid; page-break-inside: avoid; }
.receipt-payment-status strong { font-size: 1.04em; }
.receipt-footer { margin-top: 4mm; text-align: center; }
.receipt-footer > strong { display: block; font-size: 1.08em; }
.receipt-footer p { margin: 1.5mm auto 0; max-width: 125mm; white-space: pre-wrap; overflow-wrap: anywhere; }
.receipt-cut { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2mm; margin-top: 5mm; color: #333; }
.receipt-cut span { border-top: .35mm dotted var(--receipt-rule); }
.receipt-cut small { direction: ltr; }
.thermal-document { box-sizing: border-box; margin: 0 auto; background: #fff; color: #000; direction: rtl; font-family: Tahoma, Arial, sans-serif; line-height: 1.45; box-shadow: 0 8px 28px rgba(0,0,0,.12); font-variant-numeric: tabular-nums lining-nums; }
.thermal-document *, .thermal-document *::before, .thermal-document *::after { box-sizing: border-box; }
.thermal-document.receipt--thermal58 { width: 58mm; padding: 3mm; font-size: 9.5px; }
.thermal-document.receipt--thermal80 { width: 80mm; padding: 4mm; font-size: 11px; }
.thermal-head { text-align: center; }
.thermal-head img { display: block; max-width: 22mm; max-height: 12mm; margin: 0 auto 1.5mm; object-fit: contain; filter: grayscale(1) contrast(1.3); }
.thermal-head h1 { margin: 0; font-size: 1.55em; font-weight: 900; }
.thermal-head h2 { margin: 1.5mm 0 .6mm; font-size: 1.15em; }
.thermal-head p { margin: .5mm 0; overflow-wrap: anywhere; }
.thermal-reference { display: block; margin: .8mm 0 1.5mm; font-size: 1.05em; }
.thermal-divider { border-top: .4mm dotted #000; margin: 2.3mm 0; }
.thermal-meta { margin: 0; }
.thermal-meta div { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 2mm; padding: .9mm 0; border-bottom: .3mm dotted #444; }
.thermal-meta dt, .thermal-meta dd { margin: 0; }
.thermal-meta dt { font-weight: 800; }
.thermal-meta dt::after { content: ":"; }
.thermal-meta dd { text-align: left; overflow-wrap: anywhere; }
.thermal-balance { display: flex; justify-content: space-between; gap: 2mm; margin: 2mm 0; padding: 1.8mm 0; border-top: .55mm solid #000; border-bottom: 1mm double #000; font-size: 1.18em; }
.thermal-note, .maintenance-terms { margin: 2mm 0; padding: 1.5mm; border: .35mm solid #000; font-size: .88em; text-align: center; }
.ledger-head, .ledger-row { display: grid; grid-template-columns: minmax(0,1fr) 9mm 9mm 11mm; gap: 1mm; align-items: start; }
.ledger-head { margin-top: 2mm; padding: 1.2mm 0; border-top: .55mm solid #000; border-bottom: .55mm solid #000; font-size: .78em; font-weight: 900; text-align: center; }
.ledger-row { padding: 1.5mm 0; border-bottom: .3mm dotted #333; font-size: .78em; text-align: left; break-inside: avoid; page-break-inside: avoid; }
.ledger-row > div { min-width: 0; text-align: right; }
.ledger-row > div strong, .ledger-row > div small { display: block; overflow-wrap: anywhere; }
.ledger-row > div small { margin-top: .4mm; }
.ledger-row > span, .ledger-row > strong { text-align: left; white-space: nowrap; }
.ledger-row.opening { font-weight: 800; }
.thermal-empty { padding: 3mm 0; text-align: center; border-bottom: .3mm dotted #333; }
.thermal-footer { text-align: center; margin-top: 2mm; }
.thermal-footer > strong { display: block; font-size: 1.08em; }
.thermal-footer p { margin: 1mm 0 0; font-size: .82em; }
.thermal-section { margin-top: 2mm; border-top: .5mm solid #000; border-bottom: .3mm dotted #333; padding: 1.5mm 0; }
.thermal-section > strong { display: block; margin-bottom: .7mm; }
.thermal-section p { margin: 0; min-height: 4mm; white-space: pre-wrap; overflow-wrap: anywhere; }
.maintenance-amounts { margin-top: 2mm; border-top: .55mm solid #000; border-bottom: 1mm double #000; }
.maintenance-amounts div, .expected-date { display: flex; justify-content: space-between; gap: 2mm; padding: 1mm 0; }
.expected-date { margin-top: 1.5mm; padding: 1.5mm 0; border-bottom: .4mm dotted #000; }
.thermal-signatures { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 5mm; margin: 4mm 0 2mm; text-align: center; }
.thermal-signatures span { display: block; }
.thermal-signatures b { display: block; height: 7mm; border-bottom: .3mm dotted #000; }
.thermal-thanks { margin: 0; text-align: center; font-weight: 900; }
.costs-shell { display: grid; gap: 16px; }
.costs-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, .72fr);
  gap: 24px;
  align-items: end;
  padding: 4px 2px 16px;
  border-bottom: 2px solid var(--text);
}
.costs-header h3 { margin: 3px 0 0; font-size: 25px; line-height: 1.35; }
.costs-header > p { max-width: 480px; margin: 0; color: var(--muted); line-height: 1.85; font-size: 13px; }
.costs-kicker { margin: 0; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.costs-primary-grid, .costs-operational-grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.costs-primary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.costs-operational-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cost-metric { min-width: 0; min-height: 105px; padding: 15px; background: var(--panel); border-inline-start: 3px solid transparent; }
.cost-metric small { display: block; min-height: 32px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.costs-amount { display: block; margin-top: 10px; font-size: 20px; line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; letter-spacing: -.02em; }
.cost-metric.is-blue { border-inline-start-color: var(--blue); }
.cost-metric.is-green { border-inline-start-color: var(--green); }
.cost-metric.is-amber { border-inline-start-color: var(--amber); }
.cost-metric.is-red { border-inline-start-color: var(--red); }
.cost-metric.is-green .costs-amount, .text-green { color: var(--green); }
.cost-metric.is-amber .costs-amount, .text-amber { color: var(--amber); }
.cost-metric.is-red .costs-amount { color: var(--red); }
.cost-metric.net-profit { background: color-mix(in srgb, var(--green) 5%, var(--panel)); }
.cost-metric.net-profit.is-red { background: color-mix(in srgb, var(--red) 5%, var(--panel)); }
.costs-flow { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 12px 26px rgba(15, 23, 42, .05); }
.costs-flow-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.costs-flow-title span { font-weight: 800; }
.costs-flow-title small { color: var(--muted); font-size: 12px; }
.costs-flow-track { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr); align-items: stretch; padding: 15px; }
.flow-stop { min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-content: start; padding: 2px 12px 0; }
.flow-index { grid-row: span 2; padding-top: 2px; color: var(--muted); font: 800 11px/1 Arial, sans-serif; direction: ltr; }
.flow-stop small { color: var(--muted); font-size: 12px; }
.flow-stop .costs-amount { margin-top: 5px; font-size: 22px; }
.flow-stop i { grid-column: 1 / -1; display: block; height: 5px; margin-top: 14px; overflow: hidden; background: rgba(18, 100, 216, .10); }
.flow-stop i b { display: block; height: 100%; min-width: 8px; background: var(--blue); }
.flow-stop.sales i { background: rgba(8, 145, 178, .12); }
.flow-stop.sales i b { background: var(--cyan); }
.flow-stop.profit i { background: rgba(5, 150, 105, .12); }
.flow-stop.profit i b { background: var(--green); }
.flow-stop.profit .costs-amount { color: var(--green); }
.flow-stop.profit.negative i { background: rgba(220, 38, 38, .11); }
.flow-stop.profit.negative i b { background: var(--red); }
.flow-stop.profit.negative .costs-amount { color: var(--red); }
.flow-arrow { display: grid; place-items: center; color: var(--muted); font-size: 23px; font-family: Arial, sans-serif; }
.costs-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 3px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.costs-section-heading span { font-size: 15px; font-weight: 800; }
.costs-section-heading small { color: var(--muted); font-size: 12px; }
.costs-operational-grid .cost-metric { min-height: 96px; padding: 13px; }
.costs-operational-grid .cost-metric small { min-height: 30px; }
.costs-operational-grid .costs-amount { font-size: 17px; }
.costs-health { padding: 0; overflow: hidden; box-shadow: none; }
.costs-health .panel-head { margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.costs-health .panel-head small { color: var(--muted); font-size: 12px; }
.costs-health-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.costs-health-item { min-width: 0; min-height: 74px; display: grid; align-content: center; gap: 5px; padding: 12px 15px; border-inline-start: 1px solid var(--line); }
.costs-health-item:first-child { border-inline-start: 0; }
.costs-health-item span { color: var(--muted); font-size: 12px; }
.costs-health-item strong { font-size: 18px; font-variant-numeric: tabular-nums lining-nums; }
.costs-health-item.attention strong { color: var(--amber); }
.costs-health-item.costs-danger strong { color: var(--red); }
.costs-health-item.positive strong { color: var(--green); }
.costs-table-panel { padding: 0; overflow: hidden; box-shadow: none; }
.costs-table-panel .panel-head { margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.costs-table-panel .panel-head > div { min-width: 0; }
.costs-table-panel .panel-head small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.costs-table-total { color: var(--blue); font-size: 16px; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.costs-table-total.amber { color: var(--amber); }
.costs-table { margin: 0; }
.costs-scroll-hint { display: none; color: var(--muted); }
.costs-table table { min-width: 900px; }
.costs-table th { padding: 10px 14px; background: rgba(18, 100, 216, .045); white-space: nowrap; }
.costs-table td { padding: 12px 14px; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.costs-table tbody tr:hover { background: rgba(18, 100, 216, .04); }
.costs-table-panel .empty-state { margin: 0; border: 0; border-radius: 0; }
@media (max-width: 980px) {
  .login-panel { grid-template-columns: 1fr; }
  .login-hero { min-height: 260px; padding: 28px; }
  .login-hero h1 { font-size: 32px; }
  .login-card { padding: 28px; }
  .pos { grid-template-columns: 1fr; }
  .costs-primary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .costs-operational-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .costs-health-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .costs-health-item:nth-child(4) { border-inline-start: 0; }
  .costs-flow-track { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .flow-stop { padding: 9px 0; }
  .flow-arrow { width: 28px; height: 23px; margin-inline-start: 12px; transform: rotate(-90deg); }
}
@media (max-width: 760px) {
  html, body { width: 100%; max-width: 100%; overflow-x: clip; }
  body.nav-open { overflow: hidden; }
  .login-shell { min-height: 100dvh; padding: 10px; align-items: center; }
  .login-panel { width: 100%; min-height: 0; }
  .login-hero { min-height: 150px; padding: 18px 20px; grid-template-columns: 52px minmax(0, 1fr); align-content: center; gap: 6px 14px; }
  .login-hero::after { display: none; }
  .login-hero .brand-mark { width: 52px; height: 52px; grid-row: 1 / 3; font-size: 19px; }
  .login-hero h1 { font-size: 24px; line-height: 1.25; }
  .login-hero p { font-size: 13px; line-height: 1.55; }
  .login-hero .login-metrics, .login-hero footer { display: none; }
  .login-card { padding: 20px; gap: 12px; }
  .login-card h2 { font-size: 24px; }
  .login-card input, .login-card button { min-height: 48px; }

  .app { display: block; min-height: 100dvh; }
  .sidebar { position: fixed; z-index: 31; inset: 0 0 0 auto; width: min(86vw, 310px); height: 100dvh; padding: 14px; gap: 12px; overflow-y: auto; overscroll-behavior: contain; transform: translateX(105%); visibility: hidden; transition: transform .22s ease, visibility .22s; box-shadow: -18px 0 50px rgba(2, 6, 23, .34); }
  .sidebar.open { transform: translateX(0); visibility: visible; }
  .side-brand { padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.12); }
  .side-brand .logo { width: 44px; height: 44px; flex: 0 0 auto; }
  .drawer-close { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; min-height: 40px; padding: 0; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.14); }
  #nav { gap: 5px; }
  #nav button, .secret { min-height: 44px; padding: 9px 12px; }
  .drawer-session { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 10px; align-items: center; padding: 11px 12px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06); border-radius: 8px; }
  .drawer-session div { min-width: 0; }
  .drawer-session strong, .drawer-session small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .drawer-session small { margin-top: 3px; color: #a7b1c2; }
  .session-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.15); }
  .sidebar footer { padding-top: 8px; border-top: 1px solid rgba(255,255,255,.1); }
  .drawer-overlay { display: block; position: fixed; z-index: 30; inset: 0; width: 100%; height: 100%; padding: 0; border-radius: 0; background: rgba(2, 6, 23, .58); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease, visibility .22s; }
  body.nav-open .drawer-overlay { opacity: 1; visibility: visible; pointer-events: auto; }

  main { width: 100%; }
  .topbar { height: 64px; padding: 0 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; background: var(--panel); backdrop-filter: none; }
  body.dark .topbar { background: var(--panel); }
  .menu-btn { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; flex: 0 0 auto; font-size: 19px; }
  .topbar-identity { gap: 8px; overflow: hidden; }
  .topbar h2 { margin: 0 0 2px; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-identity #headerShop { display: block; max-width: 100%; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions { gap: 5px; }
  .top-actions #currentUser { display: none; }
  .top-actions .icon-btn, .top-actions #logoutBtn { min-width: 40px; height: 40px; min-height: 40px; padding: 0 8px; }
  .notification-btn { width: 40px; }
  .badge { top: -5px; inset-inline-start: -5px; }
  .notification-panel { top: 70px; right: 10px; left: 10px; width: auto; max-height: calc(100dvh - 82px); padding: 14px; z-index: 25; }

  .view { padding: 12px; gap: 12px; }
  .grid { gap: 10px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 13px; min-height: 82px; }
  .card strong { margin-top: 6px; font-size: 18px; overflow-wrap: anywhere; }
  .panel { padding: 13px; }
  .panel-head { gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
  .panel-head h3 { font-size: 16px; }
  .dashboard-split, .alert-grid, .report-split { grid-template-columns: minmax(0, 1fr); }
  .costs-shell { gap: 12px; }
  .costs-header { grid-template-columns: minmax(0, 1fr); gap: 7px; padding-bottom: 12px; }
  .costs-header h3 { font-size: 21px; }
  .costs-header > p { font-size: 12px; line-height: 1.7; }
  .costs-primary-grid, .costs-operational-grid, .costs-health-grid { grid-template-columns: minmax(0, 1fr); }
  .cost-metric, .costs-operational-grid .cost-metric { min-height: 0; padding: 13px; }
  .cost-metric small, .costs-operational-grid .cost-metric small { min-height: 0; }
  .costs-amount, .costs-operational-grid .costs-amount { margin-top: 6px; font-size: 19px; }
  .costs-flow-title, .costs-section-heading { display: grid; gap: 3px; }
  .costs-flow-track { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 12px; }
  .flow-stop { padding: 9px 0; }
  .flow-stop .costs-amount { font-size: 20px; }
  .flow-stop i { margin-top: 9px; }
  .flow-arrow { width: 28px; height: 23px; margin-inline-start: 12px; transform: rotate(-90deg); }
  .costs-health-item, .costs-health-item:nth-child(4) { min-height: 0; padding: 11px 14px; border-inline-start: 0; border-top: 1px solid var(--line); }
  .costs-health-item:first-child { border-top: 0; }
  .costs-table-panel { padding: 0; }
  .costs-table-panel .panel-head { padding: 13px; }
  .costs-scroll-hint { display: block; padding: 9px 13px 0; font-size: 11px; }
  .costs-table { border: 0; border-radius: 0; }
  .costs-table table { min-width: 780px; }
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; align-items: stretch; gap: 8px; }
  .toolbar > button { width: 100%; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  button, input, select, textarea { min-height: 44px; }
  label { font-size: 13px; }
  .alert-line { gap: 8px; }
  .alert-line span { padding: 5px 7px; font-size: 12px; }
  .table-scroll { margin-top: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
  .table-scroll:not(.compact-data) table { min-width: max-content; }
  .table-scroll:not(.compact-data) th, .table-scroll:not(.compact-data) td { white-space: nowrap; }
  .compact-data { border: 0; margin-top: 0; overflow: visible; }
  .compact-data table, .compact-data tbody, .compact-data tr, .compact-data td { display: block; width: 100%; }
  .compact-data thead { display: none; }
  .compact-data tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .compact-data tr:last-child { border-bottom: 0; }
  .compact-data td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  .compact-data td::before { content: attr(data-label); color: var(--muted); font-weight: 700; text-align: right; }

  .pos { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .category-tabs { flex-wrap: nowrap; gap: 7px; padding-bottom: 7px; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
  .category-tabs button { flex: 0 0 auto; min-height: 42px; white-space: nowrap; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .product-tile { min-height: 108px; padding: 10px; }
  .product-tile strong { overflow-wrap: anywhere; }
  .qty button { width: 40px; height: 40px; }
  #saveSale { width: 100%; min-height: 48px; }
  .totals .final { font-size: 20px; }
  .registered-customer-fields { grid-template-columns: minmax(0, 1fr); }
  .account-search { max-width: none; }
  .maintenance-tabs { overflow-x: auto; }
  .maintenance-tabs button { flex: 0 0 auto; white-space: nowrap; }
  .users-shell, .maintenance-shell { min-height: 0; }
  .user-grid { grid-template-columns: minmax(0, 1fr); }
  .permissions-box { padding: 10px; }

  dialog { width: 100vw; max-width: 100vw; max-height: min(92dvh, 760px); margin: auto 0 0; border-radius: 12px 12px 0 0; }
  .modal-card { max-height: min(92dvh, 760px); padding: 12px; gap: 12px; }
  .close { position: sticky; top: 0; z-index: 4; width: 44px; height: 44px; min-height: 44px; background: var(--panel); box-shadow: 0 1px 0 var(--line); }
  #modalContent { max-width: 100%; overflow-x: auto; }
  .receipt-dialog-head { display: grid; align-items: stretch; }
  .receipt-preview-switch { width: 100%; }
  .receipt-actions { grid-template-columns: 1fr; gap: 7px; }
  .receipt-actions.with-return { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .receipt-actions button { width: 100%; padding-block: 9px; }
  .receipt-preview { padding: 10px; }
  .return-dialog-head { align-items: start; flex-direction: column; }
  .return-item { grid-template-columns: auto minmax(0, 1fr); }
  .return-item > input[type="number"] { grid-column: 2; width: 100%; }
}
@media (max-width: 340px) {
  .top-actions #logoutBtn { width: 40px; max-width: 40px; overflow: hidden; color: transparent; position: relative; }
  .top-actions #logoutBtn::after { content: "↪"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--text); font-size: 18px; }
  .product-grid { grid-template-columns: minmax(0, 1fr); }
  .cart-line { grid-template-columns: minmax(0, 1fr); }
  .qty { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .drawer-overlay { transition: none; }
}
@media print {
  @page { margin: 6mm; }
  body { background: white; }
  .no-print { display: none !important; }
  .thermal-document { box-shadow: none; }
}
