/* Yaso Bill Check — Yaso Soft Look tokens, light + dark.
   Layout: header, how-it-works strip, two tabs, one working area.
   A checked bill = photo column beside the result card on wide screens,
   stacked on phones. No inline styles anywhere (the CSP forbids them). */
:root {
  --bg: #FAF8FC; --card: #FFFFFF; --ink: #1E1A2E; --muted: #6B6680; --line: #ECE8F5;
  --primary: #6C4EF6; --on-primary: #FFFFFF; --soft: #EFEBFE; --soft-ink: #4B33C9;
  --good: #137A4B; --good-bg: #E5F6EE; --warn: #8A5A00; --warn-bg: #FFF3D6; --bad: #C8343A; --bad-bg: #FDEBEC;
  --shadow: 0 10px 30px rgba(108, 78, 246, 0.10);
  --scrim: rgba(10, 8, 20, 0.88);
  --font: "Noto Sans", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, sans-serif;
  --r-sm: 18px; --r-lg: 28px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #15121F; --card: #1F1A2E; --ink: #F1EEFA; --muted: #A9A3BF; --line: #2E2742;
  --primary: #8F78FF; --on-primary: #15121F; --soft: #2A2342; --soft-ink: #CFC4FF;
  --good: #5ED39B; --good-bg: #173326; --warn: #F2C35B; --warn-bg: #362A12; --bad: #FF8A8E; --bad-bg: #3A1B1E;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #15121F; --card: #1F1A2E; --ink: #F1EEFA; --muted: #A9A3BF; --line: #2E2742;
  --primary: #8F78FF; --on-primary: #15121F; --soft: #2A2342; --soft-ink: #CFC4FF;
  --good: #5ED39B; --good-bg: #173326; --warn: #F2C35B; --warn-bg: #362A12; --bad: #FF8A8E; --bad-bg: #3A1B1E;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35); color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: max(20px, env(safe-area-inset-top, 0px)); padding-bottom: max(48px, env(safe-area-inset-bottom, 0px)); overflow-x: hidden; }
[hidden] { display: none !important; }
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-size: clamp(24px, 4vw, 34px); font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.lead { max-width: 75ch; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.stack { display: flex; flex-direction: column; gap: 14px; }

button, .btn { font: inherit; cursor: pointer; border: 0; border-radius: var(--r-sm); padding: 10px 16px; font-weight: 700; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, .pick:focus-within, .paper:focus-visible, input:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.btn-main { background: var(--primary); color: var(--on-primary); }
.btn-soft { background: var(--soft); color: var(--soft-ink); }
.btn-big { padding: 14px 22px; font-size: 16px; }
.link { background: none; padding: 4px 6px; color: var(--soft-ink); text-decoration: underline; font-weight: 600; }

.top { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; }
.brand { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.brand .tag { color: var(--muted); max-width: 62ch; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--soft); border-radius: 22px; padding: 4px; gap: 2px; }
.seg button { background: transparent; color: var(--soft-ink); padding: 6px 14px; border-radius: 999px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs button { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.tabs button[aria-selected="true"] { background: var(--primary); color: var(--on-primary); }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.how div { background: var(--soft); border-radius: var(--r-sm); padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.how b { color: var(--soft-ink); }
@media (max-width: 600px) { .how { grid-template-columns: 1fr 1fr; } .how div { padding: 10px 12px; font-size: 13px; } }

/* New bill: code, two big pick buttons, page tiles */
.code-box { display: flex; flex-direction: column; gap: 8px; background: var(--soft); border-radius: var(--r-sm); padding: 14px; }
.code-box label { display: flex; flex-direction: column; gap: 2px; }
.code-row { display: flex; gap: 8px; flex-wrap: wrap; }
.code-row input { flex: 1 1 180px; min-width: 0; font: inherit; font-size: 16px; padding: 10px 14px; border-radius: var(--r-sm);
  border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.code-ok { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--good); font-weight: 600; }
.pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick-row.off { opacity: .5; pointer-events: none; }
.pick { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  background: var(--soft); color: var(--soft-ink); border-radius: var(--r-lg); padding: 22px 12px; cursor: pointer; min-height: 132px; }
.pick svg { width: 40px; height: 40px; }
.pick b { font-size: 18px; }
.pick span { font-size: 13px; color: var(--muted); }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
#drop.over { outline: 3px dashed var(--primary); outline-offset: -8px; }
@media (hover: none) { .drop-note { display: none; } }
.count { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.tcard { position: relative; border-radius: var(--r-sm); overflow: hidden; background: var(--soft); aspect-ratio: 3 / 4; }
.tcard img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tcard.is-broken img { visibility: hidden; }
.tbroken { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; }
.tbadge { position: absolute; top: 6px; inset-inline-start: 6px; background: var(--primary); color: var(--on-primary); border-radius: 999px;
  min-width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; padding: 0 6px; }
.tx { position: absolute; top: 4px; inset-inline-end: 4px; width: 34px; height: 34px; padding: 0; border-radius: 999px;
  background: var(--card); color: var(--bad); font-size: 20px; line-height: 1; }
.tmove { position: absolute; bottom: 4px; inset-inline: 4px; display: flex; justify-content: space-between; }
.tmove button { width: 38px; height: 34px; padding: 0; border-radius: 999px; background: var(--card); color: var(--soft-ink); }
[dir="rtl"] .flip { display: inline-block; transform: scaleX(-1); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.state { display: flex; align-items: center; gap: 10px; font-weight: 600; }
#status { display: flex; flex-direction: column; gap: 8px; }
#status:empty { display: none; }
progress { width: 100%; height: 10px; border: 0; border-radius: 999px; overflow: hidden; background: var(--soft); accent-color: var(--primary); -webkit-appearance: none; appearance: none; }
progress::-webkit-progress-bar { background: var(--soft); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--primary); border-radius: 999px; }
.spin { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 3px solid var(--soft); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
.note { font-size: 13px; color: var(--muted); max-width: 70ch; }
.err { background: var(--bad-bg); color: var(--bad); border-radius: var(--r-sm); padding: 12px 14px; font-weight: 600; }

/* Example bills */
.papers { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.paper { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 8px; text-align: start; color: var(--ink); }
.paper img { width: 100%; height: 150px; object-fit: cover; border-radius: var(--r-sm); background: var(--soft); }
.paper .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }

/* One checked bill */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill.big { font-size: 15px; padding: 6px 14px; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.soft { background: var(--soft); color: var(--soft-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .pill { white-space: normal; }
.detail { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .detail { grid-template-columns: minmax(0, 1fr); } }
.photo { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px); display: flex; flex-direction: column; gap: 8px; }
.ph-main { width: 100%; border-radius: var(--r-sm); cursor: zoom-in; background: var(--soft); display: block; }
@media (max-width: 860px) { .photo { position: static; } .ph-main { max-height: 360px; object-fit: contain; } }
.ph-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ph-arrow { padding: 6px 16px; font-size: 20px; line-height: 1; }
.ph-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.ph-thumb { position: relative; flex: none; width: 54px; height: 70px; padding: 0; border-radius: 12px; overflow: hidden; background: var(--soft); border: 2px solid transparent; }
.ph-thumb.on { border-color: var(--primary); }
.ph-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-thumb span { position: absolute; bottom: 2px; inset-inline-start: 2px; background: var(--card); color: var(--ink); border-radius: 999px; font-size: 11px; padding: 0 5px; }
.sum { display: flex; flex-direction: column; gap: 14px; }
.sumhead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: flex-start; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.fact { background: var(--bg); border-radius: var(--r-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fact span:first-child { font-size: 12px; color: var(--muted); }
.fact b { font-size: 17px; }
.fact.hi { background: var(--soft); }
.fact.hi b { color: var(--soft-ink); }
.verdict { border-radius: var(--r-sm); padding: 12px 14px; font-weight: 600; }
.verdict.good { background: var(--good-bg); color: var(--good); }
.verdict.warn { background: var(--warn-bg); color: var(--warn); }
.verdict.bad { background: var(--bad-bg); color: var(--bad); }
.verdict.soft { background: var(--soft); color: var(--soft-ink); }
.tbl { overflow-x: auto; border-radius: var(--r-sm); -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 14px; }
th { text-align: start; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: end; }
tr.free td { background: var(--good-bg); }
.item { font-weight: 600; }
.why { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.why-in { color: inherit; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.zoom { position: fixed; inset: 0; background: var(--scrim); z-index: 20; overflow: auto; padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px 12px; }
.zoom img { max-width: none; width: 160%; display: block; margin: 0 auto; }
@media (max-width: 860px) { .zoom img { width: 260%; } }
.zoom button { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 12px); inset-inline-end: max(12px, env(safe-area-inset-right, 0px)); z-index: 21; }
footer { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 420px) { .pick { min-height: 116px; padding: 16px 8px; } .pick b { font-size: 16px; } }
