/* Bilqis brand tokens (from the website brand.css / cost-system CONTRACT). Flat colours, no gradients. */
:root {
  --saba: #1C3861; --sand: #F4E9DC; --clay: #DC9F85; --clay-text: #A55F40; --stone: #B8A68E;
  --coffee: #4A352A; --olive: #7D8467; --paper: #FAF2E6; --line: #E6D8C6; --white: #fff;
  --danger: #B3261E; --ok: #2E6B3F; --warn: #9A6200;
  --radius: 12px; --tap: 44px; --gap: 12px;
  --font: system-ui, -apple-system, "Segoe UI", "Noto Naskh Arabic", "Geeza Pro", Tahoma, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; background: var(--paper); color: var(--coffee); font: 16px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
h1, h2, h3 { color: var(--saba); line-height: 1.3; margin: 0 0 8px; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.12rem; } h3 { font-size: 1rem; }
p { margin: 0 0 8px; }
a { color: var(--saba); }
.skip { position: absolute; inset-inline-start: -999px; } .skip:focus { inset-inline-start: 8px; top: 8px; background: var(--white); padding: 8px; z-index: 10; }
.boot { text-align: center; margin-top: 40vh; letter-spacing: .2em; color: var(--saba); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: #7a6a5c; font-size: .9rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Layout */
header.top { position: sticky; top: 0; z-index: 5; background: var(--saba); color: var(--sand); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 8px; }
header.top h1 { color: var(--sand); font-size: 1.05rem; margin: 0; flex: 1; }
header.top button { background: transparent; color: var(--sand); border: 1px solid rgba(244,233,220,.4); min-height: 36px; padding: 0 12px; border-radius: 999px; font: inherit; font-size: .85rem; }
main { padding: 16px; max-width: 760px; margin: 0 auto; }
nav.tabs { position: fixed; bottom: 0; inset-inline: 0; z-index: 5; display: flex; background: var(--white); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.tabs a { flex: 1; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: #7a6a5c; font-size: .78rem; position: relative; }
nav.tabs a[aria-current="page"] { color: var(--saba); font-weight: 600; }
nav.tabs a .i { font-size: 1.3rem; line-height: 1; }
nav.tabs .dot { position: absolute; top: 6px; inset-inline-end: calc(50% - 18px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; padding: 0 5px; line-height: 18px; }

/* Cards & lists */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: var(--gap); }
.card.alert { border-color: var(--clay); background: #fff8f3; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.kpi b { display: block; font: 600 1.25rem var(--mono); color: var(--saba); direction: ltr; text-align: start; }
.kpi span { font-size: .82rem; color: #7a6a5c; }
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-height: var(--tap); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow-wrap: anywhere; }
a.row { text-decoration: none; color: inherit; }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--sand); flex: none; display: grid; place-items: center; color: var(--stone); font-size: 1.4rem; }
.qty { font: 600 1.3rem var(--mono); color: var(--saba); min-width: 3ch; text-align: center; direction: ltr; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.badge { font-size: .72rem; border-radius: 999px; padding: 1px 8px; background: var(--sand); color: var(--coffee); white-space: nowrap; }
.badge.red { background: #fde4e1; color: var(--danger); } .badge.amber { background: #fff1d6; color: var(--warn); } .badge.green { background: #e3f1e6; color: var(--ok); } .badge.blue { background: #e4eaf4; color: var(--saba); }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.t th, table.t td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
table.t td.n, table.t th.n { text-align: end; font-family: var(--mono); direction: ltr; }
.scroll-x { overflow-x: auto; }

/* Forms */
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
label .hint { font-weight: 400; color: #7a6a5c; font-size: .82rem; }
input, select, textarea { font: inherit; min-height: var(--tap); padding: 8px 12px; border: 1px solid var(--stone); border-radius: 10px; background: var(--white); color: var(--coffee); width: 100%; }
input[type="number"], input[inputmode="numeric"], input[inputmode="decimal"] { font-family: var(--mono); direction: ltr; text-align: start; }
textarea { min-height: 80px; }
input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; min-height: 0; padding: 0; flex: none; accent-color: var(--saba); }
input[type="file"] { padding: 8px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--clay); outline-offset: 2px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 0; display: grid; gap: 8px; }
legend { font-weight: 600; padding: 0 4px; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { display: flex; align-items: center; gap: 6px; font-weight: 400; border: 1px solid var(--stone); border-radius: 999px; padding: 0 14px; min-height: var(--tap); background: var(--white); }
.choice input { width: 20px; height: 20px; }
.choice label:has(input:checked) { background: var(--saba); color: var(--sand); border-color: var(--saba); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button, .btn { font: inherit; font-weight: 600; min-height: var(--tap); border-radius: 999px; padding: 0 18px; border: 1px solid var(--saba); background: var(--saba); color: var(--sand); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button.secondary, .btn.secondary { background: var(--white); color: var(--saba); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.ghost { background: transparent; border-color: transparent; color: var(--saba); }
button[disabled] { opacity: .55; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions.stack > * { flex: 1 1 100%; }
.preview { background: var(--sand); border-radius: 10px; padding: 10px 12px; font-weight: 600; }
.photo-pick { display: flex; align-items: center; gap: 10px; }
.photo-pick img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.error { color: var(--danger); font-weight: 600; }
.search { position: sticky; top: 58px; z-index: 4; background: var(--paper); padding: 6px 0 10px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.chips button { background: var(--white); color: var(--saba); min-height: 36px; padding: 0 14px; font-weight: 500; white-space: nowrap; }
.chips button[aria-pressed="true"] { background: var(--saba); color: var(--sand); }
#toast { position: fixed; inset-inline: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 20; display: grid; gap: 8px; pointer-events: none; }
#toast div { background: var(--coffee); color: var(--sand); border-radius: 12px; padding: 12px 14px; box-shadow: none; pointer-events: auto; }
#toast div.err { background: var(--danger); color: #fff; }
dialog { border: 0; border-radius: 16px; padding: 18px; width: min(520px, calc(100vw - 32px)); max-height: 85vh; }
dialog::backdrop { background: rgba(28,56,97,.45); }
.pin-pad { direction: ltr; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-pad button { min-height: 56px; font-size: 1.3rem; background: var(--white); color: var(--saba); }
.pin-dots { display: flex; justify-content: center; gap: 12px; direction: ltr; margin: 8px 0 14px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--saba); }
.pin-dots i.on { background: var(--saba); }
.login { max-width: 420px; margin: 8vh auto 0; padding: 0 16px; }
.logo { text-align: center; color: var(--saba); letter-spacing: .25em; font-weight: 700; margin-bottom: 18px; }
@media print { nav.tabs, header.top button, .no-print { display: none !important; } body { padding: 0; background: #fff; } .card { break-inside: avoid; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
