/* Tra cứu đơn hàng — one narrow column, read on a phone held in one hand.
   The shop's own look (catituhu.com): CATITUHU red on warm grey, Be Vietnam
   Pro, codes in JetBrains Mono. Status colours are the shop's three verdicts
   (webtheme/theme.css) plus one for "on its way". */
:root {
  --bg: #f4f4f3;
  --surface: #ffffff;
  --fg: #0a0a0a;
  --muted: #5c5c5a;
  --border: #e6e6e3;
  --accent: #e11d2e;
  --accent-hover: #c8172a;
  --accent-on: #ffffff;
  --focus: #e11d2e;
  --ok: #1f7a4d;      --ok-bg: #e8f5ee;
  --warn: #8a5a00;    --warn-bg: #fdf3e2;
  --hot: #a32020;     --hot-bg: #fdeaea;
  --moon: #1d4f91;    --moon-bg: #e8f0fb;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110; --surface: #1c1c1b; --fg: #f2f2f0; --muted: #a3a39f;
    --border: #2e2e2c; --accent: #ff4d5b; --accent-hover: #ff6b77; --accent-on: #1a0003;
    --focus: #ff6b77;
    --ok: #6ede9f;  --ok-bg: #14301f;
    --warn: #f0c070; --warn-bg: #33280f;
    --hot: #ff8f8f; --hot-bg: #3a1b1b;
    --moon: #8fb8ff; --moon-bg: #172238;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111110; --surface: #1c1c1b; --fg: #f2f2f0; --muted: #a3a39f;
  --border: #2e2e2c; --accent: #ff4d5b; --accent-hover: #ff6b77; --accent-on: #1a0003;
  --focus: #ff6b77;
  --ok: #6ede9f;  --ok-bg: #14301f;
  --warn: #f0c070; --warn-bg: #33280f;
  --hot: #ff8f8f; --hot-bg: #3a1b1b;
  --moon: #8fb8ff; --moon-bg: #172238;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.5 var(--font);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0; font-weight: 700; text-wrap: balance; }
code { font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.bar-inner, .wrap {
  max-width: 34rem;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.bar-inner { display: flex; align-items: baseline; gap: 12px; padding-block: 14px; }
.brand { color: var(--accent); font-weight: 800; letter-spacing: 0.06em; font-size: 0.95rem; }
.bar-title { color: var(--muted); font-size: 0.95rem; }

.wrap { padding-block: 20px 40px; display: grid; gap: 16px; }
.loading { color: var(--muted); text-align: center; padding-block: 40px; margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
#login, #closed { display: grid; gap: 14px; }
.lead { margin: 0; color: var(--muted); }

form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
label { font-weight: 600; }
input {
  font: 500 1.2rem/1.3 var(--font);
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
}
#code { font-family: var(--mono); letter-spacing: 0.02em; }
input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.hint { margin: 0; color: var(--muted); font-size: 0.92rem; }

.where summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.95rem; padding-block: 4px; }
.where-body { display: grid; gap: 10px; padding-top: 10px; font-size: 0.95rem; color: var(--muted); }
.where-body p, figure { margin: 0; }
figure { display: grid; gap: 6px; }
figure svg { width: 100%; max-width: 320px; height: auto; }
figcaption { font-size: 0.88rem; }
.sv-bubble { fill: var(--bg); stroke: var(--border); }
.sv-text { fill: var(--fg); font: 500 14px var(--mono); }
.sv-dim { fill: var(--muted); font: 400 13px var(--mono); }
.sv-mark { fill: var(--accent); font-weight: 700; }

.from-link {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px dashed var(--border);
}
.from-link code { font-weight: 600; }
.link-button {
  background: none; border: 0; padding: 4px 0; color: var(--accent);
  font: 600 0.95rem var(--font); cursor: pointer;
}

.turnstile:empty { display: none; }

.error {
  margin: 0; padding: 12px 14px; border-radius: 10px;
  background: var(--hot-bg); color: var(--hot); font-weight: 500;
}

button.primary, button.secondary {
  font: 700 1.1rem var(--font);
  min-height: 56px; width: 100%;
  border-radius: 12px; cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-on); border: 0; }
button.primary:hover { background: var(--accent-hover); }
button.primary:disabled { opacity: 0.6; cursor: progress; }
button.secondary { background: transparent; color: var(--fg); border: 1.5px solid var(--border); font-weight: 600; }

.scope { margin: 0; font-size: 0.9rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 14px; }

/* ── the orders ─────────────────────────────────────────────────────────── */
#orders { display: grid; gap: 14px; }
.list-title { font-size: 1.2rem; padding-top: 4px; }

.points { display: grid; gap: 2px; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.points-label { color: var(--muted); font-size: 0.92rem; }
.points-value { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.points-note { color: var(--muted); font-size: 0.88rem; }

.orders { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.order { display: grid; gap: 10px; }
.order-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.order-code { font: 600 1.1rem var(--mono); }
.order-date { margin: -6px 0 0; color: var(--muted); font-size: 0.92rem; }

.pill {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 3px 12px; font-size: 0.9rem; font-weight: 600; white-space: nowrap;
  background: var(--moon-bg); color: var(--moon);
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.hot { background: var(--hot-bg); color: var(--hot); }

.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.lines li { display: flex; justify-content: space-between; gap: 12px; }
.lines .name { min-width: 0; overflow-wrap: anywhere; }
.lines .qty { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.money {
  margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.money dt { color: var(--muted); }
.money dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.money .due dt, .money .due dd { color: var(--fg); font-weight: 700; }

.parcels { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.parcels li {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px;
  padding: 10px 12px; border-radius: 10px; background: var(--bg);
}
.parcels code { overflow-wrap: anywhere; }
.parcels .state { color: var(--muted); font-size: 0.9rem; }
.parcels a {
  color: var(--accent); font-weight: 600; text-decoration: none;
  padding: 6px 0; min-height: 32px; display: inline-flex; align-items: center;
}
.parcels a:hover { text-decoration: underline; }

.empty { margin: 0; color: var(--muted); }

.foot { display: grid; gap: 12px; padding-top: 8px; }
.updated { margin: 0; text-align: center; color: var(--muted); font-size: 0.9rem; }

@media (prefers-reduced-motion: no-preference) {
  .order, #login { animation: rise 220ms ease-out both; }
  @keyframes rise { from { opacity: 0.4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
