/* ==========================================================================
   Supplier Portal design system: "soft Akte" skin. Tokens + components, NO DaisyUI.
   Layout = Tailwind utilities (compiled bundle); look = these classes.
   Served directly (no build step). See specs/supplier/OVERHAUL.md D5,
   specs/ui/FRONTEND.md ("Skin") and specs/ui/AKTE.md (the parent language).

   Soft Akte = Akte's paper/graphite surfaces, hairlines, semantic inks and
   type roles, with a friendlier finish for an external audience: 6px radius,
   more air, sentence case, and one unmistakable filled primary action.
   Rules: no gradients, no coloured left borders, no heavy shadows (only
   overlays get a faint lift), one subtle page rise, nothing under
   prefers-reduced-motion. Plain CSS only (no nesting, no color-mix), so it
   renders the same in older Android/WeChat webviews.
   ========================================================================== */

/* ---- self-hosted faces ----
   Atkinson Hyperlegible = body + labels; DM Serif Display = wordmark only;
   Fira Code (Medium file only) for data-as-data: ONE file serves
   every weight so bold refs/serials never pull the extra Regular/SemiBold
   files (about 100 KB each). CJK glyphs fall through to the system CJK stack. */
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/AtkinsonHyperlegible-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/AtkinsonHyperlegible-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/AtkinsonHyperlegible-Italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Serif Display';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/DMSerifDisplay-Regular.woff2') format('woff2');
}
/* "SP Data" = Fira Code Medium under a private family name, used by
   --sp-font-data. A separate name matters: faces sharing a family AND
   descriptors form one composite font, and a glyph miss (every CJK char)
   makes the browser fetch the other files too. So the data stack never
   names 'Fira Code'; CJK falls straight through to the system CJK fonts. */
@font-face {
  font-family: 'SP Data';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/FiraCode-Medium.woff2') format('woff2');
}
/* 'Fira Code' is still named by inline styles in templates (nav initials,
   weight 600). Re-point every weight at the Medium file: these load after
   style.min.css, so for Latin text the Medium file is found first and the
   Regular/SemiBold files (~100 KB each) are never fetched. */
@font-face {
  font-family: 'Fira Code';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/FiraCode-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Fira Code';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/FiraCode-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Fira Code';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/FiraCode-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Fira Code';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/FiraCode-Medium.woff2') format('woff2');
}

/* ---- tokens ----
   Values derive from the Werkbank --nav-* / Akte --akte-* blocks in
   app/static/src/css/input.css (paper + graphite, navy/steel accent,
   good/warn/danger/info/prime inks). Every legacy --sp-* name is kept (the
   templates and JS use them); inks are nudged darker (light) / brighter
   (dark) where Akte's values miss WCAG AA as small chip text.
   Hex (not rgba) for anything that carries text, so contrast is exact;
   tints are rgba so they sit correctly on any surface. */
:root {
  color-scheme: light;

  --sp-font-body: 'Atkinson Hyperlegible', "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sp-font-data: 'SP Data', ui-monospace, SFMono-Regular, Menlo, Consolas,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", monospace;
  --sp-font-mark: 'DM Serif Display', Georgia, "Songti SC", serif;

  /* surfaces: warm paper page, white sheets, recessed paper wells */
  --sp-bg: #efeee9;
  --sp-surface: #ffffff;
  --sp-surface-2: #f6f5f1;
  --sp-recess: #f6f5f1;                 /* kanban columns: the tray the sheets sit in */
  --sp-etch: rgba(30, 28, 24, 0.045);
  --sp-track: rgba(30, 28, 24, 0.10);

  /* hairlines (Akte) — --sp-border(-strong) are the legacy names */
  --sp-hairline: rgba(30, 28, 24, 0.13);
  --sp-hairline-strong: rgba(30, 28, 24, 0.26);
  --sp-border: var(--sp-hairline);
  --sp-border-strong: var(--sp-hairline-strong);
  --sp-input-border: #8c8a84;          /* 3:1 against white: form fields must be findable */

  /* inks */
  --sp-text: #23221f;
  --sp-ink: var(--sp-text);
  --sp-muted: #5f5d57;                  /* AA on bg, surface and surface-2 */
  --sp-ink-dim: var(--sp-muted);
  --sp-ink-faint: #8a877f;              /* decoration only, never body text */

  /* accent: navy on paper. A marker and the primary-action fill. */
  --sp-accent: #1e3a5f;
  --sp-accent-strong: #162c49;
  --sp-accent-text: #ffffff;
  --sp-accent-tint: rgba(30, 58, 95, 0.08);
  --sp-accent-line: rgba(30, 58, 95, 0.28);
  --sp-focus-ring: #1e3a5f;

  /* semantic inks (Akte good / warn / prime / danger / info) */
  --sp-ok: #226940;
  --sp-ok-bg: rgba(42, 122, 80, 0.12);
  --sp-warn: #7d520b;
  --sp-warn-bg: rgba(183, 121, 31, 0.15);
  --sp-late: #9a4116;                   /* = Akte prime */
  --sp-late-bg: rgba(192, 86, 33, 0.12);
  --sp-prime: var(--sp-late);
  --sp-prime-bg: var(--sp-late-bg);
  --sp-danger: #ad2929;
  --sp-danger-bg: rgba(197, 48, 48, 0.11);
  --sp-info: #245f9e;
  --sp-info-bg: rgba(43, 108, 176, 0.11);
  --sp-danger-fill: #b42b2b;
  --sp-danger-fill-strong: #9a2323;
  --sp-on-danger: #ffffff;

  /* chat */

  /* shape + elevation */
  --sp-radius: 6px;
  --sp-radius-sm: 4px;
  --sp-radius-lg: 10px;
  --sp-shadow: none;                    /* cards are flat; legacy name kept */
  --sp-shadow-lg: 0 10px 30px rgba(30, 28, 24, 0.10), 0 1px 2px rgba(30, 28, 24, 0.06);
  --sp-focus: 0 0 0 2px var(--sp-surface), 0 0 0 4px var(--sp-focus-ring);
  --sp-backdrop: rgba(24, 23, 20, 0.45);
}

[data-theme="dark"] {
  color-scheme: dark;

  --sp-bg: #111113;
  --sp-surface: #18181b;
  --sp-surface-2: #1f1f23;
  --sp-recess: #141417;
  --sp-etch: rgba(255, 255, 255, 0.045);
  --sp-track: rgba(255, 255, 255, 0.09);

  --sp-hairline: rgba(255, 255, 255, 0.085);
  --sp-hairline-strong: rgba(255, 255, 255, 0.18);
  --sp-input-border: #6c6b65;

  --sp-text: #dad8d3;
  --sp-muted: #9d9b95;
  --sp-ink-faint: #6b6a66;

  --sp-accent: #60a5fa;                 /* steel blue — Werkbank dark accent */
  --sp-accent-strong: #82b8fb;
  --sp-accent-text: #0c1929;
  --sp-accent-tint: rgba(96, 165, 250, 0.10);
  --sp-accent-line: rgba(96, 165, 250, 0.32);
  --sp-focus-ring: #82b8fb;

  --sp-ok: #3fb27f;
  --sp-ok-bg: rgba(63, 178, 127, 0.13);
  --sp-warn: #d9a62e;
  --sp-warn-bg: rgba(217, 166, 46, 0.13);
  --sp-late: #eb8a48;
  --sp-late-bg: rgba(232, 130, 62, 0.13);
  --sp-danger: #f07373;
  --sp-danger-bg: rgba(224, 82, 82, 0.14);
  --sp-info: #6cb2e4;
  --sp-info-bg: rgba(88, 166, 222, 0.13);
  --sp-danger-fill: #c53030;
  --sp-danger-fill-strong: #d43c3c;
  --sp-on-danger: #ffffff;


  --sp-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.50), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --sp-backdrop: rgba(0, 0, 0, 0.60);
}

/* ---- base ---- */
/* The hidden attribute always wins over component display rules
   (.sp-btn / .sp-menu-item set display at equal specificity). */
[hidden] { display: none !important; }

html:has(> body.sp-body) { background: var(--sp-bg); }

body.sp-body {
  font-family: var(--sp-font-body);
  font-size: 1rem;                      /* 16px body: readable on phones, no iOS input zoom */
  line-height: 1.55;
  background: var(--sp-bg);
  color: var(--sp-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.sp-body ::selection { background: var(--sp-accent-line); }

/* one visible, consistent focus ring for keyboard users everywhere */
.sp-body :focus-visible {
  outline: 2px solid var(--sp-focus-ring);
  outline-offset: 2px;
}

/* data-as-data: refs (ISS-2026-0004), serials, part numbers, timestamps.
   Templates mark these with Tailwind's font-mono; .sp-ref / .sp-num are the
   skin's own hooks for new markup. */
.sp-body .font-mono,
.sp-ref,
.sp-num {
  font-family: var(--sp-font-data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "calt" 0;     /* no Fira ligatures inside refs (=>, --, ...) */
}
.sp-ref { letter-spacing: 0.01em; }
.sp-wordmark {
  font-family: var(--sp-font-mark);
  font-weight: 400;
  letter-spacing: 0.005em;
}

/* Chinese: letterspacing and uppercase are Latin devices — neutralise them,
   and give CJK a touch more size where Tailwind's text-xs (12px) is used. */
html:lang(zh) .sp-body .text-xs { font-size: 0.8125rem; line-height: 1.25rem; }

.sp-muted { color: var(--sp-muted); }
.sp-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--sp-accent-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 120ms ease;
}
.sp-muted .sp-link, .sp-link.sp-muted { color: var(--sp-muted); }
.sp-link:hover { text-decoration-color: var(--sp-accent); text-decoration-thickness: 2px; }

/* ---- surfaces ---- */
.sp-card {
  background: var(--sp-surface);
  border: 1px solid var(--sp-hairline);
  border-radius: var(--sp-radius);
  box-shadow: none;
}
.sp-card-flat { box-shadow: none; }
.sp-well {
  background: var(--sp-surface-2);
  border: 1px solid var(--sp-hairline);
  border-radius: var(--sp-radius);
}
a.sp-well { color: inherit; text-decoration: none; transition: border-color 120ms ease; }
a.sp-well:hover { border-color: var(--sp-hairline-strong); }
.sp-navbar {
  background: var(--sp-surface);
  border-bottom: 1px solid var(--sp-hairline);
}

/* ---- buttons ----
   primary = the one thing to do (filled accent); default = hairline frame;
   ghost = chrome; danger = quiet ink, never a red slab. Sentence case. */
.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  min-height: 2.5rem;
  border-radius: var(--sp-radius);
  border: 1px solid var(--sp-hairline-strong);
  background: var(--sp-surface);
  color: var(--sp-text);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.25rem;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.sp-btn:hover { background: var(--sp-etch); border-color: var(--sp-muted); }
.sp-btn:focus-visible { outline: 2px solid var(--sp-focus-ring); outline-offset: 2px; box-shadow: none; }
.sp-btn:disabled, .sp-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.sp-btn.is-active { background: var(--sp-etch); }
.sp-btn-primary {
  background: var(--sp-accent);
  border-color: var(--sp-accent);
  color: var(--sp-accent-text);
}
.sp-btn-primary:hover { background: var(--sp-accent-strong); border-color: var(--sp-accent-strong); }
.sp-btn-danger {
  background: transparent;
  border-color: var(--sp-hairline-strong);
  color: var(--sp-danger);
}
.sp-btn-danger:hover { background: var(--sp-danger-bg); border-color: var(--sp-danger); }
.sp-btn-ghost { border-color: transparent; background: transparent; }
.sp-btn-ghost:hover { background: var(--sp-etch); border-color: transparent; }
.sp-btn-sm { min-height: 2.25rem; padding: 0.3125rem 0.75rem; font-size: 0.875rem; }

/* fingers need bigger targets than cursors */
@media (pointer: coarse) {
  .sp-btn { min-height: 2.75rem; }
  .sp-btn-sm { min-height: 2.5rem; }
}

/* ---- inputs ---- */
.sp-input, .sp-select, .sp-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  min-height: 2.75rem;
  border-radius: var(--sp-radius);
  border: 1px solid var(--sp-input-border);
  background: var(--sp-surface);
  color: var(--sp-text);
  font-family: inherit;
  font-size: 1rem;                      /* >= 16px: iOS Safari won't zoom on focus */
  line-height: 1.5;
  box-shadow: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.sp-textarea { min-height: 5.5rem; }
.sp-input::placeholder, .sp-textarea::placeholder { color: var(--sp-muted); opacity: 0.85; }
.sp-input:hover, .sp-select:hover, .sp-textarea:hover { border-color: var(--sp-muted); }
.sp-input:focus, .sp-select:focus, .sp-textarea:focus,
.sp-input:focus-visible, .sp-select:focus-visible, .sp-textarea:focus-visible {
  outline: none;
  border-color: var(--sp-accent);
  box-shadow: 0 0 0 1px var(--sp-accent);
}
.sp-input:disabled, .sp-input[readonly].sp-locked {
  background: var(--sp-surface-2);
  border-color: var(--sp-hairline);
  color: var(--sp-muted);
  cursor: not-allowed;
}
.sp-input-error, .sp-input-error:hover { border-color: var(--sp-danger) !important; }
.sp-input-error:focus { box-shadow: 0 0 0 1px var(--sp-danger); }
.sp-field-msg { font-size: 0.8125rem; margin-top: 0.25rem; }
.sp-field-msg.is-error { color: var(--sp-danger); }

/* autosave state — set data-save-state on the field wrapper */
.sp-save-indicator {
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 150ms ease;
}
[data-save-state="saving"] .sp-save-indicator { opacity: 1; color: var(--sp-muted); }
[data-save-state="saved"] .sp-save-indicator { opacity: 1; color: var(--sp-ok); }
[data-save-state="error"] .sp-save-indicator { opacity: 1; color: var(--sp-danger); }
[data-save-state="error"] .sp-input { border-color: var(--sp-danger); }

/* ---- chips (status + urgency) ----
   Akte tonal pattern: ink text on a 12-15% tint of the same ink. Soft: 4px
   radius, sentence case, Atkinson bold. Counters (numbers) use Fira Code. */
.sp-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.0625rem 0.5rem;
  min-height: 1.375rem;
  border-radius: var(--sp-radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25rem;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.sp-chip-neutral { background: transparent; color: var(--sp-muted); border-color: var(--sp-hairline-strong); }
/* qty counts inside wells: data in ink on a white sheet, lightest frame */
.sp-well .sp-chip-neutral { background: var(--sp-surface); color: var(--sp-text); border-color: var(--sp-hairline); }
.sp-chip-ok { background: var(--sp-ok-bg); color: var(--sp-ok); }
.sp-chip-due { background: var(--sp-warn-bg); color: var(--sp-warn); }
.sp-chip-late { background: var(--sp-late-bg); color: var(--sp-late); }
.sp-chip-overdue { background: var(--sp-danger-bg); color: var(--sp-danger); }
/* critical = the one chip that shouts: a flat danger fill. No pulse. */
.sp-chip-critical { background: var(--sp-danger-fill); color: var(--sp-on-danger); }
/* accent = filled counter (nav badges, in-progress count) */
.sp-chip-accent { background: var(--sp-accent); color: var(--sp-accent-text); }

/* counters: nav + menu badges are filled accent counters whatever their
   level class (the "you have something to do" signal); kanban, tab and qty
   counts read as numbers. */
.sp-nav-link .sp-chip,
.sp-menu-item .sp-chip {
  background: var(--sp-accent);
  color: var(--sp-accent-text);
  border-color: transparent;
}
.sp-chip-accent,
.sp-nav-link .sp-chip,
.sp-menu-item .sp-chip,
.sp-kanban-col > header .sp-chip,
.sp-tab .sp-chip,
.sp-well .sp-chip-neutral,
#notification-badge {
  font-family: var(--sp-font-data);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  border-radius: 3px;
  min-width: 1.5rem;
  justify-content: center;
  padding-left: 0.375rem;
  padding-right: 0.375rem;
}
#notification-badge { min-width: 1.125rem; min-height: 1.125rem; line-height: 1.125rem; }

/* transport mode tag: outlined data tag, colourless next to urgency chips.
   Missing mode is a genuine problem -> warn tint, dashed to read "unset". */
.sp-chip-mode,
.sp-chip-mode-missing {
  border-radius: 3px;
  font-family: var(--sp-font-data);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.sp-chip-mode {
  background: transparent;
  color: var(--sp-text);
  border-color: var(--sp-hairline-strong);
}
.sp-chip-mode-missing {
  background: var(--sp-warn-bg);
  color: var(--sp-warn);
  border-color: var(--sp-warn);
  border-style: dashed;
}

/* ---- progress ---- */
.sp-progress {
  height: 0.375rem;
  border-radius: 3px;
  background: var(--sp-track);
  overflow: hidden;
}
.sp-progress > div {
  height: 100%;
  border-radius: 3px;
  background: var(--sp-accent);
  transition: width 300ms ease;
}
.sp-progress.is-complete > div { background: var(--sp-ok); }

/* ---- tabs (Akte instrument strip, sentence case) ---- */
.sp-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--sp-hairline-strong);
  overflow-x: auto;
  scrollbar-width: none;
}
.sp-tabs::-webkit-scrollbar { display: none; }
.sp-tab {
  text-decoration: none;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--sp-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 120ms ease, border-color 120ms ease;
}
.sp-tab:hover { color: var(--sp-text); border-bottom-color: var(--sp-hairline-strong); }
.sp-tab.is-active { color: var(--sp-text); font-weight: 700; border-bottom-color: var(--sp-accent); }
.sp-tab:focus-visible { outline: 2px solid var(--sp-focus-ring); outline-offset: -2px; border-radius: var(--sp-radius-sm); }

/* ---- tables (spec-sheet rows, hairline rules) ---- */
.sp-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.sp-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sp-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--sp-hairline-strong);
}
.sp-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--sp-hairline);
  vertical-align: middle;
}
.sp-table tr:last-child td { border-bottom: none; }
html:lang(zh) .sp-table th { letter-spacing: 0; }

/* ---- modal (native <dialog>) ---- */
.sp-modal {
  border: 1px solid var(--sp-hairline-strong);
  border-radius: var(--sp-radius-lg);
  background: var(--sp-surface);
  color: var(--sp-text);
  box-shadow: var(--sp-shadow-lg);
  padding: 1.5rem;
  max-width: 32rem;
  width: calc(100vw - 2rem);
}
.sp-modal::backdrop { background: var(--sp-backdrop); }

/* ---- toasts ("Meldung", soft): tonal sheet + a status lamp, no side stripe ---- */
.sp-toast-region {
  position: fixed;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  right: 1rem;
  left: auto;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(24rem, calc(100vw - 2rem));
}
.sp-toast {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  border-radius: var(--sp-radius);
  border: 1px solid var(--sp-accent-line);
  background: var(--sp-surface);
  background-image: linear-gradient(var(--sp-accent-tint), var(--sp-accent-tint));
  color: var(--sp-text);
  box-shadow: var(--sp-shadow-lg);
  font-size: 0.9375rem;
  line-height: 1.4;
}
.sp-toast::before {
  content: "";
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
  background: var(--sp-accent);
  transform: translateY(-0.05em);
}
.sp-toast.is-info { border-color: var(--sp-info); background-image: linear-gradient(var(--sp-info-bg), var(--sp-info-bg)); }
.sp-toast.is-info::before { background: var(--sp-info); }
.sp-toast.is-success { border-color: var(--sp-ok); background-image: linear-gradient(var(--sp-ok-bg), var(--sp-ok-bg)); }
.sp-toast.is-success::before { background: var(--sp-ok); }
.sp-toast.is-error { border-color: var(--sp-danger); background-image: linear-gradient(var(--sp-danger-bg), var(--sp-danger-bg)); }
.sp-toast.is-error::before { background: var(--sp-danger); }
.sp-toast.is-warning { border-color: var(--sp-warn); background-image: linear-gradient(var(--sp-warn-bg), var(--sp-warn-bg)); }
.sp-toast.is-warning::before { background: var(--sp-warn); }
@media (max-width: 480px) {
  .sp-toast-region { left: 1rem; right: 1rem; max-width: none; }
}

/* ---- banner (critical escalations): the loudest thing on the page, still flat ---- */
.sp-banner-critical {
  background: var(--sp-danger-fill);
  color: var(--sp-on-danger);
  border-radius: var(--sp-radius);
  padding: 0.5rem 1rem;
  min-height: 2.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: background-color 120ms ease;
}
.sp-banner-critical:hover { background: var(--sp-danger-fill-strong); }

/* ---- kanban ---- */
.sp-kanban-col {
  background: var(--sp-recess);
  border: 1px solid var(--sp-hairline);
  border-radius: var(--sp-radius);
}
.sp-kanban-col > header {
  padding: 0.75rem 0.875rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sp-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
html:lang(zh) .sp-kanban-col > header { letter-spacing: 0.02em; font-size: 0.8125rem; }

/* ---- lock state ---- */
.sp-lock-badge { color: var(--sp-ok); font-weight: 700; font-size: 0.8125rem; }

/* ---- empty states: quiet and honest ---- */
.sp-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--sp-muted);
}

/* ==========================================================================
   Navbar, dropdowns, nav links (D5/D6 template vocabulary).
   ========================================================================== */

/* nav links (desktop) — Werkbank topbar: ink label, 2px accent bar when active */
.sp-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.375rem 0.75rem;
  min-height: 2.5rem;
  border-radius: var(--sp-radius);
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--sp-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 120ms ease, background-color 120ms ease;
}
.sp-nav-link:hover { color: var(--sp-text); background: var(--sp-etch); }
.sp-nav-link.is-active {
  color: var(--sp-text);
  font-weight: 700;
  border-radius: 0;
  box-shadow: inset 0 -2px 0 0 var(--sp-accent);
}
.sp-nav-link.is-active:hover { background: transparent; }

/* JS-free dropdowns (<details><summary>…) */
.sp-dropdown > summary { list-style: none; cursor: pointer; }
.sp-dropdown > summary::-webkit-details-marker { display: none; }
.sp-menu-panel {
  position: absolute;
  top: calc(100% + 0.375rem);
  left: 0;
  min-width: 13rem;
  z-index: 60;
  background: var(--sp-surface);
  border: 1px solid var(--sp-hairline-strong);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow-lg);
  padding: 0.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.sp-dropdown-end .sp-menu-panel { left: auto; right: 0; }
.sp-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  min-height: 2.5rem;
  border-radius: var(--sp-radius-sm);
  font-size: 0.9375rem;
  color: var(--sp-text);
  text-decoration: none;
}
.sp-menu-item:hover { background: var(--sp-etch); }

/* unread notification: a faint accent sheet + accent hairline (no side rail) */
.sp-unread {
  background: var(--sp-surface);
  background-image: linear-gradient(var(--sp-accent-tint), var(--sp-accent-tint));
  border-color: var(--sp-accent-line);
}

/* radial progress ring — conic fill is data (percent), not ornament */
.sp-ring {
  --sp-ring-value: 0;
  width: 4rem;
  height: 4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sp-font-data);
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--sp-text);
  background:
    radial-gradient(closest-side, var(--sp-surface) 80%, transparent 81% 100%),
    conic-gradient(var(--sp-accent) calc(var(--sp-ring-value) * 1%), var(--sp-track) 0);
}
.sp-ring.is-complete {
  color: var(--sp-ok);
  background:
    radial-gradient(closest-side, var(--sp-surface) 80%, transparent 81% 100%),
    conic-gradient(var(--sp-ok) calc(var(--sp-ring-value) * 1%), var(--sp-track) 0);
}

/* vertical timeline */
.sp-timeline { list-style: none; padding: 0; margin: 0; }
.sp-timeline > li {
  position: relative;
  padding-left: 1.75rem;
  padding-bottom: 1.25rem;
}
.sp-timeline > li::before {
  content: "";
  position: absolute;
  left: 0.4375rem;
  top: 0.45rem;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 999px;
  background: var(--sp-surface);
  border: 2px solid var(--sp-accent);
}
.sp-timeline > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0.71875rem;
  top: 1.2rem;
  bottom: 0.1rem;
  width: 1px;
  background: var(--sp-hairline-strong);
}

/* stat tile */
.sp-stat {
  background: var(--sp-surface);
  border: 1px solid var(--sp-hairline);
  border-radius: var(--sp-radius);
  padding: 1rem 1.25rem;
}
.sp-stat-label { font-size: 0.8125rem; color: var(--sp-muted); font-weight: 700; }
.sp-stat-value {
  font-family: var(--sp-font-data);
  font-variant-numeric: tabular-nums;
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.15;
  margin-top: 0.25rem;
}

/* checkbox that reads well in both themes without DaisyUI */
.sp-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--sp-accent);
  cursor: pointer;
}
.sp-checkbox:disabled { cursor: not-allowed; opacity: 0.6; }

/* chat bubbles (messenger anatomy, restored): yours = filled accent with
   "You · time" inside; theirs = recessed paper with the name above. */
.sp-bubble-you {
  background: var(--sp-accent);
  color: var(--sp-accent-text);
  border-radius: var(--sp-radius);
}
.sp-bubble-them {
  background: var(--sp-surface-2);
  color: var(--sp-text);
  border-radius: var(--sp-radius);
}
.sp-bubble-you p, .sp-bubble-them p { line-height: 1.5; }
.sp-bubble-you .sp-well, .sp-bubble-them .sp-well { background: var(--sp-surface); }

/* spinner
   NB: this file loads AFTER the tailwind bundle, so at equal specificity
   `display: inline-block` here beats tailwind's `.hidden` — the .hidden
   combo below keeps JS show/hide toggling working. */
.sp-spinner.hidden { display: none; }
.sp-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--sp-track);
  border-top-color: var(--sp-accent);
  border-radius: 999px;
  animation: sp-spin 0.8s linear infinite;
}
@keyframes sp-spin { to { transform: rotate(360deg); } }

/* auth card (login / activate) */
.sp-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--sp-bg);
}
.sp-auth-card {
  width: 100%;
  max-width: 24rem;
  background: var(--sp-surface);
  border: 1px solid var(--sp-hairline);
  border-radius: var(--sp-radius-lg);
  box-shadow: none;
  padding: 2rem 1.75rem;
}
.sp-auth-card .sp-toast { box-shadow: none; }
@media (max-width: 400px) {
  .sp-auth-card { padding: 1.5rem 1.25rem; }
}

/* days-past text beside urgency chips (outside the pill so it can wrap) */
.sp-urgency-past { color: var(--sp-danger); }

/* ---- composer (issue chat) ----
   Messenger-style (commit 1ef1f51c3, restored after the 2026-09 skin pass):
   one rounded pill holding tray + input row; accent ring on focus; the send
   button is inert while empty and springs into a filled accent circle when
   there is something to send. The shape is deliberate — do not square it off
   to match cards. */
.sp-composer {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border-strong);
  border-radius: 1.375rem;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.sp-composer:focus-within {
  border-color: var(--sp-accent);
  box-shadow: var(--sp-focus);
}
.sp-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  padding: 0.375rem;
}
.sp-composer-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--sp-text);
  font-family: inherit;
  font-size: 1rem;            /* >= 16px: iOS Safari zooms smaller inputs on focus */
  line-height: 1.4;
  padding: 0.4375rem 0.25rem;
  resize: none;
  max-height: 8.5em; /* ~6 lines, then internal scroll */
  overflow-y: hidden;
}
.sp-composer-input:focus, .sp-composer-input:focus-visible { outline: none; box-shadow: none; }
.sp-composer-input::placeholder { color: var(--sp-muted); }

/* round icon buttons living inside the pill */
.sp-composer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--sp-muted);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
  -webkit-tap-highlight-color: transparent;
}
.sp-composer-icon:hover { background: var(--sp-surface-2); color: var(--sp-text); }
.sp-composer-icon:focus-visible { outline: none; box-shadow: var(--sp-focus); }

/* the send button: muted + inert while empty, accent circle when sendable */
.sp-composer-send {
  color: var(--sp-muted);
  transform: scale(0.9);
  transition: background-color 160ms ease, color 160ms ease,
              transform 160ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sp-composer-send:disabled { cursor: default; }
.sp-composer-send:disabled:hover { background: transparent; color: var(--sp-muted); }
.sp-composer.is-sendable .sp-composer-send {
  background: var(--sp-accent);
  color: var(--sp-accent-text);
  transform: scale(1);
}
.sp-composer.is-sendable .sp-composer-send:hover { background: var(--sp-accent-strong); }

/* attachment tray inside the composer, above the input row */
.sp-composer-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem 0;
}
.sp-composer-tray:empty { display: none; }
.sp-composer-tray .sp-chip { max-width: 14rem; }

/* upload progress strip inside the composer */
.sp-composer-status { padding: 0.375rem 0.875rem 0; }

/* hint below, barely-there until needed */
.sp-composer-hint {
  font-size: 0.6875rem;
  color: var(--sp-muted);
  opacity: 0.75;
  padding: 0.375rem 0.875rem 0;
}

/* ---- motion: Akte's single page rise; everything off for reduced motion ---- */
@keyframes sp-rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
body.sp-body > main,
.sp-auth-card,
.sp-onb-shell {
  animation: sp-rise 220ms ease-out backwards;
}
@media (prefers-reduced-motion: reduce) {
  .sp-body *, .sp-body *::before, .sp-body *::after,
  body.sp-body > main, .sp-auth-card, .sp-onb-shell {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  /* the spinner is information (busy), not decoration: keep it, slowly */
  .sp-body .sp-spinner { animation: sp-spin 1.6s linear infinite !important; }
}

/* ==========================================================================
   Onboarding — public supplier registration form (sp-onb-*).
   ========================================================================== */

/* page shell: a calm single column, block flow (the form is long — no
   vertical centring like .sp-auth-wrap). min-height keeps the body's
   --sp-bg covering the whole viewport on the short pages (receipt /
   expired / inactive). */
.sp-onb-shell {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
  min-height: 100vh;
}
@media (min-width: 640px) {
  .sp-onb-shell { padding: 2.25rem 1.5rem 5rem; }
}

.sp-onb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.sp-onb-brand {
  font-family: var(--sp-font-mark);
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  color: var(--sp-text);
}

/* header meta: the registration reference, engraved and official */
.sp-onb-ref {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--sp-hairline-strong);
  border-radius: var(--sp-radius-sm);
  background: var(--sp-surface);
  font-size: 0.8125rem;
}
.sp-onb-ref > code {
  font-family: var(--sp-font-data);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--sp-text);
}

/* one sheet per numbered section */
.sp-onb-section {
  background: var(--sp-surface);
  border: 1px solid var(--sp-hairline);
  border-radius: var(--sp-radius);
  padding: 1.25rem 1.25rem 1.5rem;
}
@media (min-width: 640px) {
  .sp-onb-section { padding: 1.5rem 1.75rem 1.75rem; }
}
.sp-onb-section + .sp-onb-section { margin-top: 1rem; }

.sp-onb-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.sp-onb-section-title {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.005em;
}
.sp-onb-blurb {
  font-size: 0.875rem;
  color: var(--sp-muted);
  margin-top: 0.375rem;
  max-width: 36rem;
}

/* progressive-enhancement tick: quietly turns green once the section holds
   any content. Decorative only (aria-hidden), never blocks anything. */
.sp-onb-tick {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  border: 1.5px solid var(--sp-hairline-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  line-height: 1;
  color: transparent;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.sp-onb-tick.is-done {
  background: var(--sp-ok);
  border-color: var(--sp-ok);
  color: var(--sp-surface);
}
.sp-onb-tick.is-done::after { content: "✓"; }

/* field grid: two-up on desktop, single column on phones */
.sp-onb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.125rem 1.25rem;
  margin-top: 1.25rem;
}
@media (max-width: 640px) {
  .sp-onb-grid { grid-template-columns: 1fr; }
}
.sp-onb-field--full { grid-column: 1 / -1; }

.sp-onb-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

/* server-side validation summary (top of form on re-render) */
.sp-onb-error-summary {
  background: var(--sp-surface);
  background-image: linear-gradient(var(--sp-danger-bg), var(--sp-danger-bg));
  border: 1px solid var(--sp-danger);
  border-radius: var(--sp-radius);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  color: var(--sp-text);
  margin-bottom: 1rem;
}

/* actions block under the sections */
.sp-onb-actions { margin-top: 1.5rem; }
.sp-onb-actions .sp-btn { width: 100%; }
.sp-onb-note {
  font-size: 0.8125rem;
  color: var(--sp-muted);
  text-align: center;
  margin-top: 0.75rem;
}

/* footer: the one-line telemetry notice */
.sp-onb-footnote {
  font-size: 0.75rem;
  color: var(--sp-muted);
  text-align: center;
  margin-top: 2.5rem;
}

/* confirmation page reference plate */
.sp-onb-done-ref {
  font-family: var(--sp-font-data);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 1.375rem;
  letter-spacing: 0.05em;
}

/* visually removed but form-submittable (spam trap lives here) */
.sp-offscreen {
  position: absolute !important;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- goods moved between orders (templates/supplier/_order_changes.html) ---- */
.sp-change {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--sp-surface);
  border: 1px solid var(--sp-hairline);
  border-radius: var(--sp-radius);
  padding: 0.85rem 1rem;
}
.sp-change--pending {
  border-color: var(--sp-late);
  background: var(--sp-late-bg);
}
.sp-change-body { flex: 1 1 18rem; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.sp-change-title { font-weight: 700; }
.sp-change--pending .sp-change-title { color: var(--sp-late); }
.sp-change-when { font-weight: 400; font-size: 0.75rem; color: var(--sp-ink-faint); margin-left: 0.35rem; }
.sp-change-lines { margin: 0; padding: 0; list-style: none; font-size: 0.875rem; }
.sp-change-act { flex: 0 0 auto; }
.sp-change--void { opacity: 0.7; }
.sp-line-note {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sp-late);
}
