/* Order viewer - plain, readable, works on a phone. No external assets; served under a strict CSP
   (style-src 'self'), so no inline styles anywhere. Light by default, dark when the device asks. */
:root {
  --bg: #f4f6f9; --card: #ffffff; --line: #d8dee7; --text: #18202b; --muted: #5b6878;
  --accent: #1f6feb; --accent-text: #ffffff; --ok: #1a7f37; --warn: #9a6700; --bad: #c62828;
  --soft: #eef2f7; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a; --card: #161d26; --line: #2a3441; --text: #e3e9f1; --muted: #93a1b2;
    --accent: #4d9bff; --accent-text: #0b1220; --ok: #4cc276; --warn: #e3b341; --bad: #ff6b6b;
    --soft: #1c2530; --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; margin: 0; }
html, body { min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}
/* Sections are hidden with the HTML hidden attribute only (viewer.html, viewer.js). !important keeps
   a display rule such as .center { display: flex } from showing a hidden section. */
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.err { color: var(--bad); min-height: 22px; font-size: 15px; }
/* Catalogue strings are hostile input: isolate their direction and let them wrap anywhere. */
.u { unicode-bidi: isolate; overflow-wrap: anywhere; }
.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; }
.title { font-size: 20px; font-weight: 700; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px;
  box-shadow: var(--shadow); }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.narrow { width: 380px; max-width: 100%; display: flex; flex-direction: column; gap: 8px; }
.narrow label { font-weight: 600; font-size: 15px; margin-top: 6px; }
input[type="text"], input[type="password"], input[type="search"], select {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  min-height: 44px; width: 100%;
}
select { width: auto; }
.btn { border: 1px solid var(--line); background: var(--soft); border-radius: 8px; padding: 9px 16px;
  min-height: 44px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .55; cursor: default; }
.narrow .btn { margin-top: 10px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.top-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.content { max-width: 920px; margin: 0 auto; padding: 18px 16px 48px; display: flex; flex-direction: column; gap: 16px; }

.search { display: flex; flex-direction: column; gap: 8px; }
.search-label { font-weight: 700; font-size: 18px; }
.search-row { display: flex; gap: 10px; }
.search-row input { flex: 1; font-size: 20px; letter-spacing: .5px; }
@media (max-width: 520px) { .search-row { flex-direction: column; } }

.status { min-height: 24px; font-size: 16px; }
.status.bad { color: var(--bad); }
.notice { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
#results { display: flex; flex-direction: column; gap: 12px; }
#results h2 { font-size: 20px; }
#photos-wrap { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
#photos-wrap h3 { font-size: 17px; }
.list { display: flex; flex-direction: column; gap: 12px; }

.item { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
.item.compact { display: block; padding: 12px 16px; }
@media (max-width: 620px) { .item { grid-template-columns: 1fr; } }
.thumb { width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; background: var(--soft); object-fit: cover;
  display: block; }
.thumb-empty { width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; background: var(--soft); color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 14px; text-align: center; padding: 8px; }
.info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.when { font-weight: 700; font-size: 17px; }
.note { font-size: 15px; }
.note.warn { color: var(--warn); }
.note.bad { color: var(--bad); font-weight: 600; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.player { width: 100%; max-height: 70vh; border-radius: 8px; background: #000; margin-top: 8px; }
.photo { max-width: 100%; border-radius: 8px; margin-top: 8px; display: block; }

.foot { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 8px; }
.toasts { position: fixed; right: 16px; bottom: 16px; left: 16px; display: flex; flex-direction: column;
  align-items: flex-end; gap: 8px; z-index: 20; pointer-events: none; }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 8px;
  padding: 10px 14px; max-width: 460px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18); pointer-events: auto; }
.toast.bad { border-left-color: var(--bad); }
