/* SALONEX — apple.com-inspired skin. Radius is capped at 4px via --r everywhere. Novva Inc. */
@font-face { font-family: "Geist"; src: url("../fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Noto Sans Arabic"; src: url("../fonts/noto-arabic.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+0660-0669; }

:root {
  --bg: #f5f5f7; --surface: #ffffff; --surface-2: #fbfbfd; --ink: #1d1d1f; --ink-2: #6e6e73; --ink-3: #86868b;
  --line: #d2d2d7; --line-2: #e8e8ed; --accent: #0071e3; --accent-ink: #ffffff; --accent-soft: rgba(0,113,227,.08);
  --ok: #248a3d; --warn: #b25000; --bad: #d70015; --ok-soft: rgba(36,138,61,.1); --warn-soft: rgba(178,80,0,.1); --bad-soft: rgba(215,0,21,.08);
  --glass: rgba(251,251,253,.74); --glass-line: rgba(0,0,0,.08); --shadow: 0 2px 12px rgba(0,0,0,.06); --shadow-lg: 0 20px 60px rgba(0,0,0,.14);
  --r: 4px; --rail: 64px; --nav: 52px;
  --f: "Geist", "Noto Sans Arabic", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000; --surface: #1c1c1e; --surface-2: #161617; --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #86868b; --line: #38383a; --line-2: #2c2c2e;
    --accent: #2997ff; --accent-soft: rgba(41,151,255,.14); --ok: #30d158; --warn: #ff9f0a; --bad: #ff453a; --ok-soft: rgba(48,209,88,.14); --warn-soft: rgba(255,159,10,.14); --bad-soft: rgba(255,69,58,.14);
    --glass: rgba(22,22,23,.74); --glass-line: rgba(255,255,255,.08); --shadow: 0 2px 12px rgba(0,0,0,.5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000; --surface: #1c1c1e; --surface-2: #161617; --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #86868b; --line: #38383a; --line-2: #2c2c2e;
  --accent: #2997ff; --accent-soft: rgba(41,151,255,.14); --ok: #30d158; --warn: #ff9f0a; --bad: #ff453a; --ok-soft: rgba(48,209,88,.14); --warn-soft: rgba(255,159,10,.14); --bad-soft: rgba(255,69,58,.14);
  --glass: rgba(22,22,23,.74); --glass-line: rgba(255,255,255,.08); --shadow: 0 2px 12px rgba(0,0,0,.5); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--f); font-size: 14px; line-height: 1.47; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; font-feature-settings: "ss01", "tnum" 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, td.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.hidden { display: none !important; }
[data-lucide], .lucide { width: 18px; height: 18px; stroke-width: 1.75; flex: none; }

/* ---------- shell ---------- */
.rail { position: fixed; inset: 0 auto 0 0; width: var(--rail); z-index: 40; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0; overflow-y: auto; overflow-x: visible; scrollbar-width: none;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-right: 1px solid var(--glass-line); }
.rail .brand { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 10px; }
.rail .brand img { width: 34px; height: 34px; object-fit: contain; }
.rail a.ri { position: relative; width: 44px; height: 40px; display: grid; place-items: center; color: var(--ink-2); border-radius: var(--r); }
.rail a.ri:hover { color: var(--ink); background: var(--line-2); text-decoration: none; }
.rail a.ri.on { color: var(--accent); background: var(--accent-soft); }
.rail a.ri .tip { position: absolute; left: 54px; top: 50%; transform: translateY(-50%); white-space: nowrap; background: var(--ink); color: var(--bg); font-size: 12px; padding: 5px 9px; border-radius: var(--r); pointer-events: none; opacity: 0; transition: opacity .12s; }
.rail a.ri:hover .tip, .rail a.ri:focus-visible .tip { opacity: 1; }
.rail .sep { width: 28px; height: 1px; background: var(--line); margin: 6px 0; }
.rail .grow { flex: 1; }
.rail .badge-dot { position: absolute; top: 7px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r); background: var(--bad); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; }

.nav { position: sticky; top: 0; z-index: 30; height: var(--nav); margin-left: var(--rail); display: flex; align-items: center; gap: 10px; padding: 0 20px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--glass-line); }
.nav h1 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.015em; }
.nav .sp { flex: 1; }
.nav .search { position: relative; width: min(420px, 40vw); }
.nav .search input { width: 100%; height: 34px; padding: 0 12px 0 34px; border: 1px solid transparent; background: var(--line-2); border-radius: var(--r); font: inherit; color: var(--ink); }
.nav .search input:focus { background: var(--surface); border-color: var(--accent); outline: none; }
.nav .search > svg { position: absolute; left: 10px; top: 8px; color: var(--ink-3); }
.nav .search .res { position: absolute; top: 40px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); max-height: 60vh; overflow: auto; }
.nav .search .res a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; color: var(--ink); border-bottom: 1px solid var(--line-2); }
.nav .search .res a:hover, .nav .search .res a.on { background: var(--accent-soft); text-decoration: none; }
.nav .ib { position: relative; width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-2); border-radius: var(--r); cursor: pointer; }
.nav .ib:hover { background: var(--line-2); color: var(--ink); }
.nav .ib .badge-dot { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r); background: var(--bad); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; }
.nav .me { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border-radius: var(--r); color: var(--ink); }
.nav .me:hover { background: var(--line-2); text-decoration: none; }
.avatar { width: 28px; height: 28px; border-radius: var(--r); object-fit: cover; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.nav .me b { font-weight: 500; font-size: 13px; display: block; line-height: 1.1; }
.nav .me span { font-size: 11px; color: var(--ink-2); }
.shift-pill { font-size: 12px; padding: 4px 9px; border-radius: var(--r); background: var(--line-2); color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.shift-pill.on { background: var(--ok-soft); color: var(--ok); }

main.page { margin-left: var(--rail); padding: 16px 20px 8px; min-height: calc(100vh - var(--nav) - 46px); }
.wrap { max-width: 1560px; margin: 0 auto; }
footer.foot { margin-left: var(--rail); padding: 12px 20px; display: flex; align-items: center; gap: 14px; justify-content: space-between; color: var(--ink-3); font-size: 12px; border-top: 1px solid var(--line-2); }
footer.foot .dev { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
footer.foot .dev img { height: 18px; width: auto; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); }
.card > .hd { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.card > .hd h2, .card > .hd h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }
.card > .hd .sp { flex: 1; }
.card > .bd { padding: 16px; }
.card > .bd.flush { padding: 0; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.page-head h2 { font-size: 28px; line-height: 1.1; font-weight: 600; letter-spacing: -0.025em; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.page-head .sp { flex: 1; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 16px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
label.f > span em { font-style: normal; color: var(--ink-3); font-weight: 400; }
.in, select.in, textarea.in { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
textarea.in { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.in:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.in.big { height: 48px; font-size: 18px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.seg { display: inline-flex; background: var(--line-2); padding: 2px; border-radius: var(--r); gap: 2px; }
.seg button { border: 0; background: none; height: 28px; padding: 0 12px; border-radius: var(--r); font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); font-weight: 500; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font: inherit; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .thumb { width: 36px; height: 36px; border-radius: var(--r); object-fit: cover; background: var(--line-2); }
.tbl .thumb.ph { display: grid; place-items: center; color: var(--ink-3); }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; font-weight: 600; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: var(--r); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.reorder { color: var(--warn); background: var(--warn-soft); }
.pill.critical, .pill.out { color: var(--bad); background: var(--bad-soft); }
.pill.neutral { color: var(--ink-2); background: var(--line-2); }

/* ---------- dashboard hero ---------- */
.hero { position: relative; height: 300px; border-radius: var(--r); overflow: hidden; background: #e8e8ed; margin-bottom: 12px; }
.hero canvas, .hero img.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero .copy { position: absolute; left: 40px; bottom: 34px; max-width: 560px; color: #1d1d1f; }
.hero.dark .copy { color: #f5f5f7; }
.hero .copy h2 { font-size: 48px; line-height: 1.05; letter-spacing: -0.035em; font-weight: 650; margin: 0 0 8px; }
.hero .copy p { font-size: 19px; line-height: 1.35; margin: 0; opacity: .78; letter-spacing: -0.015em; }
.hero .tools { position: absolute; right: 14px; top: 14px; display: flex; gap: 6px; }
.hero .tools .btn { background: rgba(255,255,255,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-color: rgba(0,0,0,.08); color: #1d1d1f; }
.hero .cta { display: flex; gap: 10px; margin-top: 18px; }
.hero .cta .btn { height: 38px; padding: 0 18px; border-radius: var(--r); }
@media (max-width: 800px) { .hero .copy h2 { font-size: 32px; } .hero .copy { left: 20px; } }

.kpi { padding: 16px 18px; }
.kpi .l { color: var(--ink-2); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.kpi .v { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .d { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.chart-box { position: relative; height: 240px; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 12px; height: calc(100vh - var(--nav) - 46px - 24px); }
@media (max-width: 1100px) { .pos { grid-template-columns: 1fr; height: auto; } }
.pos .left { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.scanbar { display: flex; gap: 8px; align-items: center; padding: 10px; }
.scanbar .in { height: 46px; font-size: 17px; }
.scan-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); padding: 0 8px; white-space: nowrap; }
.scan-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; overflow: auto; padding: 10px; align-content: start; }
.ptile { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); padding: 0; text-align: left; cursor: pointer; font: inherit; color: var(--ink); display: flex; flex-direction: column; overflow: hidden; }
.ptile:hover { border-color: var(--accent); }
.ptile .im { aspect-ratio: 1/1; background: var(--line-2); display: grid; place-items: center; color: var(--ink-3); overflow: hidden; }
.ptile .im img { width: 100%; height: 100%; object-fit: cover; }
.ptile .tx { padding: 8px 10px; }
.ptile .nm { font-size: 13px; font-weight: 500; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 32px; }
.ptile .pr { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 13px; }
.ptile .pr b { font-weight: 600; }
.ptile .st { font-size: 11px; color: var(--ink-2); }
.ptile.out { opacity: .5; }
.cats { display: flex; gap: 6px; overflow-x: auto; padding: 0 10px 10px; }
.cats button { border: 1px solid var(--line); background: var(--surface); padding: 5px 12px; border-radius: var(--r); font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.cats button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cart { display: flex; flex-direction: column; min-height: 0; }
.cart .lines { flex: 1; overflow: auto; }
.cline { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.cline.flash { animation: flash .9s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.cline .thumb { width: 40px; height: 40px; border-radius: var(--r); object-fit: cover; background: var(--line-2); }
.cline .nm { font-weight: 500; font-size: 13.5px; line-height: 1.25; }
.cline .meta { font-size: 12px; color: var(--ink-2); }
.cline .qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r); margin-top: 5px; }
.cline .qty button { width: 26px; height: 24px; border: 0; background: none; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.cline .qty input { width: 46px; height: 24px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font: inherit; font-size: 13px; background: none; color: var(--ink); }
.cline .amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.cline .amt small { display: block; font-weight: 400; color: var(--ink-2); font-size: 11px; }
.totals { padding: 12px 16px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.totals .t { display: flex; justify-content: space-between; padding: 2px 0; color: var(--ink-2); }
.totals .t.grand { color: var(--ink); font-size: 26px; font-weight: 600; letter-spacing: -0.03em; padding-top: 8px; }
.pay-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 0 16px 10px; }
.pay-btn { padding: 0 16px 16px; }
.pay-btn .btn { width: 100%; height: 52px; font-size: 17px; }

/* ---------- modal / toasts ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.36); z-index: 100; display: grid; place-items: center; padding: 20px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .18s ease-out; }
.modal.wide { width: min(880px, 100%); }
.modal.xl { width: min(1120px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal .mh { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal .mh h3 { margin: 0; font-size: 17px; font-weight: 600; flex: 1; letter-spacing: -0.02em; }
.modal .mb { padding: 18px 20px; overflow: auto; }
.modal .mf { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line-2); }
.toasts { position: fixed; left: calc(var(--rail) + 18px); bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; width: 360px; max-width: calc(100vw - 36px); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 12px 14px; font-size: 13.5px; animation: slidein .2s ease-out; }
.toast.ok { border-left-color: var(--ok); } .toast.warn { border-left-color: var(--warn); } .toast.bad { border-left-color: var(--bad); }
.toast b { display: block; font-weight: 600; }
.toast .x { margin-left: auto; border: 0; background: none; color: var(--ink-3); cursor: pointer; }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

/* ---------- product editor ---------- */
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.imgs .im { position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--line-2); border: 1px solid var(--line-2); }
.imgs .im img { width: 100%; height: 100%; object-fit: cover; }
.imgs .im .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: var(--r); background: rgba(0,0,0,.6); color: #fff; cursor: pointer; display: grid; place-items: center; }
.imgs .im .main { position: absolute; left: 4px; bottom: 4px; font-size: 10px; background: rgba(0,0,0,.6); color: #fff; padding: 1px 5px; border-radius: var(--r); }
.imgs .add { aspect-ratio: 1; border: 1px dashed var(--line); border-radius: var(--r); display: grid; place-items: center; color: var(--ink-2); cursor: pointer; background: none; font: inherit; font-size: 12px; text-align: center; gap: 2px; }
.imgs .add:hover { border-color: var(--accent); color: var(--accent); }
.codebox { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line-2); border-radius: var(--r); padding: 16px; color: #000; }
.codebox .q svg, .codebox .b svg { width: 100%; height: auto; display: block; }
.codebox .q { max-width: 150px; justify-self: center; }
.codebox .cap { grid-column: 1/-1; text-align: center; font-size: 12px; color: #555; }

/* camera */
.cam { position: relative; background: #000; border-radius: var(--r); overflow: hidden; aspect-ratio: 4/3; }
.cam video { width: 100%; height: 100%; object-fit: cover; }
.cam .frame { position: absolute; inset: 18% 14%; border: 2px solid rgba(255,255,255,.85); border-radius: var(--r); box-shadow: 0 0 0 9999px rgba(0,0,0,.28); }
.cam .laser { position: absolute; left: 14%; right: 14%; top: 50%; height: 2px; background: #ff3b30; box-shadow: 0 0 10px #ff3b30; animation: laser 2s ease-in-out infinite; }
@keyframes laser { 0%, 100% { top: 22%; } 50% { top: 78%; } }

.list-alerts .ai { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line-2); }
.list-alerts .ai:last-child { border-bottom: 0; }
.bar-meter { height: 4px; background: var(--line-2); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.bar-meter i { display: block; height: 100%; background: var(--warn); }
.bar-meter i.critical, .bar-meter i.out { background: var(--bad); }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--bg); }
.auth .art { position: relative; overflow: hidden; background: #e8e8ed; }
.auth .art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth .form { display: grid; place-items: center; padding: 40px; }
.auth .box { width: min(380px, 100%); }
.auth .box h1 { font-size: 40px; letter-spacing: -0.035em; line-height: 1.05; margin: 18px 0 6px; font-weight: 650; }
.auth .box p.lead { color: var(--ink-2); font-size: 17px; margin: 0 0 26px; }
.auth .err { background: var(--bad-soft); color: var(--bad); padding: 9px 12px; border-radius: var(--r); font-size: 13px; margin-bottom: 12px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth .art { height: 200px; } }

.splash-mark { display: flex; align-items: center; gap: 10px; }
.splash-mark img { width: 44px; height: 44px; }
.splash-mark b { font-size: 22px; font-weight: 650; letter-spacing: -0.03em; }

.kbd { font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: var(--r); padding: 0 5px; color: var(--ink-2); }
.divider { height: 1px; background: var(--line-2); margin: 12px 0; }
.note { font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 12px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .rail, .nav, footer.foot, .no-print { display: none !important; } main.page { margin: 0; padding: 0; } body { background: #fff; } }

.rail::-webkit-scrollbar { display: none; }
.rail a.ri { flex: none; }
/* tooltips escape the scrolling rail */
.rail a.ri .tip { position: fixed; left: calc(var(--rail) + 6px); top: auto; transform: none; margin-top: -2px; }
/* pharmacy */
.sched { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 600; letter-spacing: .03em; padding: 1px 6px; border-radius: var(--r); border: 1px solid currentColor; }
.sched.OTC { color: var(--ink-3); } .sched.P { color: var(--accent); } .sched.POM { color: var(--warn); } .sched.CD { color: var(--bad); background: var(--bad-soft); }
.finding { display: grid; grid-template-columns: 4px minmax(0, 1fr); gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.finding::before { content: ""; border-radius: 2px; background: var(--warn); }
.finding.contraindicated::before, .finding.allergy::before { background: var(--bad); }
.finding.major::before { background: #ff6b00; } .finding.duplicate::before, .finding.caution::before { background: var(--warn); } .finding.moderate::before { background: var(--ink-3); }
.finding b { font-weight: 600; display: block; }
.allergy-bar { display: flex; gap: 8px; align-items: center; padding: 7px 14px; background: var(--bad-soft); color: var(--bad); font-size: 12.5px; font-weight: 500; border-bottom: 1px solid var(--line-2); }
.md { font-size: 14px; line-height: 1.55; }
.md h1, .md h2, .md h3, .md h4 { font-size: 14.5px; font-weight: 650; margin: 12px 0 4px; letter-spacing: -0.01em; }
.md p { margin: 0 0 8px; } .md ul, .md ol { margin: 0 0 8px; padding-left: 20px; } .md li { margin: 2px 0; }
.md code { font-size: 12.5px; background: var(--line-2); padding: 1px 4px; border-radius: 3px; }
.md table { border-collapse: collapse; margin: 6px 0 10px; font-size: 13px; } .md td, .md th { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.md .cursor { display: inline-block; width: 7px; height: 15px; background: var(--accent); vertical-align: -2px; animation: blink 1s steps(2) infinite; border-radius: 1px; }
@keyframes blink { 50% { opacity: 0; } }
.chat { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 860px; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; padding: 9px 14px; border-radius: var(--r); max-width: 70%; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line-2); padding: 12px 16px; border-radius: var(--r); width: 100%; }
.msg.bot .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 8px; display: flex; gap: 10px; align-items: center; }
.ai-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #fff; padding: 3px 9px; border-radius: var(--r); background: linear-gradient(135deg, #0071e3, #7d4dff); }
.rtl { direction: rtl; text-align: right; font-family: "Noto Sans Arabic", Geist, sans-serif; }

/* POS layout with large catalogues: only the product grid and the cart lines may flex; everything else keeps its natural size */
.pos .left > .scanbar { flex: none; }
.cats { flex: none; }
.pgrid { flex: 1 1 auto; min-height: 0; grid-auto-rows: max-content; }
.cart { overflow-y: auto; }
.cart > * { flex: none; }
.cart > .lines { flex: 1 1 auto; min-height: 140px; }
.cats { flex-wrap: wrap; overflow-x: visible; row-gap: 6px; }
.cline .meta.rx { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; min-width: 0; }
.cline .meta.rx [data-a="sig"] { flex: 1 1 auto; min-width: 0; display: inline-flex; overflow: hidden; }
.cline .meta.rx [data-a="sig"] > span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cline .meta.rx [data-a="alt"] { flex: none; }
