/* Speed UI: the one design system for every TCG Speed Suite app (Shipper, Scan, Inventory, Agent, the extensions).
   Docs and rules: docs/suite/DESIGN-SYSTEM.md. Gallery: /suite/design.html.
   The same file is copied into each extension package (strict page policy, no remote files); a test keeps the copies equal.
   Layout concept: one green-black top bar, content on a pale green-grey ground, white cards only where something is a
   separate object; iPad (820px) first, phone (390px) gets a bottom tab bar.
   Fonts: the site's self-hosted faces (/fonts/fonts.css). Pages that cannot load them fall back to Georgia and system mono. */

:root {
  /* Brand */
  --su-green-900: #12301f;
  --su-green-800: #1b4332;
  --su-green-700: #2d6a4f;
  --su-green-600: #40916c;
  --su-green-400: #74c69d;
  --su-green-200: #b7e4c7;
  --su-green-50: #edf7f1;

  /* Neutrals, biased toward the brand green */
  --su-bg: #f3f6f2;
  --su-surface: #ffffff;
  --su-surface-2: #f8faf7;
  --su-sunken: #e9eee8;
  --su-line: #dbe3db;
  --su-line-strong: #c3cfc4;
  --su-fg: #16201a;
  --su-fg-2: #3c4a41;
  --su-muted: #5b6a61;
  --su-accent: var(--su-green-700);
  --su-accent-strong: var(--su-green-800);
  --su-accent-soft: var(--su-green-50);
  --su-accent-line: var(--su-green-200);
  --su-on-accent: #ffffff;
  --su-bar: #15211a;
  --su-bar-fg: rgba(255, 255, 255, .92);
  --su-bar-muted: rgba(255, 255, 255, .6);
  --su-bar-hover: rgba(255, 255, 255, .08);
  --su-bar-active: var(--su-green-400);
  --su-focus: #2f6fd6;

  /* Status (separate from the brand accent) */
  --su-ok: #1a7a45;      --su-ok-bg: #e6f5ec;     --su-ok-line: #a9d9bb;
  --su-warn: #8a5a00;    --su-warn-bg: #fff4dc;   --su-warn-line: #ecd08a;
  --su-bad: #b42318;     --su-bad-bg: #fdecea;    --su-bad-line: #f0b3ad;
  --su-info: #1f5fa8;    --su-info-bg: #e8f1fc;   --su-info-line: #b3cdee;

  /* Type */
  --su-font-display: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --su-font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --su-font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --su-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --su-text-xs: 12px;
  --su-text-sm: 14px;
  --su-text-md: 16px;
  --su-text-lg: 19px;
  --su-text-xl: 24px;
  --su-text-2xl: 32px;

  /* Space, radius, shadow, motion */
  --su-space-1: 4px;  --su-space-2: 8px;  --su-space-3: 12px; --su-space-4: 16px;
  --su-space-5: 24px; --su-space-6: 32px; --su-space-7: 48px;
  --su-radius-sm: 6px; --su-radius: 10px; --su-radius-lg: 16px; --su-radius-pill: 999px;
  --su-shadow-1: 0 1px 2px rgba(18, 48, 31, .06), 0 1px 3px rgba(18, 48, 31, .05);
  --su-shadow-2: 0 4px 14px rgba(18, 48, 31, .08), 0 1px 4px rgba(18, 48, 31, .05);
  --su-shadow-3: 0 18px 40px rgba(18, 48, 31, .16), 0 4px 12px rgba(18, 48, 31, .08);
  --su-ease: cubic-bezier(.2, .8, .2, 1);
  --su-bar-h: 56px;
  --su-tabbar-h: 60px;
  --su-max: 1080px;
  color-scheme: light;
}

/* Dark is a choice people make (the moon button in the Suite bar, or Settings → Colors: Light, Dim, Dark, Match device);
   speed-ui.js sets data-theme on <html> to "light" or "dark". With no choice saved, or no script, pages are light. */
:root[data-theme="dark"] {
  --su-bg: #0f1512; --su-surface: #172019; --su-surface-2: #1b251e; --su-sunken: #0b100d;
  --su-line: #2a3830; --su-line-strong: #3a4c41; --su-fg: #e5ede7; --su-fg-2: #c3d0c7; --su-muted: #9db0a4;
  --su-accent: #74c69d; --su-accent-strong: #95d5b2; --su-accent-soft: #19301f; --su-accent-line: #2f5a41; --su-on-accent: #0c1a12;
  --su-bar: #0a0f0c; --su-focus: #8ab4f8;
  --su-ok: #8fd9ae; --su-ok-bg: #12301f; --su-ok-line: #2f6a47;
  --su-warn: #f1d58a; --su-warn-bg: #2e2612; --su-warn-line: #6b5a22;
  --su-bad: #f4aaa3; --su-bad-bg: #331916; --su-bad-line: #7a3b36;
  --su-info: #a9c8f2; --su-info-bg: #15243a; --su-info-line: #33507a;
  --su-shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --su-shadow-2: 0 4px 14px rgba(0, 0, 0, .45); --su-shadow-3: 0 18px 40px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* Dim: a softer, lighter dark (Settings → Colors → Dim). speed-ui.js keeps data-theme="dark" and adds data-tone="dim",
   so every dark rule still applies and only these tones change: grey-green instead of near-black, lower contrast. */
:root[data-theme="dark"][data-tone="dim"] {
  --su-bg: #242b27; --su-surface: #2d3530; --su-surface-2: #323b35; --su-sunken: #1f2522;
  --su-line: #434e47; --su-line-strong: #55625a; --su-fg: #e7ece8; --su-fg-2: #cad4cd; --su-muted: #adbab2;
  --su-accent: #7fd3a3; --su-accent-strong: #9be2b9; --su-accent-soft: #2c3e33; --su-accent-line: #4c755c; --su-on-accent: #0c1a12;
  --su-bar: #1a201c;
  --su-ok-bg: #2a4033; --su-ok-line: #4c755c;
  --su-warn-bg: #433a24; --su-warn-line: #7a6830;
  --su-bad-bg: #48312e; --su-bad-line: #85504a;
  --su-info-bg: #2a3a52; --su-info-line: #4a6890;
  --su-shadow-1: 0 1px 2px rgba(0, 0, 0, .25); --su-shadow-2: 0 4px 14px rgba(0, 0, 0, .3); --su-shadow-3: 0 18px 40px rgba(0, 0, 0, .4);
}

/* ── Base (only on pages that opt in with class="su" on <body>; app pages keep their own base) ── */
.su, .su *, .su *::before, .su *::after { box-sizing: border-box; }
body.su {
  margin: 0; background: var(--su-bg); color: var(--su-fg);
  font: var(--su-text-md)/1.55 var(--su-font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
.su h1, .su h2, .su h3 { text-wrap: balance; color: var(--su-fg); }
.su a { color: var(--su-accent-strong); }
.su a { text-underline-offset: 2px; }
.su :focus-visible, .su-bar :focus-visible, .su-tabbar :focus-visible { outline: 3px solid var(--su-focus); outline-offset: 2px; }
.su [hidden] { display: none !important; }
.su-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Shell: top bar, app tabs, bottom tab bar, page ── */
.su-bar {
  position: sticky; top: 0; z-index: 500; background: var(--su-bar); color: var(--su-bar-fg);
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  font-family: var(--su-font-ui);
}
.su-bar.su-bar-static { position: relative; }
.su-bar-in { display: flex; align-items: center; gap: var(--su-space-3); height: var(--su-bar-h); max-width: var(--su-max); margin: 0 auto; min-width: 0; }
.su-bar .su-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex: none; margin-right: auto; }
.su-brand-mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.su-brand-mark img { width: 28px; height: 28px; display: block; }
.su-brand-mark svg { width: 18px; height: 18px; }
.su-brand-name { font-family: var(--su-font-display); font-size: 19px; letter-spacing: -.01em; line-height: 1; white-space: nowrap; }
.su-brand-name small { display: block; font-family: var(--su-font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--su-bar-muted); margin-top: 4px; }
.su-apps { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.su-apps::-webkit-scrollbar { display: none; }
.su-bar .su-apps a, .su-bar .su-bar-icon {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px; border-radius: 9px;
  color: var(--su-bar-muted); text-decoration: none; font: 600 14px/1 var(--su-font-ui); white-space: nowrap;
  transition: color .15s, background .15s;
}
.su-apps a svg, .su-bar-icon svg { width: 18px; height: 18px; flex: none; }
.su-apps a:hover, .su-bar-icon:hover { color: #fff; background: var(--su-bar-hover); }
.su-apps a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .1); box-shadow: inset 0 -2px 0 var(--su-bar-active); }
.su-bar-icon { padding: 0 10px; flex: none; }
.su-bar-icon[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .1); }
button.su-bar-icon { border: 0; background: none; cursor: pointer; }
button.su-bar-icon:hover { background: var(--su-bar-hover); }

.su-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 500; display: none;
  background: var(--su-surface); border-top: 1px solid var(--su-line); box-shadow: 0 -4px 16px rgba(18, 48, 31, .06);
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  font-family: var(--su-font-ui);
}
.su-tabbar-in { display: grid; grid-template-columns: repeat(5, 1fr); height: var(--su-tabbar-h); }
.su .su-tabbar a, .su-tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
  color: var(--su-muted); text-decoration: none; font: 600 11px/1 var(--su-font-ui); letter-spacing: .01em;
}
.su-tabbar a svg { width: 22px; height: 22px; }
.su-tabbar a[aria-current="page"] { color: var(--su-accent); }
.su-tabbar a[aria-current="page"] svg { stroke-width: 2.3; }

@media (max-width: 699px) {
  .su-has-tabbar .su-tabbar { display: block; }
  .su-has-tabbar { padding-bottom: calc(var(--su-tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  /* The site's cookie choice sits just above the tab bar instead of covering it */
  .su-has-tabbar .cc { bottom: calc(var(--su-tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: 8px; }
  .su-has-tabbar .su-apps { display: none; }
  .su-bar .su-apps.su-apps-compact { display: flex; }
  .su-apps.su-apps-compact a { padding: 0 9px; }
  .su-apps.su-apps-compact a span { display: none; }
  /* Room for all five app icons: the logo stays, the name goes (Scan keeps its own bottom bar). */
  .su-bar-compact .su-brand-name { display: none; }
  .su-bar-compact .su-bar-in { gap: 4px; }
  .su-apps.su-apps-compact { margin-left: auto; }
  .su-brand-name small { display: none; }
}

.su-page {
  max-width: var(--su-max); margin: 0 auto;
  padding-block: var(--su-space-5) var(--su-space-7);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.su-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--su-space-3); margin-bottom: var(--su-space-5); }
.su-page-head > div { min-width: 0; }
/* Suite Home: Up next, Start here and Install sit above the Today tiles with the same gap as the tiles. */
#home > .su-card:not(.su-section) { margin-bottom: var(--su-space-4); }
/* Suite Home, calmer: tile notes stay to three lines, apps sit two by two on a phone too, the computer downloads fold away. */
#home .su-stat-note { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#home-apps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--su-space-3); }
#home-apps .su-card { padding: var(--su-space-4); }
#home-apps .su-row { gap: var(--su-space-2); flex-wrap: nowrap; }
#home-apps .su-h3 { margin: 0; }
#home-apps p { margin: 6px 0 0; }
#home-apps .su-pill { margin-top: 6px; }
#home-more > summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 12px; }
#home-more > summary > .su-small { grid-column: 1; grid-row: 2; }
#home-more > summary::-webkit-details-marker { display: none; }
#home-more > summary::after { content: "Show"; grid-column: 2; grid-row: 1; font-size: var(--su-text-sm); font-weight: 600; color: var(--su-brand, currentColor); }
#home-more[open] > summary::after { content: "Hide"; }
#home-more[open] > summary { margin-bottom: var(--su-space-3); }
#home-foot { text-align: center; margin-top: var(--su-space-5); }
.su-eyebrow { font: 600 var(--su-text-xs)/1.2 var(--su-font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--su-accent); margin: 0 0 6px; }
.su-h1 { font: 400 var(--su-text-2xl)/1.1 var(--su-font-display); letter-spacing: -.01em; margin: 0; }
.su-h2 { font: 400 var(--su-text-xl)/1.15 var(--su-font-display); margin: 0 0 var(--su-space-2); }
.su-h3 { font: 700 var(--su-text-md)/1.3 var(--su-font-ui); margin: 0 0 var(--su-space-1); }
.su-lede { color: var(--su-fg-2); max-width: 62ch; margin: 6px 0 0; }
.su-muted { color: var(--su-muted); }
.su-small { font-size: var(--su-text-sm); }
.su-num { font-variant-numeric: tabular-nums; }
.su-mono { font-family: var(--su-font-mono); font-size: .9em; }

/* Side nav (for long pages such as the gallery; becomes a scrolling row on narrow screens) */
.su-split { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--su-space-6); align-items: start; }
.su-side { position: sticky; top: calc(var(--su-bar-h) + 16px); display: flex; flex-direction: column; gap: 2px; font-family: var(--su-font-ui); }
.su-side a { padding: 8px 12px; border-radius: var(--su-radius-sm); color: var(--su-fg-2); text-decoration: none; font-size: var(--su-text-sm); font-weight: 600; }
.su-side a:hover { background: var(--su-sunken); }
.su-side a[aria-current="true"] { background: var(--su-accent-soft); color: var(--su-accent-strong); }
@media (max-width: 899px) {
  .su-split { grid-template-columns: minmax(0, 1fr); gap: var(--su-space-4); }
  .su-side { position: static; flex-direction: row; overflow-x: auto; }
  .su-side a { white-space: nowrap; }
}

/* ── Layout helpers ── */
.su-stack { display: flex; flex-direction: column; gap: var(--su-space-4); }
.su-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--su-space-2); }
.su-grid { display: grid; gap: var(--su-space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.su-grid > * { min-width: 0; }
.su-grid-2 { display: grid; gap: var(--su-space-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 699px) { .su-grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ── Cards ── */
.su-card {
  background: var(--su-surface); border: 1px solid var(--su-line); border-radius: var(--su-radius-lg);
  padding: var(--su-space-5); box-shadow: var(--su-shadow-1); min-width: 0;
}
.su-card-tight { padding: var(--su-space-4); }
.su-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--su-space-2); margin-bottom: var(--su-space-3); }
.su-card-head h2, .su-card-head h3 { margin: 0; }
a.su-card-link { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s var(--su-ease); }
a.su-card-link:hover { border-color: var(--su-accent-line); box-shadow: var(--su-shadow-2); }
a.su-card-link:active { transform: scale(.99); }
.su-app-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--su-accent-soft); color: var(--su-accent-strong); flex: none; }
.su-app-icon svg { width: 22px; height: 22px; }

/* Stat tile and meter */
.su-stat { display: flex; flex-direction: column; gap: 2px; }
.su-stat-label { font: 600 var(--su-text-xs)/1.2 var(--su-font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--su-muted); }
.su-stat-value { font: 400 34px/1.05 var(--su-font-display); font-variant-numeric: tabular-nums; color: var(--su-fg); }
.su-stat-note { font-size: var(--su-text-sm); color: var(--su-muted); }
.su-meter { height: 8px; border-radius: var(--su-radius-pill); background: var(--su-sunken); overflow: hidden; }
.su-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--su-accent); width: 0; transition: width .4s var(--su-ease); }
.su-meter.warn > span { background: var(--su-warn); }
.su-meter.bad > span { background: var(--su-bad); }

/* ── Buttons ── */
.su-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--su-radius); border: 1px solid var(--su-line-strong); background: var(--su-surface); color: var(--su-fg);
  font: 600 15px/1 var(--su-font-ui); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .12s var(--su-ease);
}
.su-btn:hover { background: var(--su-surface-2); border-color: var(--su-accent-line); }
.su-btn:active { transform: scale(.98); }
.su-btn:disabled, .su-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.su-btn svg { width: 18px; height: 18px; }
.su-btn.primary { background: var(--su-accent); border-color: var(--su-accent); color: var(--su-on-accent); }
.su-btn.primary:hover { background: var(--su-accent-strong); border-color: var(--su-accent-strong); }
.su-btn.ghost { background: transparent; border-color: transparent; color: var(--su-accent-strong); }
.su-btn.ghost:hover { background: var(--su-accent-soft); }
.su-btn.danger { background: var(--su-bad); border-color: var(--su-bad); color: #fff; }
.su-btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.su-btn.block { width: 100%; }
a.su-btn.primary, a.su-btn.danger { color: var(--su-on-accent); }
a.su-btn.danger { color: #fff; }

/* ── Pills ── */
.su-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--su-radius-pill);
  font: 600 12px/1.4 var(--su-font-ui); border: 1px solid var(--su-line); background: var(--su-surface-2); color: var(--su-fg-2); white-space: nowrap;
}
.su-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.su-pill.plain::before { display: none; }
.su-pill.ok { background: var(--su-ok-bg); border-color: var(--su-ok-line); color: var(--su-ok); }
.su-pill.warn { background: var(--su-warn-bg); border-color: var(--su-warn-line); color: var(--su-warn); }
.su-pill.bad { background: var(--su-bad-bg); border-color: var(--su-bad-line); color: var(--su-bad); }
.su-pill.info { background: var(--su-info-bg); border-color: var(--su-info-line); color: var(--su-info); }
.su-pill.brand { background: var(--su-accent-soft); border-color: var(--su-accent-line); color: var(--su-accent-strong); }

/* ── Forms ── */
.su-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font: 600 var(--su-text-sm)/1.3 var(--su-font-ui); color: var(--su-fg-2); }
.su-field .su-hint { font-weight: 400; color: var(--su-muted); font-size: 13px; }
.su-input, .su-select, .su-textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--su-radius); border: 1px solid var(--su-line-strong);
  background: var(--su-surface); color: var(--su-fg); font: 400 16px/1.3 var(--su-font-ui);
  transition: border-color .15s, box-shadow .15s;
}
.su-textarea { min-height: 96px; resize: vertical; }
.su-select {
  appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--su-muted) 50%), linear-gradient(135deg, var(--su-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.su-input:focus, .su-select:focus, .su-textarea:focus { outline: none; border-color: var(--su-accent); box-shadow: 0 0 0 3px var(--su-accent-soft); }
.su-input[aria-invalid="true"] { border-color: var(--su-bad); }
.su-check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font: 400 15px/1.3 var(--su-font-ui); cursor: pointer; }
.su-check input { width: 20px; height: 20px; accent-color: var(--su-accent); }
.su-form-grid { display: grid; gap: var(--su-space-3); grid-template-columns: repeat(6, minmax(0, 1fr)); }
.su-form-grid > .w6 { grid-column: span 6; } .su-form-grid > .w3 { grid-column: span 3; }
.su-form-grid > .w2 { grid-column: span 2; } .su-form-grid > .w4 { grid-column: span 4; }
@media (max-width: 599px) { .su-form-grid > .w3, .su-form-grid > .w4 { grid-column: span 6; } .su-form-grid > .w2 { grid-column: span 3; } }

/* ── Segmented tabs ── */
.su-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--su-sunken); max-width: 100%; overflow-x: auto; }
.su-tabs [role="tab"] {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--su-fg-2);
  font: 600 14px/1 var(--su-font-ui); cursor: pointer; white-space: nowrap;
}
.su-tabs [role="tab"][aria-selected="true"] { background: var(--su-surface); color: var(--su-fg); box-shadow: var(--su-shadow-1); }

/* ── Tables ── */
.su-table-wrap { overflow-x: auto; border: 1px solid var(--su-line); border-radius: var(--su-radius); background: var(--su-surface); }
.su-table { width: 100%; border-collapse: collapse; font: 400 var(--su-text-sm)/1.4 var(--su-font-ui); font-variant-numeric: tabular-nums; }
.su-table th { text-align: left; font: 600 11px/1.2 var(--su-font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--su-muted); background: var(--su-surface-2); }
.su-table th, .su-table td { padding: 10px 12px; border-bottom: 1px solid var(--su-line); }
.su-table tr:last-child td { border-bottom: 0; }
.su-table td.r, .su-table th.r { text-align: right; }

/* ── List rows ── */
.su-list { list-style: none; margin: 0; padding: 0; }
.su-list > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--su-space-3); padding: 12px 0; border-bottom: 1px solid var(--su-line); min-width: 0; }
.su-list > li:last-child { border-bottom: 0; }
.su-list > li > :first-child { min-width: 0; }

/* ── Empty state, notice ── */
.su-empty { text-align: center; padding: var(--su-space-6) var(--su-space-4); border: 1px dashed var(--su-line-strong); border-radius: var(--su-radius-lg); color: var(--su-muted); }
.su-empty strong { display: block; color: var(--su-fg); font: 400 var(--su-text-lg)/1.3 var(--su-font-display); margin-bottom: 4px; }
.su-empty p { margin: 0 auto var(--su-space-3); max-width: 46ch; }
.su-notice { padding: 12px 14px; border-radius: var(--su-radius); border: 1px solid var(--su-info-line); background: var(--su-info-bg); color: var(--su-fg); font: 400 var(--su-text-sm)/1.45 var(--su-font-ui); }
.su-notice.warn { border-color: var(--su-warn-line); background: var(--su-warn-bg); }
.su-notice.ok { border-color: var(--su-ok-line); background: var(--su-ok-bg); }
.su-notice.bad { border-color: var(--su-bad-line); background: var(--su-bad-bg); }

/* ── Toasts ── */
.su-toasts {
  position: fixed; z-index: 900; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px));
}
.su-has-tabbar .su-toasts { bottom: calc(var(--su-tabbar-h) + 12px + env(safe-area-inset-bottom, 0px)); }
.su-toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--su-radius);
  background: var(--su-bar); color: #fff; box-shadow: var(--su-shadow-3); font: 500 15px/1.35 var(--su-font-ui);
  animation: su-rise .25s var(--su-ease);
}
.su-toast.ok::before, .su-toast.bad::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--su-green-400); }
.su-toast.bad::before { background: #f4aaa3; }

/* ── Dialog ── */
dialog.su-dialog {
  border: 1px solid var(--su-line); border-radius: var(--su-radius-lg); padding: 0; width: min(480px, calc(100% - 32px));
  background: var(--su-surface); color: var(--su-fg); box-shadow: var(--su-shadow-3);
}
dialog.su-dialog::backdrop { background: rgba(10, 18, 13, .5); }
.su-dialog-body { padding: var(--su-space-5); }
.su-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: var(--su-space-3) var(--su-space-5); border-top: 1px solid var(--su-line); background: var(--su-surface-2); border-radius: 0 0 var(--su-radius-lg) var(--su-radius-lg); }

/* ── Skeleton ── */
.su-skel { display: block; border-radius: var(--su-radius-sm); background: linear-gradient(90deg, var(--su-sunken), var(--su-surface-2), var(--su-sunken)); background-size: 200% 100%; animation: su-shimmer 1.4s linear infinite; min-height: 14px; }

@keyframes su-rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes su-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .su *, .su-toast, .su-skel, .su-meter > span { animation: none !important; transition: none !important; }
}

/* ── App bridges: the apps' own pages, retoned to the shared tokens (html[data-speed-app] is set by the server) ── */
html[data-speed-app] body { overflow-x: hidden; }

/* Speed Scan: its own variables, mapped onto the system */
html[data-speed-app="scan"] {
  --bg: var(--su-bg); --bg-warm: var(--su-sunken); --surface: var(--su-surface); --surface-raised: var(--su-surface-2);
  --border: var(--su-line); --border-mid: var(--su-line-strong); --text: var(--su-fg); --text-secondary: var(--su-fg-2);
  --muted: var(--su-muted); --hint: var(--su-muted); --accent: var(--su-accent); --accent-light: var(--su-green-600);
  --accent-bg: var(--su-accent-soft); --accent-border: var(--su-accent-line);
  --success: var(--su-ok); --success-bg: var(--su-ok-bg); --danger: var(--su-bad); --danger-bg: var(--su-bad-bg);
  --warn-bg: var(--su-warn-bg); --warn-border: var(--su-warn-line);
}
html[data-speed-app="scan"] input[type="checkbox"], html[data-speed-app="scan"] input[type="radio"] { accent-color: var(--su-accent); }
/* Inside the Suite the Suite bar scrolls away and Scan's own section tabs stay pinned, as a light sub-bar */
html.su-shell[data-speed-app="scan"] .su-bar { position: relative; }
html[data-speed-app="scan"] .top-nav { background: var(--su-surface); box-shadow: none; border-bottom: 1px solid var(--su-line); }
html[data-speed-app="scan"] .nav-brand { color: var(--su-fg); border-right-color: var(--su-line); }
html.su-shell[data-speed-app="scan"] .nav-brand { display: none; }
html[data-speed-app="scan"] .nav-tab { color: var(--su-muted); }
html[data-speed-app="scan"] .nav-tab:hover { color: var(--su-fg); }
html[data-speed-app="scan"] .nav-tab.active { color: var(--su-accent-strong); border-bottom-color: var(--su-accent); }
html[data-speed-app="scan"] .nav-tab span { background: var(--su-accent); color: var(--su-on-accent); }
html[data-speed-app="scan"] input, html[data-speed-app="scan"] select, html[data-speed-app="scan"] textarea { background: var(--su-surface); color: var(--su-fg); }

/* Speed Inventory */
html[data-speed-app="inventory"] {
  --bg: var(--su-bg); --card: var(--su-surface); --text: var(--su-fg); --muted: var(--su-muted); --line: var(--su-line);
  --brand: var(--su-accent); --soft: var(--su-accent-soft); --warn: var(--su-bad);
}
html[data-speed-app="inventory"] body { font-family: var(--su-font-body); }
html[data-speed-app="inventory"] h1, html[data-speed-app="inventory"] h2 { font-family: var(--su-font-display); font-weight: 400; letter-spacing: -.01em; }
html[data-speed-app="inventory"] .card { border-radius: var(--su-radius-lg); box-shadow: var(--su-shadow-1); }
html[data-speed-app="inventory"] .btn, html[data-speed-app="inventory"] button { font-family: var(--su-font-ui); border-radius: var(--su-radius); }

/* Shipper (the Labels extension app, also served inside the Suite) */
html[data-speed-app="shipper"] {
  --bg: var(--su-bg); --card: var(--su-surface); --text: var(--su-fg); --muted: var(--su-muted); --line: var(--su-line);
  --brand: var(--su-accent); --brand-dark: var(--su-accent-strong); --brand-soft: var(--su-accent-soft);
  --warn-bg: var(--su-warn-bg); --warn-line: var(--su-warn-line); --warn-text: var(--su-warn);
  --err-bg: var(--su-bad-bg); --err-line: var(--su-bad-line); --err-text: var(--su-bad);
  --ok-bg: var(--su-ok-bg); --ok-line: var(--su-ok-line); --ok-text: var(--su-ok); --focus: var(--su-focus);
}
html.su-shell[data-speed-app="shipper"] .top { display: none; }

/* Speed Agent page (and the website's other content pages, if mounted later): site nav and footer give way to the Suite bar */
html[data-speed-app="agent"] {
  --bg: var(--su-bg); --surface: var(--su-surface); --border: var(--su-line); --text: var(--su-fg); --text-secondary: var(--su-fg-2);
  --muted: var(--su-muted); --hint: var(--su-muted); --accent: var(--su-accent); --accent-light: var(--su-green-600);
  --accent-bg: var(--su-accent-soft); --accent-border: var(--su-accent-line);
}
html.su-shell[data-speed-app="agent"] .site-nav, html.su-shell[data-speed-app="agent"] footer.sf { display: none; }
/* The Agent page's own boxes used fixed light colours; give them the Suite's so they read in dark mode too */
html[data-speed-app="agent"] .highlight, html[data-speed-app="agent"] .msg.me { background: var(--su-accent-soft); border-color: var(--su-accent-line); }
html[data-speed-app="agent"] .msg.err { background: var(--su-bad-bg); border-color: var(--su-bad-line); color: var(--su-bad); }
html[data-speed-app="agent"] code { background: var(--su-sunken); }
html[data-speed-app="agent"] .btn:not(.btn-ghost), html[data-speed-app="agent"] .steps li::before { color: var(--su-on-accent); }
html[data-speed-app="scan"] .btn-dl { background: var(--su-accent); color: var(--su-on-accent); box-shadow: none; border-radius: var(--su-radius); font-family: var(--su-font-ui); }
html[data-speed-app="scan"] .btn-dl:hover { background: var(--su-accent-strong); transform: none; box-shadow: none; }
html[data-speed-app="scan"] .btn-ghost { font-family: var(--su-font-ui); border-radius: var(--su-radius); }
html[data-speed-app="inventory"] .btn { color: var(--su-on-accent); }
html[data-speed-app="inventory"] .n, html[data-speed-app="shipper"] .steps .n { color: var(--su-on-accent); }
.su-section { margin-top: var(--su-space-6); }
.su-section-sm { margin-top: var(--su-space-4); }
/* Gallery swatches (/suite/design.html) */
.su-swatches { display: grid; gap: var(--su-space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.su-swatch { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-family: var(--su-font-ui); }
.su-swatch code { font: 12px var(--su-font-mono); overflow-wrap: anywhere; }
.su-swatch-chip { height: 48px; border-radius: var(--su-radius); border: 1px solid var(--su-line); }
/* The preview copy's banner (preview.js), on Suite pages */
#tcgss-preview-banner { background: #b45309; color: #fff; font: 600 14px/1.4 var(--su-font-ui); text-align: center; padding: 8px 16px; }
#tcgss-preview-banner a { color: #fff; text-decoration: underline; }
/* Shipper: the shared type and button shapes */
html[data-speed-app="shipper"] body { font-family: var(--su-font-ui); }
html[data-speed-app="shipper"] h1, html[data-speed-app="shipper"] h2 { font-family: var(--su-font-display); font-weight: 400; }
html[data-speed-app="shipper"] .card { border-radius: var(--su-radius-lg); box-shadow: var(--su-shadow-1); }
html[data-speed-app="shipper"] .btn { border-radius: var(--su-radius); font-family: var(--su-font-ui); }
html[data-speed-app="shipper"] .btn.primary { color: var(--su-on-accent); }
html.su-shell[data-speed-app="shipper"] .wrap { padding-top: var(--su-space-5); }
/* Stat row: two wide tiles then three (iPad); two columns, the first tile full width (phone) */
.su-stats { display: grid; gap: var(--su-space-4); grid-template-columns: repeat(6, minmax(0, 1fr)); }
.su-stats > * { grid-column: span 2; min-width: 0; }
.su-stats > :nth-child(-n+2) { grid-column: span 3; }
@media (max-width: 699px) {
  .su-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--su-space-3); }
  .su-stats > *, .su-stats > :nth-child(-n+2) { grid-column: span 1; }
  .su-stats > :first-child { grid-column: span 2; }
  .su-stats .su-card { padding: var(--su-space-4); }
  .su-stats .su-stat-value { font-size: 28px; }
}

/* Touch screens (phones and iPads): small buttons and tabs are still at least 44px tall to tap. */
@media (pointer: coarse) {
  .su-btn.sm, .su-tabs [role="tab"] { min-height: 44px; }
}
