:root {
  --paper: #EEF1F0;
  --surface: #FFFFFF;
  --sunk: #F5F7F6;
  --line: #DDE3E1;
  --ink: #17212B;
  --ink-2: #44515C;
  --muted: #6A7782;
  --lapis: #1E4FA0;
  --lapis-ink: #FFFFFF;
  --lapis-soft: #E4ECF8;
  --gold: #C08A12;
  --gold-soft: #F6EDD6;
  --teal: #1F9A84;
  --teal-ink: #137262;
  --red: #B83A32;
  --red-soft: #F8E5E3;
  --cash: #C08A12;
  --bank: #1E4FA0;
  --transfer: #1F9A84;
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 7px;
  --side: 236px;
  --font: "Readex Pro", system-ui, "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12171C; --surface: #1A2027; --sunk: #151B21; --line: #2B343D;
    --ink: #E8ECEF; --ink-2: #BAC4CC; --muted: #8C98A2;
    --lapis: #5B8FE0; --lapis-ink: #0E1A2E; --lapis-soft: #1E2C44;
    --gold: #D4A43A; --gold-soft: #3A3120; --teal: #2FAA92; --teal-ink: #5CCBB4;
    --red: #E2716A; --red-soft: #3D2322;
    --cash: #B88A22; --bank: #5B8FE0; --transfer: #2FAA92;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12171C; --surface: #1A2027; --sunk: #151B21; --line: #2B343D;
  --ink: #E8ECEF; --ink-2: #BAC4CC; --muted: #8C98A2;
  --lapis: #5B8FE0; --lapis-ink: #0E1A2E; --lapis-soft: #1E2C44;
  --gold: #D4A43A; --gold-soft: #3A3120; --teal: #2FAA92; --teal-ink: #5CCBB4;
  --red: #E2716A; --red-soft: #3D2322;
  --cash: #B88A22; --bank: #5B8FE0; --transfer: #2FAA92;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, input, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
body {
  font-family: var(--font); background: var(--paper); color: var(--ink);
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum";
}
[hidden] { display: none !important; }
body:not(.is-admin) .admin-only { display: none !important; }
svg { width: 20px; height: 20px; flex: none; }
a { color: var(--lapis); }
code { font-size: .9em; background: var(--sunk); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
:focus-visible { outline: 2px solid var(--lapis); outline-offset: 2px; }

/* ---------- boot / login ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot-err { max-width: 420px; margin: 16px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); line-height: 1.8; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--lapis); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px 28px; display: grid; gap: 14px; }
.login-card h1 { margin: 6px 0 0; font-size: 26px; font-weight: 600; }
.login-card p { margin: 0 0 6px; }

.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--lapis) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 13l8-5 8 5v11H8z' fill='none' stroke='%23E8C25A' stroke-width='2.4' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat; flex: none; }
.brand-mark.big { width: 52px; height: 52px; border-radius: 13px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  background: var(--surface); border-inline-end: 1px solid var(--line); padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 4px 8px 20px; }
.brand .shop-name { font-weight: 600; font-size: 18px; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius);
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--sunk); color: var(--ink); }
.nav-scan, .nav-more { display: none; }
.nav a[aria-current="page"] { background: var(--lapis-soft); color: var(--lapis); }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.side-foot #userName { font-weight: 500; color: var(--ink); font-size: 14px; }
.side-foot .user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }

.main { min-width: 0; display: flex; flex-direction: column; }
.demo-banner { background: var(--gold-soft); color: var(--ink); padding: 8px 28px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 20px 28px 14px; position: sticky; top: 0; z-index: 5;
  background: var(--paper); background: color-mix(in srgb, var(--paper) 88%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.topbar h1 { font-size: 24px; font-weight: 600; margin: 0; margin-inline-end: auto; letter-spacing: -.01em; }
.period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.custom-range { display: inline-flex; align-items: center; gap: 6px; }
.view { padding: 6px 28px 48px; outline: none; }

/* ---------- controls ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 11px; min-height: 40px; width: 100%;
}
select { width: auto; padding-inline-end: 28px; }
.period input[type=date] { width: auto; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lapis); box-shadow: 0 0 0 3px var(--lapis-soft); }
textarea { min-height: 64px; resize: vertical; }
.field { display: grid; gap: 5px; font-size: 13.5px; color: var(--ink-2); }
.field > span { font-weight: 500; }
.field .hint { font-size: 12.5px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--radius); padding: 8px 16px; min-height: 40px; cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--sunk); }
.btn.primary { background: var(--lapis); border-color: var(--lapis); color: var(--lapis-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--red); }
.btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.dlg.confirm { width: min(420px, calc(100vw - 24px)); }
.dlg.confirm .dlg-body { padding-top: 22px; font-size: 16px; }
.dlg.confirm p { margin: 0; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 32px; padding: 4px 12px; font-size: 13.5px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); width: 34px; height: 34px; border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--sunk); color: var(--ink); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-soft); }
.icon-btn svg { width: 18px; height: 18px; }

.seg { display: inline-flex; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-weight: 500; min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 0 0 1px var(--line); }

.form-error { color: var(--red); background: var(--red-soft); padding: 8px 12px; border-radius: var(--radius-sm); margin: 0; font-size: 14px; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; font-weight: 600; margin: 0; margin-inline-end: auto; }
.panel-body { padding: 14px 20px 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stack { display: grid; gap: 18px; }

/* ---------- dashboard: the till ---------- */
.till { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.till-main { padding: 24px 26px; border-inline-end: 1px solid var(--line); }
.till-label { font-size: 14px; color: var(--muted); margin: 0; }
.till-total { font-size: clamp(38px, 5.2vw, 58px); font-weight: 600; line-height: 1.1; letter-spacing: -.02em; margin: 6px 0 4px; }
.till-sub { margin: 0 0 22px; color: var(--ink-2); font-size: 14px; }
.ribbon { display: flex; height: 18px; gap: 2px; border-radius: 5px; overflow: hidden; background: var(--sunk); }
.ribbon span { display: block; min-width: 0; }
.ribbon-legend { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-top: 14px; }
.ribbon-legend div { display: grid; gap: 2px; }
.ribbon-legend dt { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); }
.ribbon-legend dt i { width: 10px; height: 10px; border-radius: 3px; }
.ribbon-legend dd { margin: 0; font-weight: 600; font-size: 18px; }
.ribbon-legend dd small { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-inline-start: 4px; }
.till-side { display: grid; align-content: stretch; }
.till-side > div { padding: 18px 24px; display: grid; gap: 2px; }
.till-side > div + div { border-top: 1px solid var(--line); }
.till-side .v { font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.till-side .profit .v { color: var(--teal-ink); }
.till-side .loss .v { color: var(--red); }

/* chart */
.chart { position: relative; }
.chart svg { width: 100%; height: 240px; display: block; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid line { stroke: var(--line); stroke-dasharray: 2 3; }
.chart .bar { fill: var(--lapis); }
.chart .bar.dim { opacity: .35; }
.chart .hit { fill: transparent; cursor: crosshair; }
.tip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--paper);
  border-radius: 8px; padding: 8px 11px; font-size: 12.5px; line-height: 1.5; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px)); z-index: 3;
}
.tip b { font-weight: 600; font-size: 14px; }

/* ranked lists */
.rank { list-style: none; margin: 0; padding: 0; display: grid; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.rank li:last-child { border-bottom: 0; }
.rank .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .meter { grid-column: 1 / -1; height: 4px; background: var(--sunk); border-radius: 2px; overflow: hidden; }
.rank .meter i { display: block; height: 100%; background: var(--lapis); border-radius: 2px; }
.rank .val { font-weight: 600; }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); }

/* ---------- tables ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 240px; max-width: 380px; }
.totals { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 14px; }
.totals > div { padding: 12px 20px; display: grid; gap: 1px; border-inline-end: 1px solid var(--line); }
.totals > div:last-child { border-inline-end: 0; }
.totals > div > span { font-size: 12.5px; color: var(--muted); }
.totals b { font-size: 19px; font-weight: 600; }
.totals .pos b { color: var(--teal-ink); }
.totals .neg b { color: var(--red); }
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 500; color: var(--muted); font-size: 13px; background: var(--sunk); position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th[aria-sort="ascending"]::after { content: " ▲"; font-size: 9px; }
th[aria-sort="descending"]::after { content: " ▼"; font-size: 9px; }
td.n, th.n { text-align: end; font-variant-numeric: tabular-nums; }
td.n { direction: ltr; }
td.name { white-space: normal; min-width: 200px; font-weight: 500; }
td.note { white-space: normal; color: var(--ink-2); max-width: 220px; font-size: 13px; }
td.act { width: 1%; padding-block: 4px; }
tbody tr:hover td { background: color-mix(in srgb, var(--lapis-soft) 40%, transparent); }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; background: var(--sunk); border-top: 1px solid var(--line); }
.neg { color: var(--red); }
.pos { color: var(--teal-ink); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; }
.pill.out { background: var(--red-soft); color: var(--red); }
.pill.zero { background: var(--gold-soft); color: var(--ink); }
.pill.admin { background: var(--lapis-soft); color: var(--lapis); }
.pill.staff { background: var(--sunk); color: var(--ink-2); }
.pill.off { background: var(--sunk); color: var(--muted); }
.pay { display: inline-flex; gap: 6px; align-items: center; }
.pay i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }

/* ---------- product picker ---------- */
.picker { position: relative; }
.picker-list {
  position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 20; max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; margin: 0; list-style: none;
  box-shadow: 0 12px 28px rgb(0 0 0 / .14);
}
.picker-list li { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.picker-list li[aria-selected="true"], .picker-list li:hover { background: var(--lapis-soft); }
.picker-list .code { color: var(--muted); font-size: 12.5px; min-width: 26px; }
.picker-list .price { margin-inline-start: auto; color: var(--muted); font-size: 12.5px; }

/* ---------- dialog ---------- */
.dlg { border: 0; padding: 0; border-radius: var(--radius-lg); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgb(0 0 0 / .25); }
.dlg::backdrop { background: rgb(10 16 24 / .45); }
.dlg[open] { animation: pop .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 6px; }
.dlg-head h2 { margin: 0; font-size: 19px; font-weight: 600; }
.dlg-body { padding: 10px 22px 6px; display: grid; gap: 14px; }
.dlg .form-error { margin: 4px 22px 0; }
.dlg-foot { display: flex; gap: 10px; padding: 16px 22px 20px; flex-wrap: wrap; }
.dlg-foot .spacer { margin-inline-end: auto; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.calc { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--sunk); border-radius: var(--radius); padding: 10px 14px; font-size: 13.5px; color: var(--ink-2); }
.calc b { color: var(--ink); font-weight: 600; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; font-size: 14px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); color: #fff; }

/* language/theme/scan */
.tools { display: inline-flex; gap: 2px; }
.lang-btn { font-weight: 600; font-size: 13px; font-family: var(--font); width: 38px; }
.login-tools { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); inset-inline-end: 12px; display: flex; gap: 4px; }
.input-btn { display: flex; gap: 8px; }
.input-btn input { flex: 1; min-width: 0; }
.picker input { padding-inline-end: 44px; }
.picker-scan { position: absolute; inset-inline-end: 4px; top: 3px; }
.scan-area { width: 100%; min-height: 0; border-radius: var(--radius); overflow: hidden; background: #000; }
.scan-area:empty { display: none; }
.scan-area video { width: 100% !important; display: block; }
.pill.ok { background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal-ink); }
.pcard { display: grid; gap: 14px; }
.pcard-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.pcard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pcard-grid div { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pcard-grid div:nth-child(odd) { border-inline-end: 1px solid var(--line); }
.pcard-grid div:nth-last-child(-n+2) { border-bottom: 0; }
.pcard-grid dt { font-size: 12.5px; color: var(--muted); }
.pcard-grid dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; }
.pcard-grid dd small { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.dlg .picker-list { position: relative; top: 4px; box-shadow: none; }
.pc-foot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pc-foot .btn { white-space: normal; text-align: center; line-height: 1.25; }
.field.check { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.field.check input { width: 18px; min-height: 18px; }
.seg button[disabled] { opacity: .5; cursor: not-allowed; }
.cred { margin: 0; padding: 14px 16px; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--font); font-size: 15px; line-height: 1.9; white-space: pre-wrap; user-select: all; }
.loading { padding: 60px; display: grid; place-items: center; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .till { grid-template-columns: 1fr; }
  .till-main { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .till-side { grid-template-columns: repeat(3, 1fr); }
  .till-side > div + div { border-top: 0; border-inline-start: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; bottom: 0; top: auto; inset-inline: 0; height: auto; z-index: 30; flex-direction: row;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-inline-end: 0; border-top: 1px solid var(--line);
  }
  .brand, .side-foot, .nav .nav-extra { display: none !important; }
  .nav { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; gap: 0; align-items: end; }
  .nav a, .nav-more, .nav-scan {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 5px; font-size: 11.5px; font-weight: 500;
    text-align: center; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); font-family: var(--font); cursor: pointer; min-height: 52px; justify-content: flex-end;
  }
  .nav a svg, .nav-more svg { width: 22px; height: 22px; }
  .nav a span, .nav-more span, .nav-scan > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav a[aria-current="page"], .nav-more.active { background: transparent; color: var(--lapis); }
  .nav a[aria-current="page"] svg, .nav-more.active svg { stroke-width: 2.2; }
  .nav-scan-dot { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--lapis); color: var(--lapis-ink); margin-top: -26px; box-shadow: 0 6px 16px rgb(30 79 160 / .35); border: 4px solid var(--surface); }
  .nav-scan-dot svg { width: 24px; height: 24px; }
  .topbar .tools, .topbar #scanBtn { display: none; }
  input, select, textarea { font-size: 16px; }   /* أقل من 16 بيخلي الآيفون يعمل زووم */
  .dlg { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: calc(100dvh - 24px); padding-bottom: env(safe-area-inset-bottom); }
  .dlg[open] { animation: sheet .2s ease-out; }
  .dlg.confirm { margin: auto; width: calc(100vw - 32px); border-radius: var(--radius-lg); }
  .dlg-head { position: sticky; top: 0; background: var(--surface); z-index: 2; padding-top: 16px; }
  .dlg-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding-block: 12px; }
  .dlg-foot .btn { flex: 1 1 auto; }
  .dlg-foot .spacer { display: none; }
  .picker-list { max-height: 220px; }
  .topbar { padding: 14px 16px 10px; gap: 10px; }
  .topbar h1 { font-size: 20px; flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pc-foot { grid-template-columns: 1fr; }
  .topbar #quickSale span, .topbar #scanBtn span { display: none; }
  .topbar #quickSale, .topbar #scanBtn { padding: 8px 11px; }
  .period { order: 3; width: 100%; }
  .period select { flex: 1; }
  .view { padding: 4px 16px 96px; }
  .demo-banner { padding: 8px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .till-main { padding: 20px; }
  .till-side { grid-template-columns: 1fr; }
  .till-side > div + div { border-inline-start: 0; border-top: 1px solid var(--line); }
  .till-side > div { padding: 14px 20px; grid-template-columns: 1fr auto; align-items: baseline; }
  .till-side .v { font-size: 20px; }
  .ribbon-legend dd { font-size: 15px; }
  .totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); overflow: hidden; }
  .totals > div { padding: 10px 14px; border: 0 !important; background: var(--surface); }
  .totals > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .totals b { font-size: 17px; }
  .toolbar { gap: 8px; }
  .toolbar .btn { flex: 1 1 auto; }
  .pager { flex-wrap: wrap; }
  .demo-banner { font-size: 12.5px; }
  .row-3 { grid-template-columns: 1fr; }
  .toolbar .grow { max-width: none; }
  .panel-head, .panel-body { padding-inline: 16px; }
}
@media (max-width: 640px) {
  table.cards thead { display: none; }
  table.cards, table.cards tbody { display: block; }
  table.cards tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
  table.cards td { border: 0; padding: 0; white-space: normal; text-align: start; min-width: 0; overflow-wrap: anywhere; }
  table.cards td.d { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
  table.cards td.name { grid-column: 1 / -1; min-width: 0; padding: 0 0 6px; padding-inline-end: 70px; }
  table.cards td.n { font-size: 14px; text-align: start; }
  table.cards td.n > *, table.cards td.n { unicode-bidi: plaintext; }
  table.cards td[data-l]::before { content: attr(data-l); display: block; font-size: 11.5px; color: var(--muted); }
  table.cards td.note { grid-column: 1 / -1; max-width: none; }
  table.cards td.note:empty { display: none; }
  table.cards td.act { position: absolute; top: 8px; inset-inline-end: 6px; width: auto; }
  table.cards td.hide-sm, table.cards tfoot { display: none; }
  table.cards td.empty { grid-column: 1 / -1; text-align: center; }
  table.cards tr:has(td.empty) { display: block; }
}
@media (max-width: 420px) { .row { grid-template-columns: 1fr; } }
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
/* قايمة المزيد */
.sheet { padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 14px; }
.more-user { display: grid; gap: 2px; padding: 0 4px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.more-user #moreName { font-weight: 600; font-size: 16px; }
.more-user .muted { font-size: 13px; }
.more-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.more-links a { display: flex; align-items: center; gap: 10px; padding: 14px 12px; border-radius: var(--radius); background: var(--sunk); color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14.5px; }
.more-links a[aria-current="page"] { background: var(--lapis-soft); color: var(--lapis); }
.more-prefs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.more-prefs .btn { justify-content: space-between; min-height: 48px; }
.lang-row b { font-weight: 600; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
