/* Daleel: fresh & friendly. Soft green-white ground, white rounded cards, palm green for actions;
   colour elsewhere only carries meaning (score bands, traffic lights, evidence levels). */
:root {
  --bg: #F2F6F3;
  --surface: #FFFFFF;
  --surface-2: #EDF3EF;
  --ink: #13221B;
  --ink-2: #485A51;
  --ink-3: #5D6E65;
  --line: #DFE8E3;
  --brand: #0F7B55;
  --brand-ink: #0B5E40;
  --brand-soft: #DDF1E6;
  --on-brand: #FFFFFF;
  --accent: #F0A537;
  --focus: #2F6BFF;
  --s-excellent: #0F7D4A;
  --s-good: #4A7A1C;
  --s-poor: #A35A08;
  --s-bad: #C3372A;
  --s-excellent-soft: #DDF2E5;
  --s-good-soft: #E8F2D9;
  --s-poor-soft: #FBEBD5;
  --s-bad-soft: #FBE2DE;
  --on-band: #FFFFFF;
  --t-low: #0C6B3F;
  --t-med: #8A5F05;
  --t-high: #A82B20;
  --s-poor-ink: #8E4E06;
  --field-line: #788B82;
  --hero-btn: color-mix(in srgb, #000 20%, var(--brand));
  --ev-official: #2547A8;
  --ev-strong: #0B7570;
  --ev-early: #8F5B00;
  --ev-belief: #5D6A64;
  --alert-bg: #FDE9E6;
  --alert-ink: #8A1F15;
  --note-bg: #E7F0FC;
  --note-ink: #1F3C8C;
  --shadow: 0 1px 2px rgba(19, 34, 27, .06), 0 8px 24px rgba(19, 34, 27, .06);
  --r-card: 20px;
  --r-ctl: 14px;
  --f-display: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --f-body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --f-data: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1411; --surface: #15201B; --surface-2: #1D2A24; --ink: #E8F1EC; --ink-2: #A9BCB2; --ink-3: #8EA197; --line: #26352E;
    --brand: #36C489; --brand-ink: #6EDBAA; --brand-soft: #173A2B; --on-brand: #0C1411; --focus: #8EB0FF;
    --s-excellent: #41B874; --s-good: #9BC85A; --s-poor: #EFA244; --s-bad: #EF6B5C;
    --s-excellent-soft: #173426; --s-good-soft: #263419; --s-poor-soft: #3A2A14; --s-bad-soft: #3B1A16; --on-band: #0C1411;
    --t-low: #41B874; --t-med: #E3B23F; --t-high: #EF6B5C; --s-poor-ink: #EFA244; --field-line: #6E8279;
    --hero-btn: color-mix(in srgb, var(--on-brand) 14%, var(--brand));
    --ev-official: #93ADFF; --ev-strong: #53C6BB; --ev-early: #E1A93E; --ev-belief: #A6B2AB;
    --alert-bg: #3A1612; --alert-ink: #FFB3A8; --note-bg: #172038; --note-ink: #BACAFF;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1411; --surface: #15201B; --surface-2: #1D2A24; --ink: #E8F1EC; --ink-2: #A9BCB2; --ink-3: #8EA197; --line: #26352E;
  --brand: #36C489; --brand-ink: #6EDBAA; --brand-soft: #173A2B; --on-brand: #0C1411; --focus: #8EB0FF;
  --s-excellent: #41B874; --s-good: #9BC85A; --s-poor: #EFA244; --s-bad: #EF6B5C;
  --s-excellent-soft: #173426; --s-good-soft: #263419; --s-poor-soft: #3A2A14; --s-bad-soft: #3B1A16; --on-band: #0C1411;
  --t-low: #41B874; --t-med: #E3B23F; --t-high: #EF6B5C; --s-poor-ink: #EFA244; --field-line: #6E8279;
  --hero-btn: color-mix(in srgb, var(--on-brand) 14%, var(--brand));
  --ev-official: #93ADFF; --ev-strong: #53C6BB; --ev-early: #E1A93E; --ev-belief: #A6B2AB;
  --alert-bg: #3A1612; --alert-ink: #FFB3A8; --note-bg: #172038; --note-ink: #BACAFF;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
/* keeps focused items clear of the sticky top bar and the fixed bottom bar */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; scroll-padding-bottom: 124px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--f-body); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
img { max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.25; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--brand-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--f-data); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.stack { display: grid; gap: 12px; }
.wrap { width: 100%; max-width: 560px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
[dir="rtl"] .flip { transform: scaleX(-1); }
.ico { display: inline-grid; place-items: center; flex: none; }
.ico svg { width: 100%; height: 100%; display: block; }

/* top bar */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); }
.topbar .wrap { display: flex; align-items: center; gap: 8px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 12px; margin: 0; margin-inline-end: auto; min-width: 0; font: inherit; }
.logo .mark { width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: var(--on-brand); padding: 8px; }
.logo .words { display: grid; gap: 0; min-width: 0; }
.logo b { font: 700 22px/1.15 var(--f-display); }
.logo span.tag { font-size: 12.5px; line-height: 1.3; color: var(--ink-2); }
.viewtitle { font: 600 17px/1.3 var(--f-display); margin: 0; margin-inline-end: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { flex: none; width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: var(--surface); border-radius: 999px; cursor: pointer; box-shadow: var(--shadow); color: var(--ink); }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn svg { width: 22px; height: 22px; }
.langbtn { flex: none; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font: 600 14px/1 var(--f-body); cursor: pointer; color: var(--ink); }
.langbtn:hover { background: var(--surface-2); }

main.wrap { padding-block: 8px 112px; display: grid; gap: 16px; }

/* cards */
.card, .sec { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.sec { display: grid; gap: 12px; }
.sec-h { display: flex; align-items: center; gap: 8px; font: 600 17px/1.35 var(--f-display); }
.sec-h .ico { width: 24px; height: 24px; color: var(--brand); }
.sec-h small { display: block; font: 400 14px/1.5 var(--f-body); color: var(--ink-2); margin-top: 4px; }
.sec-h.stacked { display: block; }
.sec.flat { background: transparent; box-shadow: none; padding: 0; }
.sec-head { display: flex; align-items: flex-start; gap: 12px; }
.sec-head > .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); padding: 8px; }
.sec-head > div { display: grid; gap: 4px; min-width: 0; padding-top: 4px; }
.sec-sub { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.lead { font-size: 16.5px; color: var(--ink-2); }
.hero h1 { font: 700 28px/1.2 var(--f-display); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 20px; border: 0; border-radius: var(--r-ctl); background: var(--surface-2); color: var(--ink); font: 600 16px/1.2 var(--f-body); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.outline { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.compact { min-height: 44px; padding: 8px 16px; }
.btn .ico { width: 22px; height: 22px; }
.linkbtn { display: inline-flex; align-items: center; min-height: 44px; padding: 0; background: none; border: 0; font: 600 15px var(--f-body); color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* home hero */
.home-hero { position: relative; overflow: hidden; display: grid; gap: 16px; padding: 24px 20px; border-radius: 24px; background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow); }
.home-hero::before, .home-hero::after { content: ""; position: absolute; border-radius: 50%; background: currentColor; opacity: .07; pointer-events: none; }
.home-hero::before { width: 220px; height: 220px; inset-inline-end: -60px; top: -80px; }
.home-hero::after { width: 140px; height: 140px; inset-inline-start: -50px; bottom: -60px; }
.home-hero h2 { font: 700 26px/1.25 var(--f-display); position: relative; }
.home-hero p { opacity: .9; position: relative; }
.home-hero :focus-visible, .home-hero label.btn:focus-within { outline-color: var(--on-brand); }
.scanbtn { position: relative; display: flex; align-items: center; gap: 16px; width: 100%; min-height: 72px; padding: 12px 20px; border: 0; border-radius: 16px; background: var(--surface); color: var(--ink); cursor: pointer; text-align: start; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.scanbtn .ico { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); padding: 12px; }
.scanbtn b { display: block; font: 600 19px/1.25 var(--f-display); }
.scanbtn small { display: block; font-size: 14px; color: var(--ink-2); }
.hero-actions { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.hero-actions .btn { background: var(--hero-btn); color: var(--on-brand); min-height: 52px; position: relative; }
.hero-actions .btn:hover { filter: brightness(1.1); }
.hero-actions input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.hero-actions label.btn:focus-within { outline: 3px solid var(--on-brand); outline-offset: 2px; }

/* forms */
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
legend { font: 600 19px/1.3 var(--f-display); padding: 0; margin-bottom: 12px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field > label, .lbl { font: 600 14px/1.4 var(--f-body); }
input[type="text"], input[type="search"], textarea { width: 100%; min-height: 48px; padding: 8px 16px; border: 0; border-radius: var(--r-ctl); background: var(--surface-2); color: var(--ink); font: 400 16px/1.4 var(--f-body); box-shadow: inset 0 0 0 1.5px var(--field-line); }
input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--s-bad); }
input[type="text"]:focus, textarea:focus { box-shadow: inset 0 0 0 2px var(--brand); outline: none; }
textarea { min-height: 104px; padding-block: 12px; resize: vertical; }
input.mono { font-family: var(--f-data); }
.searchbox { display: flex; gap: 8px; }
.searchbox .inputwrap { position: relative; flex: 1; min-width: 0; }
.searchbox .inputwrap .ico { position: absolute; top: 50%; inset-inline-start: 12px; width: 20px; height: 20px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.searchbox input { padding-inline-start: 40px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.err { color: var(--alert-ink); font-size: 14px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 360px) { .grid2 { grid-template-columns: 1fr; } }

.opt { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); cursor: pointer; box-shadow: inset 0 0 0 2px transparent; }
.opt:hover { box-shadow: inset 0 0 0 2px var(--line); }
.opt:has(input:checked) { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt .ico { width: 36px; height: 36px; border-radius: 12px; background: var(--surface); color: var(--brand-ink); padding: 8px; grid-row: span 2; }
.opt b { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; line-height: 1.35; }
.opt small { grid-column: 2; color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.opt.plain { grid-template-columns: 1fr; padding-inline-end: 48px; }
.opt.plain small { grid-column: 1; }
.opt.tile { grid-template-columns: 1fr; justify-items: start; align-content: start; gap: 8px; padding: 16px; min-height: 124px; }
.opt.tile .ico { grid-row: auto; }
.opt.tile small { grid-column: 1; }
.opt .check { position: absolute; top: 12px; inset-inline-end: 12px; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--ink-3); }
.opt:has(input:checked) .check { background: var(--brand); box-shadow: none; }
.opt:has(input:checked) .check::after { content: ""; position: absolute; left: 7px; top: 4px; width: 6px; height: 11px; border: solid var(--on-brand); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.pill { font: 600 12px/1 var(--f-body); padding: 4px 8px; border-radius: 999px; background: var(--brand); color: var(--on-brand); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 999px; background: var(--surface-2); cursor: pointer; font-size: 15px; box-shadow: inset 0 0 0 1.5px var(--line); }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip:has(input:checked) { background: var(--brand); color: var(--on-brand); box-shadow: none; }
.chip:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.switch { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); cursor: pointer; }
.switch b { font-weight: 600; }
.switch small { color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.switch input { appearance: none; -webkit-appearance: none; grid-column: 2; grid-row: 1 / span 2; width: 52px; height: 32px; margin: 0; border-radius: 999px; background: var(--ink-3); position: relative; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s ease; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(20px); }
[dir="rtl"] .switch input::after { left: auto; right: 4px; }
[dir="rtl"] .switch input:checked::after { transform: translateX(-20px); }
.switch:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch:has(input:disabled) { cursor: not-allowed; }
.switch input:disabled { opacity: .45; cursor: not-allowed; }

/* status and messages */
.status { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; background: var(--note-bg); color: var(--note-ink); font-weight: 500; }
.status .grow { flex: 1; min-width: 0; }
.spin { flex: none; width: 20px; height: 20px; border: 3px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.note { background: var(--note-bg); color: var(--note-ink); padding: 12px 16px; border-radius: 16px; font-size: 14.5px; }
.alert { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start; background: var(--alert-bg); color: var(--alert-ink); padding: 16px; border-radius: 16px; }
.alert > .ico { width: 24px; height: 24px; grid-row: span 3; }
.alert b { font-size: 16px; }
.alert p { font-size: 14.5px; font-weight: 500; grid-column: 2; }
.alert.plain { display: block; }

/* product lists */
.plist { list-style: none; margin: 0; padding: 0; display: grid; }
.plist li + li { border-top: 1px solid var(--line); }
.prow { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; width: 100%; padding: 12px 0; background: none; border: 0; text-align: start; cursor: pointer; min-height: 64px; color: var(--ink); }
.prow:hover b { color: var(--brand-ink); }
.prow b { font-weight: 600; line-height: 1.35; min-width: 0; grid-column: 2; }
.prow small { color: var(--ink-2); font-size: 13.5px; grid-column: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .avatar { grid-column: 1; grid-row: 1 / span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); font: 700 17px/1 var(--f-display); }
.prow .chev { grid-column: 3; grid-row: 1 / span 2; width: 20px; height: 20px; color: var(--ink-3); }
.mini { display: flex; gap: 4px; grid-column: 1; grid-row: 1 / span 2; }
.mini span.bandbg { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font: 700 16px/1 var(--f-display); color: var(--on-band); }
.empty { padding: 16px; border-radius: 16px; background: var(--surface-2); color: var(--ink-2); font-size: 15px; }

/* score bands */
.b-excellent { --band: var(--s-excellent); --band-soft: var(--s-excellent-soft); }
.b-good { --band: var(--s-good); --band-soft: var(--s-good-soft); }
.b-poor { --band: var(--s-poor); --band-soft: var(--s-poor-soft); }
.b-bad { --band: var(--s-bad); --band-soft: var(--s-bad-soft); }
.b-none { --band: var(--ink-3); --band-soft: var(--surface-2); }
.bandbg { background: var(--band); }

/* result hero */
.res-hero { display: grid; gap: 16px; padding: 24px 20px 20px; border-radius: 24px; background: linear-gradient(180deg, var(--band-soft) 0%, var(--surface) 78%); box-shadow: var(--shadow); }
.phead { display: grid; gap: 4px; }
.phead h2 { font: 700 24px/1.25 var(--f-display); }
.phead p { color: var(--ink-2); font-size: 14.5px; }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dial { display: grid; justify-items: center; align-content: start; gap: 8px; padding: 16px 8px; border-radius: 16px; background: var(--surface); text-align: center; min-width: 0; box-shadow: 0 1px 2px rgba(19, 34, 27, .05); }
.ring { position: relative; width: 116px; height: 116px; }
.ring svg { width: 116px; height: 116px; transform: rotate(-90deg); }
[dir="rtl"] .ring svg { transform: rotate(-90deg) scaleY(-1); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font: 700 38px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.ring .num.na { font-size: 26px; color: var(--ink-3); }
.dial .cap { font: 600 14.5px/1.3 var(--f-body); color: var(--ink-2); }
.dial .band { font: 600 13px/1 var(--f-body); padding: 4px 12px; border-radius: 999px; background: var(--band); color: var(--on-band); }
.dial .band.na { background: var(--surface-2); color: var(--ink-2); }
.verdict { font: 500 17px/1.5 var(--f-body); }

.bars { display: grid; gap: 16px; margin: 0; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; }
.bar dt { font-weight: 600; }
.bar dd { margin: 0; font: 700 16px/1.4 var(--f-display); font-variant-numeric: tabular-nums; }
.bar dd small { font: 500 13px var(--f-body); color: var(--ink-2); margin-inline-start: 4px; }
.bar .track { grid-column: 1 / -1; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; background: var(--band); }
.bar small { grid-column: 1 / -1; color: var(--ink-2); font-size: 13.5px; }
.bar.off dt, .bar.off dd { color: var(--ink-3); }

/* findings */
.findings { list-style: none; margin: 0; padding: 0; display: grid; }
.finding { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 16px 0; }
.finding + .finding { border-top: 1px solid var(--line); }
.findings > .finding:first-child { padding-top: 4px; }
.findings > .finding:last-child { padding-bottom: 0; }
.f-icon { grid-row: 1 / span 6; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; padding: 8px; }
.f-icon.for { background: var(--s-excellent-soft); color: var(--s-excellent); }
.f-icon.against { background: var(--s-bad-soft); color: var(--s-bad); }
.f-icon.note { background: var(--note-bg); color: var(--note-ink); }
.f-icon.belief { background: var(--surface-2); color: var(--ev-belief); }
.finding > :not(.f-icon) { grid-column: 2; min-width: 0; }
.f-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kind { font: 600 12.5px/1 var(--f-body); color: var(--ink-2); }
.f-title { font-weight: 600; font-size: 16px; line-height: 1.45; }
.f-detail { color: var(--ink-2); font-size: 14.5px; }
.ev { display: inline-flex; align-items: center; gap: 4px; font: 600 12.5px/1 var(--f-body); white-space: nowrap; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); }
.ev i { flex: none; width: 10px; height: 10px; background: currentColor; }
.ev.official { color: var(--ev-official); }
.ev.strong { color: var(--ev-strong); }
.ev.strong i { border-radius: 50%; }
.ev.emerging { color: var(--ev-early); }
.ev.emerging i { border-radius: 50%; border: 1.5px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.ev.traditional { color: var(--ev-belief); }
.ev.traditional i { border-radius: 50%; border: 1.5px solid currentColor; background: transparent; }
details.src summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--brand-ink); min-height: 44px; display: flex; align-items: center; gap: 8px; width: fit-content; list-style: none; }
details.src summary::-webkit-details-marker { display: none; }
details.src summary::before { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .15s ease; }
[dir="rtl"] details.src summary::before { transform: rotate(135deg); }
details.src[open] summary::before { transform: rotate(45deg); }
.srcbody { display: grid; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.srcitem { display: grid; gap: 8px; }
.srcitem > p { font-size: 14px; color: var(--ink-2); }
details.src ol { margin: 0; padding-inline-start: 24px; font-size: 13.5px; color: var(--ink-2); display: grid; gap: 4px; }
details.src a { word-break: break-word; }
.says { padding: 12px; border-radius: 14px; background: var(--surface-2); font-size: 14.5px; }
.says b { display: block; font-size: 13px; color: var(--ink-2); }

/* nutrition */
.tablebox { overflow-x: auto; margin-inline: -4px; }
.ntable { width: 100%; border-collapse: collapse; font-size: 15px; }
.ntable th, .ntable td { padding: 12px 4px; border-top: 1px solid var(--line); text-align: start; vertical-align: middle; }
.ntable thead th { border-top: 0; padding-top: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ntable tbody th { font-weight: 600; }
.ntable tr.sub th { padding-inline-start: 20px; font-weight: 400; color: var(--ink-2); }
.ntable td.num { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.ntable td.num .mono { font: 600 15px var(--f-display); }
.ntable td.lv { text-align: end; width: 1%; }
.lvl { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; white-space: nowrap; padding: 4px 8px; border-radius: 999px; }
.lvl i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.lvl.low { color: var(--t-low); background: var(--s-excellent-soft); }
.lvl.med { color: var(--t-med); background: var(--s-poor-soft); }
.lvl.high { color: var(--t-high); background: var(--s-bad-soft); }

.ingr { background: var(--surface-2); padding: 12px 16px; border-radius: 14px; font-size: 15px; overflow-wrap: anywhere; }
mark { background: transparent; color: inherit; padding: 0 4px; border-bottom: 2.5px solid var(--ink-3); border-radius: 2px; }
mark.m-add { border-bottom-color: var(--t-high); }
mark.m-halal { border-bottom-color: var(--accent); }
mark.m-allergy { background: var(--alert-bg); color: var(--alert-ink); border-bottom-color: var(--s-bad); }

.addlist { list-style: none; margin: 0; padding: 0; display: grid; }
.addlist > li + li { border-top: 1px solid var(--line); }
.addlist > li > details > summary { list-style: none; display: grid; grid-template-columns: 1fr auto 12px; gap: 4px 12px; align-items: center; padding: 12px 0; cursor: pointer; min-height: 56px; }
.addlist > li > details > summary::-webkit-details-marker { display: none; }
.addlist > li > details > summary::after { content: ""; grid-column: 3; grid-row: 1 / span 2; width: 8px; height: 8px; border: solid var(--ink-3); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s ease; }
.addlist > li > details[open] > summary::after { transform: rotate(-135deg); }
.addlist > li > details > summary b { font-weight: 600; }
.addlist > li > details > summary small { grid-column: 1; color: var(--ink-2); font-size: 13.5px; }
.addplain { display: grid; gap: 4px; padding: 12px 0; min-height: 56px; }
.addplain b { font-weight: 600; }
.addplain small { color: var(--ink-2); font-size: 13.5px; }
.concern { grid-column: 2; grid-row: 1 / span 2; font: 600 12.5px/1 var(--f-body); padding: 4px 8px; border-radius: 999px; white-space: nowrap; }
.concern.none { color: var(--t-low); background: var(--s-excellent-soft); }
.concern.low { color: var(--t-med); background: var(--s-poor-soft); }
.concern.moderate { color: var(--s-poor-ink); background: var(--s-poor-soft); }
.concern.high { color: var(--t-high); background: var(--s-bad-soft); }
.addbody { padding: 0 0 16px; display: grid; gap: 12px; }
.addfind { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.addfind .concern { grid-row: auto; }

dl.kv { margin: 0; display: grid; gap: 16px; }
dl.kv div { display: grid; gap: 4px; }
dl.kv dt { font-size: 13.5px; color: var(--ink-2); }
dl.kv dd { margin: 0; font-weight: 600; }
dl.kv dd small { display: block; font-weight: 400; color: var(--ink-2); font-size: 13.5px; }

/* label photos */
.slots { display: grid; gap: 12px; }
.slot { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--line); }
.slot.filled { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.slot .thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--surface); display: grid; place-items: center; color: var(--ink-3); }
.slot .thumb svg { width: 28px; height: 28px; }
.slot b { font-weight: 600; }
.slot .btn { min-height: 44px; padding: 8px 16px; font-size: 15px; position: relative; background: var(--surface); }
.slot .btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.slot input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.nutform { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nutform .field label { font-weight: 500; font-size: 14px; }
.nutform input { font-family: var(--f-data); }

.howtext { display: grid; gap: 12px; font-size: 15.5px; }
.howtext ul { margin: 0; padding-inline-start: 24px; display: grid; gap: 8px; }
.weights { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.weights th, .weights td { padding: 8px 4px; border-top: 1px solid var(--line); text-align: start; }
.weights td.num { text-align: end; font: 600 15px var(--f-display); }
.weights caption { text-align: start; font-weight: 600; padding-bottom: 8px; }
.srclist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.srclist li { display: grid; gap: 4px; font-size: 14.5px; }
.srclist small { color: var(--ink-2); }

.foot { font-size: 13px; color: var(--ink-3); padding: 8px 4px 16px; display: grid; gap: 4px; }

/* bottom action bar on product pages */
.bottombar { position: fixed; inset: auto 0 0; z-index: 6; padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: linear-gradient(180deg, transparent, var(--bg) 40%); }
.bottombar .btn { width: 100%; max-width: 528px; margin-inline: auto; display: flex; min-height: 56px; border-radius: 16px; box-shadow: 0 8px 24px rgba(15, 123, 85, .28); }

/* live barcode scanner */
.scanner { position: fixed; inset: 0; z-index: 20; background: #000; color: #fff; display: grid; grid-template-rows: auto 1fr auto; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .top, .scanner .bottom { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); }
.scanner .bottom { flex-direction: column; align-items: stretch; padding-top: 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(0deg, rgba(0, 0, 0, .7), transparent); }
.scanner .round { width: 48px; height: 48px; border-radius: 999px; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; padding: 12px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.scanner .round[aria-pressed="true"] { background: #fff; color: #000; }
.scanner .frame { position: relative; z-index: 1; align-self: center; justify-self: center; width: min(78vw, 340px); aspect-ratio: 16 / 10; border-radius: 24px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
.scanner .frame::before { content: ""; position: absolute; inset: 0; border-radius: 24px; border: 3px solid rgba(255, 255, 255, .9); }
.scanner .frame .line { position: absolute; inset-inline: 16px; top: 50%; height: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: sweep 2s ease-in-out infinite alternate; }
@keyframes sweep { from { transform: translateY(-40px); } to { transform: translateY(40px); } }
.scanner.nocam .frame { visibility: hidden; }
.scanner .hint { text-align: center; font: 600 17px/1.4 var(--f-display); text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.scanner .alt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scanner .alt .btn { background: rgba(255, 255, 255, .16); color: #fff; position: relative; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.scanner .alt input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.scanner .alt label.btn:focus-within { outline: 3px solid #fff; outline-offset: 2px; }
.scanner .msg { text-align: center; font-size: 15px; padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, .55); }

@media (prefers-reduced-motion: reduce) {
  .spin { animation: none; border-inline-end-color: currentColor; opacity: .6; }
  .switch input::after, details.src summary::before, .addlist > li > details > summary::after { transition: none; }
  .scanner .frame .line { animation: none; }
}
