/* Consumer page. Palette from design-reference/consumer. System fonts on purpose:
   phones already ship a good Bangla font (Noto Sans Bengali on Android, Bangla
   Sangam/Kohinoor on iOS), which keeps the page far under the CP-05 budget. */
:root {
  --bg: #f7f6f3; --surface: #ffffff; --ink: #22262b; --ink-2: #4a5058; --muted: #82786a;
  --line: #e8e5de; --line-2: #d3cfc6; --brand: #1f5f5b; --brand-ink: #ffffff;
  --ok: #2a6a43; --ok-soft: #e4efe7; --warn: #9a6408; --warn-soft: #f7ecd6;
  --bad: #a8322b; --bad-soft: #f6e1de; --grey-soft: #eceae5;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141716; --surface: #1c201f; --ink: #ebe8e2; --ink-2: #bfc3c8; --muted: #a39a8c;
    --line: #2a2f2e; --line-2: #3a403f; --brand: #5fb3ab; --brand-ink: #0f1a19;
    --ok: #6fcf97; --ok-soft: #173024; --warn: #f0b24a; --warn-soft: #33280f;
    --bad: #f08a80; --bad-soft: #3a1c19; --grey-soft: #262a29;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); -webkit-text-size-adjust: 100%; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.page { min-height: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; }

.top { display: flex; align-items: center; gap: 8px; padding: 18px 20px 14px; padding-top: max(18px, env(safe-area-inset-top)); }
.mark { width: 28px; height: 28px; border-radius: 7px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex-shrink: 0; }
.mark svg { width: 16px; height: 16px; }
.brand { font-weight: 600; font-size: 16px; flex-grow: 1; }
.lang { display: flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--surface); }
.lang button { border: 0; background: transparent; color: var(--ink-2); font-size: 13px; padding: 6px 12px; min-width: 44px; min-height: 32px; cursor: pointer; }
.lang button + button { border-left: 1px solid var(--line-2); }
.lang button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); font-weight: 600; }

.main { flex-grow: 1; padding: 8px 24px 24px; }
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding-top: 18vh; }
.state-title { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.35; }
.muted { margin: 0; color: var(--ink-2); font-size: 15px; }
.code-line { margin: 0; color: var(--muted); font-size: 14px; }
.code { font-family: var(--mono); font-size: 15px; letter-spacing: .04em; color: var(--ink); word-break: break-all; }
.notice { background: var(--warn-soft); color: var(--ink); border-radius: 10px; padding: 12px 14px; font-size: 14px; }

.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.foot { padding: 12px 24px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.foot p { margin: 0; font-size: 12px; line-height: 1.55; color: var(--muted); }
.foot .credit { margin-top: 6px; font-size: 11px; }
.foot .credit a { color: inherit; }

/* manual entry (C3) */
.entry { display: flex; flex-direction: column; padding-top: 12px; }
.hint { margin: 0 0 22px; padding: 12px 14px; font-size: 13px; line-height: 1.55; color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--bg)); border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent); border-radius: 10px; }
.entry-title { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.35; }
.entry .muted { margin: 6px 0 18px; font-size: 14px; }
.field-label { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.code-input { height: 54px; padding: 0 14px; border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font: 500 19px/1 var(--mono); letter-spacing: .06em; width: 100%; }
.code-input::placeholder { color: var(--line-2); font-family: var(--font); letter-spacing: 0; font-size: 15px; }
.code-input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.code-input[aria-invalid="true"] { border-color: var(--bad); }
.field-help { margin: 7px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.field-error { margin: 8px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--bad); font-weight: 500; }
.btn { margin-top: 18px; min-height: 50px; border: 0; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font-size: 16px; font-weight: 600; cursor: pointer; }
.btn:active { transform: translateY(1px); }

/* result screens (C2) */
.result { padding-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.tone-ok { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.tone-warn { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.tone-bad { --tone: var(--bad); --tone-soft: var(--bad-soft); }
.tone-grey { --tone: var(--ink-2); --tone-soft: var(--grey-soft); }
.r-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 16px 20px; background: var(--tone-soft); border-radius: 16px; }
.r-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--tone); display: grid; place-items: center; margin-bottom: 4px; }
.r-icon svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.r-title { margin: 0; font-size: 24px; font-weight: 700; color: var(--tone); line-height: 1.3; }
.r-sub { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink); max-width: 34em; }
.r-note { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.r-meta { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.r-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.r-product { display: flex; gap: 12px; align-items: center; }
.r-img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--line); flex-shrink: 0; }
.r-brand { font-size: 12.5px; color: var(--muted); }
.r-name { font-weight: 600; font-size: 16px; line-height: 1.35; }
.r-rows { margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.r-row dt { font-size: 12px; color: var(--muted); }
.r-row dd { margin: 0; font-size: 14.5px; font-weight: 500; }
.r-h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.r-hist { list-style: none; margin: 0; padding: 0; }
.r-hist li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.r-hist li:first-child { border-top: 0; }
.r-hist .muted { color: var(--muted); }
.r-typed { margin: 0; font-size: 14px; color: var(--ink-2); }
.r-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.r-actions .btn { display: flex; align-items: center; justify-content: center; text-decoration: none; margin-top: 0; }
.btn-quiet { background: var(--surface); color: var(--brand); border: 1.5px solid var(--line-2); }

/* report form (C5) */
.report .field { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font: 15px/1.5 var(--font); resize: vertical; }
.report .field:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.report .field-label { margin-top: 14px; }
.report .file { font: 14px var(--font); color: var(--ink-2); }
.photo-preview { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.photo-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.link-button { background: none; border: 0; padding: 0; color: var(--bad); text-decoration: underline; cursor: pointer; font: 14px var(--font); }
.report .btn-quiet { margin-top: 10px; }
.report .r-meta { margin-top: 14px; }
.btn-report { background: var(--bad); color: #fff; }
