/* Sheraki lookup — the till's light palette (src/shared/theme.css [data-theme='light'] in the till repo). */

@font-face { font-family: 'Noto Sans Arabic'; font-weight: 400; font-display: swap; src: url('/scan/fonts/noto-sans-arabic-arabic-400.woff2') format('woff2'); }
@font-face { font-family: 'Noto Sans Arabic'; font-weight: 600; font-display: swap; src: url('/scan/fonts/noto-sans-arabic-arabic-600.woff2') format('woff2'); }
@font-face { font-family: 'Noto Sans Arabic'; font-weight: 700; font-display: swap; src: url('/scan/fonts/noto-sans-arabic-arabic-700.woff2') format('woff2'); }
@font-face { font-family: 'Amiri'; font-weight: 700; font-display: swap; src: url('/scan/fonts/amiri-arabic-700.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('/scan/fonts/inter-latin-500.woff2') format('woff2'); }

:root {
  /* Light only: staff use the page on the shop floor, in daylight and bright boutique lighting. */
  color-scheme: light;
  --bg: #faf8f5;
  --card: #ffffff;
  --raised: #f2ede6;
  --text: #1c1917;
  --text-2: #292524;
  --muted: #57534e;
  --line: #d6cfc4;
  --line-soft: #e8e2d8;
  --gold: #d4af37;
  --gold-strong: #e0c04f;
  --gold-surface: #c9a227;
  --gold-wash: rgb(201 162 39 / 0.14);
  --accent: #7d5f10;
  --on-gold: #1c1917;
  --ok: #15803d;
  --bad: #b91c1c;
  --bad-wash: rgb(185 28 28 / 0.08);
  --shadow: 0 -12px 32px -10px rgb(28 25 23 / 0.18);
  --radius: 14px;
  --ui: 'Noto Sans Arabic', 'Inter', system-ui, sans-serif;
  --num: 'Inter', 'Noto Sans Arabic', system-ui, sans-serif;
  --display: 'Amiri', 'Noto Sans Arabic', serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 400 16px/1.55 var(--ui); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--gold-surface); color: var(--on-gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Brand ------------------------------------------------------------------------------- */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { height: 30px; width: auto; max-width: 150px; object-fit: contain; }
.brand-name { font: 700 22px/1.1 var(--display); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-lg { justify-content: center; }
.brand-lg .brand-logo { height: 72px; max-width: 240px; }
.brand-lg .brand-name { font-size: 34px; }
.brand-logo + .brand-name { display: none; }

/* ---- Buttons & fields -------------------------------------------------------------------- */
.btn {
  appearance: none; border: 0; border-radius: 12px; min-height: 48px; padding: 0 20px;
  font: 600 16px/1 var(--ui); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color 160ms var(--ease), transform 160ms var(--ease), opacity 160ms;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-gold { background: var(--gold-surface); color: var(--on-gold); }
.btn-gold:hover { background: var(--gold); }
.btn-quiet { background: var(--raised); color: var(--text); border: 1px solid var(--line); }
.btn-quiet:hover { border-color: var(--gold); }
.btn-text { appearance: none; background: none; border: 0; color: var(--muted); font: 500 14px/1 var(--ui); padding: 10px 4px; cursor: pointer; }
.btn-text:hover { color: var(--text); }
.btn.is-busy .btn-label::after { content: '…'; }

.field { display: grid; gap: 6px; font-size: 14px; color: var(--text-2); }
.field input, .manual input {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 12px;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  font: 500 17px/1 var(--num); caret-color: var(--gold);
  transition: border-color 160ms var(--ease);
}
.field input:focus, .manual input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-wash); }
input::placeholder { color: var(--muted); font-family: var(--ui); font-weight: 400; font-size: 15px; }

/* ---- Sign in ----------------------------------------------------------------------------- */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 32px 20px calc(32px + env(safe-area-inset-bottom)); }
.signin-inner { width: 100%; max-width: 380px; }
.signin-title { font: 700 26px/1.3 var(--display); text-align: center; margin: 28px 0 6px; text-wrap: balance; }
.signin-lede { color: var(--muted); text-align: center; margin: 0 0 28px; font-size: 15px; text-wrap: pretty; }
.form { display: grid; gap: 16px; }
.form .btn { margin-top: 4px; width: 100%; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bad-wash); color: var(--bad); font-size: 14px; }

/* ---- App shell --------------------------------------------------------------------------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line-soft);
}
.who { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); flex: none; }

/* ---- Viewfinder -------------------------------------------------------------------------- */
.finder {
  position: relative; margin: 14px 16px 0; border-radius: var(--radius); overflow: hidden;
  background: #000; aspect-ratio: 4 / 3; max-height: 46dvh; width: auto;
}
.finder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.finder.is-paused video { filter: brightness(0.45) saturate(0.6); }
.reticle { position: absolute; inset: 18% 22%; pointer-events: none; transition: inset 260ms var(--ease); }
.reticle i { position: absolute; width: 28px; height: 28px; border: 3px solid rgb(255 255 255 / 0.9); transition: border-color 200ms var(--ease); }
.reticle i:nth-child(1) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.reticle i:nth-child(2) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.reticle i:nth-child(3) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.reticle i:nth-child(4) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.finder.is-hit .reticle { inset: 24% 28%; }
.finder.is-hit .reticle i { border-color: var(--gold); }
.finder.is-off { aspect-ratio: auto; min-height: 168px; display: grid; place-items: center; background: var(--card); border: 1px dashed var(--line); }
.finder.is-off .reticle { display: none; }
.finder-msg {
  position: absolute; inset-inline: 12px; bottom: 56px; text-align: center; color: #fff; font-size: 14px;
  text-shadow: 0 1px 3px rgb(0 0 0 / 0.7);
}
.finder.is-off .finder-msg { position: static; color: var(--muted); text-shadow: none; padding: 20px 20px 64px; max-width: 34ch; text-wrap: pretty; }
.finder-actions { position: absolute; inset-inline: 0; bottom: 12px; display: flex; justify-content: center; gap: 8px; }
.chip {
  appearance: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border-radius: 999px; border: 1px solid rgb(255 255 255 / 0.28); background: rgb(12 10 9 / 0.62);
  color: #fff; font: 500 14px/1 var(--ui); cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.chip[aria-pressed='true'] { background: var(--gold-surface); color: #0c0a09; border-color: var(--gold-surface); }
.finder.is-off .chip { background: var(--gold-surface); color: var(--on-gold); border-color: transparent; backdrop-filter: none; }

/* ---- Manual entry ------------------------------------------------------------------------ */
.manual { display: flex; gap: 8px; margin: 12px 16px 0; }
.manual input { flex: 1; min-width: 0; letter-spacing: 0.04em; }
.manual .btn { flex: none; }

/* ---- Result sheet ------------------------------------------------------------------------ */
.result { margin-top: 14px; flex: 1; display: flex; flex-direction: column; }
.sheet {
  flex: 1; background: var(--card); border-radius: 22px 22px 0 0;
  padding: 22px 16px 28px; box-shadow: var(--shadow);
  animation: rise 360ms var(--ease) both;
}
@keyframes rise { from { transform: translateY(28px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .reticle, .reticle i { transition: none; } }

.item-head { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; }
.item-photo { width: 76px; height: 96px; border-radius: 10px; object-fit: cover; background: var(--raised); grid-row: span 2; }
.item-name { font: 700 27px/1.25 var(--display); margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.item-sub { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.item-price { font: 500 34px/1.1 var(--num); font-variant-numeric: tabular-nums; margin: 14px 0 0; direction: ltr; text-align: right; }
.item-price small { font-size: 0.55em; color: var(--muted); margin-left: 6px; }

.this-piece {
  margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px; border-radius: 12px; background: var(--gold-wash); border: 1px solid var(--line);
}
.this-piece .what { font-size: 15px; color: var(--text-2); }
.this-piece .what b { font-weight: 700; color: var(--text); }
.stock-big { font: 500 15px/1.2 var(--ui); white-space: nowrap; }
.stock-big .n { font: 500 26px/1 var(--num); font-variant-numeric: tabular-nums; margin-inline-end: 4px; }
.is-out { color: var(--bad); }
.is-in { color: var(--ok); }

.sizes-h { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 10px; }
.sizes-h h2 { font: 600 16px/1.3 var(--ui); margin: 0; }
.sizes-h span { color: var(--muted); font-size: 13px; }
.colour { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.colour:first-of-type { border-top: 0; padding-top: 2px; }
.colour-name { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.size-row { display: flex; flex-wrap: wrap; gap: 8px; }
.size {
  min-width: 60px; padding: 8px 10px 7px; border-radius: 10px; border: 1px solid var(--line);
  display: grid; justify-items: center; gap: 2px; background: var(--bg);
}
.size .s { font: 600 16px/1.1 var(--num); }
.size .q { font: 400 12px/1.2 var(--ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.size.is-zero { opacity: 0.55; border-style: dashed; }
.size.is-scanned { border-color: var(--gold); background: var(--gold-wash); box-shadow: inset 0 0 0 1px var(--gold); }

.fresh { margin: 22px 0 0; color: var(--muted); font-size: 13px; text-wrap: pretty; }

.notice { text-align: center; padding-top: 30px; }
.notice h2 { font: 700 22px/1.3 var(--display); margin: 0 0 6px; }
.notice p { color: var(--muted); margin: 0 auto; max-width: 34ch; font-size: 15px; text-wrap: pretty; }
.notice code { font: 500 15px/1 var(--num); color: var(--text); direction: ltr; unicode-bidi: isolate; }

/* Skeleton while a lookup is in flight */
.sk { background: linear-gradient(90deg, var(--raised), var(--line-soft), var(--raised)); background-size: 200% 100%; border-radius: 8px; animation: shimmer 1.2s linear infinite; }
.sk-title { height: 30px; width: 70%; }
.sk-line { height: 14px; width: 40%; margin-top: 10px; }
.sk-price { height: 34px; width: 34%; margin-top: 18px; }
.sk-grid { height: 92px; margin-top: 26px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (min-width: 640px) {
  .app { max-width: 560px; margin: 0 auto; }
  .sheet { border: 1px solid var(--line-soft); border-radius: 22px; margin: 0 16px 24px; flex: none; box-shadow: none; }
}
