/* Shimlog - the whole design system in one file, no build step.
   Look: "Workshop" - warm neutrals, a dark tool-wall sidebar in both themes and
   one blue accent for the action that matters (see docs/design.md).

   Everything visual is a token on :root (colour, radius, shadow, type), so the
   dark theme is a second set of values rather than a second stylesheet:
     - html[data-theme="dark"|"light"] is set by the inline script in base.html
       from the user's choice (localStorage "theme");
     - without a choice (or without JavaScript) prefers-color-scheme decides.
   Mobile first: one column, the sidebar becomes an off-canvas drawer below 1024px. */

/* --- fonts ---------------------------------------------------------------- */
/* Inter (SIL OFL 1.1, static/fonts/LICENSE-inter.txt), variable weight. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-wght-normal.260c81a4759b.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-ext-wght-normal.1ad231aac0a8.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- tokens: light ---------------------------------------------------------- */
:root {
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --bg: #f4f3f1;
  --surface: #ffffff;
  --surface-2: #f8f7f5;
  --surface-3: #eeece8;
  --border: #e6e3de;
  --border-strong: #d3cfc8;
  --text: #16150f;
  --text-2: #46423b;
  --muted: #77716a;
  --focus: #2563eb55;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #dbeafe;
  --accent-text: #1d4ed8;
  --on-accent: #ffffff;

  --neutral-bg: #efede9;   --neutral-fg: #4f4a43;
  --info-bg: #e0f2fe;      --info-fg: #0369a1;
  --warning-bg: #fef3c7;   --warning-fg: #92400e;
  --success-bg: #dcfce7;   --success-fg: #15803d;
  --danger-bg: #fde8e8;    --danger-fg: #c42b2b;
  --danger: #dc2626;

  /* The sidebar is a dark tool wall in both themes. */
  --sidebar-bg: #15171b;
  --sidebar-border: #15171b;
  --sidebar-divider: rgba(255, 255, 255, 0.07);
  --sidebar-text: #c9ced6;
  --sidebar-strong: #ffffff;
  --sidebar-muted: #7d8592;
  --sidebar-hover: #1f2228;
  --sidebar-active-bg: rgba(37, 99, 235, 0.22);
  --sidebar-active-text: #93c5fd;

  --radius-sm: 9px;
  /* Behind a live camera picture and around a modal - black in both themes. */
  --media-bg: #0b0b0a;
  --scrim: rgb(0 0 0 / 0.6);
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, 0.18), 0 4px 8px -4px rgba(16, 24, 40, 0.06);
  --heading-weight: 740;
  --sidebar-width: 264px;
}

/* --- tokens: dark ----------------------------------------------------------- */
/* Written twice on purpose: once for "follow the system", once for an explicit
   choice. CSS cannot share one block between a media query and a selector. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0f11;
    --surface: #16181b;
    --surface-2: #1b1d21;
    --surface-3: #24272c;
    --border: #26292e;
    --border-strong: #363a41;
    --text: #eceae6;
    --text-2: #bdb8b0;
    --muted: #8d877f;
    --focus: #60a5fa55;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-soft: rgba(96, 165, 250, 0.14);
    --accent-text: #93c5fd;
    --on-accent: #06142e;
    --neutral-bg: #26292e;  --neutral-fg: #bdb8b0;
    --info-bg: rgba(56, 189, 248, 0.13);   --info-fg: #7dd3fc;
    --warning-bg: rgba(250, 204, 21, 0.13); --warning-fg: #fcd34d;
    --success-bg: rgba(74, 222, 128, 0.13); --success-fg: #6ee7a0;
    --danger-bg: rgba(248, 81, 73, 0.14);  --danger-fg: #ff8b84;
    --danger: #f04a43;
    --sidebar-bg: #08090a;
    --sidebar-border: #1b1d21;
    --sidebar-hover: #16181b;
    --sidebar-active-bg: rgba(96, 165, 250, 0.16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.02);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f11;
  --surface: #16181b;
  --surface-2: #1b1d21;
  --surface-3: #24272c;
  --border: #26292e;
  --border-strong: #363a41;
  --text: #eceae6;
  --text-2: #bdb8b0;
  --muted: #8d877f;
  --focus: #60a5fa55;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --accent-text: #93c5fd;
  --on-accent: #06142e;
  --neutral-bg: #26292e;  --neutral-fg: #bdb8b0;
  --info-bg: rgba(56, 189, 248, 0.13);   --info-fg: #7dd3fc;
  --warning-bg: rgba(250, 204, 21, 0.13); --warning-fg: #fcd34d;
  --success-bg: rgba(74, 222, 128, 0.13); --success-fg: #6ee7a0;
  --danger-bg: rgba(248, 81, 73, 0.14);  --danger-fg: #ff8b84;
  --danger: #f04a43;
  --sidebar-bg: #08090a;
  --sidebar-border: #1b1d21;
  --sidebar-hover: #16181b;
  --sidebar-active-bg: rgba(96, 165, 250, 0.16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.02);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.6);
}


/* --- base ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3, h4 { margin: 0 0 0.5rem; line-height: 1.25; color: var(--text); font-weight: var(--heading-weight); letter-spacing: -0.015em; }
h1 { font-size: 1.6rem; letter-spacing: -0.025em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.9rem; }
p { margin: 0 0 0.75rem; }
small { font-size: 0.82rem; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
mark { background: var(--warning-bg); color: var(--warning-fg); padding: 0.1rem 0.35rem; border-radius: 4px; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.18em; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 0.88em; }
.tabular { font-variant-numeric: tabular-nums; }

/* --- app shell ---------------------------------------------------------------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-width); display: flex; flex-direction: column;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  transform: translateX(-100%); transition: transform 0.22s ease;
}
.sidebar:target, .sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 30; background: rgba(9, 12, 16, 0.5);
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.sidebar:target + .sidebar-backdrop, .sidebar.is-open + .sidebar-backdrop { opacity: 1; pointer-events: auto; }
.main { min-width: 0; }
@media (min-width: 1024px) {
  .sidebar { transform: none; }
  .sidebar:target, .sidebar.is-open { box-shadow: none; }
  .sidebar-backdrop, .topbar .menu-button, .sidebar .close-button { display: none !important; }
  .main { margin-left: var(--sidebar-width); }
}

.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.1rem 0.75rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand:hover { text-decoration: none; }
.logo-wordmark { display: block; height: 1rem; width: auto; }
.brand { color: var(--accent); }
.sidebar .brand { color: var(--sidebar-strong); }

.shop-card {
  margin: 0.25rem 0.85rem 0.75rem; padding: 0.6rem 0.7rem; display: flex; align-items: center; gap: 0.6rem;
  border: 1px solid var(--sidebar-divider); border-radius: var(--radius-sm); background: var(--sidebar-hover);
}
.avatar {
  display: grid; place-items: center; width: 2rem; height: 2rem; flex: none; border-radius: 8px;
  font-weight: 700; font-size: 0.8rem; background: var(--accent-soft); color: var(--accent-text);
}
.avatar.round { border-radius: 999px; }
.shop-card .shop-name { color: var(--sidebar-strong); font-weight: 620; font-size: 0.88rem; line-height: 1.2; }
.shop-card .shop-meta { font-size: 0.75rem; color: var(--sidebar-muted); }

.nav { padding: 0.25rem 0.75rem; overflow-y: auto; flex: 1; }
.nav-label {
  margin: 1rem 0.5rem 0.35rem; font-size: 0.7rem; font-weight: 650; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--sidebar-muted);
}
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav a {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.6rem; margin: 1px 0;
  border-radius: var(--radius-sm); color: var(--sidebar-text); font-weight: 520; font-size: 0.92rem;
}
.nav a .icon { width: 1.15rem; height: 1.15rem; opacity: 0.8; }
.nav a:hover { background: var(--sidebar-hover); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 620; }
.nav a[aria-current="page"] .icon { opacity: 1; }

.sidebar-foot { padding: 0.75rem; border-top: 1px solid var(--sidebar-divider); display: grid; gap: 0.5rem; }
.user-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.25rem 0.35rem; }
.user-row .user-name { color: var(--sidebar-strong); font-size: 0.86rem; font-weight: 600; line-height: 1.2; }
.user-row .user-mail { font-size: 0.74rem; color: var(--sidebar-muted); overflow: hidden; text-overflow: ellipsis; }
.user-row > div { min-width: 0; flex: 1; }
.icon-button {
  padding: 0; box-shadow: none; height: 2.25rem;
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none;
  border-radius: var(--radius-sm); border: 0; background: transparent; color: inherit; cursor: pointer;
}
.icon-button:hover { background: var(--sidebar-hover); }
.main .icon-button:hover, .auth .icon-button:hover { background: var(--surface-3); }
.icon-button .icon { width: 1.15rem; height: 1.15rem; }

/* The theme switch: three radios styled as a segmented control. */
.theme-switch {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; margin: 0; border: 0;
  border-radius: var(--radius-sm); background: var(--sidebar-hover);
}
.theme-switch button {
  padding: 0; box-shadow: none; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 0.35rem; height: 2rem;
  border: 0; border-radius: 6px; background: transparent; color: var(--sidebar-muted);
  font: inherit; font-size: 0.78rem; font-weight: 560; cursor: pointer;
}
.theme-switch button:hover { background: transparent; color: var(--sidebar-text); }
.theme-switch button .icon { width: 0.95rem; height: 0.95rem; }
.theme-switch button[aria-pressed="true"] { background: #2b2f37; color: var(--sidebar-strong); box-shadow: var(--shadow); }
.no-js .theme-switch { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 0.75rem;
  height: 3.75rem; padding: 0 1rem; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-button { color: var(--text-2); }
.topbar .brand { margin-right: auto; }
.topbar .spacer { flex: 1; }
@media (min-width: 1024px) {
  .topbar { padding: 0 2rem; }
  .topbar .brand { display: none; }
}
.crumbs { display: none; align-items: center; gap: 0.4rem; font-size: 0.86rem; color: var(--muted); min-width: 0; }
.crumbs a { color: var(--muted); }
.crumbs .icon { width: 0.9rem; height: 0.9rem; }
.crumbs .current { color: var(--text); font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1024px) { .crumbs { display: flex; } }

.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.content.narrow { max-width: 820px; }
@media (min-width: 768px) { .content { padding: 2rem 2rem 4rem; } }

/* --- page header -------------------------------------------------------------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { margin: 0; }
.page-header .subtitle { margin: 0.3rem 0 0; color: var(--muted); }
.page-header .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.eyebrow { display: inline-flex; align-items: center; gap: 0.4rem; margin-bottom: 0.35rem; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.title-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* --- cards ------------------------------------------------------------------------ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin: 0 0 1rem;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.9rem 1.15rem; border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { margin: 0; font-size: 0.98rem; display: flex; align-items: center; gap: 0.5rem; }
.card-header h2 .icon, .card-header h3 .icon { color: var(--muted); }
.card-body { padding: 1.15rem; }
.card-body > :last-child { margin-bottom: 0; }
.card-footer { display: flex; gap: 0.5rem; flex-wrap: wrap; padding: 0.85rem 1.15rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card.flush > .card-body { padding: 0; }
.card.subtle { background: var(--surface-2); box-shadow: none; }

.grid { display: grid; gap: 1rem; }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .layout-aside { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.grid > .card { margin: 0; }
.stack > * + * { margin-top: 1rem; }

/* Key-value lists: label left, value right, hairline between rows. */
dl.kv { margin: 0; display: grid; grid-template-columns: minmax(8rem, 40%) 1fr; }
dl.kv dt, dl.kv dd { margin: 0; padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
dl.kv dt { color: var(--muted); font-size: 0.88rem; padding-right: 1rem; }
dl.kv dd { font-weight: 520; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
dl.kv dt:nth-last-of-type(1), dl.kv dd:last-of-type { border-bottom: 0; }
dl.kv.compact dt, dl.kv.compact dd { padding: 0.4rem 0; }

/* --- buttons ------------------------------------------------------------------------ */
.btn, :where(button) {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  height: 2.5rem; padding: 0 1rem; border-radius: var(--radius-sm);
  font: inherit; font-size: 0.9rem; font-weight: 600; line-height: 1; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--on-accent);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover, :where(button):hover { background: var(--accent-hover); text-decoration: none; }
.btn:active, :where(button):active { transform: translateY(1px); }
.btn .icon, button .icon { width: 1.05rem; height: 1.05rem; }
.btn-secondary, button.btn-secondary {
  background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm);
}
.btn-secondary:hover, button.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost, button.btn-ghost { background: transparent; color: var(--text-2); box-shadow: none; border-color: transparent; }
.btn-ghost:hover, button.btn-ghost:hover { background: var(--surface-3); }
.btn-danger, button.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover, button.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn-danger-soft, button.btn-danger-soft { background: transparent; color: var(--danger-fg); border-color: var(--border-strong); box-shadow: none; }
.btn-danger-soft:hover, button.btn-danger-soft:hover { background: var(--danger-bg); border-color: transparent; }
.btn-sm, button.btn-sm { height: 2rem; padding: 0 0.7rem; font-size: 0.82rem; }
.btn-lg, button.btn-lg { height: 3rem; padding: 0 1.4rem; font-size: 0.98rem; }
.btn-block { width: 100%; }
form.inline { display: inline; margin: 0; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* --- forms ---------------------------------------------------------------------------- */
label, .label { display: block; margin-bottom: 0.35rem; font-size: 0.86rem; font-weight: 600; color: var(--text); }
.req { color: var(--danger-fg); margin-left: 0.15rem; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea {
  display: block; width: 100%; min-height: 2.6rem; padding: 0.55rem 0.8rem;
  font: inherit; font-size: 0.95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 2.25rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a93a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--muted)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus); }
input[readonly] { background: var(--surface-2); }
input[type="checkbox"], input[type="radio"] { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--accent); flex: none; cursor: pointer; }
input[type="file"] { font: inherit; font-size: 0.88rem; color: var(--text-2); max-width: 100%; }
input[type="file"]::file-selector-button {
  margin-right: 0.75rem; height: 2.25rem; padding: 0 0.85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
optgroup { font-weight: 700; }

.field { margin-bottom: 1.1rem; }
.field > small, .help { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.8rem; }
/* `.field > .field-error` and the long input selector below outrank `.field > small` and the
   base input rule; a bare `.field-error` / `.field.has-error input` would lose to them. */
.field-error, .field > .field-error, .errorlist { display: block; margin: 0.35rem 0 0; padding: 0; list-style: none; color: var(--danger-fg); font-size: 0.82rem; font-weight: 560; }
.field.has-error input:not([type="checkbox"]):not([type="radio"]), .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field.has-error input:not([type="checkbox"]):not([type="radio"]):focus, .field.has-error select:focus, .field.has-error textarea:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 22%, transparent); }
.check { display: flex; align-items: flex-start; gap: 0.65rem; font-weight: 520; cursor: pointer; margin-bottom: 1rem; }
.check input { margin-top: 0.18rem; }
.field-grid { display: grid; gap: 0 1rem; }
@media (min-width: 640px) { .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

fieldset { margin: 0 0 1rem; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 0.75rem; font-weight: 650; font-size: 0.95rem; }
.form-section { padding: 1.15rem; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section > legend, .form-section-title {
  float: left; width: 100%; display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.9rem; font-size: 0.95rem; font-weight: 650;
}
.form-section > legend + * { clear: both; }
.form-section-title .icon { color: var(--muted); }
.hint {
  display: flex; gap: 0.65rem; align-items: flex-start; margin: 0 0 1.25rem; padding: 0.8rem 0.95rem;
  border-radius: var(--radius-sm); background: var(--info-bg); color: var(--text-2); font-size: 0.88rem;
}
.hint .icon { color: var(--info-fg); margin-top: 0.15rem; }
.hint.warning-hint { background: var(--warning-bg); }
.hint.warning-hint .icon { color: var(--warning-fg); }

/* Search-as-you-type pickers: each match is a selectable card. */
.choices { margin: 0 0 1rem; padding: 0; border: 0; display: grid; gap: 0.5rem; }
.choices label {
  display: flex; align-items: center; gap: 0.75rem; margin: 0; padding: 0.7rem 0.85rem; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  font-weight: 520; transition: border-color 0.15s, background 0.15s;
}
.choices label:hover { border-color: var(--border-strong); }
.choices label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.choices .choice-text { display: flex; flex-direction: column; min-width: 0; }
.choices .choice-text small { color: var(--muted); font-weight: 450; }
.choices .choice-text .match-note { display: inline-flex; gap: 0.3rem; align-items: center; color: var(--warning-fg); }
.choices label.choice-new { border-style: dashed; color: var(--accent-text); font-weight: 600; }
.choices .empty-note { margin: 0; padding: 0.25rem 0.1rem; font-size: 0.85rem; color: var(--muted); }

/* The incoming inspection's checklist: one OK / Issue per checkpoint, big enough
   to hit on a workbench tablet, and the typical findings as tappable chips. */
.checklist .check-row { padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.checklist .check-row:last-child { border-bottom: 0; }
.check-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.check-label { font-weight: 600; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.segmented label { display: inline-flex; align-items: center; margin: 0; padding: 0.55rem 1.1rem; min-width: 5.5rem; justify-content: center; cursor: pointer; font-weight: 600; color: var(--text-2); }
.segmented label + label { border-left: 1px solid var(--border-strong); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.segmented label.seg-ok:has(input:checked) { background: var(--success-bg); color: var(--success-fg); }
.segmented label.seg-issue:has(input:checked) { background: var(--warning-bg); color: var(--warning-fg); }
.check-row.has-error .segmented { border-color: var(--danger); }
.chips-field { margin: 0.6rem 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chips .chip { display: inline-flex; align-items: center; margin: 0; padding: 0.45rem 0.85rem; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; font-weight: 520; background: var(--surface); }
.chips .chip input { position: absolute; opacity: 0; pointer-events: none; }
.chips .chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.chips .chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.check-summary { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.35rem; }
.check-summary li { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.9rem; }
.check-summary li.is-ok .icon { color: var(--success-fg); }
.check-summary li.is-issue .icon { color: var(--warning-fg); }

.form-actions {
  display: flex; gap: 0.75rem; justify-content: flex-end; align-items: center; flex-wrap: wrap;
  margin-top: 1.25rem;
}
/* On the workbench the primary action must stay under the thumb. */
.action-bar {
  position: sticky; bottom: 0; z-index: 10; display: flex; gap: 0.75rem; justify-content: space-between;
  margin: 1.25rem -1rem 0; padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--border);
}
.action-bar > * { flex: 1; height: 3rem; }
@media (min-width: 768px) {
  .action-bar { position: static; margin: 1.25rem 0 0; padding: 0; background: none; border: 0; backdrop-filter: none; justify-content: flex-end; }
  .action-bar > * { flex: 0 0 auto; height: 2.75rem; min-width: 8rem; }
}

/* --- badges, tabs ---------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem; height: 1.45rem; padding: 0 0.55rem;
  border-radius: 999px; font-size: 0.75rem; font-weight: 620; white-space: nowrap; line-height: 1;
  background: var(--neutral-bg); color: var(--neutral-fg);
}
.badge::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge.plain::before { display: none; }
.tone-info, .status-arrived { background: var(--info-bg); color: var(--info-fg); }
.tone-warning, .status-in_progress { background: var(--warning-bg); color: var(--warning-fg); }
.tone-success, .status-done { background: var(--success-bg); color: var(--success-fg); }
.tone-danger, .status-cancelled { background: var(--danger-bg); color: var(--danger-fg); }
.tone-accent { background: var(--accent-soft); color: var(--accent-text); }

.tabs {
  display: flex; gap: 0.25rem; overflow-x: auto; padding: 0.25rem; margin: 0;
  background: var(--surface-3); border-radius: calc(var(--radius-sm) + 2px); scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: 0.4rem; height: 2rem; padding: 0 0.8rem; border-radius: 7px;
  font-size: 0.85rem; font-weight: 580; color: var(--text-2); white-space: nowrap;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs .count { font-size: 0.72rem; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.toolbar form { margin: 0; }
.toolbar select { width: auto; min-width: 12rem; }
.search-field { position: relative; flex: 1; max-width: 26rem; }
.search-field .icon { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 2.35rem !important; }

/* --- stat tiles -------------------------------------------------------------------- */
.stat { padding: 1rem 1.15rem; }
.stat .stat-label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; color: var(--muted); font-weight: 560; }
.stat .stat-label .icon { width: 1rem; height: 1rem; }
.stat .stat-value { margin-top: 0.35rem; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat .stat-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; display: inline-block; }

/* --- lists and tables ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th {
  text-align: left; padding: 0.65rem 1.15rem; font-size: 0.74rem; font-weight: 650; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border);
}
table.data td { padding: 0.85rem 1.15rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background 0.12s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .primary-cell { display: flex; align-items: center; gap: 0.75rem; min-width: 14rem; }
table.data .primary-cell a { color: var(--text); font-weight: 620; }
table.data .sub { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 450; }
table.data td.actions { text-align: right; white-space: nowrap; }
.thumb {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; flex: none; border-radius: 10px;
  background: var(--surface-3); color: var(--text-2);
}
.thumb .icon { width: 1.2rem; height: 1.2rem; }
.thumb.tone-accent { background: var(--accent-soft); color: var(--accent-text); }
/* Below tablet width every row becomes a card. */
@media (max-width: 767px) {
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { position: relative; padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); }
  table.data tr:last-child { border-bottom: 0; }
  table.data td { padding: 0.15rem 0 0.15rem 3.15rem; border: 0; }
  table.data td.cell-primary { padding-left: 0; }
  table.data td.hide-sm { display: none; }
  table.data td.actions { text-align: left; padding-top: 0.6rem; }
  table.data td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 0.8rem; }
}

.progress { display: flex; align-items: center; gap: 0.6rem; min-width: 8rem; }
.progress-track { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--accent); }
.progress-label { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 0.85rem; padding: 0.85rem 1.15rem; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .list-main { flex: 1; min-width: 0; }
.list .list-title { font-weight: 620; color: var(--text); }
.list .list-sub { font-size: 0.82rem; color: var(--muted); }
.list .list-end { display: flex; align-items: center; gap: 0.5rem; flex: none; }
.list a.list-title:hover { color: var(--accent-text); }
.list > li.is-reverted .list-title { text-decoration: line-through; color: var(--muted); }

.pager { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; padding: 0.75rem 1.15rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); }

/* --- empty states, toasts ---------------------------------------------------------------- */
.empty { text-align: center; padding: 2.75rem 1.5rem; color: var(--muted); }
.empty .empty-icon {
  display: inline-grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 0.75rem;
  border-radius: 14px; background: var(--surface-3); color: var(--text-2);
}
.empty .empty-icon .icon { width: 1.4rem; height: 1.4rem; }
.empty h3 { color: var(--text); margin-bottom: 0.25rem; }
.empty p { max-width: 26rem; margin: 0 auto 1rem; font-size: 0.9rem; }

.toasts { position: fixed; z-index: 60; right: 1rem; left: 1rem; bottom: 1rem; display: grid; gap: 0.5rem; justify-items: end; pointer-events: none; }
@media (min-width: 768px) { .toasts { left: auto; top: 1rem; bottom: auto; width: 24rem; } }
.toast {
  pointer-events: auto; display: flex; gap: 0.7rem; align-items: flex-start; width: 100%;
  padding: 0.85rem 0.9rem; border-radius: var(--radius); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 0.9rem; font-weight: 520;
  animation: toast-in 0.25s ease-out;
}
.toast > .icon { margin-top: 0.1rem; }
.toast.success > .icon { color: var(--success-fg); }
.toast.error > .icon { color: var(--danger-fg); }
.toast.warning > .icon { color: var(--warning-fg); }
.toast.info > .icon { color: var(--info-fg); }
.toast .toast-text { flex: 1; }
.toast .icon-button { width: 1.6rem; height: 1.6rem; margin: -0.15rem -0.25rem 0 0; color: var(--muted); }
.toast .icon-button:hover { background: var(--surface-3); }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
.alert {
  display: flex; gap: 0.65rem; align-items: flex-start; padding: 0.8rem 0.95rem; margin-bottom: 1rem;
  border-radius: var(--radius-sm); font-size: 0.9rem; background: var(--danger-bg); color: var(--danger-fg);
}
.alert ul { margin: 0; padding: 0; list-style: none; }

/* --- technician wizard ------------------------------------------------------------------ */
.wizard-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.wizard-head .step-count { font-size: 0.8rem; font-weight: 650; color: var(--accent-text); letter-spacing: 0.02em; }
.wizard-head h1 { margin: 0.15rem 0 0.25rem; }
.wizard-head .subtitle { margin: 0; color: var(--muted); font-size: 0.92rem; }

.timer {
  display: inline-flex; align-items: center; gap: 0.75rem; padding: 0.4rem 0.4rem 0.4rem 0.9rem;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.timer .timer-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--muted); }
.timer[data-running="1"] .timer-dot { background: var(--danger); box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 60%, transparent); animation: pulse 1.8s infinite; }
.timer .timer-value { font-family: var(--font-mono); font-size: 1rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.timer form { margin: 0; }
.timer button { height: 2.1rem; border-radius: 999px; padding: 0 0.9rem; font-size: 0.82rem; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Horizontal on phones (scrolls), a vertical checklist beside the form on desktop. */
.card-body > .stepper { margin: 0; padding: 0; }
.step-body > fieldset + fieldset, .step-body > .hint + fieldset { padding-top: 0.25rem; }
.step-body > fieldset + fieldset { border-top: 1px solid var(--border); padding-top: 1.1rem; }
/* A floated legend is not drawn into the fieldset's border, so the divider stays whole. */
.step-body legend { float: left; width: 100%; margin-bottom: 0.75rem; }
.step-body legend + * { clear: both; }
.step-body > .card { margin: 1rem 0; }
.stepper { margin: 0 -1rem 1.25rem; padding: 0 1rem; overflow-x: auto; scrollbar-width: none; }
.stepper::-webkit-scrollbar { display: none; }
.stepper ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.4rem; }
.step-pill {
  display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  border-radius: 999px; font-size: 0.82rem; font-weight: 560; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
}
a.step-pill:hover { text-decoration: none; border-color: var(--border-strong); }
.step-number {
  display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  font-size: 0.72rem; font-weight: 700; background: var(--surface-3); color: var(--text-2);
}
.step-pill.is-done .step-number { background: var(--success-bg); color: var(--success-fg); }
.step-pill[aria-current="step"] { border-color: var(--accent); color: var(--text); font-weight: 650; box-shadow: 0 0 0 1px var(--accent); }
.step-pill[aria-current="step"] .step-number { background: var(--accent); color: var(--on-accent); }
.step-pill.is-locked { opacity: 0.55; }
.step-pill .step-check { display: none; }
.step-pill.is-done:not([aria-current]) .step-check { display: block; width: 0.8rem; height: 0.8rem; }
.step-pill.is-done:not([aria-current]) .step-digit { display: none; }
@media (max-width: 767px) {
  .step-pill:not([aria-current="step"]) .step-title { display: none; }
  .step-pill:not([aria-current="step"]) { padding-right: 0.35rem; }
}
@media (min-width: 1024px) {
  .wizard-aside .stepper { margin: 0; padding: 0; overflow: visible; }
  .wizard-aside .stepper ol { flex-direction: column; gap: 0; position: relative; }
  .wizard-aside .step-pill { border: 0; background: none; box-shadow: none; border-radius: var(--radius-sm); padding: 0.45rem 0.5rem; white-space: normal; }
  .wizard-aside a.step-pill:hover { background: var(--surface-2); }
  .wizard-aside .step-pill[aria-current="step"] { background: var(--accent-soft); box-shadow: none; }
  .wizard-aside .stepper li { position: relative; }
  .wizard-aside .stepper li + li::before {
    content: ""; position: absolute; left: 1.24rem; top: -0.45rem; height: 0.9rem; width: 2px;
    background: var(--border); border-radius: 2px;
  }
}
.wizard-aside { display: none; }
@media (min-width: 1024px) {
  .wizard-aside { display: block; position: sticky; top: 4.75rem; }
  .wizard-main .stepper { display: none; }
}

.confirm-gate {
  display: flex; align-items: flex-start; gap: 0.75rem; margin: 1.25rem 0 0; padding: 0.9rem 1rem;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface);
  font-weight: 600; cursor: pointer;
}
.confirm-gate:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.confirm-gate input { width: 1.25rem; height: 1.25rem; margin-top: 0.05rem; }

.recap section { padding: 0.9rem 1.15rem; border-bottom: 1px solid var(--border); }
.recap section:last-child { border-bottom: 0; }
.recap .recap-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.35rem; }
.recap .recap-head strong { display: flex; align-items: center; gap: 0.5rem; }
.recap .recap-head .icon { color: var(--success-fg); }

/* --- photos ------------------------------------------------------------------------------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.75rem; list-style: none; margin: 0 0 1rem; padding: 0; }
.photo-grid li { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-grid .photo-meta { padding: 0.45rem 0.55rem; font-size: 0.74rem; color: var(--muted); display: flex; flex-direction: column; gap: 0.4rem; }
.photo-grid .photo-actions { display: flex; gap: 0.3rem; }
.photo-grid .photo-actions form { flex: 1; margin: 0; }
.photo-grid .photo-actions button { width: 100%; height: 1.85rem; padding: 0 0.4rem; font-size: 0.72rem; }
.photo-notice, .panel-notice { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.75rem; font-size: 0.85rem; color: var(--success-fg); }

/* The work step's parts panel: one entry field for camera, handheld scanner and
   typing; one line per article number with its quantity. */
.part-entry { display: grid; gap: 0.4rem; margin-bottom: 1rem; }
.part-entry label { margin: 0; font-weight: 600; font-size: 0.88rem; }
.part-entry-row { display: flex; gap: 0.5rem; }
.part-entry-row input { flex: 1; min-width: 0; font-family: var(--font-mono, ui-monospace, monospace); }
.part-entry-row button { flex: none; }
.part-scan { width: 100%; justify-content: center; min-height: 3rem; font-size: 1rem; }
.part-entry label { margin-top: 0.35rem; color: var(--text-2); font-weight: 520; }
@media (max-width: 480px) { .part-entry-row button span { display: none; } }
.part-matches { list-style: none; margin: 0.25rem 0 0; padding: 0.25rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.part-matches button { width: 100%; justify-content: flex-start; gap: 0.5rem; text-align: left; }
.part-matches small { color: var(--muted); }
.part-learn { display: grid; gap: 0.6rem; margin-bottom: 1rem; padding: 0.9rem; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--warning-bg); }
.part-learn .hint { margin: 0; }
.part-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.part-lines li { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.part-line-text { display: flex; flex-direction: column; min-width: 0; }
.part-line-text small { color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
/* Shopify stock (#17): the line's state, and linking an unlinked line by hand. */
.part-line-text { flex: 1 1 auto; }
.part-line-text .badge { align-self: flex-start; margin-top: 0.3rem; max-width: 100%; height: auto; min-height: 1.45rem; padding-block: 0.2rem; white-space: normal; line-height: 1.25; border-radius: 0.6rem; }
.part-link { display: grid; gap: 0.4rem; margin-top: 0.5rem; min-width: 0; }
.part-link input[type="search"] { width: 100%; min-width: 0; font-size: 0.85rem; }
.part-line-actions { display: flex; gap: 0.4rem; align-items: center; flex: none; }
.part-line-actions form { display: flex; gap: 0.3rem; align-items: center; margin: 0; }
.part-line-actions button { width: 2.1rem; height: 2.1rem; padding: 0; justify-content: center; }
.part-qty { min-width: 1.6rem; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.part-lines.readonly li { background: transparent; }

/* The camera scanner (static/js/scanner.js): a full-screen sheet on a phone. */
.scanner { width: min(34rem, 100vw); max-width: 100vw; padding: 0; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); }
.scanner::backdrop { background: var(--scrim); }
.scanner-body { display: grid; gap: 0.75rem; padding: 1rem; }
.scanner-view { position: relative; overflow: hidden; border-radius: var(--radius-sm); background: var(--media-bg); aspect-ratio: 4 / 3; }
.scanner-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-view::after { content: ""; position: absolute; inset: 30% 10%; border: 2px solid var(--accent); border-radius: var(--radius-sm); box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--media-bg) 25%, transparent); pointer-events: none; }
.scanner-status { margin: 0; min-height: 1.4em; font-weight: 600; }
.scanner-status.is-hit { color: var(--success-fg); }
.scanner-status.is-error { color: var(--danger); }
@media (max-width: 640px) {
  .scanner { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .scanner-view { aspect-ratio: 3 / 4; }
}
.photo-upload { display: grid; gap: 0.75rem; padding: 1rem; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.photo-upload .check { margin: 0; font-weight: 520; font-size: 0.88rem; }

/* --- public link and QR ------------------------------------------------------------------------ */
.copy-field { display: flex; gap: 0.5rem; }
.copy-field input { font-family: var(--font-mono); font-size: 0.8rem !important; }
.copy-field button { flex: none; }
.no-js .copy-field button { display: none; }
.qr-block { display: flex; gap: 1.15rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.qr-block > div { flex: 1 1 14rem; }
/* A white quiet zone whatever the theme: a code drawn on a dark background does not scan. */
.qr-code { width: 8.5rem; height: 8.5rem; background: #fff; padding: 0.45rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.qr-block > .two-factor-qr { flex: none; width: 11rem; height: auto; }
.two-factor-qr svg { display: block; width: 100%; height: auto; }
.two-factor-secret { font-size: 0.95rem; letter-spacing: 0.04em; overflow-wrap: anywhere; }
.recovery-codes { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem 1rem; }

/* --- public service history ---------------------------------------------------------------- */
.public-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 820px; margin: 0 auto;
  padding: 1rem;
}
.hero {
  position: relative; overflow: hidden; padding: 1.5rem; margin-bottom: 1.25rem; border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.hero h1 { font-size: 1.75rem; margin: 0.5rem 0 0.25rem; }
.hero .hero-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; color: var(--muted); font-size: 0.88rem; }
.hero .hero-meta span { display: inline-flex; align-items: center; gap: 0.35rem; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 0.95rem; top: 0.5rem; bottom: 0.5rem; width: 2px; background: var(--border); }
.timeline > li { position: relative; padding-left: 2.75rem; margin-bottom: 1rem; }
.timeline .tl-dot {
  position: absolute; left: 0.3rem; top: 1.05rem; display: grid; place-items: center; width: 1.35rem; height: 1.35rem;
  border-radius: 50%; background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 4px var(--bg);
}
.timeline .tl-dot .icon { width: 0.8rem; height: 0.8rem; }
details.card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.75rem; padding: 0.95rem 1.15rem; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .summary-main { flex: 1; min-width: 0; }
details.card > summary .chev { color: var(--muted); transition: transform 0.2s; }
details.card[open] > summary .chev { transform: rotate(180deg); }
details.card[open] > summary { border-bottom: 1px solid var(--border); }
details.card .card-body h4 { margin: 1.25rem 0 0.5rem; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.note { padding: 0.85rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); border-left: 3px solid var(--accent); }
.live-card { border-color: color-mix(in srgb, var(--warning-fg) 35%, var(--border)); }

/* --- logged-out pages ---------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; }
@media (min-width: 1024px) { .auth { grid-template-columns: 1.05fr 1fr; } }
.auth-aside {
  display: none; position: relative; overflow: hidden; padding: 2.5rem; color: #eef4ff;
  background:
    radial-gradient(80% 60% at 20% 10%, rgba(96, 165, 250, 0.42), transparent 60%),
    radial-gradient(70% 70% at 90% 90%, rgba(37, 99, 235, 0.3), transparent 60%),
    linear-gradient(160deg, #0a1428, #0f1116 60%, #08080a);
}
@media (min-width: 1024px) { .auth-aside { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-aside .brand { color: #fff; }
.auth-aside h2 { color: #fff; font-size: 2.1rem; line-height: 1.15; letter-spacing: -0.035em; max-width: 26rem; margin: 0 0 1rem; }
.auth-aside p { color: rgba(255, 255, 255, 0.72); max-width: 26rem; }
.auth-aside ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 0.75rem; }
.auth-aside li { display: flex; align-items: center; gap: 0.7rem; color: rgba(255, 255, 255, 0.86); font-weight: 520; }
.auth-aside li .icon { padding: 0.35rem; width: 1.8rem; height: 1.8rem; border-radius: 8px; background: rgba(255, 255, 255, 0.1); }
.auth-aside .deco { position: absolute; right: -5rem; bottom: -5rem; width: 26rem; height: 26rem; opacity: 0.08; color: #fff; }
.auth-main { display: flex; flex-direction: column; padding: 1.25rem; }
.auth-main .auth-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
@media (min-width: 1024px) { .auth-main .auth-top .brand { visibility: hidden; } }
.auth-card { width: 100%; max-width: 25rem; margin: auto; padding: 2rem 0; }
.auth-card h1 { font-size: 1.65rem; }
.auth-card .lead { color: var(--muted); margin-bottom: 1.5rem; }
.auth-card form button[type="submit"] { width: 100%; height: 2.85rem; margin-top: 0.25rem; }
.auth-links { margin-top: 1.5rem; display: grid; gap: 0.4rem; font-size: 0.88rem; color: var(--muted); }
.auth-foot { display: flex; justify-content: center; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem 1rem; font-size: 0.8rem; }
.legal-links a { color: var(--muted); }
.sidebar .legal-links { justify-content: flex-start; padding: 0 0.25rem; }
.sidebar .legal-links a { color: var(--sidebar-muted); }
.legal-doc h1 { margin-bottom: 1rem; }
.legal-doc h2 { margin: 1.5rem 0 0.5rem; font-size: 1.05rem; }
.legal-doc p, .legal-doc ul { margin: 0 0 0.75rem; }
.legal-doc ul { padding-left: 1.2rem; }
.language-switcher { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.language-switcher label { margin: 0; font-weight: 520; color: var(--muted); font-size: 0.82rem; display: inline-flex; gap: 0.35rem; align-items: center; }
.language-switcher select { width: auto; min-height: 2.1rem; padding-top: 0.25rem; padding-bottom: 0.25rem; font-size: 0.85rem; }
.inline-theme { display: flex; gap: 0.25rem; }
.inline-theme .theme-switch { background: var(--surface-3); }
.inline-theme .theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.inline-theme .theme-switch button { color: var(--muted); }
.inline-theme .theme-switch .label-text { display: none; }

/* --- print: the record a shop hands over ----------------------------------------------- */
@media print {
  .sidebar, .topbar, .toasts, .action-bar, .wizard-aside, .btn { display: none !important; }
  .main { margin: 0 !important; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* --- small helpers ------------------------------------------------------------------------ */
.settings-theme .theme-switch .label-text { display: inline; }
.settings-theme .theme-switch button { height: 2.4rem; font-size: 0.85rem; }
@media (max-width: 767px) { .hide-sm { display: none !important; } }
.brand-filter { margin: 0; }
.brand-filter select { min-width: 11rem; }
/* Grid children may shrink below their content (the stepper never wraps). */
.grid > * { min-width: 0; }
@media (max-width: 639px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .stat { padding: 0.75rem 0.85rem; }
  .stat .stat-value { font-size: 1.4rem; margin-top: 0.15rem; }
  .topbar .btn span { display: none; }
  .topbar .btn { width: 2.25rem; padding: 0; }
  h1 { font-size: 1.4rem; }
  .page-header { margin-bottom: 1rem; }
  .card-header { padding: 0.8rem 1rem; }
  .card-body { padding: 1rem; }
}
.inline-theme .theme-switch button { width: 2.1rem; height: 1.9rem; }
.wrap-sm { flex-wrap: wrap; }
.inline-theme.settings-theme .theme-switch button { width: auto; padding: 0 0.75rem; }
.inline-theme.settings-theme .theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); }

/* --- non-production label (ENVIRONMENT_BANNER) ------------------------------------------- */
/* A tab hanging from the top edge, above everything including the drawer, in
   workshop hazard stripes: impossible to mistake staging for the real thing. */
.env-banner {
  position: fixed; top: 0; left: 50%; z-index: 80; transform: translateX(-50%);
  padding: 0.2rem 0.9rem 0.25rem; border-radius: 0 0 10px 10px;
  font-size: 0.72rem; font-weight: 750; letter-spacing: 0.04em; white-space: nowrap;
  color: #1c1205; box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.4);
  background: repeating-linear-gradient(-45deg, #facc15 0 10px, #fbbf24 10px 20px);
  pointer-events: none;
}
