*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  color-scheme: light;
  --bg: #f4f6f7; --surface: #ffffff; --surface-alt: #fafbfc; --bg-tertiary: #eef1f2;
  --border: #dee3e5; --border-subtle: #eaeeef;
  --text: #2a2f31; --text-secondary: #5a6470; --text-muted: #8a919c;
  /* Aliases for the two names a number of rules already reference
     (`--text-primary`, `--bg-primary`). They used to resolve to nothing
     (or to a literal fallback), which meant those rules could not follow
     a theme switch. Defining them here makes every call site themable. */
  --text-primary: var(--text);
  --bg-primary: var(--surface);
  /* BAYARD brand (per BAYARD_STYLE_GUIDE.md):
     - interactive / text teal = DEEP teal #0A8F85 (readable on white) -> --primary
     - bright Orbital teal #0BD2C5 is DECORATIVE only (logo / glow / fills) -> --brand-teal
     - charcoal is the primary-button + wordmark colour. */
  --primary: #0A8F85; --primary-hover: #0B736B;
  --primary-light: rgba(11, 210, 197, 0.12); --primary-glow: rgba(11, 210, 197, 0.20);
  --brand-teal: #0BD2C5; --brand-teal-deep: #0A8F85; --brand-mint: #C8E8E8;
  --brand-charcoal: #34393B; --brand-charcoal-dark: #23282A;
  --success: #00a67d; --success-light: rgba(0, 166, 125, 0.08);
  --danger: #dc3545; --danger-light: rgba(220, 53, 69, 0.08);
  --accent: #7c3aed; --accent-light: #f5f3ff;
  --warn: #e6940a; --warn-light: rgba(230, 148, 10, 0.08);
  /* Active-selection accent: calm blue, used for current GTIN, expanded section, current tab.
     Brand red is reserved for the brand identity (logo, header gradient, ai-pill). */
  --accent-blue: #2563eb;
  --accent-blue-light: rgba(37, 99, 235, 0.08);
  --accent-blue-glow: rgba(37, 99, 235, 0.18);
  /* Two-state mandatory tokens (see QW-5):
     - mandatory-empty (amber): default for unfilled required fields.
     - mandatory-error (red):  upgraded after an export attempt blocked by this field. */
  --mandatory-empty-border: #f59e0b;
  --mandatory-empty-bg: rgba(245, 158, 11, 0.08);
  --mandatory-empty-glow: rgba(245, 158, 11, 0.18);
  --mandatory-error-border: #dc2626;
  --mandatory-error-bg: rgba(220, 38, 38, 0.08);
  --mandatory-error-glow: rgba(220, 38, 38, 0.20);
  /* Chrome / container surfaces that used to be hardcoded white. Split out
     from --surface because they carry translucency or a distinct elevation
     that has to be re-tuned per theme rather than derived. */
  --header-bg: rgba(255,255,255,.82);
  --panel-bg: #ffffff;
  --input-bg: #ffffff;
  --code-bg: #f8fafc;
  --overlay-scrim: rgba(0,0,0,.7);
  --backdrop: rgba(0,0,0,.4);
  /* `--border-light` was referenced by the GPC picker rules but never
     defined, so it silently fell through to a hardcoded light grey. */
  --border-light: #eef0f2;
  /* Neutral washes for zebra rows, inset strips and read-only columns.
     Tokenised because a black alpha is INVISIBLE on a dark surface —
     the dark theme flips these to white alpha rather than re-tinting. */
  --tint-subtle: rgba(15,23,42,.03);
  --tint-soft: rgba(0,0,0,.05);
  --tint-strong: rgba(0,0,0,.08);
  /* Compare-mode diff rows. The wash spans the full row width, so its
     alpha has to stay low enough that a red tint doesn't turn into a
     solid block of colour. On white a low-alpha red reads as a gentle
     pink; on a dark surface the same red muddies into maroon, so the
     dark theme drops the wash further and adds a left edge to carry
     the signal instead (edge is transparent here — light mode already
     signals the row via the teal label). */
  --diff-row-bg: rgba(232, 61, 61, .08);
  --diff-row-bg-hover: rgba(232, 61, 61, .12);
  --diff-row-edge: transparent;
  --diff-skipped-bg: rgba(232, 61, 61, .05);
  /* Translucent "glass" buttons that sit on the tinted compare banner. */
  --glass: rgba(255,255,255,.65);
  --glass-hover: rgba(255,255,255,.9);
  /* Deliberately inverted surfaces (tooltips): dark on light, and only
     slightly darker than the page on dark so they still read as raised. */
  --tooltip-bg: #1f2937;
  --tooltip-text: #f9fafb;
  --tooltip-text-muted: #d1d5db;
  /* Deep status variants — used where the status colour is TEXT sitting on
     its own tinted background, which needs more contrast than the base
     token (and must go LIGHTER, not darker, in the dark theme). */
  --success-text: #15803d;
  --danger-text: #b91c1c;
  --warn-text: #b45309;
  --neutral-text: #475569;
  --info: #0ea5e9; --info-text: #0369a1; --info-light: rgba(14,165,233,.15);
  /* Compliance grades B/C (A and D reuse success / mandatory-error). */
  --grade-b-text: #0f8a63; --grade-b-bg: rgba(16,185,129,.10);
  --grade-c-text: #b45309; --grade-c-bg: #fff7ed;
  /* Packaging-hierarchy tier chips. */
  --tier-pallet-bg: #e8f5e9;  --tier-pallet-text: #2e7d32;
  --tier-shipper-bg: #fff3e0; --tier-shipper-text: #e65100;
  --tier-case-bg: #e3f2fd;    --tier-case-text: #1565c0;
  /* Selected boolean radio. Its own token purely to keep the legacy
     light-mode red pixel-identical while letting dark lift it. */
  --radio-accent: #c41e3a;
  /* Ink for text/icons sitting ON a filled accent (teal button, blue tab,
     green badge...). It cannot just be #fff: the dark theme LIGHTENS those
     fills so they read against a dark page, which would leave white text
     at ~1.6:1 on them. Dark mode therefore flips this ink to near-black. */
  --on-accent: #fff;
  /* Sub-surfaces drawn ON a filled accent (a nested count badge, a ring).
     They have to flip with --on-accent or a white wash ends up sitting
     behind dark ink. */
  --on-accent-wash: rgba(255,255,255,.22);
  --on-accent-line: rgba(255,255,255,.4);
  /* Select arrows are data-URI SVGs with the colour baked into the markup.
     `var()` is NOT substituted inside a url() token, so the token has to
     carry the WHOLE url(...) — that is what makes them themable without
     duplicating the rule under the dark selector. */
  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23777' d='M0 0l5 6 5-6z'/></svg>");
  --select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748b' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  --radius-sm: 6px; --radius: 10px; --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --font-sans: 'Outfit', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}
/* ---------------------------------------------------------------------
   Dark theme.
   `<html data-theme>` always holds a RESOLVED value (light|dark) — the
   boot script in <head> turns the user's stored choice (or a one-shot
   OS preference when missing/legacy "system") into one of the two
   before first paint. That keeps the dark palette in exactly one place
   instead of duplicating it inside a prefers-color-scheme media query.
   Only SEMANTIC tokens are overridden. Brand-identity tokens
   (--brand-teal, --brand-charcoal, --brand-mint) are fixed artwork
   colours and stay put in both themes.
   --------------------------------------------------------------------- */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14181a; --surface: #1c2124; --surface-alt: #22282b; --bg-tertiary: #2a3135;
  /* Multiply base for the desk photo (see the `body` rule below). This is
     the value the photo's white desk maps to, so it doubles as the page
     background: lower = quieter backdrop, higher = more visible props. */
  --desk-tint: #1e2427;
  --border: #333c41; --border-subtle: #2a3236;
  --text: #e6eaec; --text-secondary: #a8b3ba; --text-muted: #7c878e;
  /* The deep brand teal (#0A8F85) is tuned for readability on white and
     fails contrast on a dark surface, so the INTERACTIVE teal lifts
     towards the bright Orbital teal while staying below full saturation. */
  --primary: #14b8ab; --primary-hover: #2dd4c4;
  --primary-light: rgba(11, 210, 197, 0.14); --primary-glow: rgba(11, 210, 197, 0.26);
  --success: #34d399; --success-light: rgba(52, 211, 153, 0.12);
  --danger: #f87171; --danger-light: rgba(248, 113, 113, 0.12);
  --accent: #a78bfa; --accent-light: rgba(167, 139, 250, 0.14);
  --warn: #fbbf24; --warn-light: rgba(251, 191, 36, 0.12);
  --accent-blue: #60a5fa;
  --accent-blue-light: rgba(96, 165, 250, 0.14);
  --accent-blue-glow: rgba(96, 165, 250, 0.28);
  --mandatory-empty-border: #fbbf24;
  --mandatory-empty-bg: rgba(251, 191, 36, 0.12);
  --mandatory-empty-glow: rgba(251, 191, 36, 0.24);
  --mandatory-error-border: #f87171;
  --mandatory-error-bg: rgba(248, 113, 113, 0.12);
  --mandatory-error-glow: rgba(248, 113, 113, 0.26);
  --header-bg: rgba(28,33,36,.85);
  --panel-bg: #1f2528;
  --input-bg: #171c1f;
  --code-bg: #12171a;
  --overlay-scrim: rgba(0,0,0,.78);
  --backdrop: rgba(0,0,0,.62);
  --border-light: #2a3236;
  /* Flipped to white alpha: black-on-dark reads as nothing at all. */
  --tint-subtle: rgba(255,255,255,.035);
  --tint-soft: rgba(255,255,255,.055);
  --tint-strong: rgba(255,255,255,.09);
  /* Neutral-with-red-edge: the wash is a whisper of warmth over the row
     (not enough to read as maroon) and the 3px left edge does the
     "this row differs" work. Keeps the teal Take buttons as the most
     saturated thing in the row. */
  --diff-row-bg: rgba(248, 113, 113, .055);
  --diff-row-bg-hover: rgba(248, 113, 113, .11);
  --diff-row-edge: var(--danger);
  --diff-skipped-bg: rgba(248, 113, 113, .07);
  --glass: rgba(255,255,255,.10);
  --glass-hover: rgba(255,255,255,.18);
  --tooltip-bg: #0e1316;
  --tooltip-text: #e6eaec;
  --tooltip-text-muted: #a8b3ba;
  --success-text: #4ade80;
  --danger-text: #fca5a5;
  --warn-text: #fcd34d;
  --neutral-text: #94a3b8;
  --info: #38bdf8; --info-text: #7dd3fc; --info-light: rgba(56,189,248,.16);
  --grade-b-text: #34d399; --grade-b-bg: rgba(16,185,129,.16);
  --grade-c-text: #fbbf24; --grade-c-bg: rgba(251,191,36,.14);
  --tier-pallet-bg: rgba(52,211,153,.16);  --tier-pallet-text: #6ee7b7;
  --tier-shipper-bg: rgba(251,146,60,.16); --tier-shipper-text: #fdba74;
  --tier-case-bg: rgba(96,165,250,.16);    --tier-case-text: #93c5fd;
  --radio-accent: #ef5f6d;
  --on-accent: #0b1013;
  --on-accent-wash: rgba(0,0,0,.18);
  --on-accent-line: rgba(0,0,0,.32);
  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23a8b3ba' d='M0 0l5 6 5-6z'/></svg>");
  --select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23a8b3ba' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  /* A 8-12% black shadow is invisible against a dark surface — elevation
     on dark needs both a much deeper shadow and a lighter border. */
  --shadow: 0 1px 3px rgba(0,0,0,.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,.55);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.6);
}
/* ---------------------------------------------------------------------
   Dark theme, part 2: the handful of places where a token swap is not
   enough because the light value is baked into an ASSET or a gradient.
   Every selector here is `[data-theme="dark"] X`, which outranks the
   plain `X` rule below on specificity, so placement is not order-
   sensitive — keeping them together beats scattering them.
   --------------------------------------------------------------------- */
/* The desk flat-lay is a bright photo built for a white page. A plain
   alpha dim can't rescue it: the white desk only drops below the card
   colour at ~96% opacity, by which point the photo is gone. Multiplying
   against a dark base instead maps the white desk to exactly
   `--desk-tint` and everything else strictly darker, so the backdrop can
   never out-light the cards and the props survive as silhouettes with
   their teal cast intact. */
[data-theme="dark"] body {
  background-color: var(--desk-tint);
  background-blend-mode: multiply;
}
/* The lockup is a transparent PNG with a charcoal wordmark that vanishes
   on a dark header. Inverting alone would turn the teal mark magenta, so
   the hue is rotated back a half turn. Interim measure — a shipped
   light-variant asset would beat a filter. */
[data-theme="dark"] .brand-lockup img {
  filter: invert(1) hue-rotate(180deg) saturate(1.15) brightness(1.05);
}
/* Pastel-to-mid gradients built for a white card; on dark they glare. */
[data-theme="dark"] .section-icon.amber {
  background: linear-gradient(135deg, #b4770c, #7c4a06); color: #fde68a;
}
[data-theme="dark"] .section-icon.blue {
  background: linear-gradient(135deg, #2f5fa8, #1e3a6b); color: #dbeafe;
}
/* Section accent dots get their colour from `ATTR_SECTIONS[].color` as an
   inline style (see `addCard`), so CSS cannot re-map them per theme. A
   filter lifts all 22 at once — which beats maintaining a parallel dark
   palette in JS, and matters most for the near-black slates (#475569,
   #5a6370) that would otherwise disappear against the card. */
[data-theme="dark"] .card-header .dot { filter: brightness(1.5) saturate(1.2); }
/* Two heavyweight action buttons keep WHITE ink rather than the dark
   `--on-accent` ink, because they must stay the loudest thing on screen.
   That only works if the fill stays deep, so their gradients are darkened
   here instead of inheriting the lifted --success / --warn tokens. */
[data-theme="dark"] .btn-export-xml {
  background: linear-gradient(135deg, #0f8f6c, #00614a);
  border-color: rgba(0,122,91,.65);
}
[data-theme="dark"] .overlay-proceed-warn {
  background: linear-gradient(135deg, #b4770c, #8a5a06);
}
/* An OPEN <select> popup is drawn by the browser, not by this stylesheet.
   On macOS it is fully OS-drawn and follows the SYSTEM appearance, so the
   app in dark mode on a light-appearance Mac opens a LIGHT popup over a
   dark page. Inheriting `color-scheme: dark` does not help, and neither
   does this rule — MEASURED: painting the options has no effect on macOS.
   It is kept because it does work where the popup is Blink-drawn (Chromium
   on Windows / Linux copies `option` styles into the popup document), and
   Firefox reads the popup colour off the select, which is already dark.
   Theming the popup on macOS would mean replacing `<select>` with a custom
   listbox and re-implementing the keyboard nav, type-ahead and ARIA it
   gives for free. The more specific `.customer-select
   option[value="BYRD_TEST"]` rule still wins, so the flag keeps its teal. */
[data-theme="dark"] option,
[data-theme="dark"] optgroup {
  background-color: var(--surface-alt);
  color: var(--text);
}
[data-theme="dark"] optgroup { color: var(--text-muted); }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font-sans); color: var(--text); line-height: 1.6; min-height: 100vh;
  background-color: var(--bg);
  /* BAYARD teal desk flat-lay backdrop (objects framing a white centre),
     shown at full strength (scrim removed). fixed so it does not scroll. */
  background-image: url("/static/bg-desk.jpg");
  background-position: center center; background-size: cover; background-repeat: no-repeat; background-attachment: fixed; }
header {
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding: .75rem 2rem;
  position: sticky; top: 0; z-index: 100; overflow: visible;
  box-shadow: 0 1px 0 rgba(15,23,42,.02), 0 8px 22px -14px rgba(15,23,42,.12);
}
header::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--brand-teal) 50%, var(--primary) 100%);
  pointer-events: none;
}
/* Share the content column's edges: `main` caps at 1400px *including* its
   2rem gutters, while this row sits inside header's own 2rem padding — so it
   must cap 4rem narrower or the header drifts left of the cards below. */
header .inner { max-width: calc(1400px - 4rem); margin: 0 auto; display: flex; align-items: center; gap: .85rem; overflow: visible; }
/* Brand lockup — one horizontal artwork carrying both the mark and the
   wordmark, so there is no separate title text to style. Shrinks before
   the pills/chips do on narrow viewports. */
.brand-lockup { display: flex; align-items: center; min-width: 0; flex: 0 1 auto; }
/* `object-fit` matters: once max-width clamps the box on a narrow viewport,
   the fixed height would otherwise squash the artwork horizontally. */
.brand-lockup img { height: 34px; width: auto; max-width: 100%; object-fit: contain; object-position: left center; display: block; }
header .header-sub { font-size: .66rem; color: var(--text-muted); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }
/* The AI pill is a button — it displays the active (default) model
   and opens a read-only list of available models. Users cannot
   switch models from the UI. */
.model-picker-wrap { position: relative; display: inline-block; }
header .ai-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .25rem .55rem .25rem .45rem;
  border-radius: 999px; border: 1px solid rgba(11,210,197,.16);
  background: linear-gradient(135deg, var(--primary-light), rgba(11,210,197,.03));
  color: var(--primary); font-size: .68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
  font-family: inherit; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
header .ai-pill:hover,
header .ai-pill[aria-expanded="true"] {
  border-color: rgba(11,210,197,.42);
  box-shadow: 0 2px 8px rgba(11,210,197,.14);
}
header .ai-pill:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
header .ai-pill .ai-pill-icon { width: 11px; height: 11px; }
header .ai-pill .model-divider { width: 1px; height: 11px; background: rgba(11,210,197,.2); }
header .ai-pill .model-name { font-size: .65rem; color: var(--text-secondary); font-weight: 500; text-transform: none; letter-spacing: 0; }
header .ai-pill .model-picker-chevron {
  width: 10px; height: 10px;
  color: var(--text-muted);
  transition: transform .15s;
  margin-left: .1rem;
}
header .ai-pill[aria-expanded="true"] .model-picker-chevron { transform: rotate(180deg); }

/* Model list popover (anchored to the AI pill). Read-only: names and
   notes only — no selection. */
.model-picker-popover {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 280px; max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px rgba(15,23,42,.16);
  padding: .35rem;
  display: none;
  flex-direction: column;
  z-index: 200;
}
.model-picker-popover.visible { display: flex; }
.model-picker-header {
  display: flex; flex-direction: column; gap: .1rem;
  padding: .45rem .65rem .35rem;
  border-bottom: 1px solid var(--border);
  margin: 0 -.35rem .25rem;
  font-size: .78rem; font-weight: 600; color: var(--text);
}
.model-picker-header .model-picker-sub {
  font-size: .65rem; font-weight: 500;
  color: var(--text-muted); letter-spacing: .01em;
  text-transform: none;
}
.model-picker-list { display: flex; flex-direction: column; gap: 1px; }
.model-picker-loading {
  padding: 1rem; text-align: center;
  font-size: .78rem; color: var(--text-muted);
}
.model-picker-item {
  display: flex; align-items: flex-start; gap: .55rem;
  padding: .55rem .65rem;
  background: none; border: 0; border-radius: 6px;
  text-align: left; cursor: default;
  font: inherit; color: var(--text-secondary);
}
.model-picker-item.is-default { color: var(--text); }
.model-picker-item .mpi-body { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.model-picker-item .mpi-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.model-picker-item .mpi-label { font-size: .82rem; font-weight: 600; }
.model-picker-item .mpi-note {
  font-size: .68rem; color: var(--text-muted);
  line-height: 1.35; white-space: normal;
}
.model-picker-item .mpi-tag {
  font-size: .58rem; font-weight: 700; letter-spacing: .06em;
  padding: .08rem .35rem; border-radius: 4px;
  background: var(--bg-tertiary); color: var(--text-muted);
  text-transform: uppercase;
}
.model-picker-item .mpi-tag-sunset {
  background: var(--warn-light); color: var(--warn);
  border: 1px solid var(--warn);
  text-transform: none;
  letter-spacing: .02em;
}
.model-picker-sunset {
  font-size: .68rem; color: var(--text-muted); line-height: 1.4;
  padding: .55rem .75rem .5rem; border-top: 1px solid var(--border);
}
.btn-info { background: none; border: 1px solid var(--border); border-radius: 50%; width: 28px; height: 28px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); transition: all .15s; flex-shrink: 0; }
.btn-info:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.version-backdrop { position: fixed; inset: 0; background: var(--backdrop); backdrop-filter: blur(8px); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; pointer-events: none; }
.version-backdrop.open { opacity: 1; pointer-events: auto; }
.version-dialog { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 420px; max-width: 90vw; transform: scale(.95) translateY(8px); transition: transform .2s; overflow: hidden; }
.version-backdrop.open .version-dialog { transform: scale(1) translateY(0); }
.version-dialog-header { background: var(--bg-tertiary); padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.version-dialog-header h2 { font-size: 1rem; font-weight: 600; margin-bottom: .1rem; }
.version-dialog-header .ver-sub { font-size: .78rem; color: var(--text-muted); }
.version-dialog-body { padding: 1.25rem 1.5rem; }
.version-dialog table { width: 100%; font-size: .85rem; border-collapse: collapse; }
.version-dialog table td { padding: .35rem 0; }
.version-dialog table td:first-child { color: var(--text-muted); width: 40%; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }
.version-dialog table td:last-child { font-weight: 500; }
.version-dialog table tr+tr td { border-top: 1px solid var(--border-subtle); }
.version-dialog .ver-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); text-align: right; }
/* `.ver-close` is the shared "primary close" button used by the
   help-menu dialogs (version + release notes). It was originally
   scoped under `.version-dialog`, but now lives at the top level
   so any sibling dialog (release notes, future entries) can pick
   up the same red-gradient affordance with the same class. */
.ver-close { background: linear-gradient(135deg, var(--brand-charcoal), var(--brand-charcoal-dark)); color: #fff; border: none; padding: .4rem 1.2rem; border-radius: var(--radius-sm); font-size: .78rem; font-weight: 500; cursor: pointer; box-shadow: 0 4px 16px var(--primary-glow); transition: all .15s; }
.ver-close:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--primary-glow); }
.version-dialog .ver-features { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--border-subtle); }
.version-dialog .ver-features h3 { font-size: .7rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .45rem; }
.version-dialog .ver-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.version-dialog .ver-tag { font-size: .7rem; padding: .15rem .5rem; border-radius: var(--radius-sm); font-weight: 500; }
.ver-tag-blue { background: var(--primary-light); color: var(--primary); }
.ver-tag-green { background: var(--success-light); color: var(--success); }
.ver-tag-amber { background: var(--warn-light); color: var(--warn); }
.ver-tag-purple { background: var(--accent-light); color: var(--accent); }
/* Release notes dialog — opened from the help menu ("Release notes"
   entry). Markup is server-rendered from `_RELEASE_NOTES` in `app.py`
   via a Jinja for-loop inside `#releaseNotesDialog`. Shape mirrors
   `.version-dialog` (backdrop + open animation, header/body/footer)
   so the two help-menu dialogs feel like the same family; the body
   is made scrollable here because the release list grows over time. */
.release-notes-backdrop {
  position: fixed; inset: 0;
  background: var(--backdrop); backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s; pointer-events: none;
  padding: 1rem;
}
.release-notes-backdrop.open { opacity: 1; pointer-events: auto; }
.release-notes-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 760px; max-width: 95vw;
  max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: scale(.95) translateY(8px); transition: transform .2s;
}
.release-notes-backdrop.open .release-notes-dialog { transform: scale(1) translateY(0); }
.release-notes-header { background: var(--bg-tertiary); padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.release-notes-header h2 { font-size: 1rem; font-weight: 600; margin-bottom: .1rem; }
.release-notes-header .rn-sub { font-size: .78rem; color: var(--text-muted); margin: 0; }
.release-notes-body { padding: 1.25rem 1.5rem; overflow-y: auto; flex: 1; }
.rn-release + .rn-release { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border-subtle); }
.rn-release-head {
  display: flex; align-items: baseline; gap: .65rem;
  margin-bottom: .65rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--border-subtle);
}
.rn-version { font-family: var(--font-mono); font-size: .9rem; font-weight: 700; color: var(--text-primary); }
.rn-date { font-size: .72rem; color: var(--text-muted); }
.rn-ticket-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
/* Row layout: [type chip] [ticket key] [title]. Flexbox with
   `align-items: flex-start` keeps the chip + key pinned to the top of
   the row so they stay aligned when the title wraps onto multiple
   lines. The title column shrinks (`min-width: 0`) and wraps long
   summaries instead of truncating; the full title is also exposed via
   the `title=` attribute. */
.rn-ticket {
  display: flex; align-items: flex-start; gap: .65rem;
  font-size: .85rem; line-height: 1.4;
  padding: .15rem 0;
}
/* Fixed-width chip column so the ticket keys line up vertically
   across rows regardless of whether a row is `BUG` / `FEATURE` /
   `CHANGE`. Without this, a `BUG` (3 letters) and a `FEATURE`
   (7 letters) push the second column out by different amounts. */
.rn-type {
  flex: 0 0 auto;
  min-width: 4.5rem;
  text-align: center;
  font-size: .65rem; text-transform: uppercase; letter-spacing: .06em;
  padding: .15rem .5rem; border-radius: 999px;
  font-weight: 700; white-space: nowrap;
}
.rn-type-bug { background: var(--danger-light); color: var(--danger-text); }
.rn-type-feature { background: var(--success-light); color: var(--success-text); }
.rn-type-change { background: var(--bg-tertiary); color: var(--text-secondary); }
/* Ticket key — also flex-basis fixed so titles start at the same
   horizontal position across every row. 5.5rem comfortably fits
   up to `PRDC-9999` in the project's monospace size. */
.rn-key {
  flex: 0 0 5.5rem;
  font-family: var(--font-mono); font-weight: 600;
  color: var(--primary); text-decoration: none;
  white-space: nowrap;
}
.rn-key:hover { text-decoration: underline; }
/* Title wraps onto multiple lines so the full summary is always
   readable (no truncation). The `title=` tooltip still mirrors the
   text for quick hover inspection. */
.rn-title {
  flex: 1 1 auto; min-width: 0;
  color: var(--text-secondary);
  white-space: normal; overflow-wrap: anywhere;
}
.rn-empty { font-size: .85rem; color: var(--text-muted); font-style: italic; margin: 0; }
.rn-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); text-align: right; }
main { max-width: 1400px; margin: 0 auto; padding: 1.5rem 2rem; }

/* Phase A rework: Mapping Defaults card moved permanently into the
   Customer / Project drawer; upload dropzone moved permanently into
   the Uploaded Material widget. #topRow no longer hosts any
   user-facing content — it only exists as a transient parking spot
   for the dropZone during renderPreviews() re-renders. Always
   hidden in the layout. */
.top-row { display: none; }

.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 1.4rem 1rem;
  text-align: center; cursor: pointer; position: relative;
  background: linear-gradient(180deg, var(--surface), var(--bg-tertiary));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.upload-zone:hover { border-color: var(--primary); background: linear-gradient(180deg, var(--surface), var(--primary-light)); box-shadow: 0 6px 22px -10px rgba(11,210,197,.25); }
.upload-zone.dragover { border-style: solid; border-color: var(--primary); background: var(--primary-light); transform: scale(1.005); box-shadow: 0 8px 24px -6px rgba(11,210,197,.3); }
/* Phase B: compact upload zone — applied when #dropZone is hosted
   INSIDE the material widget toolbar, next to the extraction actions.
   The hero styling above still applies in the pre-upload empty state
   where #dropZone sits inside #topRow. */
.material-section .upload-zone {
  padding: .45rem 1.1rem;
  flex-direction: row; align-items: center; justify-content: flex-start;
  gap: .7rem; text-align: left;
  margin: 0;
  border-style: dashed;
  box-shadow: none;
  /* Shrink-to-fit: a grow factor here would make the pill split the
     toolbar's free space with .toolbar-spacer and stretch far past
     its label. The floor keeps it a comfortable drop target rather than
     collapsing onto its short label; the cap guards long translations. */
  flex: 0 1 auto;
  min-width: 380px;
  max-width: 460px;
  min-height: 0;
  height: 50px;
  border-width: 2px;
}
.material-section .upload-zone:hover { box-shadow: none; }
.material-section .upload-zone .icon { width: 30px; height: 30px; margin-bottom: 0; flex-shrink: 0; border-radius: 8px; }
.material-section .upload-zone .icon svg { width: 17px; height: 17px; }
.material-section .upload-zone h2 { font-size: .9rem; margin: 0; line-height: 1; white-space: nowrap; }
.material-section .upload-zone p { display: none; }
/* Empty state: no material yet, so the widget is a single upload
   step. Promote the compact pill into a centered hero — plain
   outline glyph, stacked drop / click / formats copy, and an
   explicit select button. Reverts to the compact pill above as soon
   as `is-empty` drops. */
.material-section.is-empty .upload-toolbar { padding-bottom: 1rem; }
.material-section.is-empty .upload-zone {
  /* Spans the full card width rather than a centred 640px column: the
     cap left ~300px of unused white on each side. `max-width` must be
     reset explicitly — the compact pill above caps itself at 320px.
     `main` is capped at 1400px, so this stays bounded on wide monitors. */
  flex: 1 0 100%; width: 100%; max-width: none; margin: .35rem 0 0;
  height: auto; min-height: 178px;
  flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 1.9rem 1.25rem; gap: 0;
  border-style: solid; border-color: var(--border);
  border-radius: var(--radius-lg);
  /* Tinted rather than `--surface`: the hero sits on a white card, so
     matching it left a large flat white area with only a hairline to
     separate the two. */
  background: var(--bg-tertiary);
}
/* The teal tile and the pill's one-line label belong to the compact
   layout; the hero has its own glyph and stacked copy. */
.material-section.is-empty .upload-zone > .icon,
.material-section.is-empty .upload-zone h2 { display: none; }
.material-section.is-empty .upload-zone .uz-hero-icon { display: block; width: 26px; height: 26px; color: var(--text-primary); margin-bottom: .75rem; transition: color .2s ease; }
.material-section.is-empty .upload-zone .uz-hero-title { display: block; font-size: .95rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.material-section.is-empty .upload-zone p { display: block; font-size: .72rem; color: var(--text-muted); margin: .45rem 0 0; }
.material-section.is-empty .upload-zone .uz-hero-btn {
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 1.1rem; padding: .62rem 1.85rem;
  border: none; border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-charcoal), var(--brand-charcoal-dark));
  color: #fff; font: inherit; font-size: .8rem; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 14px rgba(52,57,59,.22);
}
.material-section.is-empty .upload-zone .uz-hero-btn:hover { box-shadow: 0 6px 20px rgba(52,57,59,.3); }
/* The whole panel is the click target, not just the button, so hover
   lights up the entire zone: teal rim, faint teal wash, teal glyph
   and a soft lift. Driven by `--primary` rather than a literal hex so
   dark mode tracks it. The base `.upload-zone` hover/dragover rules
   are less specific than the hero block above, hence the restatement. */
.material-section.is-empty .upload-zone:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  box-shadow: 0 6px 20px -12px var(--primary-glow);
}
.material-section.is-empty .upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.material-section.is-empty .upload-zone:hover .uz-hero-icon,
.material-section.is-empty .upload-zone.dragover .uz-hero-icon { color: var(--primary); }
/* Gated before sign-in: the click does nothing, so it offers nothing. */
.material-section.is-empty .upload-zone.upload-disabled:hover {
  border-color: var(--border); background: var(--bg-tertiary); box-shadow: none;
}
.material-section.is-empty .upload-zone.upload-disabled:hover .uz-hero-icon { color: var(--text-primary); }
.material-section.is-empty .upload-zone.upload-disabled .uz-hero-btn { cursor: not-allowed; }
/* The hero copy says what this bubble said, in place. */
.material-section.is-empty .upload-callout { display: none; }
/* Upload is the only action that applies before material exists, so
   the extraction/mapping row is suppressed until then. Drop the
   `#btnOpenPromptDialog` selector to keep the AI-prompt button
   reachable pre-upload. */
.material-section.is-empty .upload-toolbar > .action-btn-wrap,
.material-section.is-empty .upload-toolbar > .toolbar-status,
.material-section.is-empty .upload-toolbar > .toolbar-spacer,
.material-section.is-empty .upload-toolbar > #btnOpenPromptDialog { display: none; }
.upload-zone .icon {
  width: 44px; height: 44px; margin-bottom: .55rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(11,210,197,.25), inset 0 1px 0 rgba(255,255,255,.18);
}
.upload-zone .icon svg { width: 22px; height: 22px; color: #fff; }
.upload-zone h2 { font-size: .95rem; font-weight: 600; margin-bottom: .15rem; }
.upload-zone p { color: var(--text-muted); font-size: .78rem; }
.upload-zone input[type="file"] { display: none; }
/* Hero-only copy — shown by the `.material-section.is-empty` block. */
.upload-zone .uz-hero-icon,
.upload-zone .uz-hero-title,
.upload-zone .uz-hero-btn { display: none; }
/* Gated upload zone — disabled until an organisation is logged in, to
   stop unauthorized uploads. Neutralises the hover affordances too. */
.upload-zone.upload-disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.45); }
.upload-zone.upload-disabled:hover {
  border-color: var(--border); background: var(--surface);
  box-shadow: none; transform: none;
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; transition: border-color .4s, box-shadow .4s; }

@keyframes card-flash {
  0%   { box-shadow: 0 0 0 0 rgba(11,210,197,.4); border-color: var(--primary); }
  60%  { box-shadow: 0 0 12px 4px var(--primary-glow); border-color: var(--primary); }
  100% { box-shadow: var(--shadow-md); border-color: var(--border); }
}
@keyframes row-highlight {
  0%   { background: var(--primary-light); }
  100% { background: transparent; }
}
.card.flash-update, .attr-accordion.flash-update { animation: card-flash .9s ease-out forwards; }
.card.flash-update .attr-table tr td, .attr-accordion.flash-update .attr-table tr td { animation: row-highlight .7s ease-out forwards; }
.card-header { padding: .65rem 1rem; font-weight: 600; font-size: .82rem; background: linear-gradient(180deg, var(--surface), var(--bg-tertiary)); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .55rem; }
.card-header .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.section-icon {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.6);
}
.section-icon svg { width: 13px; height: 13px; }
.section-icon.amber { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #78350f; }
.section-icon.blue  { background: linear-gradient(135deg, #bfdbfe, #3b82f6); color: #1e3a8a; }
.section-icon.red   { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: var(--on-accent); box-shadow: 0 2px 8px rgba(11,210,197,.25), inset 0 1px 0 rgba(255,255,255,.18); }
.section-icon.teal  { background: linear-gradient(135deg, var(--brand-teal), var(--primary)); color: var(--on-accent); box-shadow: 0 2px 8px rgba(11,210,197,.3), inset 0 1px 0 rgba(255,255,255,.25); }
.card-body { padding: .75rem 1rem; }

.nutrition-table, .allergen-table, .claims-table { width: 100%; border-collapse: collapse; font-size: .75rem; }
.nutrition-table th, .allergen-table th, .claims-table th { text-align: left; padding: .35rem .5rem; background: var(--bg-tertiary); border-bottom: 2px solid var(--border); font-weight: 600; color: var(--text-secondary); font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; }
.nutrition-table td, .allergen-table td, .claims-table td { padding: .3rem .5rem; border-bottom: 1px solid var(--border); }
.nutrition-table tr:last-child td, .allergen-table tr:last-child td { border-bottom: none; }
.nutrition-table input, .allergen-table input, .allergen-table select, .claims-table input, .claims-table select { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .2rem .35rem; font-size: .72rem; background: var(--surface); color: var(--text-primary); }
/* Nutritional components: fixed column widths (via colgroup) + full-width
   inputs so every row lines up linearly regardless of content length. */
.nutrition-table { table-layout: fixed; }
.nutrition-table td { vertical-align: middle; }
.nutrition-table input, .nutrition-table select { width: 100%; box-sizing: border-box; }
.nutrition-table select { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .2rem 1.4rem .2rem .35rem; font-size: .72rem; background: var(--surface); color: var(--text-primary); text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.nut-comp-cell-wrap { display: flex; flex-direction: row; align-items: center; gap: .35rem; min-width: 0; }
.nut-comp-cell-wrap .nut-names-cell { flex: 1 1 55%; min-width: 0; }
.nut-comp-cell-wrap .nut-code { flex: 1 1 45%; min-width: 0; }
/* Component cell is a clean single row: hide the multilingual per-row
   remove-× and language tag so it reads as just name + code. */
.nut-comp-cell-wrap .nut-del-lang, .nut-comp-cell-wrap .nut-lang-tag { display: none; }
.nut-comp-cell-wrap .nut-lang-row { gap: 0; }
.nutrition-table .nut-names-cell { min-width: 0; }
/* Per-row diff highlight on byrd's read-only target table */
.nut-readonly-table tr.nut-row-diff td { background: var(--danger-light); }
/* Green tick on target rows whose value was taken from the app (changed
   from byrd's original) — placed exactly on that row's first cell. */
.nut-readonly-table tr.nut-row-taken td:first-child::before { content: '\2713'; color: var(--success); font-weight: 700; margin-right: .35rem; }
.nut-readonly-table tr.nut-row-taken td { background: var(--success-light); }
/* Aligned Nutri-Score compare table: per-field diff on the target cell */
.ns-cmp-table td.nut-row-diff { background: var(--danger-light); }
.ns-cmp-table td.nut-row-taken { background: var(--success-light); }
.ns-cmp-table td.nut-row-taken::before { content: '\2713'; color: var(--success); font-weight: 700; margin-right: .35rem; }
.ns-cmp-table td, .ns-cmp-table th { border-bottom: 1px solid var(--border-subtle); }
.ns-cmp-table .nutrisc-level, .ns-cmp-table .nutrisc-status, .ns-cmp-table .nuth-ml-val { width: 100%; box-sizing: border-box; }
/* byrd-style chip multi-select (e.g. Ingredient of concern code) */
.ms-field { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.ms-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.ms-chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .12rem .1rem .12rem .45rem; font-size: .78rem; color: var(--text-primary); }
.ms-chip-x { border: none; background: transparent; cursor: pointer; color: var(--text-muted); font-size: 1rem; line-height: 1; padding: 0 .3rem; }
.ms-chip-x:hover { color: var(--danger); }
.ms-add { min-width: 8rem; max-width: 16rem; }
.nutrition-table .indent { padding-left: 1.2rem; color: var(--text-muted); }
.nut-names-cell { display: flex; flex-direction: column; gap: 2px; min-width: 140px; }
.nut-lang-row { display: flex; align-items: center; gap: 3px; }
.nut-lang-tag { font-size: .6rem; font-weight: 700; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); border-radius: 3px; padding: 1px 4px; min-width: 18px; text-align: center; text-transform: uppercase; flex-shrink: 0; }
/* Hidden (but kept in the DOM for the language round-trip) when only one
   language is selected — no point showing a single "DE" badge. */
.nut-lang-tag.is-hidden { display: none; }
.nut-lang-val { flex: 1; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .15rem .3rem; font-size: .7rem; background: var(--surface); color: var(--text-primary); }
.nut-add-lang { border: none; background: none; color: var(--primary); cursor: pointer; font-size: .6rem; padding: 0; margin-top: 1px; }
.nut-add-lang:hover { text-decoration: underline; }
.nut-del-lang { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: .6rem; padding: 0 2px; }
.nut-del-lang:hover { color: var(--danger); }
/* Claim descriptions are full sentences — give the reused multilingual
   cell more room than the (short) nutrient-name cell gets. */
.claims-table .nut-names-cell { min-width: 320px; }
.claims-table .nut-lang-val { font-size: .8rem; }
.btn-add-row { border: none; background: none; color: var(--primary); cursor: pointer; font-size: .72rem; padding: .3rem 0; }
.btn-add-row:hover { text-decoration: underline; }
.btn-del-row { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: .7rem; padding: 0 .2rem; }
.btn-del-row:hover { color: var(--primary); }

.kv-row { display: flex; gap: .35rem; align-items: center; margin-bottom: .4rem; }
.kv-row input { flex: 1; padding: .35rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .78rem; font-family: var(--font-mono); color: var(--text); background: var(--surface); transition: border-color .15s, box-shadow .15s, background .15s; }
.kv-row input::placeholder { color: var(--text-muted); }
.kv-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); background: var(--surface); }
.kv-row input.kv-key { flex: .9; font-weight: 600; color: var(--text); background: var(--bg-tertiary); }
.kv-row input.kv-key:focus { background: var(--surface); }
.kv-row input.kv-value { flex: 1.3; }
.kv-row .kv-arrow { flex-shrink: 0; color: var(--text-muted); font-size: .8rem; user-select: none; line-height: 1; }
.kv-row .btn-remove { flex-shrink: 0; width: 26px; height: 26px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .85rem; transition: all .15s; }
.kv-row .btn-remove:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
.btn-add-row {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .7rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .72rem; font-weight: 600; cursor: pointer;
  color: var(--text-secondary); transition: all .15s;
}
.btn-add-row:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-add-row.is-primary { color: var(--primary); border-color: rgba(11,210,197,.25); background: var(--primary-light); }
.btn-add-row.is-primary:hover { background: var(--primary); color: var(--on-accent); border-color: var(--primary); }
.btn-add-row.is-danger { color: var(--danger); border-color: rgba(220,53,69,.25); background: var(--danger-light); }
.btn-add-row.is-danger:hover { background: var(--danger); color: var(--on-accent); border-color: var(--danger); }
.btn-add-row:disabled { opacity: .45; cursor: not-allowed; }
.btn-add-row svg { width: 12px; height: 12px; }
.kv-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .35rem; }
.kv-toolbar .kv-toolbar-divider { width: 1px; align-self: stretch; background: var(--border); margin: 0 .3rem; }

.sets-bar { display: flex; align-items: center; gap: .3rem; margin-bottom: .6rem; flex-wrap: wrap; }
.sets-bar select { width: 180px; min-width: 0; padding: .28rem 1.6rem .28rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .75rem; font-family: var(--font-mono); color: var(--text); background: var(--bg-tertiary); cursor: pointer; text-overflow: ellipsis; }
.sets-bar select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.sets-bar .btn-set { padding: .24rem .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .68rem; font-weight: 500; cursor: pointer; background: var(--surface); color: var(--text-secondary); white-space: nowrap; transition: all .15s; }
.sets-bar .btn-set:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.sets-bar .btn-set.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-light); }
.sets-bar .btn-set:disabled { opacity: .35; pointer-events: none; }
.sets-bar .active-name { font-size: .65rem; font-weight: 500; color: var(--warn); background: var(--warn-light); padding: .15rem .45rem; border-radius: var(--radius-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

.overlay { display: none; position: fixed; inset: 0; z-index: 1000; background: var(--backdrop); backdrop-filter: blur(8px); align-items: center; justify-content: center; }
.overlay.visible { display: flex; }
.overlay-box { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 2rem 2.5rem; display: flex; flex-direction: column; align-items: center; gap: 1.2rem; min-width: 340px; max-width: 520px; width: auto; text-align: center; }
.overlay-box.error { border-top: 4px solid var(--danger); }
.overlay-box.warning { border-top: 4px solid var(--warn); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.overlay-text { font-size: .9rem; line-height: 1.6; color: var(--text); word-break: break-word; white-space: pre-line; text-align: center; max-height: 60vh; overflow-y: auto; }
.overlay-dismiss { padding: .4rem 1.2rem; background: linear-gradient(135deg, var(--brand-charcoal), var(--brand-charcoal-dark)); border: none; border-radius: var(--radius-sm); font-size: .82rem; font-weight: 500; cursor: pointer; color: white; box-shadow: 0 4px 16px var(--primary-glow); transition: all .15s; }
.overlay-dismiss:hover { transform: translateY(-1px); }
.overlay-cancel { margin-top: .6rem; padding: .4rem 1.4rem; background: transparent; border: 1.5px solid var(--danger); border-radius: var(--radius-sm); font-size: .82rem; font-weight: 600; cursor: pointer; color: var(--danger); transition: all .15s; }
.overlay-cancel:hover { background: var(--danger); color: var(--on-accent); }
.overlay-confirm-row { display: flex; gap: .6rem; margin-top: .2rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.overlay-confirm-row .overlay-cancel { margin-top: 0; }
.overlay-proceed-warn { padding: .4rem 1.2rem; background: linear-gradient(135deg, var(--warn), #d97706); border: none; border-radius: var(--radius-sm); font-size: .82rem; font-weight: 600; cursor: pointer; color: white; box-shadow: 0 4px 16px rgba(245, 158, 11, .35); transition: all .15s; }
.overlay-proceed-warn:hover { transform: translateY(-1px); }

.summary-card { font-size: .82rem; }
.summary-section { margin-bottom: .65rem; }
.summary-section:last-child { margin-bottom: 0; }
.summary-label { font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .25rem; }
.summary-stat { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 5px; font-size: .78rem; font-weight: 500; margin-right: .4rem; margin-bottom: .25rem; }
.stat-ok { background: var(--success-light); color: var(--success); }
.stat-warn { background: var(--warn-light); color: var(--warn); }
.stat-info { background: var(--primary-light); color: var(--primary); }
.summary-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.summary-list li { padding: .15rem .5rem; border-radius: 4px; font-size: .75rem; }
.summary-list li.missing { background: var(--warn-light); color: var(--warn); font-weight: 500; }
.summary-list li.filled { background: var(--success-light); color: var(--success); }
.summary-list li.file-tag { background: var(--primary-light); color: var(--primary); }
.summary-list li.unmapped { background: var(--danger-light); color: var(--danger); }

.lightbox { display: none; position: fixed; inset: 0; z-index: 1100; background: var(--overlay-scrim); backdrop-filter: blur(8px); align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox.visible { display: flex; }
/* PRDC-36: give the wrap a definite viewport-sized box and let the image
   scale to FILL it (object-fit: contain preserves aspect ratio, upscaling
   smaller images and downscaling larger ones) so a material preview uses
   the available space instead of sitting small in a large empty modal. */
.lightbox .lb-img-wrap { position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; width: 96vw; height: 94vh; cursor: grab; }
.lightbox .lb-img-wrap.dragging { cursor: grabbing; }
.lightbox .lb-img-wrap img { object-fit: contain; transform-origin: center center; transition: transform .15s ease; pointer-events: none; user-select: none; width: 100%; height: 100%; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: none; border-radius: 50%; background: rgba(255,255,255,.85); color: #333; font-size: 1.4rem; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.3); transition: background .15s, transform .15s; z-index: 1101; }
.lightbox-nav:hover { background: #fff; transform: translateY(-50%) scale(1.1); }
.lightbox-nav.prev { left: 12px; }
.lightbox-nav.next { right: 12px; }
.lightbox-zoom { position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; z-index: 1101; background: rgba(0,0,0,.55); border-radius: 20px; padding: 4px 6px; }
.lightbox-zoom button { width: 34px; height: 34px; border: none; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.lightbox-zoom button:hover { background: rgba(255,255,255,.35); }
.lightbox-zoom .lb-zoom-level { color: #fff; font-size: .72rem; min-width: 40px; text-align: center; line-height: 34px; user-select: none; opacity: .8; }
.lightbox-info { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: #fff; font-size: .82rem; text-align: center; text-shadow: 0 1px 4px rgba(0,0,0,.6); pointer-events: none; max-width: 80vw; }
.lightbox-info .lb-counter { font-size: .72rem; opacity: .75; margin-top: .2rem; }
.lightbox-close { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border: none; border-radius: 50%; background: rgba(255,255,255,.9); color: #333; font-size: 1.3rem; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.3); z-index: 1101; }

.results { display: none; flex-direction: column; gap: 1.25rem; }
.results.visible { display: flex; }

.gtin-tab-bar { display: none; padding: .5rem 0; gap: .4rem; flex-wrap: wrap; align-items: center; }
.gtin-tab-bar.visible { display: flex; }
.gtin-tab-bar .gtin-tab-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); margin-right: .25rem; }
.gtin-tab-bar .gtin-tab { padding: .35rem .75rem; font-size: .78rem; font-weight: 500; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: all .15s; display: flex; align-items: center; gap: .35rem; }
.gtin-tab-bar .gtin-tab:hover { border-color: var(--accent-blue); background: var(--accent-blue-light); }
/* QW-2: active GTIN tab uses the calm blue accent, not brand red. */
.gtin-tab-bar .gtin-tab.active { background: var(--accent-blue); color: var(--on-accent); border-color: var(--accent-blue); }
.gtin-tab-bar .gtin-tab .gtin-tab-count { font-size: .65rem; background: var(--tint-strong); padding: .1rem .35rem; border-radius: 8px; }
.gtin-tab-bar .gtin-tab.active .gtin-tab-count { background: var(--on-accent-wash); }
/* BAYARD §6 floating chrome: the section is a transparent layout
   container; the title + toolbar live in their own floating card
   (.ms-toolbar-card) and the material list gets its own card below,
   separated by a gap that reveals the background photo. */
.material-section { background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
/* overflow must stay visible so the Run/Map/upload speech-bubble
   callouts can escape below the card instead of being clipped. The
   title rounds its own top corners since the card no longer clips. */
.ms-toolbar-card { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); box-shadow: var(--shadow-md); overflow: visible; }
.ms-toolbar-card .material-section-title { border-radius: var(--radius) var(--radius) 0 0; }
.material-section-body { padding: .85rem 1rem 1rem !important; min-height: 60px !important; }
.material-section .material-section-title { padding: .65rem 1rem; font-weight: 600; font-size: .82rem; background: linear-gradient(180deg, var(--surface), var(--bg-tertiary)); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .55rem; }
.material-section.is-collapsed .material-section-title { border-bottom: 0; }
.material-section.is-collapsed .upload-zone,
.material-section.is-collapsed .upload-toolbar,
.material-section.is-collapsed .mapping-stale-hint,
.material-section.is-collapsed .material-section-body { display: none; }
.material-title-main { display: inline-flex; align-items: center; gap: .55rem; min-width: 0; }
/* Rendered only while the widget is the pre-upload step (see
   `uploadStepOnly` in renderPreviews). */
.material-title-main .step-badge {
  font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-secondary); background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle); border-radius: 6px;
  padding: .12rem .45rem; flex-shrink: 0;
}
.material-collapse-summary { margin-left: auto; color: var(--text-muted); font-size: .72rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Disclosure-triangle treatment shared by the material-widget
   header toggle AND the per-layered-PDF caret toggle. The chevron
   points RIGHT in the collapsed/closed state and rotates 90deg to
   DOWN when expanded — driven entirely off `aria-expanded="true"`
   so any button using the `.caret-icon` SVG animates identically.
   Putting the rule on the generic attribute selector instead of a
   button-specific class is what keeps the two toggles visually in
   sync (same icon, same animation, same resting direction). */
[aria-expanded] .caret-icon { width: 14px; height: 14px; display: block; transition: transform .18s ease; transform: rotate(0deg); }
[aria-expanded="true"] .caret-icon { transform: rotate(90deg); }
/* Matches the per-layered-PDF `.layer-collapse-toggle` exactly so
   the widget header chevron and the PDF-layers chevron read as the
   same affordance. Square 22×22, 6px radius, soft accent-blue hover
   — see `.material-item.is-layer-parent .layer-collapse-toggle`
   below for the sibling rule. */
.material-collapse-toggle { width: 22px; height: 22px; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); border-radius: 6px; padding: 0; line-height: 1; cursor: pointer; flex-shrink: 0; transition: background .12s, border-color .12s, color .12s; display: inline-flex; align-items: center; justify-content: center; }
.material-collapse-toggle:hover { background: var(--accent-blue-light); border-color: var(--accent-blue); color: var(--accent-blue); }
.material-section .material-section-title .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.material-section-body { padding: 1rem 1.25rem 1.25rem; min-height: 80px; }
/* BAYARD §6: material list is its own floating card. The gap only has
   to clear the Run/Map/upload speech-bubble callouts that float below
   the toolbar card, so they sit in the gap (over the photo) instead of
   overlapping this card. Sized against the tallest bubble plus the 3px
   the bob animation adds — was 3rem, which left ~29px of dead space. */
.material-section-body { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); box-shadow: var(--shadow-md); margin-top: 1rem; }
/* No files yet → the list card is empty (the dropzone is in the toolbar
   card), so hide it until material is uploaded. */
.material-section.is-empty .material-section-body { display: none; }
.material-section .section-label { font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .5rem; }

/* Material widget — list-only layout. Each row reads left-to-right:
   drag handle · remove · preview (image / PDF / file icon) ·
   filename + status row (filename above, status pill / counts below) ·
   primary toggle · include toggle. */
.material-grid { display: flex; flex-direction: column; gap: .3rem; align-content: start; }
.material-grid.list-view { gap: .3rem; }
.material-item {
  position: relative; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
  display: flex; align-items: center; gap: .55rem;
  padding: .35rem .55rem .35rem .25rem; text-align: left;
  transition: border-color .15s, box-shadow .15s, background .15s, opacity .12s, transform .12s;
}
.material-item:hover { border-color: var(--accent-blue); box-shadow: 0 1px 4px rgba(15,23,42,.05); }
/* Drag handle — only meaningful on top-level rows (not layer children) */
.material-item .mat-drag {
  width: 16px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); opacity: .35;
  cursor: grab; user-select: none; touch-action: none;
  transition: opacity .15s, color .15s;
}
.material-item:hover .mat-drag { opacity: .85; color: var(--text-secondary); }
.material-item .mat-drag:active { cursor: grabbing; }
.material-item .mat-drag svg { width: 12px; height: 16px; }
.material-item.is-dragging { opacity: .35; transform: scale(.99); }
.material-item.drop-before { box-shadow: inset 0 2px 0 var(--accent-blue); }
.material-item.drop-after  { box-shadow: inset 0 -2px 0 var(--accent-blue); }
.material-item img.mat-thumb { width: 44px; height: 44px; aspect-ratio: 1; flex-shrink: 0; border-radius: var(--radius-sm); object-fit: cover; cursor: zoom-in; background: var(--bg-tertiary); }
.material-item .mat-file-icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; flex-shrink: 0; color: var(--primary); border-radius: var(--radius-sm); background: var(--primary-light); border: 1px solid rgba(11,210,197,.12); transition: background .15s, color .15s, border-color .15s; }
.material-item .mat-file-icon.is-clickable { cursor: pointer; }
.material-item .mat-file-icon.is-clickable:hover { background: var(--primary); color: var(--on-accent); border-color: var(--primary); }
.material-item .mat-file-icon svg { width: 22px; height: 22px; }
/* Remove button — sits at the END of the row (after every other
   control) and is rendered as a borderless ghost icon button so it
   blends in until hovered. Uses the same circular-on-hover treatment
   as other inline icon-only verbs in the queue panel. */
.material-item .btn-remove-mat {
  flex-shrink: 0;
  width: 26px; height: 26px;
  margin-left: .15rem;
  padding: 0;
  border: 1px solid transparent; border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s, border-color .12s;
}
.material-item .btn-remove-mat:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
.material-item .btn-remove-mat:disabled { display: none; }
.material-item .btn-remove-mat svg { width: 14px; height: 14px; }
.material-section.needs-extraction .ms-toolbar-card { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow-md); }
.material-section.needs-extraction .material-section-title { background: linear-gradient(180deg, var(--primary-light), var(--surface)); }
.material-item.needs-extraction { border-color: rgba(11,210,197,.45); background: linear-gradient(90deg, var(--primary-light), var(--surface)); }
@keyframes pulse-extraction-needed { 0%,100% { box-shadow: 0 0 0 3px var(--primary-glow); } 50% { box-shadow: 0 0 0 7px var(--primary-light); } }

/* Upload-section rework — per-tile controls. The tile is now a
   single flex row (see .material-item above). Filename + status
   pill stack vertically in the middle, controls float to the
   right. */
.material-item .mat-name { flex: 1 1 auto; min-width: 0; font-size: .82rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.material-item.is-disabled { opacity: .6; }
.material-item.is-disabled img, .material-item.is-disabled .mat-file-icon { filter: grayscale(.6); }
/* `.mat-body` now holds *only* the filename (and the optional
   per-row error line). The badges (`.mat-meta`) were moved out so
   they sit on the right side of the row as a sibling of
   `.mat-controls`, vertically centered with the Primary / Include
   toggles. This keeps every row type — top-level item, layer
   parent, layer child — using the same one-line column order:
     [drag] [thumb] [name…] [badges] [controls] [trash]. */
.material-item .mat-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.material-item .mat-meta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .3rem;
  font-size: .68rem; color: var(--text-muted);
  padding: 0; background: none; border: none;
  /* Don't let a long filename squeeze the badges to a single column
     — keep them on one line whenever possible. `margin-left: auto`
     is a no-op when `.mat-body` is already eating the slack, but
     it makes the right-clustering explicit and survives layouts
     where `.mat-body` is absent (e.g. layer-children rows). */
  flex-shrink: 0; margin-left: auto;
}
.material-item .mat-status { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem; border-radius: 999px; font-size: .65rem; font-weight: 600; text-transform: none; letter-spacing: 0; line-height: 1.3; }
.material-item .mat-status.queued    { background: var(--tint-strong); color: var(--neutral-text); }
.material-item .mat-status.inspecting{ background: var(--info-light);  color: var(--info-text); }
.material-item .mat-status.processing{ background: var(--warn-light);  color: var(--warn-text); }
.material-item .mat-status.done      { background: var(--success-light);   color: var(--success-text); }
.material-item .mat-status.stale     { background: rgba(11,210,197,.14);    color: var(--primary); }
.material-item .mat-status.error     { background: var(--danger-light);   color: var(--danger-text); }
.material-item .mat-status.skipped   { background: var(--tint-soft);  color: var(--text-secondary); }
.material-item .mat-status.layer-off { background: var(--tint-soft);  color: var(--text-secondary); }
.material-item .mat-status .mini-spin { width: 8px; height: 8px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.9s linear infinite; }
/* Red stop button shown just before the "Extracting" pill — aborts the
   in-flight extraction and halts the batch. */
.material-item .mat-stop-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-right: .35rem; padding: 0;
  border: none; border-radius: 50%; background: var(--danger); color: var(--on-accent);
  cursor: pointer; vertical-align: middle; flex-shrink: 0;
  transition: background .15s ease, transform .1s ease;
}
.material-item .mat-stop-btn:hover { background: var(--danger-text); }
.material-item .mat-stop-btn:active { transform: scale(.92); }
.material-item .mat-stop-btn svg { width: 13px; height: 13px; }
.material-item.is-layer-child .mat-stop-btn { width: 16px; height: 16px; }
.material-item.is-layer-child .mat-stop-btn svg { width: 11px; height: 11px; }
.material-item .mat-extracted, .material-item .mat-used { display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .5rem; border-radius: 999px; font-size: .65rem; font-weight: 500; background: var(--tint-strong); color: var(--text-secondary); }
.material-item .mat-extracted.can-open { cursor: pointer; border: 1px solid transparent; }
.material-item .mat-extracted.can-open:hover { background: var(--accent-blue-light); color: var(--accent-blue); border-color: var(--accent-blue); }
.material-item .mat-used.is-used { background: var(--success-light); color: var(--success-text); }
.material-item .mat-used.is-used::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.material-item .mat-used.is-unused { color: var(--text-muted); }
/* Right-side control cluster (Primary source + Include on image &
   layer-child rows; All / None + collapse toggle on layer-parent
   rows). Both clusters share the same `min-width` and right-align
   their contents (`justify-content: flex-end`) so the badge column
   (`.mat-meta`, which sits immediately to the left of `.mat-controls`)
   lines up vertically across EVERY row type — top-level image,
   layered-PDF parent, and layered-PDF child. Without the min-width,
   the natural width of the inner labels differs (Primary+Include is
   wider than All+None+chevron, and the .66rem layer-child font is
   narrower than the .72rem top-level font), which previously made
   badges and toggles drift left/right depending on row type. */
.material-item .mat-controls { display: flex; align-items: center; justify-content: flex-end; gap: .55rem; padding: 0; background: none; border: none; font-size: .75rem; color: var(--text-secondary); flex-shrink: 0; min-width: 210px; }
/* Invisible spacer that reserves the same column width as the
   row-trailing trash button (`.btn-remove-mat`) — used on
   layer-child rows so their Primary / Include cluster lines up
   horizontally with the same cluster on top-level image rows
   (which DO have a real trash button at the far right). Matches
   the trash button's box exactly: 26×26 + the same .15rem left
   margin used by `.btn-remove-mat`. */
.material-item .mat-trash-placeholder { flex-shrink: 0; width: 26px; height: 26px; margin-left: .15rem; visibility: hidden; }
.material-item .mat-primary-radio, .material-item .mat-enable-toggle { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; user-select: none; padding: .2rem .5rem; border: 1px solid var(--border); border-radius: 999px; font-size: .72rem; font-weight: 500; color: var(--text-secondary); transition: background .15s, border-color .15s, color .15s; }
.material-item .mat-primary-radio:hover:not(.disabled), .material-item .mat-enable-toggle:hover:not(.disabled) { border-color: var(--accent-blue); color: var(--accent-blue); }
.material-item .mat-primary-radio input, .material-item .mat-enable-toggle input { accent-color: var(--primary); margin: 0; cursor: pointer; }
.material-item .mat-primary-radio.disabled, .material-item .mat-enable-toggle.disabled { cursor: not-allowed; opacity: .5; border-color: var(--border); color: var(--text-muted); }
.material-item .mat-primary-radio.is-primary { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.material-item .mat-error { display: block; width: 100%; flex-basis: 100%; padding: .25rem 0 0; color: var(--danger-text); font-size: .68rem; }
/* Layered-PDF parent tile and child stack. */
.material-item.is-layer-parent {
  background: var(--bg-tertiary);
  flex-wrap: wrap; row-gap: .25rem;
}
.material-item.is-layer-parent .layer-bulk { display: inline-flex; gap: .2rem; flex-shrink: 0; }
.material-item.is-layer-parent .layer-bulk button { border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); padding: 0 .4rem; font-size: .62rem; border-radius: 6px; cursor: pointer; height: 20px; }
.material-item.is-layer-parent .layer-bulk button:hover { color: var(--primary); border-color: var(--primary); }
/* Multi-sheet Excel parent controls: the separate/merge toggle and
   the "add sheets to queue" action. Sit alongside the bulk + collapse
   controls; flex-basis 100% pushes them to their own line under the
   parent row so they don't crowd the badge column. */
.material-item.is-layer-parent .excel-sheet-mode {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .68rem; color: var(--text-secondary); cursor: pointer;
  user-select: none; flex-shrink: 0; margin-left: .4rem;
}
.material-item.is-layer-parent .excel-sheet-mode input { cursor: pointer; }
.material-item.is-layer-parent .excel-queue-sheets {
  border: 1px solid var(--accent-blue, var(--primary));
  background: transparent; color: var(--accent-blue, var(--primary));
  padding: 0 .55rem; height: 22px; font-size: .66rem; font-weight: 600;
  border-radius: 6px; cursor: pointer; flex-shrink: 0; margin-left: .4rem;
  transition: background .12s, color .12s;
}
.material-item.is-layer-parent .excel-queue-sheets:hover {
  background: var(--accent-blue, var(--primary)); color: var(--on-accent);
}
/* Merge/separate recommendation chip. Wraps to its own full-width line
   under the parent row (flex-basis 100%) so the detection message + the
   one-click apply button never crowd the badge column. The data-reco
   attribute tints the chip (merge = info-blue, separate = neutral). */
.material-item.is-layer-parent .excel-reco {
  flex-basis: 100%; display: flex; align-items: center; gap: .5rem;
  margin-top: .35rem; padding: .35rem .55rem; border-radius: 6px;
  font-size: .68rem; line-height: 1.3;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-secondary);
}
.material-item.is-layer-parent .excel-reco[data-reco="merge"] {
  background: var(--accent-blue-light, var(--primary-light));
  border-color: var(--accent-blue, var(--primary));
  color: var(--accent-blue, var(--primary));
}
.material-item.is-layer-parent .excel-reco-msg { flex: 1 1 auto; }
.material-item.is-layer-parent .excel-reco-apply {
  flex-shrink: 0; border: 1px solid var(--accent-blue, var(--primary));
  background: var(--surface); color: var(--accent-blue, var(--primary));
  padding: 0 .55rem; height: 22px; font-size: .66rem; font-weight: 600;
  border-radius: 6px; cursor: pointer; transition: background .12s, color .12s;
}
.material-item.is-layer-parent .excel-reco-apply:hover {
  background: var(--accent-blue, var(--primary)); color: var(--on-accent);
}
.material-item.is-layer-parent .excel-reco-applied {
  flex-shrink: 0; font-size: .64rem; font-style: italic; opacity: .7;
}
.material-item.is-layer-parent .layer-collapse-toggle {
  width: 22px; height: 22px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); border-radius: 6px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .12s, color .12s, border-color .12s;
}
.material-item.is-layer-parent .layer-collapse-toggle:hover {
  background: var(--accent-blue-light); color: var(--accent-blue); border-color: var(--accent-blue);
}
/* The chevron rotation is owned by the generic `[aria-expanded]`
   rule near the top of the stylesheet — see comment there. Down
   here we only need to keep the button shape (rounded 22×22 square
   to fit the layer row's tighter vertical rhythm). */
.material-item.is-layer-parent .layer-children {
  flex: 1 1 100%; display: flex; flex-direction: column; gap: .2rem;
  /* Left padding indents child rows so each child's preview icon
     left-edge aligns with the parent's preview icon left-edge.
     Parent icon offset (from material-item outer left) =
       parent_padding_left (.25rem) + drag-handle (1rem)
       + parent_gap (.55rem) = 1.8rem.
     Child icon offset = parent_padding_left (.25rem) +
       layer-children_padding_left + child_padding_left (.35rem).
     Solving for layer-children_padding_left = 1.2rem aligns the
     left-edges of every preview icon in the column.
     Note: child's flex `gap` between icon and the next item is the
     child's own concern; we only need icon left-edges to line up.
     Right side: negative `margin-right` cancels out the layer-parent's
     own .55rem right padding so that the layer-children container
     stretches to the same right boundary as a top-level image row.
     Combined with the matching `padding-right: .55rem` on
     `.material-item.is-layer-child` and the trash-button placeholder
     in `_renderLayerChild`, the badges + Primary + Include columns
     line up VERTICALLY between top-level image rows and indented
     layer-child rows. */
  padding: .4rem 0 0 1.2rem;
  margin-right: -.55rem;
  border-top: 1px dashed var(--border);
  margin-top: .25rem;
}
.material-item.is-layer-parent.collapsed .layer-children { display: none; }
.material-item.is-layer-child {
  background: var(--surface); border: 1px solid var(--border);
  /* Right padding matches the .55rem padding used on top-level
     `.material-item` rows so the trash placeholder + Primary /
     Include cluster ends at the same offset from the row's right
     border as on an image row. */
  border-radius: var(--radius-sm); padding: .25rem .55rem .25rem .35rem;
  display: flex; align-items: center; gap: .5rem;
  font-size: .72rem; flex-direction: row;
}
.material-item.is-layer-child .mat-file-icon { width: 28px; height: 28px; }
.material-item.is-layer-child .mat-file-icon svg { width: 14px; height: 14px; }
.material-item.is-layer-child .layer-name { flex: 1 1 auto; min-width: 0; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.material-item.is-layer-child .mat-status { font-size: .6rem; padding: .08rem .4rem; }
.material-item.is-layer-child .mat-extracted { font-size: .6rem; padding: .08rem .4rem; }
.material-item.is-layer-child.is-disabled { opacity: .55; }
/* Layer child reuses the same "primary radio + include toggle" cluster as
   the standalone material rows so the controls live in the same place. */
.material-item.is-layer-child .mat-controls { gap: .35rem; }
.material-item.is-layer-child .mat-primary-radio,
.material-item.is-layer-child .mat-enable-toggle { font-size: .66rem; padding: .12rem .4rem; }

/* Upload-section toolbar with Run extraction / Map Data action buttons.
   Rendered transparently — the surrounding material widget already
   provides a card frame, so adding a second light-gray box around
   the toolbar created visual noise around the buttons. The
   horizontal padding mirrors `.material-section-title` (1rem) so
   the buttons + dropzone share the same left/right gutters as the
   widget header and the material list, instead of touching the
   widget edges. */
.upload-toolbar { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; padding: .75rem 1rem .35rem; background: transparent; border: 0; border-radius: 0; margin: 0 0 .35rem; box-shadow: none; }
.upload-toolbar .toolbar-status { font-size: .72rem; color: var(--text-secondary); display: inline-flex; align-items: center; gap: .35rem; min-width: 110px; }
.upload-toolbar .toolbar-status .mini-spin { width: 10px; height: 10px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.9s linear infinite; }
.upload-toolbar .toolbar-spacer { flex: 1; }
.upload-toolbar .toolbar-btn { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); font-size: .76rem; font-weight: 600; cursor: pointer; transition: background .12s, border-color .12s, color .12s, box-shadow .12s; }
.upload-toolbar .toolbar-btn:hover:not(:disabled) { background: var(--bg-tertiary); }
.upload-toolbar .toolbar-btn:disabled { opacity: .45; cursor: not-allowed; }
.upload-toolbar .toolbar-btn.primary { background: linear-gradient(135deg, var(--brand-charcoal), var(--brand-charcoal-dark)); border-color: var(--brand-charcoal); color: #fff; box-shadow: 0 4px 14px rgba(52,57,59,.22); }
.upload-toolbar .toolbar-btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--brand-charcoal), var(--brand-charcoal-dark)); box-shadow: 0 6px 20px rgba(11,210,197,.30); }
.upload-toolbar .toolbar-btn.has-pending { box-shadow: 0 0 0 3px var(--primary-glow); }
.upload-toolbar .toolbar-btn.needs-extraction { animation: pulse-extraction-needed 1.6s ease-in-out infinite; }
.upload-toolbar .toolbar-btn .pending-badge { background: var(--tint-strong); color: inherit; font-size: .62rem; padding: .04rem .35rem; border-radius: 999px; line-height: 1.4; }
.upload-toolbar .toolbar-btn.primary .pending-badge { background: rgba(255,255,255,.25); color: #fff; }
.upload-toolbar .toolbar-btn.has-prompt { border-color: var(--accent-blue); color: var(--accent-blue); background: var(--accent-blue-light); }
.upload-toolbar .toolbar-btn .prompt-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-blue); display: inline-block; }

/* Toolbar speech-bubble callouts — a generic component used by both
   the "Run extraction" and "Map Data" buttons to nudge the user
   toward the next click. Drawn in the brand red so it stands out
   against the otherwise quiet toolbar, with a gentle bobbing
   animation drawing the eye to the action button.

   The wrapper (`.action-btn-wrap`) is the positioning context; the
   bubble (`.action-callout`) is absolutely positioned below it and
   uses a CSS-triangle ::before for the speech tail pointing UP at
   the button.

   Only one callout is shown at a time (whichever step is next):
   Run extraction wins while material is pending extraction; once
   extracted, the Map Data callout takes over. See
   `_refreshActionButtons` for the mutual-exclusion logic. */
.action-btn-wrap { position: relative; display: inline-flex; }
.action-callout {
  position: absolute;
  /* Tucked close under the button so the bubble doesn't force a wide
     gap between the toolbar card and the material list below it. */
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .01em;
  padding: .4rem .7rem;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 8px 22px -8px rgba(11, 210, 197, .55), 0 1px 0 rgba(255,255,255,.18) inset;
  z-index: 6;
  /* Bubble is clickable (the user dismisses it by clicking on it),
     but only while it's `.visible` — see the rule below. When
     hidden we restore `pointer-events: none` so it doesn't swallow
     clicks meant for the toolbar behind it. */
  pointer-events: none;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease;
}
.action-callout.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: action-callout-bob 1.6s ease-in-out infinite;
}
.action-callout.visible:hover { filter: brightness(1.05); }
.action-callout.visible:active { filter: brightness(.92); }
.action-callout::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border: 6px solid transparent;
  border-bottom-color: var(--primary);
  filter: drop-shadow(0 -1px 0 rgba(11,210,197,.25));
}
@keyframes action-callout-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(3px); }
}

/* "Add to Queue" callout variant — added 2026-05-28. Lives on the
   far-right Add-to-Queue button inside the sticky mapping
   toolbar. The base `.action-callout` centers itself horizontally
   under the button, which would push half the bubble off the
   right edge of the viewport on narrow windows. This override
   right-anchors the bubble to the button so it can stretch left
   without overflow, and moves the triangle tail to align with
   the button center even though the bubble itself is offset. */
.action-callout.add-to-queue-callout {
  /* Sit ABOVE the toolbar, shifted LEFT so the bubble floats over the
     "Start new article" button area instead of the cramped space above
     "Add to Queue". This clears the collapse chevron (top-right) and the
     article content (below), and is wide enough to read on a couple of
     lines. The tail points down at the right toward the buttons. */
  left: auto;
  right: calc(100% - 72px);
  top: auto;
  bottom: calc(100% + 8px);
  transform: none;
  width: max-content;
  max-width: min(230px, 70vw);
  white-space: normal;
  text-align: center;
}
.action-callout.add-to-queue-callout::before {
  /* Tail near the bubble's bottom-right, pointing DOWN at the buttons. */
  left: auto;
  right: 18px;
  bottom: auto;
  top: 100%;
  border-bottom-color: transparent;
  border-top-color: var(--primary);
  filter: drop-shadow(0 1px 0 rgba(11,210,197,.25));
  transform: none;
}
.action-callout.add-to-queue-callout.visible {
  animation: action-callout-bob-static 1.6s ease-in-out infinite;
}
/* The base `action-callout-bob` keyframe re-applies the
   `translateX(-50%)` centering — incompatible with the
   right-anchored variant. Use a translate-Y-only animation
   instead so the bubble bobs in place without snapping back to
   the centered position mid-frame. */
@keyframes action-callout-bob-static {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(3px); }
}

/* "Not logged in" callout variant — added 2026-05-28. Lives below
   the Customer / Project drawer trigger (the building-icon
   button) in the page header on the far-right edge of the
   viewport. Same right-anchored treatment as the Add-to-Queue
   bubble so it can't overflow the right edge — but the trigger
   button is much smaller (34×34 circular), so the tail centers
   under the building icon (~17px from the right edge of the
   wrap). High z-index to escape the sticky header that hosts the
   button (`header { z-index: 100 }`). */
.action-callout.org-login-callout {
  left: auto;
  right: 0;
  transform: none;
  /* Widened 2026-05-28 (`min(320px, 80vw)` → `min(420px, 86vw)`)
     at user request so the message reads on one line without
     awkward wraps mid-sentence. */
  min-width: 320px;
  max-width: min(420px, 86vw);
  white-space: normal;
  text-align: center;
  z-index: 110;
}
.action-callout.org-login-callout::before {
  left: auto;
  right: 11px;   /* aligns with the centre of the 34px circular trigger */
  transform: none;
}
.action-callout.org-login-callout.visible {
  animation: action-callout-bob-static 1.6s ease-in-out infinite;
}
/* Empty-state drop hint. The compact dropzone is narrower than this
   bubble and sits at the far left of the toolbar, so the base
   centering would hang it past the left edge of .ms-toolbar-card
   (which is `overflow: visible`). Left-anchor it and point the tail
   at the pill's upload icon instead. Scoped to .material-section so
   the hero styling in #topRow keeps the centered treatment. */
.material-section .upload-zone .upload-callout { left: 0; transform: none; }
.material-section .upload-zone .upload-callout::before { left: 22px; transform: none; }
.material-section .upload-zone .upload-callout.visible {
  animation: action-callout-bob-static 1.6s ease-in-out infinite;
}
/* Same horizontal gutter as `.upload-toolbar` so the dashed pill
   and the toolbar above it share the same left/right edges and
   don't touch the widget border. */
.mapping-stale-hint { font-size: .7rem; color: var(--text-secondary); padding: .35rem .75rem; background: var(--bg-tertiary); border: 1px dashed var(--border); border-radius: var(--radius); margin: 0 1rem .55rem; display: flex; align-items: center; gap: .35rem; }
.mapping-stale-hint.has-pending { border-style: solid; color: var(--primary); }
.mapping-stale-hint.needs-extraction { border-style: solid; border-color: var(--primary); color: var(--primary); background: var(--primary-light); font-weight: 600; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.raw-dialog-backdrop { position: fixed; inset: 0; background: var(--backdrop); backdrop-filter: blur(4px); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.raw-dialog { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(820px, 94vw); max-height: 88vh; display: flex; flex-direction: column; }
/* Floating (non-modal) variant. The wrapper stops being a backdrop and
   becomes a transparent, click-through layer, so only the panel takes
   input and the editor underneath stays usable while the window is open.
   Set by _makeDialogFloating(); the dialogs that keep the modal shell
   (raw JSON viewer, CIC) never get this class. */
.raw-dialog-backdrop.floating {
  display: block; background: none; backdrop-filter: none; pointer-events: none;
}
.raw-dialog-backdrop.floating > .raw-dialog {
  pointer-events: auto;
  position: fixed;                 /* left/top written by the helper */
  min-width: 360px; min-height: 200px;
  /* Taller than the modal's 88vh, but still bounded: a window dragged
     past the bottom of the screen takes its resize grip with it, and
     there would be no way left to shrink it again. */
  max-width: 96vw; max-height: 96vh;
  border: 1px solid var(--border);
}
/* Only ever present while the helper is moving the window out of the way
   of a jumped-to attribute. During a drag or resize the geometry is
   rewritten on every pointer move, and a transition there would make the
   window trail the cursor. */
.raw-dialog-backdrop.floating > .raw-dialog.repositioning {
  transition: left .18s ease, top .18s ease, height .18s ease;
}
.raw-dialog-backdrop.floating .raw-dialog-header { cursor: move; user-select: none; }
.raw-dialog-backdrop.floating .raw-dialog-header .raw-icon-btn { cursor: pointer; }
/* Resize handles. CSS `resize: both` was the obvious route but it needs
   `overflow: hidden` on the panel and puts its grip inside the padding
   box — right on top of the body's scrollbar, reachable only from one
   corner. These sit just OUTSIDE the panel edge instead, so every side
   can be dragged and nothing overlaps the content. */
.raw-dialog-backdrop.floating > .raw-dialog > .raw-resize-handle {
  position: absolute; z-index: 3;
}
.raw-resize-handle[data-dir="n"] { top: -4px; left: 14px; right: 14px; height: 8px; cursor: ns-resize; }
.raw-resize-handle[data-dir="s"] { bottom: -4px; left: 14px; right: 14px; height: 8px; cursor: ns-resize; }
.raw-resize-handle[data-dir="w"] { left: -4px; top: 14px; bottom: 14px; width: 8px; cursor: ew-resize; }
.raw-resize-handle[data-dir="e"] { right: -4px; top: 14px; bottom: 14px; width: 8px; cursor: ew-resize; }
.raw-resize-handle[data-dir="nw"] { top: -4px; left: -4px; width: 18px; height: 18px; cursor: nwse-resize; }
.raw-resize-handle[data-dir="ne"] { top: -4px; right: -4px; width: 18px; height: 18px; cursor: nesw-resize; }
.raw-resize-handle[data-dir="sw"] { bottom: -4px; left: -4px; width: 18px; height: 18px; cursor: nesw-resize; }
.raw-resize-handle[data-dir="se"] { bottom: -4px; right: -4px; width: 18px; height: 18px; cursor: nwse-resize; }
/* Visible grip so the window reads as resizable without hunting for it. */
.raw-dialog-backdrop.floating > .raw-dialog::after {
  content: ''; position: absolute; right: 3px; bottom: 3px; width: 11px; height: 11px;
  pointer-events: none; opacity: .55;
  background: repeating-linear-gradient(-45deg, var(--text-muted) 0 1px, transparent 1px 3px);
}
/* Phones have no room to float anything — fall back to the modal layout. */
@media (max-width: 800px) {
  .raw-dialog-backdrop.floating { display: flex; pointer-events: auto; background: var(--backdrop); backdrop-filter: blur(4px); }
  .raw-dialog-backdrop.floating > .raw-dialog { position: static; max-height: 88vh; width: min(820px, 94vw); }
  .raw-dialog-backdrop.floating > .raw-dialog > .raw-resize-handle,
  .raw-dialog-backdrop.floating > .raw-dialog::after { display: none; }
}
.raw-dialog-header { padding: .55rem .85rem; font-weight: 600; font-size: .82rem; background: var(--bg-tertiary); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .5rem; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.raw-dialog-header .raw-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.raw-dialog-header .raw-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  padding: 0; line-height: 1; font-size: .9rem;
  flex-shrink: 0;
}
.raw-dialog-header .raw-icon-btn:hover { background: var(--accent-blue-light); color: var(--accent-blue); border-color: var(--accent-blue); }
.raw-dialog-header .raw-icon-btn.raw-close { color: var(--text-muted); border-color: transparent; background: transparent; font-size: 1.2rem; }
.raw-dialog-header .raw-icon-btn.raw-close:hover { background: var(--bg-tertiary); color: var(--text); border-color: var(--border); }
.raw-dialog-header .raw-icon-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
/* Labeled variant — the JSON / XLSX download buttons need to hold
   a glyph + a short text label side-by-side. The base `.raw-icon-btn`
   above is 28×28 square (icon-only); this modifier relaxes the
   width to fit the label without overflow and adds proper inline
   gap + padding so the icon and text sit centered together. */
.raw-dialog-header .raw-icon-btn.has-label {
  width: auto;
  padding: 0 .6rem;
  gap: .35rem;
  font-size: .66rem; font-weight: 700;
  letter-spacing: .02em;
}
.raw-dialog-header .raw-icon-btn .raw-icon-btn-label {
  line-height: 1;
}
.raw-dialog-header .raw-icon-btn.copied {
  background: var(--success-light); color: var(--success); border-color: var(--success);
}
.raw-tab-bar {
  display: flex; gap: 2px; padding: .35rem .85rem 0;
  background: var(--bg-tertiary); border-bottom: 1px solid var(--border);
}
.raw-tab-bar .raw-tab {
  padding: .35rem .75rem;
  font-size: .72rem; font-weight: 600;
  background: transparent; border: 1px solid transparent;
  border-bottom: none; border-radius: 6px 6px 0 0;
  color: var(--text-secondary); cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.raw-tab-bar .raw-tab:hover { color: var(--text); }
.raw-tab-bar .raw-tab.active {
  background: var(--surface); color: var(--accent-blue);
  border-color: var(--border); border-bottom-color: var(--surface);
  margin-bottom: -1px;
}
.raw-dialog-body { padding: 0; overflow: auto; flex: 1; }
.raw-dialog-body pre { font-family: var(--font-mono); font-size: .72rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: var(--text); margin: 0; padding: 1rem; }

/* PRDC-15 — validation errors/warnings dialog. Reuses the raw-dialog
   shell; these styles cover the body content (summary pills + grouped
   error/warning lists). */
.raw-dialog.val-dialog { width: min(760px, 94vw); }
/* The score panel is wider than the default shell to fit its two-column
   legend beside the donut. The drill-down keeps the default width: its body
   is a single-column list of rows that would only look sparse stretched. */
.raw-dialog.cs-dialog:not(.cs-detail-dialog) { width: min(980px, 95vw); }
.val-body { padding: 1rem 1.1rem; }
.val-loading, .val-empty { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: .85rem; }
.val-empty.val-ok { color: var(--success); font-weight: 600; }
.val-empty.val-error-msg { color: var(--danger); }
.val-summary { display: flex; gap: .5rem; margin-bottom: 1rem; }
.val-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.val-pill-err { background: var(--danger-light); color: var(--danger-text); }
.val-pill-warn { background: var(--warn-light); color: var(--warn-text); }
.val-group { margin-bottom: 1.1rem; }
.val-group-title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .5rem; display: flex; align-items: center; gap: .4rem; }
.val-group-err .val-group-title { color: var(--danger-text); }
.val-group-warn .val-group-title { color: var(--warn-text); }
.val-group-count { font-variant-numeric: tabular-nums; background: var(--tint-soft); border-radius: 999px; padding: .02rem .4rem; font-size: .68rem; }
.val-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.val-item { border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius-sm); padding: .5rem .65rem; background: var(--surface); }
.val-item-err { border-left-color: var(--danger); background: var(--danger-light); }
.val-item-warn { border-left-color: var(--warn); background: var(--warn-light); }
.val-item-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .25rem; }
.val-attr { font-family: var(--font-mono); font-size: .72rem; font-weight: 700; color: var(--text); }
/* Clickable attribute name in the validation dialog — jumps to the field. */
.val-attr-jump { cursor: pointer; color: var(--accent-blue); text-decoration: underline; text-underline-offset: 2px; }
.val-attr-jump:hover { color: var(--primary); }
.val-rule { font-family: var(--font-mono); font-size: .65rem; color: var(--text-muted); background: var(--bg-tertiary); padding: .05rem .35rem; border-radius: var(--radius-sm); }
.val-msg { font-size: .78rem; line-height: 1.45; color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; }
.val-group-other .val-group-title { color: var(--text-muted); }
.val-item-other { border-left-color: var(--text-muted); }
.val-stale { font-size: .75rem; color: var(--text-muted); margin: -.5rem 0 .9rem; }
.raw-attr-table {
  width: 100%; border-collapse: collapse; font-size: .78rem;
}
.raw-attr-table tr { border-bottom: 1px solid var(--border); }
.raw-attr-table tr:last-child { border-bottom: 0; }
.raw-attr-table tr:nth-child(even) { background: var(--tint-subtle); }
.raw-attr-table td { padding: .35rem .85rem; vertical-align: top; }
.raw-attr-table td.raw-attr-key {
  color: var(--text-secondary); font-weight: 500;
  width: 40%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.raw-attr-table td.raw-attr-val { color: var(--text); word-break: break-word; }
.raw-attr-empty {
  padding: 1.25rem; text-align: center; font-size: .8rem;
  color: var(--text-muted);
}
.prompt-col { display: flex; flex-direction: column; }
.prompt-box { position: relative; flex: 1; display: flex; flex-direction: column; }
.prompt-box label { display: block; font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .35rem; }
.prompt-box .prompt-help { font-size: .72rem; color: var(--text-muted); margin-bottom: .5rem; line-height: 1.5; }
.prompt-box .prompt-wrap { position: relative; flex: 1; display: flex; flex-direction: column; }
.prompt-box textarea { width: 100%; flex: 1; min-height: 140px; padding: .6rem .75rem; padding-right: 2rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .82rem; font-family: var(--font-mono); color: var(--text); background: var(--bg-tertiary); resize: vertical; line-height: 1.6; }
.prompt-box textarea:focus { outline: none; border-color: var(--primary); background: var(--input-bg); box-shadow: 0 0 0 3px var(--primary-light); }
.prompt-box textarea::placeholder { color: var(--text-muted); opacity: .6; }
.prompt-box .btn-clear-prompt { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: .7rem; cursor: pointer; display: none; align-items: center; justify-content: center; line-height: 1; }
.prompt-box .btn-clear-prompt.visible { display: flex; }
.prompt-box .btn-clear-prompt:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }

.content-row { display: grid; grid-template-columns: 1fr; gap: 1.25rem; align-items: start; }

.data-panel { display: flex; flex-direction: column; gap: 1.1rem; }

/* Search-wrap is now an optional column container that hosts the
   diff-view toolbar (compare mode only). The search input itself
   was hoisted into the mapping toolbar above (so the required-
   field counter, search, Start new article, and Add to Queue all
   sit on one row above the attribute editor) — its styles below
   are no longer scoped to `.attr-search-wrap` so they work both
   in the mapping toolbar and anywhere else `.attr-search-inputrow`
   might be reused. */
/* Margin-bottom dropped 2026-05-28: the wrapping
   `.mapping-section-body` flex layout already adds a gap between
   the diff-view toolbar and the accordion below. */
.attr-search-wrap { margin-bottom: 0; display: flex; flex-direction: column; gap: .45rem; }
.attr-search-inputrow { position: relative; }
.attr-search-inputrow input { width: 100%; padding: .55rem .75rem .55rem 2.1rem; font-size: .82rem; font-family: var(--font-sans); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.attr-search-inputrow input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.attr-search-inputrow input::placeholder { color: var(--text-muted); }
.attr-search-inputrow .search-icon { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; font-size: .85rem; }
.attr-search-inputrow .search-clear { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 0 .2rem; display: none; }
.attr-search-inputrow .search-clear:hover { color: var(--text); }
.attr-search-inputrow.has-query input { padding-right: 7.4rem; }
.attr-search-inputrow .search-nav {
  position: absolute; right: 1.65rem; top: 50%; transform: translateY(-50%);
  display: none; align-items: center; gap: .05rem;
  color: var(--text-muted); font-size: .68rem; font-weight: 600;
  font-variant-numeric: tabular-nums; white-space: nowrap; user-select: none;
}
.attr-search-inputrow.has-query .search-nav { display: inline-flex; }
.attr-search-inputrow .search-nav-count { padding: 0 .2rem; min-width: 2.4rem; text-align: right; }
.attr-search-inputrow .search-nav-count.is-empty { color: #b45309; }
.attr-search-inputrow .search-nav button {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: .62rem; line-height: 1; padding: .15rem .18rem; border-radius: 3px;
}
.attr-search-inputrow .search-nav button:hover:not(:disabled) { color: var(--text); background: var(--bg-tertiary); }
.attr-search-inputrow .search-nav button:disabled { opacity: .35; cursor: default; }

/* Diff-view toolbar (plan §4.4 + §4.8) — compare-mode-only
   segmented control + filter chips, rendered above the search
   input. The toolbar provides the dominant "what am I looking
   at?" affordance (Only differences vs All attributes) plus
   the secondary multi-select chip filters that combine as AND
   with the segmented mode and the search query. */
.diff-view-toolbar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .35rem .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.diff-view-toolbar .dv-segmented {
  display: inline-flex; gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-tertiary);
}
.diff-view-toolbar .dv-seg {
  padding: .3rem .65rem;
  font-size: .72rem; font-weight: 600;
  background: transparent; border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .12s, color .12s;
  line-height: 1.2;
  font-family: inherit;
}
.diff-view-toolbar .dv-seg:hover { color: var(--text); }
.diff-view-toolbar .dv-seg.active {
  background: var(--accent-blue, var(--primary));
  color: #fff;
}
.diff-view-toolbar .dv-seg-count {
  margin-left: .25rem;
  font-weight: 400;
  opacity: .85;
  font-variant-numeric: tabular-nums;
}
.diff-view-toolbar .dv-chips {
  display: inline-flex; gap: .25rem; flex-wrap: wrap;
  margin-left: auto;
}
.diff-view-toolbar .dv-chip {
  padding: .25rem .55rem;
  font-size: .68rem; font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
  line-height: 1.2;
}
.diff-view-toolbar .dv-chip:hover { border-color: var(--text-muted); color: var(--text); }
.diff-view-toolbar .dv-chip.active {
  background: var(--accent-blue-light, var(--primary-light));
  border-color: var(--accent-blue, var(--primary));
  color: var(--accent-blue, var(--primary));
  font-weight: 600;
}

/* Row hidden by the diff-view filters (segmented + chips).
   `display: none` on the table row collapses it out of the
   flow so the section reads as a tight diff list. Search
   hiding uses a separate class (`.search-hidden`) so the two
   can compose without one clobbering the other. */
.attr-compare-table tr.dv-filtered-out { display: none; }

/* Keyboard focus ring (plan §4.9) — `.kbd-focused` is applied
   by `_setKbdFocus` after a J/K/T/S keypress. Visual cue is a
   light box-shadow + accent-blue left border on the label
   cell so it reads as "this is the row you're acting on" at
   a glance. Combined with the existing `cmp-diff` red tint,
   a focused pending diff reads as red-with-blue-outline. */
.attr-compare-table tr.kbd-focused > td {
  box-shadow: inset 0 0 0 2px var(--accent-blue, var(--primary));
}
.attr-compare-table tr.kbd-focused > td.cmp-label {
  box-shadow: inset 4px 0 0 var(--accent-blue, var(--primary));
}
/* Per-section "show matching" override — when the user clicks
   the "N matching attributes (click to show)" summary, the
   matching rows un-hide within that section only. */
.attr-accordion-section.dv-show-matching tr.dv-filtered-out { display: table-row; }

/* Per-section summary line shown in Only-differences mode:
   "✓ N matching attributes (click to show)" — gives the user
   an at-a-glance view of how many rows were elided plus a
   one-click reveal. */
.dv-matching-summary {
  padding: .4rem .7rem;
  border-top: 1px dashed var(--border);
}
.dv-matching-summary .dv-matching-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .5rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: .72rem; font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: all .12s;
}
.dv-matching-summary .dv-matching-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text);
  border-color: var(--border);
}
.dv-matching-summary .dv-matching-icon { color: var(--success); font-weight: 700; }
.attr-table tr.search-hidden { display: none; }
.attr-table tr.search-match > td { background: var(--primary-light); }
.attr-table tr.search-match > td:first-child { box-shadow: inset 3px 0 0 var(--primary); font-weight: 600; }
.attr-table tr.search-current > td { background: rgba(11, 210, 197, 0.22); }
.attr-table tr.search-current > td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.attr-label-name .search-hit {
  background: #fde68a; color: inherit; padding: 0 .12em; border-radius: 2px;
}

/* Accordion layout for attribute sections */
.attr-accordion {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: visible;
  box-shadow: var(--shadow);
}
.attr-accordion-section + .attr-accordion-section { border-top: 1px solid var(--border); }
.attr-accordion-section:first-child .attr-accordion-header { border-top-left-radius: 7px; border-top-right-radius: 7px; }
.attr-accordion-section:last-child .attr-accordion-header { border-bottom-left-radius: 7px; border-bottom-right-radius: 7px; }
.attr-accordion-section:last-child .attr-accordion-header.expanded { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.attr-accordion-section:last-child .attr-accordion-body.expanded { border-bottom-left-radius: 7px; border-bottom-right-radius: 7px; }
.attr-accordion-header {
  /* Layout: a single-row flex container split into a left group
     (status indicators + title — takes all remaining space) and
     a right group (search-match / warn / diff / extras badges,
     bulk actions, chevron — auto-sized, hugs the right edge).
     Earlier this was a 7-column grid which couldn't accommodate
     the extra diff-dot + bulk-action cells in compare mode and
     wrapped them onto a second row (bulk actions ended up on the
     left, header doubled in height, title got squeezed). Flex
     with explicit left/right groups keeps the row a single line
     regardless of which optional badges/actions are present. */
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .5rem 1.15rem;
  background: var(--panel-bg);
  border: none;
  border-left: 3px solid transparent;
  font-family: var(--font-sans);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.attr-accordion-header:hover { background: var(--bg-tertiary); }
/* QW-2: expanded section uses the calm blue accent on the left bar + soft tinted background. */
.attr-accordion-header.expanded { background: var(--accent-blue-light); border-left-color: var(--accent-blue); }
.attr-accordion-header:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: -2px; }
/* Keep the clicked section header below the sticky page header when scrolled into view */
.attr-accordion-header { scroll-margin-top: 80px; }
.attr-accordion-header-left {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1 1 auto;
  min-width: 0;
}
.attr-accordion-header-right {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex: 0 0 auto;
}
.attr-accordion-title {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Badge slots — inline-flex so icons center cleanly. Empty slots
   collapse to zero width in flex layout, so they don't push the
   chevron away from the right edge. */
.acc-slot { display: inline-flex; align-items: center; justify-content: center; min-height: 18px; }
.acc-slot:empty { display: none; }
/* Per-section required-fields indicator. Red (error), matching the red
   field-level "must not be empty" state — a section with empty required
   fields is an error to resolve, not a soft draft note. */
.attr-accordion-warn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--mandatory-error-border);
  flex-shrink: 0;
}
.attr-accordion-warn svg { width: 18px; height: 18px; }
.attr-accordion-warn .count {
  position: absolute;
  top: -5px;
  right: -7px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  background: var(--mandatory-error-border);
  color: #fff;
  border: 1.5px solid var(--panel-bg);
  border-radius: 8px;
  font-size: .6rem;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
}
.attr-accordion-warn .attr-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  right: -10px;
  z-index: 30;
  min-width: 240px;
  max-width: 360px;
  padding: .7rem .9rem;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  font-size: .85rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  pointer-events: none;
}
.attr-accordion-warn .attr-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  right: 14px;
  width: 10px;
  height: 10px;
  background: var(--tooltip-bg);
  transform: rotate(45deg);
}
.attr-accordion-warn:hover .attr-tooltip,
.attr-accordion-warn:focus-visible .attr-tooltip,
.attr-accordion-warn:focus-within .attr-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.attr-tooltip-title { font-weight: 600; margin-bottom: .4rem; color: var(--warn); }
.attr-tooltip-list { list-style: disc; margin: 0; padding-left: 1.15rem; }
.attr-tooltip-list li { margin: .15rem 0; font-size: .85rem; }
.attr-accordion-match {
  font-size: .65rem;
  font-weight: 600;
  background: var(--primary);
  color: #ffffff;
  border-radius: 8px;
  padding: 0 .45rem;
  min-width: 16px;
  text-align: center;
  line-height: 1.5;
  flex-shrink: 0;
}
/* Section-header disclosure chevron — REVISED 2026-05-28 to share
   the `.caret-icon` class with the Mapped Item / Uploaded Material
   widget toggles. Size + rotation are owned by the global
   `[aria-expanded] .caret-icon` rules above so we only override
   the muted colour here. Both widgets and accordion sections now
   use the same right-chevron that rotates 90° to down on expand. */
.attr-accordion-chevron {
  color: var(--text-muted);
}
.attr-accordion-body { display: none; padding: .9rem 1.15rem 1.25rem 1.15rem; background: var(--panel-bg); }
.attr-accordion-body.expanded { display: block; }

/* Centered two-column form layout inside accordion bodies (matches reference design) */
.attr-accordion-body .attr-table { margin: 0 auto; table-layout: fixed; max-width: 1040px; }
.attr-accordion-body .attr-table tr:hover td { background: transparent; }
.attr-accordion-body .attr-table tr:not(:last-child) td { border-bottom: none; }
.attr-accordion-body .attr-table td { padding: .7rem .9rem; vertical-align: top; font-size: .88rem; }
.attr-accordion-body .attr-table td:first-child {
  width: 38%;
  text-align: right;
  text-transform: none;
  letter-spacing: normal;
  font-size: .88rem;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: normal;
  word-break: break-word;
  /* Top-align the row, then nudge the label down so it sits on the same
     line as the value input's text (the input adds its own padding+border
     on top of the cell padding). Keeps the label aligned with the FIRST
     value row even when a multilingual field makes the value cell taller. */
  padding-top: 1.05rem;
}
.attr-accordion-body .attr-table td:first-child .schema-len { font-size: .72rem; color: var(--text-muted); font-weight: 400; margin-left: .3rem; font-style: italic; }
.attr-accordion-body .attr-table .edit-input,
.attr-accordion-body .attr-table .edit-textarea,
.attr-accordion-body .attr-table .ml-val { font-size: .88rem; }
/* Value fields auto-grow downward to show their full text (no truncation).
   Multilingual values are now textareas; `field-sizing: content` sizes
   them to their content, with a one-line floor and wrapping. */
textarea.ml-val { field-sizing: content; min-height: 2.1em; line-height: 1.5; resize: vertical; white-space: pre-wrap; overflow-wrap: anywhere; }
.edit-textarea { field-sizing: content; }
.attr-accordion-body .attr-table td:last-child { width: 62%; }
.attr-accordion-body .attr-table td:last-child .input-wrap { max-width: 520px; }
/* Multilingual rows: align the value box's RIGHT edge with the 520px scalar
   inputs. The row is [lang dropdown (55px)] + [gap] + [value box] + buttons,
   so the value box is capped at 520 − dropdown − gap. Its right edge then
   lands exactly where scalar boxes end, and the × / info buttons flow after
   it just like scalar fields — consistent length, aligned right edge. */
.attr-accordion-body .attr-table td:last-child .ml-group { max-width: 640px; }
.attr-accordion-body .attr-table td:last-child .ml-row > .input-wrap { flex: 1 1 auto; min-width: 0; max-width: calc(520px - 55px - .3rem); }
/* GPC picker: cap the code box + "Browse"/"Suggest GPC" group at the 520px
   scalar width so the Suggest button's right edge lands exactly where the
   other value fields end (e.g. the Target Market select). The clear × / info
   icons flow AFTER this group — outside the 520px — just like every other
   field. The code input flexes to fill whatever the two buttons leave. */
.attr-accordion-body .attr-table td:last-child .gpc-field {
  display: flex; align-items: center; gap: 6px;
  flex: 0 1 520px; max-width: 520px; min-width: 0;
}
.attr-accordion-body .attr-table td:last-child .gpc-field > .gpc-input-wrap { flex: 1 1 auto; min-width: 0; }
.attr-accordion-body .attr-table tr.search-match > td:first-child { color: var(--text); font-weight: 600; }

.attr-toolbar { display: flex; justify-content: flex-end; margin-bottom: .55rem; }
.attr-toolbar .btn-queue { padding: .4rem .9rem; font-size: .78rem; border-radius: 6px; }

/* Boolean input (radio group) styled to match reference screenshot */
.bool-input { display: inline-flex; align-items: center; gap: 1.5rem; padding: .2rem 0; }
.bool-input .bool-opt { display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; color: var(--text-muted); cursor: pointer; user-select: none; transition: color .15s; }
.bool-input .bool-opt:hover { color: var(--text-secondary); }
.bool-input .bool-opt.selected { color: var(--text); font-weight: 500; }
.bool-input .bool-opt input[type="radio"] { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; border: 1.5px solid var(--border); border-radius: 50%; background: var(--input-bg); cursor: pointer; position: relative; transition: border-color .15s, background .15s; margin: 0; flex-shrink: 0; }
.bool-input .bool-opt input[type="radio"]:checked { border-color: var(--radio-accent); background: var(--radio-accent); }
.bool-input .bool-opt input[type="radio"]:checked::after { content: ''; position: absolute; top: 50%; left: 50%; width: 6px; height: 6px; background: #fff; border-radius: 50%; transform: translate(-50%, -50%); }
.bool-input .bool-opt input[type="radio"]:focus-visible { outline: 2px solid var(--radio-accent); outline-offset: 2px; }
.bool-input.mandatory { position: relative; }

.level-tabs {
  display: flex; gap: .4rem; padding: .6rem .75rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); flex-wrap: wrap; align-items: center;
}
.level-tabs-label {
  font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin-right: .3rem;
}
.level-tab {
  padding: .35rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .78rem; font-weight: 500; cursor: pointer; background: var(--surface);
  color: var(--text-secondary); transition: all .15s; display: inline-flex;
  align-items: center; gap: .35rem;
}
.level-tab:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.level-tab.active { background: var(--primary); color: var(--on-accent); border-color: var(--primary); box-shadow: 0 2px 8px var(--primary-glow); }
.level-tab .tab-gtin { font-family: var(--font-mono); font-size: .72rem; opacity: .8; }
.level-tab.tree-tab { background: var(--accent-light); color: var(--accent); border-color: rgba(124,58,237,.25); margin-left: auto; }
.level-tab.tree-tab:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.level-tab.tree-tab.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); box-shadow: 0 2px 8px rgba(124,58,237,.25); }
.level-tab.tree-tab svg { width: 14px; height: 14px; vertical-align: -2px; }

/* ---- "Done" marker for uploaded-material entries (manual, visual only) ---- */
/* Round check button: a hollow grey circle until the entry is marked done,
   then a filled green circle with a white check. Lives on article tabs and
   on Uploaded-Material rows (data-entry-id keeps the two in sync). */
.entry-done-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; flex: 0 0 auto; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--surface);
  color: transparent; cursor: pointer; transition: all .15s; padding: 0;
  vertical-align: middle;
}
.entry-done-check svg { width: 11px; height: 11px; display: block; }
.entry-done-check:hover { border-color: var(--success); color: var(--success); background: var(--success-light); }
.entry-done-check:focus-visible { outline: 2px solid var(--success); outline-offset: 1px; }
.is-done .entry-done-check {
  background: var(--success); border-color: var(--success); color: var(--on-accent);
}
.is-done .entry-done-check:hover { background: var(--success-text); border-color: var(--success-text); color: var(--on-accent); }
/* "Done" text badge — hidden until the row/tab is marked done. */
.entry-done-badge {
  display: none; align-items: center; font-size: .62rem; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase; color: var(--success);
  background: var(--success-light); border: 1px solid rgba(22,163,74,.35); border-radius: 999px;
  padding: .05rem .4rem; line-height: 1.4;
}
.is-done .entry-done-badge { display: inline-flex; }
/* Dim a finished entry so it recedes, while staying readable + clickable. */
.level-tab.is-done:not(.active) { opacity: .62; }
.level-tab.is-done .tab-gtin { opacity: .7; }
.material-item.is-done { opacity: .68; }
.material-item.is-done .entry-done-badge { opacity: 1; }
/* On an active (selected) article tab the check stays crisp for contrast. */
.level-tab.active.is-done .entry-done-check { border-color: var(--on-accent); }
.level-tab.active .entry-done-badge { color: var(--on-accent); background: var(--on-accent-wash); border-color: var(--on-accent-line); }

.hierarchy-tree-view { padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.hierarchy-tree-view h3 { font-size: .85rem; font-weight: 600; margin-bottom: 1.25rem; color: var(--text); display: flex; align-items: center; gap: .5rem; }
.hierarchy-tree-view h3 svg { width: 18px; height: 18px; color: var(--accent); }
.htree { list-style: none; padding: 0; margin: 0; }
.htree .htree { padding-left: 2rem; margin-top: .5rem; }
.htree li { position: relative; }
.htree .htree > li { padding-left: 1.5rem; }
.htree .htree > li::before {
  content: ''; position: absolute; left: 0; top: 0;
  width: 1.2rem; height: .95rem;
  border-left: 2px solid var(--border); border-bottom: 2px solid var(--border);
  border-bottom-left-radius: 8px;
}
.htree .htree > li::after {
  content: ''; position: absolute; left: 0; top: .95rem;
  width: 0; height: calc(100% - .95rem);
  border-left: 2px solid var(--border);
}
.htree .htree > li:last-child::after { display: none; }
.htree-node {
  display: inline-flex; align-items: stretch; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: .5rem;
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
  max-width: 100%;
}
.htree-node:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.htree-tier {
  writing-mode: vertical-rl; text-orientation: mixed;
  padding: .5rem .35rem; font-size: .62rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; display: flex; align-items: center; justify-content: center;
  min-height: 50px; white-space: nowrap;
}
.htree-tier.tier-pallet { background: var(--tier-pallet-bg); color: var(--tier-pallet-text); }
.htree-tier.tier-display_shipper { background: var(--tier-shipper-bg); color: var(--tier-shipper-text); }
.htree-tier.tier-case { background: var(--tier-case-bg); color: var(--tier-case-text); }
.htree-tier.tier-base { background: var(--primary-light); color: var(--primary); }
.htree-body {
  padding: .5rem .75rem; display: flex; flex-direction: column; justify-content: center;
  gap: .15rem; min-width: 0; flex: 1;
}
.htree-gtin {
  font-family: var(--font-mono); font-size: .82rem; font-weight: 600; color: var(--text);
  letter-spacing: .02em;
}
.htree-desc {
  font-size: .72rem; color: var(--text-secondary); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 380px;
}
.htree-meta {
  display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .15rem;
}
.htree-badge {
  font-size: .6rem; font-weight: 600; padding: .1rem .35rem; border-radius: 3px;
  text-transform: uppercase; letter-spacing: .04em;
}
.htree-badge-qty { background: var(--accent-light); color: var(--accent); }
.htree-badge-flag { background: var(--bg-tertiary); color: var(--text-muted); }
.htree-badge-flag.is-true { background: var(--success-light); color: var(--success); }
.htree-connector {
  display: flex; align-items: center; gap: .3rem; padding: .15rem 0 .15rem 1.5rem;
  font-size: .62rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase;
  letter-spacing: .06em;
}
.htree-connector svg { width: 14px; height: 14px; color: var(--border); flex-shrink: 0; }

/* Fields ⇄ Hierarchy-view sub-tab toggle inside the Hierarchy section. */
.hsub-tabs { display: flex; gap: .4rem; margin-bottom: .9rem; }
.hsub-tab {
  appearance: none; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: .75rem; font-weight: 600; letter-spacing: .04em;
  padding: .3rem .8rem; border-radius: 999px; cursor: pointer; transition: all .15s ease;
}
.hsub-tab:hover { border-color: var(--primary); color: var(--primary); }
.hsub-tab.active { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }
.hsub-panel.hidden { display: none; }
.hsub-panel[data-hsub-panel="tree"] { padding: .25rem 0 .5rem; }

.attr-table { width: 100%; border-collapse: collapse; }
.attr-table tr:not(:last-child) td { border-bottom: 1px solid var(--border-subtle); }
.attr-table tr:hover td { background: var(--primary-light); }
.attr-table td { padding: .4rem .35rem; font-size: .85rem; vertical-align: top; }
.attr-table td:first-child { font-weight: 500; color: var(--text-muted); white-space: nowrap; width: 170px; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.hierarchy-table thead th { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); text-align: left; padding: .35rem .3rem; border-bottom: 1px solid var(--border-subtle); font-weight: 600; }
.hierarchy-table tbody td { font-size: .8rem; }
.hierarchy-table tbody td:nth-child(n+5):nth-child(-n+8) { font-family: ui-monospace, monospace; font-size: .72rem; }
.input-wrap { position: relative; width: 100%; }
select.tm-select, select.country-select { width: 100%; padding: .3rem .5rem; font-size: .9rem; font-family: inherit; color: var(--text); background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; appearance: none; background-image: var(--select-arrow); background-repeat: no-repeat; background-position: right .7rem center; padding-right: 1.8rem; }
select.tm-select:focus, select.country-select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.edit-input { width: 100%; padding: .3rem 2.8rem .3rem .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem; font-family: var(--font-sans); color: var(--text); background: var(--surface); }
.edit-input:focus { outline: none; border-color: var(--primary); background: var(--input-bg); box-shadow: 0 0 0 3px var(--primary-light); }
.edit-textarea { width: 100%; padding: .3rem .5rem; min-height: 55px; resize: vertical; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem; font-family: var(--font-sans); color: var(--text); background: var(--surface); line-height: 1.5; }
.edit-textarea:focus { outline: none; border-color: var(--primary); background: var(--input-bg); box-shadow: 0 0 0 3px var(--primary-light); }
.char-count { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: .62rem; font-weight: 500; color: var(--text-muted); opacity: .7; pointer-events: none; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.char-count.over { color: var(--danger); opacity: 1; font-weight: 700; }
/* byrd-style "clear this field" button. Rendered as a SIBLING of
   the `.input-wrap` (not inside it), wrapped together in an
   `.input-shell` flex row so the button sits visually OUTSIDE the
   input's border \u2014 the same way app.byrd.io lays it out. Only
   appears while the input carries a value; click clears the value,
   fires `input` + `change` events so all listeners (char-count,
   required-empty validator, cross-field validator, brand-owner
   autofill mirror) run through their existing paths.               */
.input-shell {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.input-shell > .input-wrap { flex: 1 1 auto; min-width: 0; }
/* byrd-style combined value + UOM row (Gross weight / UOM, etc.) */
.input-shell.measure-pair > .measure-pair-fields,
.input-shell.measure-pair .measure-list-row > .measure-pair-fields {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 520px;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input-shell.measure-pair .measure-pair-fields:focus-within {
  border-color: var(--primary);
  background: var(--input-bg);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.input-shell.measure-pair .measure-pair-fields:has(.mandatory-error) {
  border-color: var(--mandatory-error-border);
  background: var(--mandatory-error-bg);
}
.input-shell.measure-pair .measure-pair-fields:focus-within:has(.mandatory-error) {
  box-shadow: 0 0 0 3px var(--mandatory-error-glow);
}
.input-shell.measure-pair .measure-val-wrap {
  flex: 1 1 auto;
  min-width: 0;
  border-right: 1px solid var(--border);
}
.input-shell.measure-pair .measure-uom-wrap {
  flex: 0 0 76px;
  width: 76px;
}
/* Repeatable measure (net content table): rows 2…n under row 1. */
.input-shell.measure-pair.has-measure-list { flex-wrap: wrap; }
.input-shell.measure-pair.has-measure-list > .measure-pair-fields { flex-basis: 0; }
.measure-list { flex: 1 0 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.measure-list-row { display: flex; align-items: center; gap: 6px; width: 100%; }
.input-shell.measure-pair .measure-list-row > .measure-pair-fields { flex-basis: 0; }
.measure-list-add { border: none; background: none; padding: 0; color: var(--primary); font-size: .75rem; cursor: pointer; }
.measure-list-add:hover { text-decoration: underline; }
/* Inner controls share one outer border — no double boxes. */
.input-shell.measure-pair .measure-val-wrap .edit-input,
.input-shell.measure-pair .measure-uom-wrap .measure-uom-select {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.input-shell.measure-pair .measure-val-wrap .edit-input:focus,
.input-shell.measure-pair .measure-uom-wrap .measure-uom-select:focus {
  border: none;
  box-shadow: none;
  background: transparent;
}
.input-shell.measure-pair .measure-uom-wrap .measure-uom-select {
  padding: .3rem 1.6rem .3rem .35rem;
  font-size: .85rem;
  cursor: pointer;
  appearance: none;
  background-image: var(--select-caret);
  background-repeat: no-repeat;
  background-position: right .35rem center;
}
.input-shell.measure-pair .measure-uom-wrap .char-count {
  right: 1.1rem;
}
/* byrd-style UOM picker — appears under the value input when a
   numeric value is typed (e.g. "2" → "2 Gramm", "2 Kilogramm"). */
.measure-uom-popup {
  position: fixed;
  z-index: 1200;
  display: none;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
}
.measure-uom-popup.visible { display: block; }
.measure-uom-popup .muom-item {
  padding: .45rem .65rem;
  font-size: .84rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
.measure-uom-popup .muom-item:last-child { border-bottom: none; }
.measure-uom-popup .muom-item:hover,
.measure-uom-popup .muom-item.muom-active {
  background: var(--accent-blue-light);
}
.long-select-popup {
  position: fixed;
  z-index: 3000;
  display: none;
  flex-direction: column;
  max-height: 320px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px -10px rgba(15,23,42,.35);
  overflow: hidden;
}
.long-select-popup.visible { display: flex; }
.long-select-popup .lsel-filter {
  margin: .4rem;
  padding: .35rem .55rem;
  font-size: .84rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-alt, var(--bg-primary));
  color: var(--text);
  outline: none;
}
.long-select-popup .lsel-filter:focus { border-color: var(--accent-blue, #2563eb); }
.long-select-popup .lsel-list { overflow-y: auto; max-height: 260px; }
.long-select-popup .lsel-item {
  padding: .4rem .65rem;
  font-size: .84rem;
  line-height: 1.3;
  cursor: pointer;
  color: var(--text);
}
.long-select-popup .lsel-item.lsel-current { font-weight: 600; }
.long-select-popup .lsel-item.lsel-active { background: var(--accent-blue-light); }
.long-select-popup .lsel-group {
  padding: .45rem .65rem .2rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.long-select-popup .lsel-none { padding: .5rem .65rem; font-size: .84rem; color: var(--text-muted); }
/* ---- GPC hierarchical picker ------------------------------------- */
.gpc-shell .gpc-browse-btn {
  flex: 0 0 auto;
  padding: 0 .7rem;
  height: 30px;
  font-size: .8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.gpc-shell .gpc-browse-btn:hover { background: var(--accent-blue-light); }
.gpc-title-line {
  font-size: .78rem;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.25;
}
.gpc-advice { margin-top: 5px; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.gpc-advice:empty { display: none; }
.gpc-advice-label { font-size: .72rem; font-weight: 600; color: var(--text-secondary); }
.gpc-advice-status { font-size: .74rem; color: var(--text-secondary); font-style: italic; line-height: 1.35; }
.gpc-advice-chip {
  position: relative;
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: .12rem;
  padding: .22rem .55rem .32rem; border: 1px dashed var(--primary); border-radius: 10px;
  background: var(--primary-light); color: var(--text);
  font-size: .74rem; cursor: pointer; line-height: 1.2;
  overflow: hidden;
}
.gpc-advice-main { display: inline-flex; align-items: center; gap: .35rem; }
.gpc-advice-rank {
  font-size: .62rem; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; opacity: .78;
}
.gpc-advice-chip.is-top {
  border-style: solid;
  background: color-mix(in srgb, var(--primary) 14%, var(--bg, #fff));
}
.gpc-advice-chip:hover { background: var(--primary); color: var(--on-accent); }
.gpc-advice-code { font-family: var(--font-mono, monospace); opacity: .75; font-size: .7rem; }
.gpc-advice-chip:hover .gpc-advice-rank { color: inherit; }
.gpc-advice-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px;
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  pointer-events: none;
}
.gpc-advice-bar > i {
  display: block; height: 100%;
  background: var(--primary);
}
.gpc-advice-chip:hover .gpc-advice-bar > i { background: var(--on-accent, #fff); }
.gpc-modal-backdrop {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--backdrop);
  display: flex; align-items: center; justify-content: center;
}
.gpc-modal-backdrop[hidden] { display: none; }
.gpc-modal {
  width: min(680px, 92vw); max-height: 80vh;
  display: flex; flex-direction: column;
  background: var(--bg-primary);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.gpc-modal-head {
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--border-light);
}
.gpc-breadcrumb { flex: 1 1 auto; font-size: .82rem; color: var(--text-secondary); }
.gpc-breadcrumb .gpc-crumb { color: var(--accent-blue); cursor: pointer; }
.gpc-breadcrumb .gpc-crumb:hover { text-decoration: underline; }
.gpc-breadcrumb .gpc-crumb-sep { margin: 0 .3rem; color: var(--text-secondary); }
.gpc-close {
  flex: 0 0 auto; width: 28px; height: 28px;
  border: none; background: transparent; font-size: 1.3rem; line-height: 1;
  cursor: pointer; color: var(--text-secondary); border-radius: 6px;
}
.gpc-close:hover { background: var(--border-light); }
.gpc-search {
  margin: .7rem .9rem; padding: .5rem .65rem;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: .85rem;
}
.gpc-list { flex: 1 1 auto; overflow-y: auto; padding: 0 .4rem .6rem; }
.gpc-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .55rem .65rem; margin: 2px .5rem;
  border-radius: 6px; cursor: pointer;
  border: 1px solid transparent;
}
.gpc-item:hover { background: var(--accent-blue-light); }
.gpc-item.gpc-brick { border-color: var(--border-light); }
.gpc-item-body { flex: 1 1 auto; min-width: 0; }
.gpc-item-title { font-size: .86rem; color: var(--text); }
.gpc-item-sub { font-size: .74rem; color: var(--text-secondary); }
.gpc-item-code { font-size: .74rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.gpc-item-caret { color: var(--text-secondary); flex: 0 0 auto; }
.gpc-empty { padding: 1.2rem; text-align: center; color: var(--text-secondary); font-size: .85rem; }
.attr-clear-btn {
  position: static;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
  transition: opacity .12s ease, background .12s ease, color .12s ease;
}
.attr-clear-btn:hover, .attr-clear-btn:focus {
  opacity: 1;
  background: var(--tint-strong);
  color: var(--danger);
  outline: none;
}
/* Keep the X's flex slot RESERVED while empty so every input in
   the column ends at the same horizontal position (the char-count
   `0` on empty rows was drifting rightward when the button
   collapsed with `display: none`). `visibility: hidden` keeps the
   layout but hides the glyph; overrides the browser's default
   `[hidden] { display: none }`. */
.attr-clear-btn[hidden] {
  display: inline-flex;
  visibility: hidden;
}
/* Per-attribute provenance ("i") button. Mirrors `.attr-clear-btn`
   geometry so the two sit side-by-side in the `.input-shell` flex row.
   Only rendered on filled attributes whose value traces to an uploaded
   source file, so its presence itself signals "AI-extracted". */
.attr-info-btn {
  flex: 0 0 auto;
  position: relative;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: .72rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1;
  cursor: pointer;
  opacity: .7;
  transition: opacity .12s ease, background .12s ease, color .12s ease, border-color .12s ease;
}
.attr-info-btn:hover, .attr-info-btn:focus {
  opacity: 1;
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  outline: none;
}
/* Compact variant sitting next to small bespoke labels / table titles
   (nutrition, claims, nutri-score). */
.attr-info-btn-sm {
  width: 16px;
  height: 16px;
  font-size: .6rem;
  vertical-align: middle;
  margin-left: .35rem;
}
/* On container-shaped fields the button rides inline: for multilingual it
   sits on the first `.ml-row` (after the × remove); for booleans after the
   radios. */
.ml-row > .attr-info-btn { flex: 0 0 auto; align-self: flex-start; }
.bool-input > .attr-info-btn { margin-left: .35rem; }
/* Provenance popover: a floating card anchored under the info button,
   listing each source file (and PDF layer / Excel sheet) plus the value
   that file carried. */
.attr-info-pop {
  position: absolute;
  z-index: 1200;
  max-width: 340px;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: .5rem .6rem;
  font-size: .74rem;
}
.attr-info-pop-head {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .35rem;
}
.attr-info-pop-row { padding: .28rem 0; border-top: 1px solid var(--border); }
.attr-info-pop-row:first-of-type { border-top: none; }
.attr-info-pop-file { font-weight: 600; color: var(--text); word-break: break-word; }
.attr-info-pop-loc { font-weight: 500; color: var(--text-secondary); }
.attr-info-pop-val { color: var(--text-secondary); word-break: break-word; margin-top: .1rem; }
.attr-info-pop-derived { margin-top: .15rem; font-size: .68rem; font-style: italic; color: var(--text-muted); }
.attr-info-pop-vlabel { font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.attr-info-pop-used { display: inline-block; margin-left: .4rem; padding: .05rem .35rem; font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--primary); background: var(--accent-blue-light); border-radius: 999px; vertical-align: middle; }
.attr-info-pop-row.is-used .attr-info-pop-file { color: var(--primary); }
/* Alternatives half of the popover: values OTHER uploaded materials
   carried for this attribute, each adoptable with one click. Separated
   from the provenance list above by a heavier rule so the two halves
   ("where this came from" vs "what else you could use") don't blur. */
.attr-info-pop-alt-head { margin-top: .5rem; padding-top: .45rem; border-top: 2px solid var(--border); }
.attr-info-pop-row.is-alt { display: flex; align-items: flex-start; gap: .5rem; }
.attr-info-pop-row.is-alt > div { flex: 1; min-width: 0; }
.attr-info-pop-use {
  flex: 0 0 auto; align-self: center;
  padding: .18rem .5rem; font-size: .66rem; font-weight: 700;
  color: var(--primary); background: var(--accent-blue-light);
  border: 1px solid var(--primary); border-radius: 999px;
  cursor: pointer; white-space: nowrap;
}
.attr-info-pop-use:hover { background: var(--primary); color: var(--on-accent); }
.attr-info-pop-note { margin-top: .4rem; font-size: .64rem; color: var(--text-muted); }
.attr-info-pop-undo { border: 0; background: none; padding: 0; font: inherit; cursor: pointer; color: var(--primary); font-weight: 700; text-decoration: underline; }
/* The info button advertises that a choice exists (a small dot) or that
   one is active (filled). Without this nobody discovers the picker. */
.attr-info-btn.has-alt { border-color: var(--primary); color: var(--primary); opacity: 1; }
.attr-info-btn.has-alt::after {
  content: ''; position: absolute; top: -2px; right: -2px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
  border: 1px solid var(--surface);
}
/* A field whose value the user picked is marked ONLY by its solid info
   button (the undo lives inside that button's popover). A badge beside
   the label crowded the label column with a long file name. */
.attr-info-btn.is-chosen { background: var(--primary); border-color: var(--primary); color: var(--on-accent); opacity: 1; }
/* Two uploaded materials carrying DIFFERENT values is the one case where
   the user has a decision to make, so the (i) button leaves the primary-blue
   "there is a choice here" language and borrows the amber the
   missing-mandatory markers use. */
.attr-info-btn.is-conflict {
  border-color: var(--warn); color: var(--warn);
  background: var(--warn-light); opacity: 1;
}
.attr-info-btn.is-conflict::after {
  content: ''; position: absolute; top: -2px; right: -2px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--warn);
  border: 1px solid var(--surface);
}
.attr-info-btn.is-conflict:hover, .attr-info-btn.is-conflict:focus {
  background: var(--warn); color: var(--surface); border-color: var(--warn);
}
.attr-conflict-chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center;
  margin-left: .35rem; padding: .1rem .45rem;
  border: 1px solid var(--warn); border-radius: 999px;
  background: var(--warn-light); color: var(--warn-text);
  font-size: .62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap; cursor: pointer;
}
/* `display` on the rule above would otherwise beat the hidden attribute
   `_refreshChoiceUi` sets while a pick is in force. */
.attr-conflict-chip[hidden] { display: none; }
/* Coach mark shown once, naming what the amber marker means. Anchored to
   the first conflicting button rather than floated in a corner, so the
   explanation and the thing it explains are read together. */
.conflict-coach {
  position: absolute; z-index: 1300;
  width: 300px; max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--warn);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: .6rem .7rem;
  font-size: .74rem;
}
.conflict-coach-title {
  display: flex; align-items: center; gap: .35rem;
  font-weight: 700; color: var(--warn-text); margin-bottom: .3rem;
}
.conflict-coach-body { color: var(--text-secondary); line-height: 1.4; }
.conflict-coach-actions { display: flex; justify-content: flex-end; margin-top: .55rem; }
.conflict-coach-ok {
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--warn); color: var(--surface);
  font-weight: 700; font-size: .7rem; padding: .28rem .7rem;
}
/* Banner naming the source a whole nutrition table was taken from. */
.nut-choice-banner {
  display: flex; align-items: center; gap: .5rem;
  margin: .3rem 0 .5rem; padding: .35rem .6rem;
  font-size: .72rem; color: var(--primary);
  background: var(--accent-blue-light);
  border: 1px solid var(--primary); border-radius: var(--radius-md);
}
.nut-choice-banner .ncb-undo { margin-left: auto; border: 0; background: none; cursor: pointer; color: inherit; font-weight: 700; font-size: .68rem; }
/* byrd-style length validation: a field whose value exceeds its maxLen
   gets a red border + light-red fill, plus an inline error message below
   it (mirroring app.byrd.io's "This value has an invalid length…"). This
   is a non-blocking warning — the user can still save — matching the
   existing soft char-count behaviour, just made explicit. */
.edit-input.len-invalid, .edit-textarea.len-invalid, .ml-val.len-invalid { border-color: var(--danger) !important; background: var(--danger-light); }
.len-error { color: var(--danger); font-size: .72rem; font-weight: 500; margin-top: .25rem; line-height: 1.3; }
.len-error[hidden] { display: none; }

/* `<input type="date">` renders a browser-native `dd.mm.yyyy` hint
   inside the field whenever the value is empty (Chrome / Edge /
   Safari all do it). It reads visually as garbage on an
   otherwise-empty attribute editor row \u2014 hide it. The JS toggles
   `.date-empty` on/off from `updateCharCount` so the placeholder
   reappears the moment the user picks a date (and vice-versa when
   they clear it). On focus we always show the placeholder so the
   user can still type a date manually if they prefer.

   Also hide the char counter next to date inputs \u2014 dates are a
   fixed 10 characters, the counter adds no signal.               */
input.edit-input.date-empty::-webkit-datetime-edit,
input.edit-input.date-empty::-moz-datetime-edit {
  color: transparent;
}
input.edit-input.date-empty:focus::-webkit-datetime-edit,
input.edit-input.date-empty:focus::-moz-datetime-edit {
  color: inherit;
}
/* Firefox exposes the placeholder differently; blank it out too. */
input.edit-input[type="date"]:not(:focus).date-empty {
  color: transparent;
}
input.edit-input[type="date"].date-empty:focus {
  color: inherit;
}
/* Char-count is meaningless for a fixed-format date field. */
input.edit-input[type="date"] + .char-count { display: none; }
/* Push the browser's native calendar-picker indicator to the
   right-most edge of the input. `.edit-input` has a 2.8rem
   right-padding to reserve space for the char counter; date
   inputs don't need that reservation (char count is hidden), so
   we override to a slim gap and the indicator floats up against
   the border. */
input.edit-input[type="date"] { padding-right: .3rem; }
input.edit-input[type="date"]::-webkit-calendar-picker-indicator {
  margin-right: 0;
  margin-left: auto;
  padding: 2px;
  cursor: pointer;
  opacity: .6;
}
input.edit-input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* byrd-style "must not be empty" validator for required fields.
   Renders a red banner immediately below the input whenever the
   field is required and empty \u2014 same visual as app.byrd.io. The
   existing `.mandatory` (amber) still ships alongside; the JS
   auto-escalates `.mandatory-error` (red border) so the field's
   border reads red the moment it renders empty, not only after a
   blocked export. */
.req-error {
  color: var(--danger);
  font-size: .72rem;
  font-weight: 500;
  margin-top: .25rem;
  padding: .5rem .65rem;
  background: var(--danger-light);
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger);
  line-height: 1.35;
}
.req-error[hidden] { display: none; }
/* Align every inline validation banner (length / required / mutex)
   with the `.input-wrap` above it, not the outer table cell. The
   wrap is capped at `max-width: 520px` inside the attribute editor
   (see `td:last-child .input-wrap` rule); the banner needs the
   same cap so its right edge lands exactly where the input's does.
   Block-level default `margin-right: auto` on a `max-width`d block
   leaves it left-aligned, matching the input.                     */
.input-shell ~ .req-error,
.input-shell ~ .len-error,
.input-shell ~ .req-error-xpair,
/* Container-shaped fields (multilingual / boolean) anchor their banner to
   the parent cell as a sibling after the group, so cap those too — otherwise
   they stretch the full cell width, much longer than scalar banners. */
.bool-input ~ .req-error,
.bool-input ~ .len-error,
.bool-input ~ .req-error-xpair,
.ml-group ~ .req-error,
.ml-group ~ .len-error,
.ml-group ~ .req-error-xpair,
/* GTIN banners attach to the block `.gtin-cell` (below the flex
   `.gtin-line`), so cap them the same way for right-edge parity. */
.gtin-cell > .req-error,
.gtin-cell > .len-error,
.gtin-cell > .req-error-xpair,
.byrd-live-msg {
  max-width: 520px;
}
/* Live byrd validation: findings for the current edits, shown below the
   field. Same banner shape as `.req-error`, which they replace while a
   byrd result is on screen. */
.byrd-live-msg {
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.35;
  margin-top: .25rem;
  padding: .45rem .65rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.byrd-live-msg-err { color: var(--danger); background: var(--danger-light); border-color: var(--danger); }
.byrd-live-msg-warn { color: var(--warn-text); background: var(--warn-light); border-color: var(--warn); }
.byrd-live-line { word-break: break-word; }
.edit-input.byrd-live-invalid, .edit-textarea.byrd-live-invalid,
.ml-group.byrd-live-invalid .edit-input.ml-val { border-color: var(--mandatory-error-border); background: var(--mandatory-error-bg); }
.edit-input.byrd-live-warned, .edit-textarea.byrd-live-warned,
.ml-group.byrd-live-warned .edit-input.ml-val { border-color: var(--warn); }
.bool-input.byrd-live-invalid { outline: 1px solid var(--mandatory-error-border); outline-offset: 4px; border-radius: 4px; }
.bool-input.byrd-live-warned { outline: 1px solid var(--warn); outline-offset: 4px; border-radius: 4px; }
/* Fields byrd does not use for this article: dimmed, still editable. */
tr.byrd-hidden { opacity: .45; }
tr.byrd-hidden:hover, tr.byrd-hidden:focus-within { opacity: .8; }
/* PRDC-21: Recipient feedback (CICs) — grouped retailer reviews, shown in
   a dialog opened from the found-row CIC button (next to the validation
   triangle). */
.cic-empty { font-size: .82rem; color: var(--text-muted); padding: .25rem 0; }
.cic-group { border: 1px solid var(--border-subtle, var(--border)); border-left-width: 3px; border-radius: 6px; padding: .5rem .6rem; background: var(--surface); }
.cic-group.cic-sev-action { border-left-color: var(--danger); }
.cic-group.cic-sev-warn { border-left-color: var(--warn); }
.cic-group.cic-sev-info { border-left-color: var(--text-muted); }
.cic-group-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin-bottom: .35rem; }
.cic-badge { font-size: .64rem; font-weight: 700; letter-spacing: .02em; padding: .1rem .4rem; border-radius: 4px; text-transform: uppercase; }
.cic-badge-action { background: var(--danger-light); color: var(--danger); }
.cic-badge-warn { background: var(--warn-light); color: var(--warn-text); }
.cic-badge-info { background: var(--border); color: var(--text-secondary); }
.cic-status-code { font-size: .68rem; font-family: var(--font-mono, monospace); color: var(--text-muted); }
.cic-review-status { font-size: .62rem; font-weight: 700; letter-spacing: .02em; padding: .08rem .35rem; border-radius: 4px; background: var(--border); color: var(--text-secondary); text-transform: uppercase; }
.cic-msg-empty { color: var(--text-muted); font-style: italic; }
.cic-attr-chip { font-size: .7rem; font-weight: 600; padding: .12rem .45rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-alt); color: var(--text-secondary); }
button.cic-attr-chip.is-link { cursor: pointer; color: var(--primary); border-color: var(--primary-light, var(--border)); }
button.cic-attr-chip.is-link:hover { background: var(--primary-light); }
.cic-group-msg { font-size: .8rem; color: var(--text); line-height: 1.4; }
.cic-msg-line { margin: .1rem 0; }
.cic-group-foot { display: flex; align-items: center; gap: .6rem; margin-top: .4rem; flex-wrap: wrap; }
.cic-reviewers, .cic-reviewers-static { font-size: .72rem; color: var(--text-secondary); }
.cic-reviewers summary { cursor: pointer; }
.cic-reviewer-list { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.cic-gln { font-family: var(--font-mono, monospace); font-size: .68rem; background: var(--surface-alt); border: 1px solid var(--border-subtle, var(--border)); border-radius: 4px; padding: .05rem .35rem; color: var(--text-secondary); }
.cic-date { margin-left: auto; font-size: .68rem; color: var(--text-muted); }
.cic-focus-flash { animation: cic-focus-flash 1.4s ease-out; }
@keyframes cic-focus-flash { 0% { background: var(--primary-light); } 100% { background: transparent; } }
/* GS1 identifier validation (PRDC-18): GTIN-14 / GLN-13 fields that
   fail the length or checksum check get a red border + a red
   exclamation badge. The badge sits left of the char-count (which
   stays at right:6px) so the two never overlap; its `title` carries
   the human-readable reason on mouseover. */
.id-warn-icon { position: absolute; right: 28px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: var(--danger); color: var(--on-accent); font-weight: 700; font-size: .72rem; line-height: 1; cursor: help; font-family: var(--font-sans, system-ui, sans-serif); }
.id-warn-icon[hidden] { display: none; }
.edit-input.invalid-id { border-color: var(--danger); background: var(--danger-light); color: var(--danger); }
.edit-input.invalid-id:focus { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.18); }
/* PRDC-7: inline status beneath the GTIN input when a loaded item's
   GTIN is manually changed — blocking red when the GTIN already
   exists upstream, green when a new item will be created, plus an
   Undo affordance to restore the originally loaded GTIN. */
.gtin-change-status { margin-top: .4rem; display: flex; align-items: center; gap: .45rem; font-size: .74rem; line-height: 1.35; padding: .35rem .55rem; border-radius: var(--radius-sm); }
.gtin-change-status[data-state="checking"] { background: var(--bg-tertiary); color: var(--text-muted); }
.gtin-change-status[data-state="invalid"],
.gtin-change-status[data-state="changed"] { background: var(--bg-tertiary); color: var(--text-secondary); }
.gtin-change-status[data-state="exists"] { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary); }
.gtin-change-status[data-state="newitem"] { background: var(--success-light); color: var(--success); border: 1px solid var(--success); }
.gtin-change-status .gcs-icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; font-weight: 700; font-size: .72rem; }
.gtin-change-status[data-state="exists"] .gcs-icon { background: var(--primary); color: var(--on-accent); }
.gtin-change-status[data-state="newitem"] .gcs-icon { background: var(--success); color: var(--on-accent); }
.gtin-change-status .gcs-text { flex: 1 1 auto; }
/* GTIN cell: the field + an inline Undo icon sit on one row
   (`.gtin-line`); the PRDC-7 create/update status stacks beneath
   (`.gtin-cell`). */
.gtin-line { display: flex; align-items: center; gap: .4rem; }
.gtin-line .input-wrap { flex: 1 1 auto; min-width: 0; }
/* Conventional Undo button: counter-clockwise arrow + "Undo" label. */
.gtin-undo-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-secondary); font-size: .72rem; font-weight: 600; line-height: 1; cursor: pointer; transition: all .15s; white-space: nowrap; }
.gtin-undo-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.gtin-undo-btn .gub-icon { display: block; }
/* Check-digit ghost completion for a 13-digit GTIN (PRDC-7 follow-up).
   Positioned by JS at the measured end of the typed text (see
   `_showGtinGhost`), so the gray check digit lands immediately after
   the last digit regardless of the surrounding layout. */
.gtin-ghost { position: absolute; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); font-size: .85rem; line-height: 1; white-space: pre; pointer-events: none; z-index: 1; display: inline-flex; align-items: center; }
.gtin-ghost .gg-suggest { color: var(--text-muted); }
/* Tab indicator — subtle light-gray outlined button. */
.gtin-ghost .gg-tab { margin-left: .4rem; font-family: var(--font-sans, system-ui, sans-serif); font-size: .6rem; font-weight: 600; line-height: 1; color: var(--text-muted); background: transparent; border: 1px solid var(--border); border-radius: 4px; padding: .14rem .4rem; }
.schema-len { font-weight: 400; opacity: .55; font-size: .65rem; margin-left: .2rem; text-transform: none; letter-spacing: normal; }
.attr-hint { margin-top: .25rem; font-size: .72rem; color: var(--text-muted); font-style: italic; line-height: 1.3; }
/* `?` help affordance next to a field label — shows the field's
   description as a styled tooltip on hover/focus (byrd-style). */
.attr-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: .35rem; vertical-align: middle;
  border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-tertiary); color: var(--text-muted);
  font-size: .66rem; font-weight: 700; line-height: 1; cursor: help;
  position: relative; user-select: none;
}
.attr-help:hover, .attr-help:focus {
  background: var(--primary); color: var(--on-accent); border-color: var(--primary); outline: none;
}
.attr-help::after {
  content: attr(data-tip);
  position: absolute; left: 50%; top: calc(100% + 9px); transform: translateX(-50%);
  width: max-content; min-width: 200px; max-width: 320px;
  background: var(--tooltip-bg); color: var(--tooltip-text); font-weight: 400; font-style: normal;
  font-size: .72rem; line-height: 1.45; text-align: left; letter-spacing: normal;
  padding: .5rem .65rem; border-radius: 6px;
  box-shadow: 0 10px 26px -10px rgba(0,0,0,.55);
  white-space: normal; opacity: 0; visibility: hidden; transition: opacity .12s;
  z-index: 60; pointer-events: none;
}
.attr-help::before {
  content: ""; position: absolute; left: 50%; top: calc(100% + 3px); transform: translateX(-50%);
  border: 6px solid transparent; border-bottom-color: var(--tooltip-bg);
  opacity: 0; visibility: hidden; transition: opacity .12s; z-index: 60; pointer-events: none;
}
.attr-help:hover::after, .attr-help:focus::after,
.attr-help:hover::before, .attr-help:focus::before { opacity: 1; visibility: visible; }
/* Referenced-file list: one collapsible card per file (byrd-style). */
.reffile-list { display: flex; flex-direction: column; gap: .4rem; }
.reffile-card { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.reffile-card-head { display: flex; align-items: center; gap: .5rem; padding: .5rem .65rem; background: var(--bg-tertiary); cursor: pointer; font-size: .78rem; user-select: none; }
.reffile-card-head:hover { background: var(--bg-tertiary); filter: brightness(.985); }
.reffile-card-caret { color: var(--text-muted); transition: transform .15s; flex-shrink: 0; font-size: 1rem; line-height: 1; }
.reffile-card.open .reffile-card-caret { transform: rotate(90deg); }
.reffile-card-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary); }
.reffile-card-title strong { color: var(--text); }
.reffile-card-body { padding: .15rem .65rem .5rem; }
.reffile-card-body.hidden { display: none; }
/* Keep each file's field rows compact (label + value side by side) even
   when the block renders full-width inside the compare view — otherwise
   the accordion's 38% right-aligned label column floats the labels far
   from their inputs. */
.reffile-card-body .attr-table { max-width: 660px; margin: 0; }
.reffile-card-body .attr-table td:first-child { width: 230px; }
.reffile-card-body .attr-table td:last-child { width: auto; }
.reffile-card-body .attr-table td:last-child .input-wrap { max-width: 100%; }
.reffile-card-body .attr-table td:last-child .gpc-field { flex-basis: auto; max-width: 100%; }
/* Compare-mode referenced-file table fills the card width (4 columns). */
.reffile-card-body .reffile-compare-table { max-width: none; }
.reffile-card-body .reffile-compare-table .cmp-mapped .input-wrap { max-width: 100%; }
/* Per-card "Take all / Skip all" controls in the card head. */
.reffile-cmp-bulk { display: inline-flex; gap: .35rem; margin-left: auto; flex: 0 0 auto; }
.reffile-cmp-bulk-btn {
  font-size: .68rem; font-weight: 600; line-height: 1; cursor: pointer;
  padding: .25rem .55rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary);
  transition: all .12s;
}
.reffile-cmp-bulk-btn:hover { border-color: var(--text-muted); color: var(--text-primary); }
.reffile-cmp-bulk-btn.take { border-color: var(--success); color: var(--success); }
.reffile-cmp-bulk-btn.take:hover { background: var(--success); color: var(--on-accent); }
/* Attribute-row labels (the left-hand cell of each attribute row, e.g.
   "gln", "brandName"). Hovering reveals the technical key the field
   maps to (e.g. `informationProviderGLN`) via the native browser title
   tooltip — useful when reading a CIN XML or talking with a backend
   engineer who only knows canonical keys. The dotted underline +
   help-cursor are the affordance that the label is hoverable. */
.attr-label-name { cursor: help; }
.attr-label-name:hover { color: var(--primary); }

/* Subgroup header row inside an attribute table — used by the
   Hierarchy tab to visually separate "Case (carton)" fields from
   "Pallet (non-GTIN logistics unit)" fields while keeping them in
   the same tab. Sits flush with the table edges so it reads as a
   divider between two logical blocks, not a third row of data.   */
.attr-group-header > td {
  padding: .85rem .9rem .35rem !important;
  background: transparent !important;
  border-top: 1px solid var(--border) !important;
  border-bottom: none !important;
}
.attr-group-header:first-child > td { border-top: none !important; padding-top: .25rem !important; }
.attr-group-label {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Item-lookup success row — `Load Item` button that opens the side-by-
   side comparison view. Sits at the right of the green found-status
   row, visually distinct from the auto-coloured pill-tags around it. */
.item-lookup-status .lk-load-btn {
  margin-left: auto; padding: .15rem .55rem; border-radius: var(--radius-sm);
  background: var(--success); color: var(--on-accent); border: 1px solid var(--success);
  font-size: .72rem; font-weight: 600; cursor: pointer; line-height: 1.4;
}
.item-lookup-status .lk-load-btn:hover { filter: brightness(.92); }
/* `Load Item` click triggers an async CIN-XML fetch from app.byrd.io —
   while it's in flight the button gets `.lk-load-btn-loading`. Visually
   distinct (dimmed + cursor change) so users see the click landed even
   though the comparison view hasn't appeared yet (XML parse can take a
   second on big items). */
.item-lookup-status .lk-load-btn-loading { opacity: .65; cursor: progress; }
.item-lookup-status .lk-load-btn[disabled] { cursor: not-allowed; }

/* "Still loading…" escalation — appears in the lookup-status row only
   after ~1.2s of waiting (see `_scheduleStillLoadingIndicator`). The
   up-front `.lk-load-btn-loading` dim is reassuring for sub-second
   fetches; this is the "we noticed it's taking a moment, here's a
   visible spinner so you know we haven't frozen" message for slower
   upstream responses. Inserted as a sibling of the load button so
   the descriptor chip above it stays put. */
/* The .lk-still-loading chip used to live INSIDE
   .item-lookup-status; Phase C moved its anchor (Load Article
   button) into the new .mapping-toolbar, so the selectors are now
   unscoped — the chip just needs the same look wherever it's
   inserted. */
.lk-still-loading {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-left: .55rem; padding: .15rem .5rem;
  font-size: .7rem; font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: lk-fade-in .25s ease-out;
}
.lk-spinner {
  display: inline-block; width: 11px; height: 11px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: lk-spin .8s linear infinite;
  flex-shrink: 0;
}
@keyframes lk-spin { to { transform: rotate(360deg); } }
@keyframes lk-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* Respect users who have asked for reduced motion — keep the spinner
   static and skip the fade-in. They still get the "Still loading…"
   text + box, just without the rotation. */
@media (prefers-reduced-motion: reduce) {
  .lk-spinner { animation: none; }
  .lk-still-loading { animation: none; }
}

/* Modal "Still loading…" dialog for slow CIN-XML fetches.
   Replaces the inline `.lk-still-loading` chip the schedule
   helper used to insert next to the Load Article button —
   a centered modal is harder to miss when the user has scrolled
   down into the editor while the upstream is rendering the full
   GDSN document. Mirrors the structure of the byrd-login dialog
   below it (same backdrop alpha, same blur) so the family of
   modals reads consistently. */
.byrd-load-dialog-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: var(--backdrop); backdrop-filter: blur(6px);
  z-index: 1500;
  align-items: center; justify-content: center;
}
.byrd-load-dialog-backdrop.open { display: flex; }
.byrd-load-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem 1.5rem;
  min-width: 320px; max-width: 460px;
  display: flex; align-items: center; gap: .9rem;
  animation: lk-fade-in .18s ease-out;
}
.byrd-load-dialog-spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border);
  border-right-color: var(--accent-blue, var(--primary));
  border-radius: 50%;
  animation: lk-spin .8s linear infinite;
  flex-shrink: 0;
}
.byrd-load-dialog-text { display: flex; flex-direction: column; gap: .2rem; line-height: 1.35; }
.byrd-load-dialog-text strong { font-weight: 600; color: var(--text); font-size: .9rem; }
.byrd-load-dialog-text span    { font-size: .78rem; color: var(--text-secondary); }
@media (prefers-reduced-motion: reduce) {
  .byrd-load-dialog-spinner { animation: none; }
  .byrd-load-dialog        { animation: none; }
}

/* ============================================================ */
/* Comparison view — two-column attribute editor.                */
/* Activated by clicking "Load Item" in the lookup-status row.   */
/* Left column = read-only loaded item from app.byrd.io.         */
/* Right column = editable mapping (extracted + defaults).       */
/* Search / required-fields counter both naturally key off the   */
/* right column only because the left column has no inputs.      */
/* ============================================================ */
/* Padding tightened 2026-05-28 (`.35rem .6rem` was `.4rem .7rem`)
   so the banner sits more snugly inside the new Mapped Item
   widget wrapper alongside the toolbar above and the accordion
   below. */
.compare-banner {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  padding: .35rem .6rem;
  background: var(--accent-blue-light, var(--primary-light)); color: var(--accent-blue, var(--primary));
  border: 1px solid var(--accent-blue, var(--primary)); border-radius: var(--radius-sm);
  font-size: .74rem; line-height: 1.3;
}
.compare-banner .cmp-icon { font-size: .95rem; font-weight: 700; }

/* Compare-banner title ("Comparing mapped item to loaded item:") —
   bold so it reads as the banner's primary label rather than as
   one more inline span fighting the diff counter for attention.
   Slightly trimmed (`.84rem` vs the previous `.88rem`) to match
   the banner's tighter padding inside the wrapper card. */
.compare-banner .cmp-banner-title {
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .005em;
  color: var(--accent-blue, var(--primary));
  margin-right: .25rem;
}

/* "Editing draft {gtin}" banner — shown in the sticky mapping header
   while `editQueueItem()` has loaded a queue entry for editing (see
   `_renderEditingBanner`). Purely informational (no action button) —
   Save Draft always updates the same entry, however many times you
   edit and save it. Same accent-blue treatment as the compare banner
   above so "you're in a special editing context" reads as one
   consistent visual language across both features. */
.editing-draft-banner {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .35rem .6rem;
  background: var(--accent-blue-light, var(--primary-light)); color: var(--accent-blue, var(--primary));
  border: 1px solid var(--accent-blue, var(--primary)); border-radius: var(--radius-sm);
  font-size: .74rem; line-height: 1.3;
}

/* History tooltip — appears below the loaded-PK badge on hover, pulled
   from app.byrd.io's /api/v1/items/{pk}/history. Singleton instance
   attached to <body> so the absolute positioning is page-relative. */
.history-tooltip {
  position: absolute; z-index: 2000;
  background: var(--surface); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: .55rem .7rem; min-width: 380px; max-width: 520px;
  font-size: .78rem; line-height: 1.4;
  animation: history-fade-in .12s ease-out;
}
@keyframes history-fade-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
.history-tooltip .hist-title { font-weight: 600; font-size: .68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .45rem; padding-bottom: .35rem; border-bottom: 1px solid var(--border-subtle, var(--border)); }
.history-tooltip .hist-list { list-style: none; margin: 0; padding: 0; }
.history-tooltip .history-item { display: block; padding: .4rem 0; }
.history-tooltip .history-item + .history-item { border-top: 1px solid var(--border-subtle, var(--border)); }
.history-tooltip .hist-line-1 { display: flex; flex-wrap: wrap; gap: .35rem .8rem; align-items: baseline; }
.history-tooltip .hist-when { font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace; color: var(--text-secondary); font-size: .72rem; white-space: nowrap; }
.history-tooltip .hist-user { color: var(--text-primary); font-weight: 500; }
.history-tooltip .hist-count { color: var(--text-muted); font-style: italic; font-size: .72rem; margin-left: auto; }
.history-tooltip .hist-count-none { opacity: .6; }
/* Second line: up to 3 changed-attribute names. Wraps if any chip is
   too long for one line; the full key stays accessible via the chip's
   native `title` tooltip. */
.history-tooltip .hist-keys { font-size: .68rem; color: var(--text-secondary); margin-top: .3rem; padding-left: .15rem; line-height: 1.55; word-break: break-word; }
.history-tooltip .hist-key { font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace; }
.history-tooltip .hist-key-sep { color: var(--text-muted); }
.history-tooltip .hist-more { color: var(--text-muted); font-style: italic; margin-left: .35rem; }
.history-tooltip .hist-loading,
.history-tooltip .hist-empty,
.history-tooltip .hist-error { font-style: italic; color: var(--text-muted); padding: .25rem 0; }
.history-tooltip .hist-error { color: var(--primary); }
/* `.cmp-cols` legend strip was removed in the UI restructure
   (plan §4.7) — the LEFT/RIGHT/Take-direction hint moved into
   the per-section column headers (`_compareTableHeadHtml`) where
   the arrow + Source/Target labels carry the meaning more
   efficiently. The selectors above stayed in the stylesheet to
   avoid breaking external references (none today, but cheap
   insurance). */
.compare-banner .cmp-cols { display: none; }
/* "N of M" progress counter — only visible while reconciling
   (the JS toggles the `hidden` attribute via `_refreshDiffCount`).
   Sits next to the diff-count badge so the user can see both
   absolute progress and relative position at a glance. */
.compare-banner .cmp-progress-counter {
  display: inline-flex; align-items: center;
  padding: .2rem .5rem;
  font-size: .7rem; font-weight: 600; line-height: 1.1;
  color: var(--text-secondary);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}
.compare-banner .cmp-progress-counter[hidden] { display: none; }
/* First-time keyboard-shortcut tip (plan §4.10). Renders once,
   below the compare banner, the first time compare mode opens
   after this build. Dismiss state lives in localStorage so it
   doesn't re-appear on every page load. */
.compare-first-tip {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .7rem;
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: .76rem; line-height: 1.4;
}
.compare-first-tip .tip-icon { font-size: 1rem; flex: 0 0 auto; }
.compare-first-tip .tip-body { flex: 1 1 auto; }
.compare-first-tip kbd {
  display: inline-block; padding: 0 .35rem;
  font-family: var(--font-mono);
  font-size: .68rem; font-weight: 600;
  background: var(--glass-hover);
  color: var(--success);
  border: 1px solid var(--success);
  border-radius: 4px;
  margin: 0 .1rem;
}
.compare-first-tip .tip-dismiss {
  background: transparent; border: 0;
  color: inherit; font-size: 1.1rem; line-height: 1;
  padding: 0 .35rem; cursor: pointer;
  opacity: .65; transition: opacity .12s;
}
.compare-first-tip .tip-dismiss:hover { opacity: 1; }
/* Live counter of "changes still to take over" — i.e. remaining
   `tr.cmp-diff` rows. Updated by `_refreshDiffCount()` after every
   Take/Skip. Pulses subtly when the number drops to 0 so the user
   gets feedback that they're done before they go hunting for the
   exit button. */
.compare-banner .cmp-diff-count {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .55rem;
  font-size: .72rem; font-weight: 600; line-height: 1.1;
  color: var(--primary);
  background: var(--glass);
  border: 1px solid currentColor; border-radius: var(--radius-sm);
  transition: background .12s, transform .12s, box-shadow .12s;
}
/* Pending diffs → badge doubles as "jump to next diff" button. The
   affordance is subtle (cursor + hover lift) so the badge still
   reads as a counter first. */
.compare-banner .cmp-diff-count.cmp-diff-count-clickable { cursor: pointer; }
.compare-banner .cmp-diff-count.cmp-diff-count-clickable:hover {
  background: var(--glass-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(232, 61, 61, .18);
}
.compare-banner .cmp-diff-count.cmp-diff-count-clickable:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.compare-banner .cmp-diff-count-zero {
  color: var(--success);
  background: var(--success-light);
}
.compare-banner .cmp-diff-count-num { font-variant-numeric: tabular-nums; }

/* Per-section "N changes" badge in the accordion header. Visible in
   compare mode whenever the section has had at least one diff this
   session — blue while there's still work to do, gray once every
   diff has been Taken or Skipped. Stays visible even when fully
   resolved so the user can see at a glance which sections they've
   already worked through. */
.attr-accordion-diff {
  display: inline-flex; align-items: center; gap: .3rem;
  margin-left: .55rem; padding: .12rem .55rem;
  font-size: .68rem; font-weight: 700; line-height: 1.2;
  color: var(--accent-blue, var(--primary));
  background: var(--accent-blue-light, var(--primary-light));
  border: 1px solid currentColor;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  transition: color .15s, background .15s, border-color .15s;
}
/* "All diffs in this section reviewed" — calm gray with a tick.
   Keeps the badge visible (instead of removing it) so the user can
   distinguish "section had zero diffs" from "section had diffs and
   I've reviewed them all" at a glance. */
.attr-accordion-diff.attr-accordion-diff-done {
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-color: var(--border);
}
.attr-accordion-diff-icon { font-size: .85rem; line-height: 1; }

/* "Ignore empty values as change" checkbox — sits in the compare
   banner next to the count badge. Compact + uses the banner's own
   colour palette so it doesn't look bolted on. */
.compare-banner .cmp-ignore-empty {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .15rem .55rem; cursor: pointer; user-select: none;
  font-size: .7rem; color: var(--text-secondary);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.compare-banner .cmp-ignore-empty:hover { background: var(--glass-hover); }
.compare-banner .cmp-ignore-empty input { margin: 0; cursor: pointer; }
/* Filters row — segmented `Only differences / All attributes`
   control + Unresolved/Taken/Skipped/Matching chips. Moved INTO
   the compare banner 2026-05-28 at user request (was a standalone
   `.attr-search-wrap` widget between the banner and accordion).
   The wrapper carries `flex-basis: 100%` so it always wraps onto
   its own line inside the parent compare-banner flex container,
   and stays full-width so the inner `.diff-view-toolbar` can
   distribute the segmented control + chips left → right with the
   chips pushed right via `margin-left: auto` inside the toolbar. */
.compare-banner .cmp-banner-filters {
  flex-basis: 100%;
  display: flex;
  align-items: stretch;
  margin-top: .1rem;
}
.compare-banner .cmp-banner-filters .diff-view-toolbar {
  flex: 1 1 auto;
  /* Drop the standalone toolbar's outer border — the surrounding
     blue compare-banner already frames the cluster, and a second
     hard border around it inside the same surface reads as
     visual noise. The segmented control + chips keep their own
     per-element borders so the affordance reads clearly. */
  border: 0;
  background: transparent;
  padding: 0;
}
/* Close compare view — moved to the top line of the banner
   2026-05-28 at user request. `margin-left: auto` parks it on
   the right edge of the header row so the diff-counter /
   Ignore-empty / progress trio still cluster on the left and
   the close affordance reads as the row's natural dismiss
   target. Neutral grey treatment so it doesn't read as
   destructive; hover surfaces the accent-blue family (mirrors
   the customer-drawer trigger + Load Article button) so the
   close affordance feels connected to the compare-mode chrome
   it dismisses. */
.compare-banner .cmp-stop-close {
  margin-left: auto;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.compare-banner .cmp-stop-close:hover {
  background: var(--accent-blue-light, var(--primary-light));
  color: var(--accent-blue, var(--primary));
  border-color: var(--accent-blue, var(--primary));
}
.compare-banner .cmp-stop-prefix {
  font-size: .72rem; font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .01em;
  margin-right: .15rem;
  cursor: help;
}
.compare-banner .cmp-stop { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border-radius: var(--radius-sm); font-size: .72rem; font-weight: 600; cursor: pointer; line-height: 1.1; }
.compare-banner .cmp-stop-skip { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.compare-banner .cmp-stop-skip:hover { background: var(--primary); color: var(--on-accent); }
.compare-banner .cmp-stop-keep { background: transparent; color: var(--success); border: 1px solid var(--success); }
.compare-banner .cmp-stop-keep:hover { background: var(--success); color: var(--on-accent); }
/* Fast Forward — bulk-take everything. Uses the accent-blue family
   to carry "this is the bulk-accept option" without colliding with
   the destructive red of Revert or the neutral green of Keep. */
.compare-banner .cmp-stop-fast { background: transparent; color: var(--accent-blue, var(--primary)); border: 1px solid var(--accent-blue, var(--primary)); }
.compare-banner .cmp-stop-fast:hover { background: var(--accent-blue, var(--primary)); color: var(--on-accent); }
.compare-banner .cmp-stop-icon { width: 14px; height: 14px; flex: 0 0 auto; }
/* Disabled state — applies to Revert (when no Takes journal'd) and
   Fast Forward (when no remaining diffs). Driven by
   `_refreshStopComparingButtonStates` so the verbs visibly grey out
   the instant they cease to make sense. Keep is never disabled.
   Note: we deliberately leave `pointer-events` alone — the native
   `:disabled` attribute already blocks click activation, and
   keeping pointer events allows the `title` tooltip to surface
   the "why is this off?" explanation on hover. */
.compare-banner .cmp-stop:disabled,
.compare-banner .cmp-stop[disabled] {
    opacity: .45;
    cursor: not-allowed;
}
.compare-banner .cmp-stop:disabled:hover,
.compare-banner .cmp-stop[disabled]:hover {
    /* Defeat the per-verb hover background so disabled buttons
       don't "light up" on hover. */
    background: transparent;
}
.compare-banner .cmp-stop-skip:disabled:hover { color: var(--primary); }
.compare-banner .cmp-stop-fast:disabled:hover { color: var(--accent-blue, var(--primary)); }

/* Single 4-column comparison table — guarantees row-for-row vertical
   alignment because both "mapped" and "loaded" columns are <td>s of
   the same <tr>. CSS Grid / two separate tables can't promise this.
   Column order: label | mapped (editable) | loaded (read-only) | actions
   The mapped column is the work surface — kept on the LEFT, adjacent
   to the attribute label, so editing reads naturally L→R. The loaded
   column shows what byrd already has, and the actions on the far right
   let the user copy values right-to-left into the mapping. */
.attr-compare-table { table-layout: fixed; max-width: none !important; border-collapse: separate; border-spacing: 0; }
.attr-compare-table td { vertical-align: top; padding: .55rem .7rem !important; }
.attr-compare-table td.cmp-label { width: 16%; text-align: right !important; color: var(--text-secondary); font-weight: 500; padding-top: .85rem !important; }
.attr-compare-table td.cmp-mapped { width: 38%; background: var(--surface); border-right: 2px solid var(--accent-blue, var(--primary)); }
.attr-compare-table td.cmp-loaded { width: 30%; color: var(--text-secondary); padding-top: .85rem !important; background: var(--tint-subtle); }
/* Actions column carries 2 buttons (Take · Skip) since the bulk
   verbs moved to the section header. The slimmer column gives
   the mapped + loaded columns more room for actual content. */
.attr-compare-table td.cmp-actions { width: 16%; min-width: 150px; }

/* Column header row — repeated at the top of every section's compare
   table so the user always knows which side is which without scrolling
   back to the comparison banner. The lock icon flags the loaded
   column as read-only; the pencil flags the mapped column as
   editable. The vertical divider continues the same visual cue. */
.attr-compare-table .cmp-thead { display: table-header-group; }
.attr-compare-table .cmp-th {
  padding: .35rem .7rem !important; font-size: .68rem !important;
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted) !important; text-align: left !important;
  border-bottom: 1px solid var(--border);
  vertical-align: middle !important;
}
.attr-compare-table .cmp-th-label { text-align: right !important; }
.attr-compare-table .cmp-th-mapped { background: var(--accent-blue-light, var(--primary-light)); color: var(--accent-blue, var(--primary)) !important; border-right: 2px solid var(--accent-blue, var(--primary)); }
.attr-compare-table .cmp-th-loaded { background: var(--tint-soft); color: var(--text-secondary) !important; }
.attr-compare-table .cmp-th-sub { font-weight: 400; text-transform: none; opacity: .7; margin-left: .25rem; letter-spacing: 0; }
.attr-compare-table .cmp-col-icon { margin-right: .2rem; }
/* Header arrow on the Source column — communicates the Take
   direction (Source ➜ Target) inline, replacing the legend
   sentence that used to live in the compare banner. Floats to
   the right edge of the mapped header so it visually points at
   the loaded column next door. */
.attr-compare-table .cmp-th-arrow {
  float: right;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-blue, var(--primary));
  opacity: .85;
  margin-left: .35rem;
  line-height: 1;
}
.attr-compare-table .cmp-th-actions { text-align: center !important; }

/* Read-only loaded value rendering — pre-wrap so multilingual values
   wrap naturally; empty cells get a muted dash placeholder. */
.loaded-value { white-space: pre-wrap; word-break: break-word; font-family: inherit; }
.loaded-value.multiline { display: block; line-height: 1.5; }
.loaded-value-empty { color: var(--text-muted); font-style: italic; }

/* Diff highlight — light red background painted on every cell of the
   row (background on <tr> alone won't show through table cells in all
   browsers). The hover state is slightly more saturated for affordance. */
.attr-compare-table tr.cmp-diff > td { background: var(--diff-row-bg); }
.attr-compare-table tr.cmp-diff:hover > td { background: var(--diff-row-bg-hover); }
.attr-compare-table tr.cmp-diff > td.cmp-label { color: var(--primary); font-weight: 600; }
/* Left edge on the label cell. Skipped when the row is keyboard-focused
   so the blue focus ring (which uses the same inset box-shadow slot)
   still wins — the two can't coexist on one cell. */
.attr-compare-table tr.cmp-diff:not(.kbd-focused) > td.cmp-label {
  box-shadow: inset 3px 0 0 var(--diff-row-edge);
}
/* Resolved diff rows — Take + next OR Skip + next both leave a visible
   tick chip in the actions cell + de-highlight the row so the user
   can see at-a-glance which rows are still pending vs already
   reviewed. Skipped rows keep a faint red tinge on the loaded column
   to remind that the two values *still* differ (the user chose not
   to take the loaded one in). Taken rows go fully neutral. */
.attr-compare-table tr.cmp-resolved > td { background: var(--tint-subtle); }
.attr-compare-table tr.cmp-resolved:hover > td { background: var(--tint-soft); }
.attr-compare-table tr.cmp-resolved-skipped > td.cmp-loaded { background: var(--diff-skipped-bg); }
.cmp-done {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem; white-space: nowrap;
  font-size: .7rem; font-weight: 600; line-height: 1.1;
  border-radius: var(--radius-sm);
}
.cmp-done-taken { color: var(--success); background: var(--success-light); border: 1px solid rgba(34, 197, 94, .35); }
.cmp-done-skipped { color: var(--text-secondary); background: var(--tint-soft); border: 1px solid var(--border); }
.cmp-done-tick { width: 11px; height: 11px; flex: 0 0 auto; }
/* Per-row Undo affordance — small button right next to the
   "Taken" / "Skipped" chip in the actions cell. Hovering shows a
   native tooltip with the value Undo would restore (built in
   `_describeRowUndoPreview`). */
.cmp-done-wrap { display: inline-flex; align-items: center; gap: .3rem; }
.cmp-undo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: color .12s, background .12s, border-color .12s;
}
.cmp-undo:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.cmp-undo-icon { width: 13px; height: 13px; }

/* Per-row action buttons. Slimmed to 2 (Take · Skip) by the UI
   restructure (plan §4.6) — bulk "Take all" / "Skip all" verbs
   moved to the section header so they're not duplicated on every
   row. Primary actions handle the current row + advance to the
   next pending diff. */
.cmp-act-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; align-items: stretch; }
.cmp-act { font-size: .72rem; padding: .3rem .65rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); cursor: pointer; line-height: 1.3; transition: all .12s; text-align: center; font-weight: 500; }
.cmp-act-take { border-color: var(--success); color: var(--success); font-weight: 600; }
.cmp-act-take:hover { background: var(--success); color: var(--on-accent); }
.cmp-act-skip:hover { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--text-muted); }
/* Multi-select rows: Take · Add · Skip. Add keeps the organisation's codes. */
.cmp-act-wrap:has(.cmp-act-add) { grid-template-columns: 1fr 1fr 1fr; }
.cmp-act-add { border-color: var(--success); border-style: dashed; color: var(--success); font-weight: 600; }
.cmp-act-add:hover { background: var(--success); color: var(--on-accent); border-style: solid; }

/* Post-Take wrapper around the loaded cell. The actual value (which
   is what's now in the loaded item / export target) sits on the
   right with a small green tick prefix. The "Taken" chip in the
   actions cell carries the textual meaning — here we only need the
   visual cue (green tint + tick) so the user can see at-a-glance
   which loaded values were taken from the mapping vs which are
   still byrd-original. No header text — that was redundant with
   the actions-cell chip. */
.loaded-value-taken-wrap {
  display: flex; align-items: flex-start; gap: .4rem;
  padding: .35rem .5rem;
  background: var(--success-light);
  border: 1px solid rgba(34, 197, 94, .35);
  border-radius: var(--radius-sm);
}
.loaded-value-taken-tick-inline {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  color: var(--success);
  padding-top: .12rem;  /* nudge to align with first line of value */
}
.loaded-value-taken-content { font-size: inherit; color: var(--text-primary); flex: 1; min-width: 0; }
.loaded-value-taken-tick { width: 10px; height: 10px; flex: 0 0 auto; }

/* Narrow viewports — let the comparison table reflow. The 4-button
   grid stays as 2x2 (it's already as compact as it'll get); shrink
   label + mapped to give actions room. */
@media (max-width: 980px) {
  .attr-compare-table td.cmp-label { width: 13%; }
  .attr-compare-table td.cmp-mapped { width: 36%; }
  .attr-compare-table td.cmp-loaded { width: 28%; }
  .attr-compare-table td.cmp-actions { width: 23%; min-width: 0; }
  .cmp-act { font-size: .66rem; padding: .25rem .4rem; }
}

/* "Additional attributes from loaded item" section — synthetic block
   at the bottom of the accordion (compare mode only) listing fields
   the loaded item has but the standard schema doesn't cover. Read-only
   on both sides; styled neutral (not red) because there's nothing
   actionable here — the user is just being kept aware. */
.attr-accordion-header .extras-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 18px; padding: 0 .35rem; margin-left: .35rem;
  background: var(--bg-tertiary); color: var(--text-secondary);
  border-radius: 9px; font-size: .68rem; font-weight: 600;
}
/* Extras rows get the same red diff-highlight treatment as standard
   diff rows (because the right side is now a real input that needs
   Take/Skip just like everything else). The italic label is the
   only persistent cue that this attribute isn't part of the
   standard schema — survives after the diff is resolved. */
.attr-extras-table tr.cmp-extra > td.cmp-label {
  color: var(--text-secondary); font-style: italic;
}
/* Subtle thinner-than-default font for extras inputs, to visually
   distinguish them from standard schema fields without screaming. */
.cmp-extra-input { font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace !important; font-size: .76rem !important; }
.cmp-extra-input::placeholder { font-family: inherit; font-style: italic; opacity: .55; }

/* Structured editor for repeatable GDSN sub-records (referencedFile-
   Information, packagings, dataCarriers, tradeItemFeatureBenefits,
   additionalTradeItemIdentifications, etc.). One repeatable group =
   multiple `<.cmp-struct-row>` blocks, each containing the named
   sub-fields defined in `_BYRD_EXTRA_SCHEMAS`. A hidden textarea
   carries the JSON serialisation for the form collector. */
.cmp-struct-group { display: flex; flex-direction: column; gap: .35rem; }
.cmp-struct-rows { display: flex; flex-direction: column; gap: .35rem; }
.cmp-struct-row {
  display: flex; gap: .4rem; align-items: flex-start;
  padding: .45rem .55rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.cmp-struct-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .55rem;
  flex: 1; min-width: 0;
}
.cmp-struct-field { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.cmp-struct-field-wide { grid-column: 1 / -1; }
.cmp-struct-field-label { font-size: .62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.cmp-struct-input {
  width: 100%; padding: .25rem .45rem; font-size: .76rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
  background: var(--surface-alt); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 3px;
}
.cmp-struct-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }
.cmp-struct-remove {
  flex: 0 0 auto; width: 22px; height: 22px;
  background: transparent; border: 1px solid var(--border); border-radius: 3px;
  color: var(--text-muted); cursor: pointer; font-size: .9rem; line-height: 1;
}
.cmp-struct-remove:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.cmp-struct-add {
  align-self: flex-start; padding: .25rem .65rem;
  background: transparent; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: .68rem; font-weight: 500; cursor: pointer;
}
.cmp-struct-add:hover { border-color: var(--primary); color: var(--primary); border-style: solid; }

/* Loaded-side structured display — stacked named-field cards, one per
   array entry, replacing the dense JSON dump that used to show here. */
.cmp-struct-loaded { display: flex; flex-direction: column; gap: .35rem; }
.cmp-struct-loaded-card {
  padding: .35rem .5rem; background: var(--tint-subtle);
  border-left: 2px solid var(--border); border-radius: 3px;
  font-size: .72rem; line-height: 1.45;
}
.cmp-struct-loaded-card-idx { font-weight: 600; color: var(--text-muted); margin-right: .35rem; font-size: .68rem; }
.cmp-struct-loaded-line { display: block; word-break: break-word; }
.cmp-struct-loaded-key { font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace; color: var(--text-muted); font-size: .68rem; }
.cmp-struct-loaded-val { color: var(--text-primary); }
.cmp-struct-loaded-line-extra .cmp-struct-loaded-key { font-style: italic; opacity: .7; }

/* Mandatory validation (byrd-aligned, single-state):
   - .mandatory       is an invisible HOOK marking a required field. It
                      paints nothing on its own — filled required fields
                      look like any other field.
   - .mandatory-error (red) is applied by the validators whenever a
                      required field is EMPTY (on load and live), and
                      stripped the moment it's filled.
   No amber "to-do" state — an empty required field reads as a red error,
   matching app.byrd.io. */
.edit-input.mandatory-error, .edit-textarea.mandatory-error { border-color: var(--mandatory-error-border); background: var(--mandatory-error-bg); }
.edit-input.mandatory-error:focus, .edit-textarea.mandatory-error:focus { border-color: var(--mandatory-error-border); box-shadow: 0 0 0 3px var(--mandatory-error-glow); background: var(--input-bg); }
.ml-group.mandatory-error .edit-input.ml-val { border-color: var(--mandatory-error-border); background: var(--mandatory-error-bg); }
.ml-group.mandatory-error .edit-input.ml-val:focus { border-color: var(--mandatory-error-border); box-shadow: 0 0 0 3px var(--mandatory-error-glow); background: var(--input-bg); }
.bool-input.mandatory-error { outline: 1px solid var(--mandatory-error-border); outline-offset: 4px; border-radius: 4px; }
.overwritten-badge { display: inline-flex; align-items: center; gap: .2rem; padding: .02rem .3rem; border-radius: 3px; font-size: .58rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; margin-left: .25rem; background: var(--accent-light); color: var(--accent); position: relative; }
.overwritten-badge .ow-tip { visibility: hidden; opacity: 0; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--text); color: white; padding: .3rem .6rem; border-radius: var(--radius-sm); font-size: .68rem; font-weight: 400; white-space: nowrap; text-transform: none; letter-spacing: normal; z-index: 500; pointer-events: none; transition: opacity .15s; box-shadow: var(--shadow-md); }
.overwritten-badge .ow-tip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--text); }
.overwritten-badge:hover .ow-tip { visibility: visible; opacity: 1; }
.btn-revert { background: none; border: none; color: var(--accent); cursor: pointer; font-size: .7rem; padding: 0 .15rem; font-weight: 700; line-height: 1; text-transform: none; letter-spacing: normal; }
.btn-revert:hover { color: var(--primary); }

/* multilingual rows */
.ml-group { display: flex; flex-direction: column; gap: .3rem; }
.ml-row { display: flex; gap: .3rem; align-items: flex-start; }
.ml-row select { width: 55px; padding: .28rem .2rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .78rem; font-family: var(--font-mono); color: var(--text); background: var(--bg-tertiary); flex-shrink: 0; }
.ml-row select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.ml-row .edit-input, .ml-row .edit-textarea { flex: 1; }
/* The value box must grow into the row: with only a basis of 0 (agree-chip
   rows) and `overflow-wrap: anywhere`, it collapsed to one character wide. */
.ml-row > .input-wrap { flex: 1 1 0; min-width: 8rem; }
/* Read-only auto sequence number badge (marketing message) — mirrors
   app.byrd.io's Language + Sequence Number + Message layout. */
.ml-row .ml-seq { flex-shrink: 0; align-self: flex-start; min-width: 28px; height: 28px; padding: 0 .35rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-tertiary); color: var(--text-muted); font-family: var(--font-mono); font-size: .78rem; display: flex; align-items: center; justify-content: center; user-select: none; }
.ml-row .btn-remove { flex-shrink: 0; width: 22px; height: 22px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.ml-row .btn-remove:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
.ml-add { display: inline-flex; align-self: flex-start; align-items: center; gap: .2rem; padding: .15rem .5rem; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-sm); font-size: .7rem; font-weight: 500; cursor: pointer; color: var(--text-secondary); }
.ml-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.tag { display: inline-block; padding: .12rem .4rem; border-radius: 5px; font-size: .75rem; font-weight: 500; margin: .1rem .15rem .1rem 0; }
.tag-green { background: var(--success-light); color: var(--success); }

.header-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.btn-reset, .btn-export-xml, .btn-export-mpim {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .9rem; border-radius: 8px;
  font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
  letter-spacing: .005em;
}
.btn-reset { background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); }
.btn-reset:hover:not(:disabled) { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.btn-export-xml { background: linear-gradient(135deg, var(--success), #007a5b); border: 1px solid rgba(0,122,91,.5); color: #fff; box-shadow: 0 4px 14px rgba(0,166,125,.22); }
.btn-export-xml:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,166,125,.28); }
/* Upload button — RESTYLED 2026-05-28 from indigo gradient to the
   brand-red `var(--primary)` so it joins the same primary-CTA
   family as Map data and Add to Queue. Editor's three primary
   verbs (Map data → Add to Queue → Upload) now read as one
   consistent red colour stack from top to bottom. */
.btn-export-mpim { background: linear-gradient(135deg, var(--brand-charcoal), var(--brand-charcoal-dark)); border: 1px solid var(--brand-charcoal); color: #fff; box-shadow: 0 4px 14px rgba(52,57,59,.22); }
.btn-export-mpim:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(11,210,197,.30); }
.btn-reset svg, .btn-export-xml svg, .btn-export-mpim svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-reset:disabled, .btn-export-xml:disabled, .btn-export-mpim:disabled { opacity: .5; cursor: not-allowed; transform: none; }
/* "Add to Queue" button — RESTYLED at user request (2026-05-28) to
   match the brand-red "Map data" button so the user sees the
   primary action verbs in the editor (Map data → Add to Queue
   → Upload) as one consistent red-CTA family. Previously rendered
   in a green gradient that visually competed with the green
   "✓ Found in organisation" lookup status. The mirror selector
   below `.upload-toolbar .toolbar-btn.primary` is the source of
   truth for the colour pair — we replicate it here rather than
   cross-import the class so the button can keep its own padding
   / border-radius scheme. */
.btn-queue {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .9rem;
  background: linear-gradient(135deg, var(--brand-charcoal), var(--brand-charcoal-dark));
  border: 1px solid var(--brand-charcoal);
  border-radius: var(--radius-sm);
  font-size: .8rem; font-weight: 600;
  cursor: pointer; color: #fff;
  box-shadow: 0 4px 14px rgba(52,57,59,.22);
  transition: all .15s;
}
.btn-queue:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(11,210,197,.30);
}
.btn-queue:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.queue-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn); color: var(--on-accent); font-size: .65rem; font-weight: 700; margin-left: .25rem; }
/* `.queue-section`, `.queue-list`, `.queue-item` and friends were
   removed in 0.3.0 along with the legacy under-header queue ribbon
   — the side panel (`#queuePanel`) is now the only queue surface
   beyond the header chip counter. */

/* ============================================================ */
/* QW-3: visually subordinate the "Other files" group.            */
/* ============================================================ */
.gtin-group.is-other {
  background: var(--surface-alt) !important;
  border-style: dashed !important;
  border-color: var(--border) !important;
}
.gtin-group.is-other .gtin-group-title {
  color: var(--text-muted) !important;
  font-size: .7rem !important;
  font-weight: 500 !important;
}
.gtin-group-title-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: .35rem;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: 50%; font-size: .6rem; font-weight: 700;
  color: var(--text-muted); cursor: help; user-select: none;
  position: relative;
}
.gtin-group-title-help:hover { background: var(--accent-blue-light); border-color: var(--accent-blue); color: var(--accent-blue); }
.gtin-group-title-help::after {
  content: attr(data-help);
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: white;
  padding: .35rem .55rem; border-radius: var(--radius-sm);
  font-size: .68rem; font-weight: 400;
  white-space: normal; width: max-content; max-width: 240px;
  text-transform: none; letter-spacing: normal;
  opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s;
  box-shadow: var(--shadow-md); pointer-events: none; z-index: 50;
  text-align: center;
}
.gtin-group-title-help:hover::after { opacity: 1; visibility: visible; }

/* ============================================================ */
/* "Mapped Item" widget — a card that surrounds the mapping       */
/* toolbar, the compare banner, the diff-view toolbar, AND the    */
/* whole attribute accordion as ONE collapsible unit (revised at  */
/* user request 2026-05-28). Mirrors `.material-section` so the   */
/* Uploaded Material + Mapped Item widgets in the editor read as  */
/* a matched source → destination pair, both with the same chrome,*/
/* both collapsible from a header chevron.                        */
/*                                                                */
/* CRITICAL: this wrapper does NOT clip overflow. The sticky      */
/* mapping-toolbar inside escapes upward to the viewport via      */
/* `position: sticky`, and the Add-to-Queue / Map-data /          */
/* org-login speech bubbles need to escape downward / sideways.   */
/* Border-radius corners are handled per-child via explicit       */
/* `border-top-*-radius` on the title bar.                        */
/* ============================================================ */
.mapping-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: .55rem;
  display: flex; flex-direction: column;
  /* Keep the Mapped Item title clear of the sticky top bar when
     `editQueueItem` scrolls it to the top of the viewport. */
  scroll-margin-top: 80px;
}
.mapping-section .mapping-section-title {
  padding: .55rem 1rem;
  font-weight: 600;
  font-size: .82rem;
  background: linear-gradient(180deg, var(--surface), var(--bg-tertiary));
  border-bottom: 1px solid var(--border);
  border-top-left-radius: calc(var(--radius-lg) - 1px);
  border-top-right-radius: calc(var(--radius-lg) - 1px);
  display: flex;
  align-items: center;
  gap: .55rem;
}
.mapping-section .mapping-section-title .section-icon { flex-shrink: 0; }
.mapping-section .mapping-section-title .material-title-main { display: inline-flex; align-items: center; gap: .55rem; min-width: 0; }
/* Title-bar chevron (opens the widget's action menu) — same treatment
   as the Uploaded Material widget's `.material-collapse-toggle` so the
   two headers read alike. */
.mapping-section .mapping-section-title-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
}
.mapping-section .mapped-item-menu-wrap { position: relative; display: inline-flex; }
.mapping-section .mapping-section-menu-trigger svg { width: 14px; height: 14px; display: block; }
.mapping-section .mapping-section-menu-trigger,
.mapping-section .mapping-section-close {
  width: 22px; height: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 6px; padding: 0; line-height: 1;
  cursor: pointer; flex-shrink: 0;
  transition: background .12s, border-color .12s, color .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.mapping-section .mapping-section-menu-trigger:hover,
.mapping-section .mapping-section-menu-trigger[aria-expanded="true"],
.mapping-section .mapping-section-close:hover {
  background: var(--accent-blue-light);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}
.mapping-section .mapping-section-close svg {
  width: 12px; height: 12px; display: block;
}
/* Padded to leave a visible gutter between the title bar and the
   inner toolbar / banner / accordion. */
.mapping-section .mapping-section-body {
  padding: .55rem .65rem .65rem;
  display: flex; flex-direction: column; gap: .4rem;
}
/* Extraction Summary — collapsible overview card pinned at the top of
   the Mapped Item (below the sticky toolbar, above the accordion). */
.extraction-summary-top {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: .55rem;
  overflow: hidden;
}
.extraction-summary-top > .extraction-summary-top-title {
  padding: .5rem .85rem;
  font-weight: 600;
  font-size: .82rem;
  color: var(--text-secondary);
  background: linear-gradient(180deg, var(--surface), var(--bg-tertiary));
  cursor: pointer;
  list-style: revert;
  user-select: none;
}
.extraction-summary-top[open] > .extraction-summary-top-title {
  border-bottom: 1px solid var(--border);
}
/* Compliance Score badge (label + pill) sits at the far right of the
   summary header. `float` keeps the native <summary> disclosure
   triangle intact (a flex summary would drop the marker). The whole
   group hides when the pill itself is hidden (flag off / no data) so
   the "Compliance" label never shows without a score. */
.extraction-summary-top-title .cs-header-badge { float: right; display: inline-flex; align-items: center; gap: .4rem; margin-top: -2px; }
.extraction-summary-top-title .cs-header-badge:has(.compliance-score-pill[hidden]) { display: none; }
.extraction-summary-top-title .cs-header-label { font-size: .82rem; font-weight: 600; color: var(--text-secondary); text-transform: none; }
.extraction-summary-top-body { padding: .35rem .5rem .5rem; }

/* ============================================================ */
/* Phase C: Mapping sticky header. A single sticky wrapper that   */
/* holds the mapping toolbar AND (in compare mode) the comparison */
/* banner so the two stack as one block at the top of the         */
/* viewport. Wrapping (vs each child being its own sticky sibling)*/
/* is what keeps the comparison banner anchored directly under    */
/* the toolbar without overlap once both reach the sticky offset. */
/* Now lives INSIDE `.mapping-section-body` (the Mapped Item      */
/* widget). Bottom margin removed; the body's gap handles spacing.*/
/* ============================================================ */
.mapping-sticky-header {
  position: sticky;
  top: 64px;
  z-index: 60;
  display: flex; flex-direction: column; gap: .4rem;
  /* Solid background so the accordion scrolls *under* the header
     instead of bleeding through translucent gaps between the
     toolbar and banner. */
  background: var(--surface);
  padding-bottom: .15rem;
}
/* Mapping toolbar — fixed two-row layout. The old top-level
   "Mapped Item" title bar that used to live inside this widget
   was hoisted up into the wrapping `.mapping-section-title`
   above (so the title now spans the whole Mapped Item widget
   instead of just the toolbar). The toolbar itself is now a
   borderless action strip — its surface is the body of the
   Mapped Item card, so a second border would look noisy.
     Row 1: [Search] [Checking organisation…] …… [Start new article] [Add to Queue]
     Row 2 (only for a resolved status): ✓ Article … found ……… [Load Article]
   Row 1 zones never reflow into each other; the search field has
   a fixed width, an `auto` margin on the action group keeps the
   buttons anchored to the right edge regardless of how much
   horizontal space the search takes. Row 2 only appears while the
   upstream lookup has a resolved status (found / error) to
   report — collapsed otherwise, so an unresolved or not-found PK
   leaves no gap; the Load Article button right-aligns inside the
   row when a found PK is available. */
.mapping-toolbar {
  padding: .35rem .5rem;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  /* Important: do NOT clip overflow here. The "Add to Queue"
     speech-bubble callout (rendered absolutely positioned just
     below the button in row 1) needs to escape the toolbar
     bounds. */
}
/* Inner action rows — no separate "title" inside the toolbar
   anymore (the title moved to the widget wrapper above), so the
   previous `.mapping-toolbar-rows` wrapper was simplified. */
.mapping-toolbar .mapping-toolbar-rows {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.mapping-toolbar .mapping-toolbar-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: nowrap;
  min-width: 0;
}
/* Row 2 only holds the live rules chip, right-aligned under the action
   buttons; `refreshMappingToolbarStatus` hides the whole row while the
   chip is hidden, so no blank space is reserved. `min-height` just keeps
   the toolbar from jittering while the chip's height settles. */
.mapping-toolbar .mapping-toolbar-row-2 {
  min-height: 1.4rem;
  justify-content: flex-end;
}
/* `.mapping-toolbar-row` above sets `display: flex` unconditionally,
   which (being author CSS) would otherwise beat the browser's default
   `[hidden] { display: none }` regardless of specificity — this rule
   is what actually makes the `hidden` attribute collapse the row. */
.mapping-toolbar .mapping-toolbar-row-2[hidden] { display: none; }
/* Row-1 search field — never grows, so the action buttons don't drift
   as the viewport reshuffles. 300px fits the English placeholder; it
   shrinks (down to 200px) to give the "Article found" chips room. */
.mapping-toolbar .attr-search-inputrow {
  flex: 0 1 300px;
  min-width: 200px;
  max-width: 100%;
}
.mapping-toolbar .attr-search-inputrow input {
  padding: .4rem .75rem .4rem 2rem;
  font-size: .78rem;
  /* Inset field on the now-white toolbar so the search box stays
     visible (guide: inset fields use --bg-tertiary). */
  background: var(--bg-tertiary);
}
/* Transient organisation lookup progress sits directly after the search
   field. It stays on row 1 so showing/hiding it while GTIN/GLN is edited
   cannot add and remove a toolbar row (which made the attributes jump). */
.mapping-toolbar .item-lookup-checking-status {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 0;
  padding: .25rem 0;
  flex-wrap: nowrap;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: transparent;
  color: var(--text-muted);
}
.mapping-toolbar .item-lookup-checking-status[hidden] { display: none; }
.mapping-toolbar .item-lookup-checking-status .lk-pk {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Primary action group — Start new article + green "Add to Queue".
   `margin-left: auto` parks it against the row's right edge, so
   the right-alignment is preserved even when the search field is
   narrow. */
.mapping-toolbar .mapping-primary-group {
  display: inline-flex; align-items: stretch; gap: .35rem;
  flex-shrink: 0;
  margin-left: auto;
}
.mapping-toolbar .mapping-primary-group .btn-queue {
  padding: .35rem .8rem;
  font-size: .76rem;
  border-radius: 6px;
}
/* The resolved "Article found" status sits on row 1 between the search
   field and Load Article, and fills the space between them. It stays on
   one line: the PK / descriptor / last-change chips shrink with an
   ellipsis (full value in their `title`), while the icon, label and
   buttons keep their size. No `overflow: hidden` on the box itself, so
   the CIC count bubble above its button is not clipped. */
.mapping-toolbar .mapping-toolbar-row-1 .item-lookup-status {
  flex: 1 1 auto; min-width: 0; margin-left: 0; flex-wrap: nowrap;
}
.mapping-toolbar .mapping-toolbar-row-1 .item-lookup-status[hidden] { display: none; }
.mapping-toolbar .mapping-toolbar-row-1 .item-lookup-status > * { flex: 0 0 auto; }
.mapping-toolbar .mapping-toolbar-row-1 .item-lookup-status .lk-label { font-weight: 600; white-space: nowrap; }
.mapping-toolbar .mapping-toolbar-row-1 .item-lookup-status .lk-pk,
.mapping-toolbar .mapping-toolbar-row-1 .item-lookup-status .lk-meta {
  flex: 0 1 auto; min-width: 2.5em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mapping-toolbar .mapping-toolbar-row-1 .btn-load-article { margin-left: 0; }
/* Live byrd-rules chip: result of checking the current edits. Clickable
   when there is a list to open. */
.byrd-live-status {
  flex: 0 0 auto;
  display: inline-flex; align-items: center;
  font: inherit; font-size: .74rem; font-weight: 600;
  padding: .2rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}
.byrd-live-status[hidden] { display: none; }
.byrd-live-status.byrd-live-muted { color: var(--text-muted); cursor: default; }
.byrd-live-status.byrd-live-busy { color: var(--text-muted); }
.byrd-live-status.byrd-live-ok { color: var(--success); border-color: var(--success); }
.byrd-live-status.byrd-live-warn { color: var(--warn-text); background: var(--warn-light); border-color: var(--warn); }
.byrd-live-status.byrd-live-err { color: var(--danger-text); background: var(--danger-light); border-color: var(--danger); }
.byrd-live-status.byrd-live-stale { opacity: .55; }
/* Load Article button — same accent-blue treatment as before;
   only renders when a found PK is available. `margin-left: auto`
   pushes it to the right edge of row 2 even when the status
   block doesn't grow to fill the full width. */
.mapping-toolbar .btn-load-article {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .65rem;
  background: var(--accent-blue, var(--primary));
  color: #fff; border: 1px solid var(--accent-blue, var(--primary));
  border-radius: var(--radius-sm);
  font-size: .75rem; font-weight: 600; cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
  margin-left: auto;
}
.mapping-toolbar .btn-load-article:hover:not(:disabled) { filter: brightness(.92); }
.mapping-toolbar .btn-load-article:disabled { opacity: .55; cursor: not-allowed; }
.mapping-toolbar .btn-load-article-loading { opacity: .7; cursor: progress; }
.mapping-toolbar .btn-load-article svg { width: 13px; height: 13px; flex-shrink: 0; }
/* Narrow-viewport fallback — the row-1 zones get to wrap so the
   Add to Queue button doesn't overflow off the right edge on a
   narrow phone. The fixed width on the search input is widened
   to 100% so the field uses whatever space is available. */
@media (max-width: 720px) {
  .mapping-toolbar .mapping-toolbar-row { flex-wrap: wrap; }
  .mapping-toolbar .attr-search-inputrow { width: 100%; }
  .mapping-toolbar .mapping-primary-group { margin-left: 0; }
  .mapping-toolbar .mapping-toolbar-title { padding: .5rem .75rem; }
}
/* "Start new article" button — matches the `.btn-queue` (Save
   Draft / Add to Queue) charcoal fill so the pair reads as one
   solid CTA cluster. Slightly smaller padding and font-size keep
   it visually subordinate to Save Draft while sharing the same
   colour family. */
.btn-new-article {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .8rem;
  background: linear-gradient(135deg, var(--brand-charcoal), var(--brand-charcoal-dark));
  border: 1px solid var(--brand-charcoal);
  border-radius: 6px;
  color: #fff;
  font-size: .76rem; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(52,57,59,.22);
  transition: transform .15s, box-shadow .15s;
}
.btn-new-article:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(52,57,59,.30);
}
.btn-new-article:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-new-article svg { width: 13px; height: 13px; flex-shrink: 0; }
/* Legacy `.attr-header-row` rule kept for non-data states (empty
   hero) and any external callers that still expect a horizontal
   row — but the live attribute-editor toolbar is now
   `.mapping-toolbar` (above). */
.attr-header-row {
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: .55rem;
}
.attr-header-row .btn-queue { margin-left: auto; }
.mandatory-counter-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .8rem;
  border-radius: 999px;
  font-size: .75rem; font-weight: 600;
  cursor: pointer; user-select: none;
  border: 1px solid transparent;
  transition: transform .15s, box-shadow .15s;
}
.mandatory-counter-pill.state-pending {
  background: var(--mandatory-error-bg);
  color: var(--mandatory-error-border);
  border-color: rgba(220, 38, 38, .25);
}
.mandatory-counter-pill.state-pending:hover { transform: translateY(-1px); box-shadow: 0 4px 12px var(--mandatory-error-glow); }
.mandatory-counter-pill.state-complete {
  background: var(--success-light);
  color: var(--success);
  border-color: rgba(0, 166, 125, .25);
  cursor: default;
}
.mandatory-counter-pill .pill-icon { font-size: .85rem; line-height: 1; }

/* ============================================================ */
/* Compliance Score badge (premium add-on, gated by             */
/* FEATURES.complianceScore). Grade-coloured pill in the         */
/* mapping toolbar; click opens the score breakdown dialog.      */
/* ============================================================ */
.compliance-score-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  font-size: .75rem; font-weight: 700;
  cursor: pointer; user-select: none;
  border: 1px solid transparent;
  background: var(--bg-tertiary); color: var(--text-secondary);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.compliance-score-pill[hidden] { display: none; }
.compliance-score-pill:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.compliance-score-pill .cs-icon { font-size: .8rem; line-height: 1; }
.compliance-score-pill .cs-score { font-variant-numeric: tabular-nums; }
.compliance-score-pill .cs-grade {
  font-size: .62rem; font-weight: 800; letter-spacing: .03em;
  padding: .05rem .3rem; border-radius: 4px;
  background: var(--tint-strong);
}
.compliance-score-pill.grade-a { background: var(--success-light); color: var(--success); border-color: rgba(0,166,125,.3); }
.compliance-score-pill.grade-b { background: var(--grade-b-bg); color: var(--grade-b-text); border-color: rgba(16,185,129,.28); }
.compliance-score-pill.grade-c { background: var(--grade-c-bg); color: var(--grade-c-text); border-color: rgba(180,83,9,.28); }
.compliance-score-pill.grade-d { background: var(--mandatory-error-bg); color: var(--mandatory-error-border); border-color: rgba(220,38,38,.28); }

/* Compliance breakdown dialog — sub-score bars + findings. */
.cs-dialog .raw-dialog-header .raw-title { font-size: 1.02rem; font-weight: 800; }
.cs-dialog .raw-dialog-body { padding: 1.1rem 1.5rem 1.35rem; }
.cs-dialog .cs-headline { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
/* Weighted compliance donut: slices sized by sub-score weight, coloured by
   pass-rate; overall score + grade in the hole; legend on the right. */
/* A container, so the legend below can react to the width of the WINDOW
   rather than of the viewport — the panel is a resizable, right-docked
   column now, so its width and the screen's have nothing to do with
   each other. */
.cs-dialog .cs-wd-wrap { position: relative; display: flex; align-items: center; gap: 1.4rem; margin: .2rem 0 .6rem; flex-wrap: wrap; container-type: inline-size; }
.cs-dialog .cs-wd { width: 210px; height: auto; flex: 0 0 auto; }
.cs-dialog .cs-wd circle { fill: none; stroke-width: 18; }
.cs-dialog .cs-wd-track { stroke: var(--bg-tertiary); }
/* 3D extruded side wall: darkened copies of the ring, non-interactive. */
.cs-dialog .cs-wd3d-wall { pointer-events: none; filter: brightness(0.82); }
.cs-dialog .cs-wd-seg.seg-ok { stroke: var(--success); }
.cs-dialog .cs-wd-seg.seg-mid { stroke: var(--warn); }
.cs-dialog .cs-wd-seg.seg-low { stroke: var(--mandatory-error-border); }
/* Hover animation, driven by JS so a slice AND its legend row light up
   together: the active slice pops (thicker), the rest dim. */
.cs-dialog .cs-wd-seg { cursor: pointer; transition: stroke-width .18s ease, opacity .18s ease; }
.cs-dialog .cs-wd-wrap.cs-hl .cs-wd-seg { opacity: .35; }
/* Active slice: un-dim BOTH its top face and its extruded wall. Selector
   is intentionally as specific as the dim rule above (+ .cs-hl-on) so it
   wins and the hovered wedge actually stays lit. */
.cs-dialog .cs-wd-wrap.cs-hl .cs-wd-seg.cs-hl-on { opacity: 1; }
/* Subtle pop, only on the flat top face (thickening the stacked wall
   copies would look messy). */
.cs-dialog .cs-wd3d-top .cs-wd-seg.cs-hl-on { stroke-width: 22; }
.cs-dialog .cs-wd-center { fill: var(--text); font-size: 26px; font-weight: 800; text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; }
/* The panel repaints itself as the user fixes fields; this marks the score
   readout for a moment so a change is noticed even though the user is
   looking at the field they just corrected, not at the window. Opacity
   rather than transform or colour: it is the one property that animates
   identically on the SVG donut text and the two HTML readouts. */
@keyframes cs-score-updated { from { opacity: .15; } to { opacity: 1; } }
.cs-dialog .cs-score-updated { animation: cs-score-updated .5s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .cs-dialog .cs-score-updated { animation: none; }
}
/* Legend fills top-to-bottom, then starts a second column — that is what
   `grid-auto-flow: column` plus an explicit row count buys, and it is why
   the row count has to come from the builder (`--cs-legend-rows`): only it
   knows whether the byrd sub-score is present. Rows are sized on the GRID,
   not per column, so both columns stay aligned even though one row wraps
   its detail line onto two lines and its neighbour does not. */
.cs-dialog .cs-wd-legend {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--cs-legend-rows, 3), auto);
  gap: .55rem 1.6rem;
  flex: 1 1 auto; min-width: 0;
}
/* `.cs-wd-wrap` already wraps the legend under the donut when space runs
   out, but the legend would keep two cramped columns — go back to one.
   The 820px threshold is the old `@media (max-width: 900px)` cutoff
   restated in container terms, so small screens collapse exactly as
   before while a narrowed window now collapses too. */
@container (max-width: 820px) {
  .cs-dialog .cs-wd-legend { grid-auto-flow: row; grid-template-rows: none; }
}
.cs-dialog .cs-wd-row { display: flex; align-items: flex-start; gap: .5rem; padding: .2rem .4rem; margin: -.2rem -.4rem; border-radius: 8px; cursor: pointer; transition: background .18s ease; }
.cs-dialog .cs-wd-row.cs-hl-on { background: var(--bg-tertiary); }
.cs-dialog .cs-wd-dot { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; margin-top: .15rem; }
.cs-dialog .cs-wd-dot.seg-ok { background: var(--success); }
.cs-dialog .cs-wd-dot.seg-mid { background: var(--warn); }
.cs-dialog .cs-wd-dot.seg-low { background: var(--mandatory-error-border); }
.cs-dialog .cs-wd-label { font-size: .82rem; font-weight: 700; color: var(--text); }
.cs-dialog .cs-wd-meta { font-size: .74rem; color: var(--text-muted); }
.cs-dialog .cs-wd-meta b.t-ok { color: var(--success); }
.cs-dialog .cs-wd-meta b.t-mid { color: var(--warn-text); }
.cs-dialog .cs-wd-meta b.t-low { color: var(--mandatory-error-border); }
.cs-dialog .cs-wd-detail { color: var(--text-muted); font-weight: 400; margin-top: .1rem; }
.cs-dialog .cs-wd-note { margin: 0 0 1rem; }
/* Cursor-following tooltip for the donut slices. */
.cs-dialog .cs-wd-tip { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; max-width: 220px; padding: .4rem .55rem; border-radius: 8px; background: var(--tooltip-bg); color: var(--tooltip-text); font-size: .72rem; line-height: 1.4; box-shadow: 0 6px 18px rgba(0,0,0,.22); opacity: 0; transform: translateY(3px); transition: opacity .12s ease, transform .12s ease; }
.cs-dialog .cs-wd-tip.show { opacity: 1; transform: none; }
.cs-dialog .cs-wd-tip b { color: var(--tooltip-text); }
.cs-dialog .cs-wd-tip .cs-wd-tip-detail { color: var(--tooltip-text-muted); }
.cs-dialog .cs-big-score { font-size: 2.2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.cs-dialog .cs-big-grade { font-size: 1.1rem; font-weight: 800; padding: .15rem .55rem; border-radius: 8px; }
.cs-dialog .cs-grade-a { color: var(--success); background: var(--success-light); }
.cs-dialog .cs-grade-b { color: var(--grade-b-text); background: var(--grade-b-bg); }
.cs-dialog .cs-grade-c { color: var(--grade-c-text); background: var(--grade-c-bg); }
.cs-dialog .cs-grade-d { color: var(--mandatory-error-border); background: var(--mandatory-error-bg); }
.cs-dialog .cs-sub { margin: .55rem 0; }
.cs-dialog .cs-sub-head { display: flex; justify-content: space-between; font-size: .78rem; font-weight: 600; margin-bottom: .2rem; }
.cs-dialog .cs-sub-detail { color: var(--text-muted); font-weight: 400; font-size: .72rem; }
.cs-dialog .cs-bar { height: 7px; border-radius: 999px; background: var(--bg-tertiary); overflow: hidden; }
.cs-dialog .cs-bar-fill { height: 100%; border-radius: 999px; background: var(--success); transition: width .2s; }
.cs-dialog .cs-bar-fill.low { background: var(--mandatory-error-border); }
.cs-dialog .cs-bar-fill.mid { background: var(--warn); }
.cs-dialog .cs-findings { margin-top: 1rem; }
/* Sized clearly above the .78rem findings rows — at .8rem it read as just
   another line of the list rather than the section's heading. */
.cs-dialog .cs-findings-title { font-size: .95rem; font-weight: 700; color: var(--text); margin-bottom: .45rem; }
.cs-dialog .cs-findings ul { margin: 0; padding-left: 1.1rem; }
.cs-dialog .cs-findings li { font-size: .78rem; margin: .18rem 0; color: var(--text-secondary); }
.cs-dialog .cs-na { color: var(--text-muted); font-style: italic; }
.cs-dialog .cs-explain { margin-top: 1rem; padding-top: .7rem; border-top: 1px solid var(--border); font-size: .72rem; color: var(--text-muted); line-height: 1.45; }
.cs-dialog .cs-legend { display: flex; flex-direction: column; gap: .3rem; margin-top: .55rem; }
.cs-dialog .cs-legend-row { display: flex; align-items: center; gap: .5rem; }
.cs-dialog .cs-legend-item { flex: 0 0 auto; min-width: 82px; text-align: center; font-size: .68rem; font-weight: 700; padding: .12rem .45rem; border-radius: 6px; white-space: nowrap; }
.cs-dialog .cs-legend-desc { font-size: .72rem; color: var(--text-muted); }
/* Marks the band this item's score falls in, and the grade actually applied
   after capping — without these the legend looks like it contradicts the
   headline grade. */
.cs-dialog .cs-legend-here .cs-legend-desc { color: var(--text-secondary); }
.cs-dialog .cs-legend-mark { font-weight: 700; color: var(--text-primary); }
/* Grade-cap banner: explains why the letter is lower than the number's band. */
.cs-dialog .cs-cap { display: flex; align-items: flex-start; gap: .45rem; margin: 0 0 1rem; padding: .5rem .6rem; border: 1px solid var(--mandatory-error-border); border-left-width: 3px; border-radius: 8px; background: var(--mandatory-error-bg); font-size: .74rem; line-height: 1.45; color: var(--text-secondary); }
.cs-dialog .cs-cap-icon { flex: 0 0 auto; color: var(--mandatory-error-border); font-size: .85rem; line-height: 1.3; }
.cs-dialog .cs-cap b { color: var(--text-primary); }
/* Grade letters inside the banner keep their colour but drop the pill
   background, which would clash with the banner's own tint. */
.cs-dialog .cs-cap b[class*="cs-grade-"] { background: none; padding: 0; }
/* Findings jump-links: click closes the dialog and focuses the field. */
.cs-dialog .cs-jump { color: var(--accent-blue); cursor: pointer; text-decoration: underline; }
.cs-dialog .cs-jump:hover { color: var(--primary); }
/* Findings attribute chips — wrap with spacing so long lists stay readable. */
.cs-dialog .cs-finding-prefix { margin-bottom: .3rem; }
.cs-dialog .cs-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.cs-dialog .cs-chip { display: inline-flex; align-items: center; padding: .12rem .5rem; border-radius: 999px; background: var(--bg-tertiary); border: 1px solid var(--border); font-size: .72rem; line-height: 1.5; text-decoration: none; white-space: nowrap; }
.cs-dialog a.cs-chip { color: var(--accent-blue); cursor: pointer; }
.cs-dialog a.cs-chip:hover { color: var(--primary); border-color: var(--accent-blue); background: var(--surface); }
/* Findings heading doubles as a link into the sub-score drill-down, so it
   keeps the block layout the <div> version had. It reads as a heading
   first (dark + semibold, not link-blue like the chips beneath it); the
   underline plus a blue hover carry the affordance instead. */
.cs-dialog a.cs-finding-prefix { display: block; color: var(--text); font-weight: 600; }
.cs-dialog a.cs-finding-prefix:hover { color: var(--accent-blue); }

/* ------------------------------------------------------------ */
/* Sub-score drill-down: every check behind one legend row.      */
/* ------------------------------------------------------------ */
/* Legend rows are buttons into the drill-down — the chevron is the
   affordance, revealed on hover/focus so the resting state stays calm. */
.cs-dialog .cs-wd-row .cs-wd-chevron { margin-left: auto; align-self: center; color: var(--text-muted); font-size: 1rem; opacity: 0; transition: opacity .18s ease, transform .18s ease; }
.cs-dialog .cs-wd-row:hover .cs-wd-chevron,
.cs-dialog .cs-wd-row:focus-visible .cs-wd-chevron { opacity: 1; transform: translateX(2px); }
.cs-dialog .cs-wd-row:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 1px; }
.cs-detail-dialog .cs-detail-head { display: flex; align-items: center; gap: .7rem; padding-bottom: .7rem; border-bottom: 1px solid var(--border); }
.cs-detail-dialog .cs-detail-pct { font-size: 1.8rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.cs-detail-dialog .cs-detail-pct.t-ok { color: var(--success); }
.cs-detail-dialog .cs-detail-pct.t-mid { color: var(--warn-text); }
.cs-detail-dialog .cs-detail-pct.t-low { color: var(--mandatory-error-border); }
.cs-detail-dialog .cs-detail-weight { font-size: .78rem; font-weight: 700; color: var(--text); }
.cs-detail-dialog .cs-detail-summary { font-size: .74rem; color: var(--text-muted); }
.cs-detail-dialog .cs-detail-group { margin-top: .9rem; }
.cs-detail-dialog .cs-detail-group-title { display: flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 700; margin-bottom: .35rem; }
.cs-detail-dialog .cs-detail-count { font-size: .68rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; background: var(--bg-tertiary); color: var(--text-muted); }
.cs-detail-dialog .cs-detail-empty { font-size: .76rem; color: var(--text-muted); font-style: italic; }
.cs-detail-dialog .cs-detail-list { list-style: none; margin: 0; padding: 0; }
.cs-detail-dialog .cs-detail-row { display: flex; align-items: flex-start; gap: .5rem; padding: .3rem .1rem; border-top: 1px solid var(--border); }
.cs-detail-dialog .cs-detail-row:first-child { border-top: none; }
/* Status dot: green pass, red fail, amber gap, hollow grey not-applicable. */
.cs-detail-dialog .cs-detail-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; margin-top: .32rem; background: var(--text-muted); }
.cs-detail-dialog .cs-st-pass .cs-detail-dot { background: var(--success); }
.cs-detail-dialog .cs-st-fail .cs-detail-dot { background: var(--mandatory-error-border); }
.cs-detail-dialog .cs-st-warn .cs-detail-dot { background: var(--warn); }
.cs-detail-dialog .cs-st-na .cs-detail-dot { background: none; border: 1.5px solid var(--border); }
.cs-detail-dialog .cs-detail-main { min-width: 0; }
.cs-detail-dialog .cs-detail-label { font-size: .78rem; color: var(--text); }
.cs-detail-dialog a.cs-detail-label { display: inline-block; }
.cs-detail-dialog .cs-st-na .cs-detail-label { color: var(--text-muted); }
.cs-detail-dialog .cs-detail-note { font-size: .7rem; color: var(--text-muted); margin-top: .05rem; }
.cs-detail-dialog .cs-detail-keys { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .25rem; }
/* Not-applicable group stays collapsed: the length sub-score skips a few
   hundred empty fields and an open list would bury the scored ones. */
.cs-detail-dialog .cs-detail-na-group { margin-top: 1rem; padding-top: .7rem; border-top: 1px solid var(--border); }
.cs-detail-dialog .cs-detail-toggle { display: inline-flex; align-items: center; gap: .3rem; padding: 0; border: none; background: none; color: var(--accent-blue); font-size: .74rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.cs-detail-dialog .cs-detail-toggle:hover { color: var(--primary); }
.cs-detail-dialog .cs-detail-caret { font-size: .6rem; }
.cs-detail-dialog .cs-detail-na-why { font-size: .7rem; color: var(--text-muted); margin: .35rem 0 .2rem; }

/* Compliance score line inside the Summary tab. */
.summary-compliance { display: flex; align-items: center; gap: .5rem; font-size: .82rem; margin: .3rem 0 .6rem; }
.summary-compliance .sc-badge { font-weight: 800; padding: .1rem .45rem; border-radius: 6px; }
.summary-compliance .sc-badge.grade-a { color: var(--success); background: var(--success-light); }
.summary-compliance .sc-badge.grade-b { color: var(--grade-b-text); background: var(--grade-b-bg); }
.summary-compliance .sc-badge.grade-c { color: var(--grade-c-text); background: var(--grade-c-bg); }
.summary-compliance .sc-badge.grade-d { color: var(--mandatory-error-border); background: var(--mandatory-error-bg); }

/* ============================================================ */
/* BM-3: 3-state pip on section headers (○ ◐ ●).                  */
/* ============================================================ */
.attr-accordion-pip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; flex-shrink: 0;
  font-size: 1rem; line-height: 1;
  margin-right: .15rem;
}
.attr-accordion-pip.pip-empty   { color: var(--text-muted); }
.attr-accordion-pip.pip-partial { color: var(--mandatory-error-border); }
.attr-accordion-pip.pip-full    { color: var(--success); }

/* Section-header DIFF status dot (plan §4.5). Distinct from the
   required-fields pip above — that one tracks mandatory-field
   completeness regardless of compare mode; this one only renders
   while comparing and tracks per-section diff-resolution
   progress:
     red    → has unresolved diffs    (.dot-unresolved)
     amber  → partially resolved      (.dot-partial)
     green  → all diffs resolved      (.dot-resolved)
   The dot uses a filled circle (●) so it reads as a status
   indicator vs the three-state outline glyph of the required-
   fields pip. Hidden when not comparing. */
.attr-accordion-diff-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 12px; height: 12px;
  font-size: .9rem; line-height: 1;
  flex-shrink: 0;
  margin-right: .15rem;
}
.attr-accordion-diff-dot.dot-unresolved { color: var(--primary); }
.attr-accordion-diff-dot.dot-partial    { color: var(--warn, var(--mandatory-empty-border)); }
.attr-accordion-diff-dot.dot-resolved   { color: var(--success); }
.attr-accordion-diff-dot[hidden] { display: none; }

/* Bulk action buttons in the section header (plan §4.5). These
   used to live on every diff row (`.cmp-act-bulk` — removed in
   §4.6); promoting them to the header drops 19× of duplicate
   buttons in a typical session. Visible only when comparing
   AND the section has pending diffs (JS sets
   `data-has-pending-diffs="true"` on the section); auto-hidden
   otherwise so the header stays clean in non-compare mode and
   in fully-reviewed sections. */
.attr-accordion-header .acc-bulk-actions {
  display: none;
  align-items: center;
  gap: .25rem;
  margin-left: .3rem;
}
.attr-accordion-section[data-has-pending-diffs="true"]
    > .attr-accordion-header .acc-bulk-actions {
  display: inline-flex;
}
.attr-accordion-header .acc-bulk-btn {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .5rem;
  font-size: .65rem; font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .12s;
  line-height: 1.1;
}
.attr-accordion-header .acc-bulk-btn.acc-bulk-take {
  border-color: var(--success); color: var(--success);
}
.attr-accordion-header .acc-bulk-btn.acc-bulk-take:hover {
  background: var(--success); color: var(--on-accent);
}
.attr-accordion-header .acc-bulk-btn.acc-bulk-skip:hover {
  background: var(--bg-tertiary); color: var(--text); border-color: var(--text-muted);
}
@media (max-width: 980px) {
  .attr-accordion-header .acc-bulk-btn { font-size: .6rem; padding: .15rem .35rem; }
}
/* Header element switched from native <button> to
   `<div role="button">` so it can nest the bulk-action buttons
   above without invalid HTML. The cursor + user-select rules give
   it back the button-like feel that the native element used to
   provide for free. */
.attr-accordion-header[role="button"] { cursor: pointer; user-select: none; }

/* ============================================================ */
/* BM-5: empty-state hero (pre-extraction attribute area).        */
/* ============================================================ */
.empty-state-hero {
  display: flex; flex-direction: column; align-items: center;
  padding: 3rem 1.5rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}
.empty-state-hero .ehero-icon {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: var(--accent-blue-light);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent-blue);
  margin-bottom: 1rem;
}
.empty-state-hero .ehero-icon svg { width: 38px; height: 38px; }
.empty-state-hero h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: .35rem; color: var(--text); }
.empty-state-hero .ehero-sub { font-size: .82rem; color: var(--text-secondary); max-width: 480px; line-height: 1.55; margin-bottom: 1rem; }
.empty-state-hero .ehero-flows { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; max-width: 380px; }
.empty-state-hero .ehero-flows li { font-size: .78rem; color: var(--text-secondary); display: flex; align-items: center; gap: .5rem; }
.empty-state-hero .ehero-flows li::before { content: '›'; color: var(--accent-blue); font-weight: 700; }

/* ============================================================ */
/* BM-1: slim session strip (replaces upload + mapping cards once  */
/*        at least one file is uploaded).                         */
/* ============================================================ */
.session-strip {
  display: none;
  align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: .5rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky; top: 64px; z-index: 50;
}
/* Phase A + B retire the session strip: customer/project lives in the
   header drawer (no need for the "Defaults: N entries" pill) and the
   upload zone now lives INSIDE the material widget (no need for the
   "📥 N files +" pill). Keep the rule for safety, but never apply
   `.visible` in the new flow — the strip stays hidden permanently. */
.session-strip.visible { display: none; }
.session-strip .strip-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .65rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .72rem; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.session-strip .strip-pill:hover { background: var(--accent-blue-light); border-color: var(--accent-blue); color: var(--accent-blue); }
.session-strip .strip-pill .pill-emoji { font-size: .85rem; line-height: 1; }
.session-strip .strip-pill .pill-count { font-weight: 700; color: var(--text); }
.session-strip .strip-pill:hover .pill-count { color: var(--accent-blue); }
/* When the strip is visible, hide the original .top-row to reclaim space. */
.session-strip.visible ~ .top-row.collapsed { display: none; }
.top-row.collapsed { display: none; }

/* ============================================================ */
/* Customer / Project drawer (slide-in from the right).           */
/* ----                                                           */
/* The `.strip-popover` class is the original "Mapping Defaults    */
/* popover" container; with Phase A of the layout rework it's      */
/* repurposed as the Customer / Project drawer.  Same DOM, same    */
/* `toggleDefaultsPopover()` mover, but:                           */
/*   - width matches the queue panel (360 px) for visual rhythm    */
/*   - the header label is now "Customer / Project"                */
/*   - the trigger is a building-icon button in the page header,   */
/*     immediately left of the Queue chip                          */
/* The Mapping Defaults editor still lives inside the same card    */
/* (the kv-defaults block under the customer picker) — customers   */
/* and their per-customer defaults belong in the same drawer.      */
/* ============================================================ */
.strip-popover {
  display: none;
  position: fixed; top: 0; right: 0; bottom: 0;
  /* Widened from 360px so the per-customer Mapping Defaults editor
     (key / value rows + toolbar) has enough horizontal room for the
     value column to be readable without truncating long defaults. */
  width: 480px; max-width: 96vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  flex-direction: column;
}
.strip-popover.visible { display: flex; }
.strip-popover-header {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  display: flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: .85rem;
}
.strip-popover-header .close-btn {
  margin-left: auto; background: none; border: 1px solid var(--border);
  border-radius: 50%; width: 26px; height: 26px;
  cursor: pointer; color: var(--text-muted);
}
.strip-popover-body { padding: .85rem 1rem; overflow: auto; flex: 1; }
/* When the live Mapping Defaults card is hosted inside the popover, strip its own
   header + chrome so we don't render a second "Mapping Defaults" title on top of
   the popover's header. The card body keeps all its event handlers and inputs. */
.strip-popover-body > #mappingDefaultsCard { border: none; box-shadow: none; border-radius: 0; background: transparent; }
.strip-popover-body > #mappingDefaultsCard > .card-header { display: none; }
.strip-popover-body > #mappingDefaultsCard > .card-body { padding: 0; }

/* Soft backdrop behind the drawer — click-anywhere-to-close (a UX
   hint that the page underneath is temporarily inert). The backdrop
   sits below the drawer in z-order. Kept low-contrast so it doesn't
   feel like a modal dialog. */
.customer-drawer-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: var(--tint-strong);
  z-index: 199;
}
.customer-drawer-backdrop.visible { display: block; }

/* ============================================================ */
/* Header: org chip + customer-drawer trigger button.             */
/* Phase A of the layout rework.                                  */
/* ----                                                           */
/* The chip surfaces the currently-picked customer label + (when  */
/* the user has signed in via the inline byrd-login dialog) the   */
/* logged-in email, so the active organisation is always visible  */
/* without having to open the drawer.                             */
/* Clicking the chip OR the trigger button opens the drawer.     */
/* ============================================================ */
.org-login-hint {
  color: var(--text);
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .01em;
  cursor: pointer;
}
.org-login-hint:hover { color: var(--primary); }
.org-login-hint.hidden { display: none; }
.org-chip {
  display: none;          /* shown by JS once a customer is picked */
  align-items: center; gap: .35rem;
  /* No max-width: let the chip size to its content so the logged-in
     email is never truncated. The two children have their own
     per-element caps (below) — the customer label can still
     ellipsize on long names but the login email gets a generous
     allowance because addresses like firstname.lastname@long.tld
     routinely exceed 12rem. */
  padding: .3rem .7rem;
  /* Always-green treatment when a customer is logged in. Tinted
     success surface + green border + green label so the active
     organisation reads as "connected" at a glance, regardless of
     test-connect state or whether the picked org is the BYRD_TEST
     playground. (Per UX request: the red flag belongs only to the
     BYRD_TEST entry inside the dropdown, never to the chip.) */
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: 999px;
  font-size: .72rem; font-weight: 500;
  color: var(--success);
  cursor: pointer; transition: all .15s;
  line-height: 1.2;
}
.org-chip.visible { display: inline-flex; }
.org-chip:hover { border-color: var(--success); color: var(--success); background: var(--success-light); filter: brightness(.97); }
.org-chip .org-chip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 0 3px rgba(0,166,125,.18);
  flex-shrink: 0;
}
/* Error / loading states keep the dot colour as a subtle hint but
   leave the green chip shell intact — the user explicitly asked
   for a green chip whenever an organisation is logged in. */
.org-chip.error .org-chip-dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(11,210,197,.15); }
.org-chip .org-chip-label { font-weight: 600; color: var(--success); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 14rem; }
.org-chip .org-chip-sep { color: var(--success); opacity: .6; flex-shrink: 0; }
/* Only the local part of the address is shown (see `refreshOrgChip`), so
   12rem fits it without clipping while leaving the header room for the
   language pill. The full address stays in the chip's tooltip. */
.org-chip .org-chip-email { color: var(--success); opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }

.customer-drawer-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer; transition: all .15s;
  flex-shrink: 0;
}
.customer-drawer-trigger:hover { border-color: var(--accent-blue); color: var(--accent-blue); background: var(--accent-blue-light); }
.customer-drawer-trigger[aria-expanded="true"] { border-color: var(--accent-blue); color: var(--accent-blue); background: var(--accent-blue-light); }
.customer-drawer-trigger svg { width: 16px; height: 16px; }

/* ============================================================ */
/* BM-2: persistent export-queue side panel + top-bar chip.       */
/* ============================================================ */
.queue-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .75rem; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer; transition: all .15s;
}
.queue-chip:hover { border-color: var(--accent-blue); color: var(--accent-blue); background: var(--accent-blue-light); }
.queue-chip .qc-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--accent-blue); color: var(--on-accent);
  font-size: .65rem; font-weight: 700;
}
.queue-chip.empty .qc-count { background: var(--text-muted); }

/* Shared width variable so the ambient .queue-panel-toggle handle can
   offset itself by the panel's actual rendered width without hard-
   coding 520px twice (respects the 92vw clamp on narrow viewports).
   On MacBook-class viewports (<=1728px covers the 13"/14"/15"/16"
   range) we shrink to 440px so the workspace has more breathing
   room next to the panel; external monitors keep the full 520px. */
:root { --queue-panel-width: min(520px, 92vw); }
@media (max-width: 1728px) {
  :root { --queue-panel-width: min(440px, 92vw); }
}
.queue-panel {
  display: none;
  position: fixed; top: 0; right: 0; bottom: 0;
  /* Widened from 360px so History's "Exported {date} · {email}"
     line (byrd sign-in usernames are often full addresses) fits
     without clipping. Stays right-docked, so the extra width
     grows to the left. */
  width: var(--queue-panel-width);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 150;
  flex-direction: column;
}
.queue-panel.visible { display: flex; }

/* Ambient vertical toggle tab. When the panel is CLOSED it sits
   flush with the viewport's right edge (sticking left into the
   workspace). When the panel is OPEN it slides INSIDE the panel's
   left edge so it visually belongs to the panel, not the workspace.
   Uses the brand teal so it stays clearly visible on both the
   (light) workspace and the (also light) panel background. */
.queue-panel-toggle {
  position: fixed; top: 50%; right: 0;
  transform: translateY(-50%);
  z-index: 151;
  width: 24px; height: 68px;
  padding: 0;
  border: none;
  border-radius: 8px 0 0 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: -4px 0 14px -6px rgba(0,0,0,.28);
  display: inline-flex; align-items: center; justify-content: center;
  transition: right .22s cubic-bezier(.2,.7,.3,1), background .15s ease, border-radius .22s ease;
}
.queue-panel-toggle:hover { background: var(--primary-dark, #099d94); }
.queue-panel-toggle:focus-visible { outline: 2px solid var(--primary-glow, rgba(11,210,197,.5)); outline-offset: 2px; }
.queue-panel-toggle svg { transition: transform .22s ease; }
/* Panel open: tuck the handle just INSIDE the panel's left edge and
   flip the rounded corners so they face into the panel body. Chevron
   rotates 180deg so it points RIGHT (indicates "closes to the right"). */
.queue-panel.visible ~ .queue-panel-toggle {
  right: calc(var(--queue-panel-width) - 24px);
  border-radius: 0 8px 8px 0;
  box-shadow: 4px 0 14px -6px rgba(0,0,0,.28);
}
.queue-panel.visible ~ .queue-panel-toggle svg { transform: rotate(180deg); }

/* Push the workspace aside when the queue panel is open so nothing
   hides under it (fix for MacBook-size screens where 520px of panel
   was overlapping the Upload Material / Mapped Item cards). Only
   `<body>` gets padded — position:fixed drawers/handles are
   viewport-anchored, so they don't move.

   Guarded by a media query: `main` maxes at 1400px + 64px padding
   = 1464px, so once the viewport comfortably fits main + the 520px
   panel side-by-side (roughly >=2000px), pushing just creates a
   dead gap and pulls the workspace off-centre. Above the breakpoint
   we leave `<body>` alone and let the panel overlay the (unused)
   right margin of the viewport, restoring the pre-2026-09-22 look. */
body { transition: padding-right .22s cubic-bezier(.2,.7,.3,1); }
@media (max-width: 2000px) {
  body.queue-open { padding-right: var(--queue-panel-width); }
}

.queue-panel-header {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  display: flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: .85rem;
}
.queue-panel-header .close-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 50%; width: 26px; height: 26px;
  cursor: pointer; color: var(--text-secondary);
  font-size: 1.15rem; line-height: 1; font-weight: 700;
}
.queue-panel-header .close-btn:hover { color: var(--text); }
/* When the export actions are absent (legacy callers / empty), keep
   the close-btn pinned to the right. With actions present, the
   actions cluster owns margin-left: auto and the close-btn follows. */
.queue-panel-header:not(:has(.queue-panel-actions)) .close-btn { margin-left: auto; }
.queue-panel-body { padding: .5rem; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: .35rem; }
/* The class's own `display: flex` above has higher specificity than the
   UA stylesheet's `[hidden] { display: none }`, so the Queue/History tab
   bodies (both share this class) would stay visually shown even with
   the `hidden` attribute set via `switchQueuePanelTab` — confirmed via
   live browser testing, not just code review. Restore the expected
   behavior explicitly. */
.queue-panel-body[hidden] { display: none; }
.queue-panel-empty {
  text-align: center; color: var(--text-muted);
  font-size: .82rem; padding: 2rem 1rem;
}
/* Queue / History tab strip — sits between the panel header and
   whichever body (#queuePanelBody / #queuePanelHistoryBody) is
   currently visible. Plain underline tabs, consistent with the rest
   of the panel's compact, borderless control style. */
.queue-panel-tabs {
  display: flex; gap: .25rem;
  padding: 0 .6rem; border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}
.qpt-tab {
  border: none; background: none; cursor: pointer;
  padding: .5rem .65rem; margin-bottom: -1px;
  font: 600 .9rem var(--font-sans, inherit); color: var(--text-muted);
  border-bottom: 2px solid transparent;
}
.qpt-tab:hover { color: var(--text); }
.qpt-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
/* History tab body reuses .queue-panel-body's flex/padding/gap (same
   class on the element) — #queuePanelHistoryList holds the actual
   cards and needs its own flex column since it's nested one level
   deeper than the Queue tab's cards (which sit directly in
   #queuePanelBody). */
#queuePanelHistoryList { display: flex; flex-direction: column; gap: .35rem; }
.qph-toolbar { display: flex; justify-content: flex-end; }
.qph-refresh {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); border-radius: 50%;
  width: 24px; height: 24px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.qph-refresh:hover { color: var(--primary); border-color: var(--primary); }
.qph-timestamp { font-size: .65rem; color: var(--text-muted); white-space: nowrap; }
.queue-panel-card .qph-exported {
  font-size: .78rem; color: var(--text-muted);
  overflow-wrap: anywhere;
}
/* Sweep-up footer — appended below the last card whenever the
   queue contains at least one ✓ UPLOADED entry. Visually detached
   from the cards (top border + extra top-margin) so users don't
   accidentally hit it when reaching for the last card. */
.queue-panel-footer {
  margin-top: .35rem;
  padding-top: .55rem;
  border-top: 1px dashed var(--border);
  display: flex; justify-content: flex-end;
}
.btn-clear-uploaded {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem;
  font-size: .72rem; font-weight: 600;
  background: var(--surface); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; transition: all .15s;
}
.btn-clear-uploaded:hover {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}
.queue-panel-card {
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex; flex-direction: column; gap: .3rem;
  transition: border-color .15s, box-shadow .15s;
}
.queue-panel-card:hover { border-color: var(--accent-blue); box-shadow: 0 2px 8px var(--accent-blue-glow); }
/* flex-wrap lets the chip row break onto a second line when the panel
   is too narrow to fit GTIN + UPDATING ITEM + UPLOADED + actions on
   one row, instead of pushing the action icons off the right edge.
   row-gap keeps wrapped rows readable. */
.queue-select-all {
  display: flex; align-items: center; gap: .45rem;
  padding: .1rem .15rem .4rem;
  font-size: .78rem; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; user-select: none;
}
.queue-select-all input,
.queue-panel-card .qpc-select input {
  width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer;
}
.queue-panel-card .qpc-select {
  flex: 0 0 auto; display: inline-flex; align-items: center;
}
.queue-panel-card .qpc-select input:disabled { cursor: not-allowed; opacity: .45; }
.queue-panel-card .qpc-top { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; row-gap: .25rem; }
/* Action-button group — pinned to the right via margin-left:auto so the
   download/remove icons sit in the card's right corner. flex-shrink:0
   and inline-flex on the group ensure the two icons stay together (and
   wrap as a unit rather than splitting across rows) when the row is
   tight. */
.queue-panel-card .qpc-actions { margin-left: auto; display: inline-flex; align-items: center; gap: .15rem; flex-shrink: 0; }
.queue-panel-card .qpc-gtin {
  font-family: var(--font-mono); font-size: .78rem; font-weight: 600;
  color: var(--text-secondary); background: var(--bg-tertiary);
  padding: .1rem .35rem; border-radius: 4px;
  overflow-wrap: anywhere;
}
.queue-panel-card .qpc-status {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .1rem .4rem; border-radius: 4px;
  font-size: .72rem; font-weight: 600; line-height: 1.25;
  /* Keep the chip on a single line — the "UPLOADED (<target>)" variant
     is long enough that without nowrap it broke onto two lines and
     visually dwarfed every other badge in the card header. The chip
     clusters left after the GTIN/org badge now (the action-button
     group owns the right edge via `.qpc-actions { margin-left: auto }`). */
  white-space: nowrap;
}
.queue-panel-card .qpc-status.ok    { background: var(--success-light); color: var(--success); }
/* Red like the editor's byrd-rules error chip, but the upload stays
   allowed (warn-and-confirm); only `.block` (PK missing) hard-blocks. */
.queue-panel-card .qpc-status.warn  { background: var(--mandatory-error-bg); color: var(--mandatory-error-border); }
/* PK-blocked — the queued item is missing one of GTIN / GLN /
   Target Market. Solid red, stronger than the tinted `warn`, because
   this is a HARD-block on export (see `_validatePrimaryKeyForExport`),
   not the soft warn-and-confirm gate. */
.queue-panel-card .qpc-status.block { background: var(--danger); color: var(--on-accent); border: 1px solid var(--danger); }
/* Uploaded — the queued item was successfully POSTed through the
   2-stage `/upload-cin` flow (gatherings → imports) to either the
   BYRD or m.PIM tenant. Lightweight light-green palette (matches the
   overall chip weight) with an explicit success-tinted border so it
   stays visually distinct from the borderless `ok` "ready to ship"
   badge — the border is the differentiator now that we no longer
   use a solid-fill bright-green block. */
.queue-panel-card .qpc-status.uploaded {
  background: var(--success-light); color: var(--success);
  border: 1px solid var(--success);
}
/* Uploaded-but-failed — gathering or import HTTP error. Reuses the
   same hard-block red so it reads as a blocker the user must act on. */
.queue-panel-card .qpc-status.upload-failed {
  background: var(--danger); color: var(--on-accent);
  border: 1px solid var(--danger);
}
/* Subtle dim of the rest of the card body once the item is uploaded
   so it visually recedes into "done" state without disappearing
   (the user often wants to keep the audit trail visible). */
.queue-panel-card.is-uploaded { opacity: .82; background: var(--success-light); border-color: var(--success); }
.queue-panel-card.is-uploaded .qpc-label,
.queue-panel-card.is-uploaded .qpc-desc-short,
.queue-panel-card.is-uploaded .qpc-brand { color: var(--text-secondary); }
/* The card currently loaded via `editQueueItem()` — accent-blue
   outline (same token as the editing banner and the :hover state
   above) so it's obvious at a glance which card the editor is
   showing, especially when several cards share a GTIN. */
.queue-panel-card.is-editing {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 1px var(--accent-blue);
}
/* "live" chip — appended to the status badge when the queued
   article's GTIN matches the active loaded item, signalling that
   the validation is being run against the live `_loadedItem`
   (with Takes applied) rather than the queued snapshot. Compact,
   muted, and surfaces a tooltip on hover. */
.queue-panel-card .qpc-status .qpc-live-tag {
  display: inline-flex; align-items: center;
  padding: 0 .25rem; margin-left: .15rem;
  border-radius: 3px; font-size: .55rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  background: var(--tint-strong);
  cursor: help;
}
/* PRDC-7/Phase 3: create-vs-update-on-upload indicator, shown inline
   in the header right of the GTIN. Green "Creating Item" when the
   GTIN is free upstream, blue "Updating Item" when it already exists. */
.queue-panel-card .qpc-org {
  flex: 0 0 auto;
  display: inline-block; font-size: .66rem; font-weight: 700;
  padding: .1rem .4rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .03em; cursor: help;
  white-space: nowrap;
}
.queue-panel-card .qpc-org.creating { background: var(--success-light); color: var(--success); }
.queue-panel-card .qpc-org.updating { background: var(--accent-blue-light); color: var(--accent-blue); }
.queue-panel-card .qpc-org.checking { background: var(--bg-tertiary); color: var(--text-muted); cursor: default; }
.queue-panel-card .qpc-org.taskmanager { background: var(--bg-tertiary); color: var(--text-secondary, var(--text-muted)); }
.queue-panel-card .qpc-org.prompt-pending { background: var(--accent-blue-light); color: var(--accent-blue); }
/* Secondary row — org-state (creating/updating/checking) + the Draft
   badge, demoted out of the busy `.qpc-top` row (GTIN + ship-readiness
   status + action icons) so that row stays focused on "can this ship
   right now" while this contextual metadata gets its own, lower-
   visual-weight row. Omitted entirely (no empty gap) when neither
   badge applies — see `secondaryHtml` in `renderQueuePanel`. */
.queue-panel-card .qpc-secondary {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
}
/* Draft badge — unlike the color-coded org-state pills, this is purely
   informational ("this is already saved, not just a local sketch"),
   so it stays neutral/muted rather than claiming a status color. */
.queue-panel-card .qpc-draft {
  flex: 0 0 auto;
  display: inline-block; font-size: .66rem; font-weight: 700;
  padding: .1rem .4rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .03em; cursor: help;
  white-space: nowrap;
  background: var(--bg-tertiary); color: var(--text-muted);
}
.queue-panel-card .qpc-draft-time {
  font-size: .78rem; color: var(--text-muted); cursor: help;
}
/* Change count against the organisation's copy ("12 changes"). Muted like
   the Draft badge; a button because it opens the change list. */
.queue-panel-card .qpc-changes {
  flex: 0 0 auto;
  font: inherit; font-size: .7rem; font-weight: 600;
  padding: .08rem .45rem; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary);
  cursor: pointer;
}
.queue-panel-card .qpc-changes:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.queue-panel-card .qpc-changes:focus-visible { outline: 2px solid var(--primary-glow, rgba(11,210,197,.5)); outline-offset: 1px; }
.queue-panel-card .qpc-changes.is-none { cursor: help; border-style: dashed; color: var(--text-muted); }
.qpc-changes-popover { max-width: 360px; width: 360px; max-height: 60vh; overflow-y: auto; }
.qpc-changes-popover .qcp-section {
  margin-top: .45rem; font-size: .64rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
}
.qpc-changes-popover .qcp-row { padding: .25rem 0; border-top: 1px solid var(--border); }
.qpc-changes-popover .qcp-section + .qcp-row { border-top: none; }
.qpc-changes-popover .qcp-label { font-weight: 600; color: var(--text); }
.qpc-changes-popover .qcp-vals { display: flex; gap: .35rem; align-items: baseline; flex-wrap: wrap; word-break: break-word; }
.qpc-changes-popover .qcp-from, .qpc-changes-popover .qcp-to { white-space: pre-line; }
.qpc-changes-popover .qcp-from { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border); }
.qpc-changes-popover .qcp-to { color: var(--text); }
.qpc-changes-popover .qcp-arrow { color: var(--text-muted); }
.qpc-changes-popover .qcp-empty { color: var(--text-muted); text-decoration: none; }
/* Compact meta line: level chip (tradeItemUnitDescriptorCode) + short description. */
.queue-panel-card .qpc-meta { display: flex; align-items: baseline; gap: .4rem; min-width: 0; }
.queue-panel-card .qpc-descriptor {
  flex: 0 0 auto;
  font-family: var(--font-mono); font-size: .7rem; font-weight: 600;
  color: var(--text-muted); background: var(--bg-tertiary);
  padding: .05rem .3rem; border-radius: 3px; white-space: nowrap;
}
/* 2-line clamp (was single-line ellipsis) — the full product
   description is now readable at a glance for most entries instead
   of requiring a hover; `title` on the span still covers anything
   still cut off beyond 2 lines. `align-items: baseline` on the
   parent `.qpc-meta` is fine here since flexbox baseline-aligns on
   the first line of a multi-line flex item. */
.queue-panel-card .qpc-desc-short {
  flex: 1 1 auto; min-width: 0;
  font-size: .88rem; color: var(--text);
  display: -webkit-box; -webkit-box-orient: vertical;
  line-clamp: 2; -webkit-line-clamp: 2;
  overflow: hidden;
}
/* Per-card "Edit" — loads this entry into the main editor
   (`editQueueItem`). First in the action group since it's the most
   likely next step for a draft; same footprint as the download
   icons for visual consistency. */
.queue-panel-card .qpc-edit {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0; border: 0;
  border-radius: var(--radius-sm); background: transparent;
  color: var(--text-muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.queue-panel-card .qpc-edit:hover {
  background: rgba(37, 99, 235, .12); color: var(--accent-blue);
}
.queue-panel-card .qpc-edit:focus-visible {
  outline: 2px solid var(--accent-blue); outline-offset: 2px;
}
.queue-panel-card .qpc-edit svg { width: 14px; height: 14px; }
/* Per-card "Download this article's CIN XML" — sits to the left of the
   remove button so the destructive verb stays in its corner. Muted by
   default; lifts to the accent-blue on hover so it's discoverable
   without competing with the primary Upload verb. */
.queue-panel-card .qpc-download {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0; border: 0;
  border-radius: var(--radius-sm); background: transparent;
  color: var(--text-muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.queue-panel-card .qpc-download:hover {
  background: rgba(37, 99, 235, .12); color: var(--accent-blue);
}
.queue-panel-card .qpc-download:focus-visible {
  outline: 2px solid var(--accent-blue); outline-offset: 2px;
}
.queue-panel-card .qpc-download:disabled {
  opacity: .4; cursor: not-allowed;
}
.queue-panel-card .qpc-download:disabled:hover {
  background: transparent; color: var(--text-muted);
}
.queue-panel-card .qpc-download svg { width: 14px; height: 14px; }
/* Per-card "Download this article's JSON" — same footprint as the CIN
   download, but lifts to the accent-teal on hover so the two download
   verbs are visually distinguishable. */
.queue-panel-card .qpc-download-json {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0; border: 0;
  border-radius: var(--radius-sm); background: transparent;
  color: var(--text-muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.queue-panel-card .qpc-download-json:hover {
  background: rgba(0, 166, 125, .14); color: var(--primary);
}
.queue-panel-card .qpc-download-json:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.queue-panel-card .qpc-download-json svg { width: 14px; height: 14px; }
.queue-panel-card .qpc-remove {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: .9rem; line-height: 1; padding: 0 .25rem;
}
.queue-panel-card .qpc-remove:hover { color: var(--danger); }
.queue-panel-card .qpc-label {
  font-size: .82rem; color: var(--text); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.queue-panel-card .qpc-brand { font-size: .7rem; color: var(--text-muted); }

/* ============================================================ */
/* BM-4: cheat-sheet overlay for keyboard shortcuts.              */
/* ============================================================ */
.cheat-sheet-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: var(--backdrop); backdrop-filter: blur(6px);
  z-index: 1500;
  align-items: center; justify-content: center;
}
.cheat-sheet-backdrop.visible { display: flex; }
.cheat-sheet-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  /* Widened from the original 480px so each `dl` can run two
     (kbd, description) pairs per row — see the 4-column grid on
     `.cheat-sheet-dialog dl` below. The whole sheet still fits a
     13" laptop and gracefully degrades to a single column on
     narrow viewports via the @media query at the bottom. */
  width: 720px; max-width: 92vw;
  padding: 1.25rem 1.5rem;
}
.cheat-sheet-dialog h2 { font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.cheat-sheet-dialog .cs-sub { font-size: .78rem; color: var(--text-muted); margin-bottom: .85rem; }
/* Sub-section headings inside the cheat sheet — added for the
   plan §4.10 expansion (reconciliation shortcuts get their own
   group above the global ones). Small caps + muted text so the
   headings read as labels, not as content. */
.cheat-sheet-dialog .cs-section-h {
  font-size: .65rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  margin: .85rem 0 .35rem;
}
.cheat-sheet-dialog .cs-section-h:first-of-type { margin-top: .5rem; }
/* Two (kbd, description) pairs per row. The dt cells (kbd chips)
   size to content; the 1fr description columns absorb the slack
   so the second pair always lines up at the same x-coordinate
   across rows. Row gap stays tight to keep the whole sheet
   glanceable. */
.cheat-sheet-dialog dl {
  display: grid;
  grid-template-columns: max-content 1fr max-content 1fr;
  gap: .4rem 1.25rem;
  align-items: center;
}
@media (max-width: 640px) {
  /* Narrow viewports: collapse to the original single-pair grid
     so kbd chips don't get squashed against descriptions. */
  .cheat-sheet-dialog dl { grid-template-columns: max-content 1fr; }
}
.cheat-sheet-dialog dt {
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
  color: var(--text); background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: .15rem .5rem; border-radius: 4px;
  white-space: nowrap; align-self: center;
}
.cheat-sheet-dialog dd { font-size: .82rem; color: var(--text-secondary); align-self: center; margin: 0; }
.cheat-sheet-dialog .cs-footer { margin-top: 1rem; text-align: right; font-size: .72rem; color: var(--text-muted); }

/* ============================================================ */
/* app.byrd.io login dialog — used when the selected customer has no
   server-side BASIC_AUTH configured. Mirrors the version dialog's
   structure / animation conventions. */
/* ============================================================ */
/* Gemini AI Prompt dialog.                                      */
/* Opened via the "AI Prompt" button in the uploaded-material    */
/* widget's toolbar. Hosts the live #geminiPrompt textarea so    */
/* the value is preserved across renderPreviews() re-renders.   */
/* ============================================================ */
.prompt-dialog-backdrop { position: fixed; inset: 0; background: var(--backdrop); backdrop-filter: blur(6px); z-index: 1050; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.prompt-dialog-backdrop.open { display: flex; opacity: 1; }
.prompt-dialog { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 640px; max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.prompt-dialog-header { display: flex; align-items: center; gap: .5rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--bg-tertiary); }
.prompt-dialog-header h2 { font-size: 1rem; font-weight: 600; margin: 0; flex: 1; }
.prompt-dialog-close { background: none; border: 1px solid var(--border); border-radius: 50%; width: 28px; height: 28px; color: var(--text-muted); cursor: pointer; font-size: 1.05rem; line-height: 1; }
.prompt-dialog-close:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
.prompt-dialog-body { padding: 1.1rem 1.25rem; flex: 1; overflow: auto; display: flex; flex-direction: column; gap: .8rem; }
.prompt-dialog-body .prompt-help { margin: 0; font-size: .78rem; color: var(--text-muted); line-height: 1.55; }
.prompt-dialog-body .prompt-wrap { position: relative; flex: 1; display: flex; flex-direction: column; }
.prompt-dialog-body textarea { width: 100%; flex: 1; min-height: 180px; padding: .7rem .85rem; padding-right: 2rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .82rem; font-family: var(--font-mono); color: var(--text); background: var(--bg-tertiary); resize: vertical; line-height: 1.6; }
.prompt-dialog-body textarea:focus { outline: none; border-color: var(--primary); background: var(--input-bg); box-shadow: 0 0 0 3px var(--primary-light); }
.prompt-dialog-body textarea::placeholder { color: var(--text-muted); opacity: .6; }
.prompt-dialog-body .btn-clear-prompt { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: .8rem; cursor: pointer; display: none; align-items: center; justify-content: center; line-height: 1; }
.prompt-dialog-body .btn-clear-prompt.visible { display: flex; }
.prompt-dialog-body .btn-clear-prompt:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
.prompt-dialog-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--border); background: var(--bg-tertiary); display: flex; justify-content: flex-end; gap: .5rem; }
.prompt-dialog-done { padding: .45rem 1.1rem; border-radius: 8px; border: 1px solid var(--brand-charcoal); background: linear-gradient(135deg, var(--brand-charcoal), var(--brand-charcoal-dark)); color: #fff; font-size: .8rem; font-weight: 600; cursor: pointer; }
.prompt-dialog-done:hover { background: var(--primary-hover, var(--primary)); }

.byrd-login-backdrop { position: fixed; inset: 0; background: var(--backdrop); backdrop-filter: blur(8px); z-index: 1100; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; pointer-events: none; }
.byrd-login-backdrop.open { opacity: 1; pointer-events: auto; }
.byrd-login-dialog { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 420px; max-width: 90vw; transform: scale(.95) translateY(8px); transition: transform .2s; overflow: hidden; }
.byrd-login-backdrop.open .byrd-login-dialog { transform: scale(1) translateY(0); }
.byrd-login-header { background: var(--bg-tertiary); padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border); }
.byrd-login-header h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .25rem; }
.byrd-login-sub { font-size: .75rem; color: var(--text-muted); margin: 0; line-height: 1.4; }
.byrd-login-body { padding: 1.1rem 1.5rem; display: flex; flex-direction: column; gap: .9rem; }
.byrd-login-label { display: flex; flex-direction: column; gap: .3rem; }
.byrd-login-label span { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.byrd-login-label input,
.byrd-login-label select { padding: .5rem .65rem; font-size: .85rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); }
.byrd-login-label input:focus,
.byrd-login-label select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.byrd-login-label select { cursor: pointer; }
.byrd-login-backdrop.is-required .byrd-login-cancel { display: none; }
.byrd-login-remember { display: flex; align-items: center; gap: .5rem; font-size: .78rem; color: var(--text-secondary); cursor: pointer; }
.byrd-login-remember input { margin: 0; }
.byrd-login-hint { font-size: .74rem; color: var(--text-muted); margin: -.4rem 0 0; line-height: 1.4; }
.byrd-login-error { font-size: .78rem; padding: .4rem .6rem; border-radius: var(--radius-sm); background: var(--danger-light); color: var(--danger-text); border: 1px solid var(--danger); }
.byrd-login-footer { padding: .85rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .6rem; }
.byrd-login-cancel { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); padding: .4rem 1rem; border-radius: var(--radius-sm); font-size: .78rem; cursor: pointer; }
.byrd-login-cancel:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.byrd-login-submit { background: linear-gradient(135deg, var(--brand-charcoal), var(--brand-charcoal-dark)); color: #fff; border: none; padding: .4rem 1.2rem; border-radius: var(--radius-sm); font-size: .78rem; font-weight: 500; cursor: pointer; box-shadow: 0 4px 16px var(--primary-glow); }
.byrd-login-submit:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* Mapping Defaults — Customer / Project picker.                 */
/* Section-aware dropdown sourced from .env (server-side) that   */
/* runs a live test-connect against app.byrd.io on selection.    */
/* ============================================================ */
.customer-picker { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; padding-bottom: .9rem; border-bottom: 1px solid var(--border-subtle, var(--border)); }
.customer-picker-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
/* Subtitle separating the per-customer kv-defaults editor below from
   the customer-org context above (test-connect status, etc.). */
.mapping-defaults-subtitle { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .35rem; }
/* Inline hint that follows `.mapping-defaults-subtitle`. Carries the
   "scope of the editor" disclosure so the user understands why
   switching the Customer / Project dropdown above replaces the
   kv-rows below. Sized slightly smaller than the rest of the body
   copy so it reads as a footnote, not a banner. */
.mapping-defaults-hint { font-size: .72rem; color: var(--text-muted); line-height: 1.35; margin: 0 0 .7rem; }
/* General Settings — the last block in the Customer / Project drawer.
   Holds the browser-scoped preferences (Languages filter, Add only) that
   used to sit in the Uploaded Material toolbar. The top rule separates it
   from the per-organisation mapping defaults above, since the two have
   different persistence scopes. */
/* General Settings — one setting per hairline-separated block: label,
   control, then the note that explains it. The language codes used to sit
   inline with their label as bare checkboxes, which read as a single run-on
   row and gave the two settings no visual separation. */
.gen-settings { margin-top: 1rem; border-top: 1px solid var(--border-subtle, var(--border)); }
.gen-settings-head { padding: .9rem 0 .8rem; }
.gen-settings-title { font-size: .84rem; font-weight: 600; color: var(--text-primary); margin: 0 0 .25rem; }
.gen-settings-label { display: block; font-size: .72rem; font-weight: 600; color: var(--text-secondary); }
.gen-settings-note { font-size: .68rem; color: var(--text-muted); line-height: 1.4; }
.gen-settings-block { padding: .8rem 0; border-top: 1px solid var(--border-subtle, var(--border)); }
.gen-settings-block .gen-settings-label + .gen-settings-langs { margin-top: .45rem; }
.gen-settings-block .gen-settings-langs + .gen-settings-note { margin-top: .45rem; }

/* Language pills. The checkbox is visually hidden but still focusable, so
   the tick and the pill state ride off `:checked` — no re-render needed
   when toggling, which `_onLangFilterChange()` does not do. */
.gen-settings-langs { display: flex; flex-wrap: wrap; gap: .4rem; }
.lang-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: .72rem; color: var(--text-secondary); cursor: pointer; user-select: none; transition: border-color .15s, background .15s, color .15s; }
.lang-pill:hover { border-color: var(--primary); }
.lang-pill-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lang-pill-icon { width: 14px; height: 14px; flex: none; color: var(--text-muted); transition: color .15s; }
.lang-pill-icon .tick { opacity: 0; transition: opacity .15s; }
.lang-pill-input:checked ~ .lang-pill-icon { color: var(--primary); }
.lang-pill-input:checked ~ .lang-pill-icon .tick { opacity: 1; }
.lang-pill-input:checked ~ .lang-pill-text { color: var(--text-primary); font-weight: 600; }
.lang-pill:has(.lang-pill-input:checked) { border-color: var(--primary); background: var(--primary-light); }
.lang-pill:has(.lang-pill-input:focus-visible) { outline: none; box-shadow: 0 0 0 3px var(--primary-glow); }

.gen-settings-toggle { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; user-select: none; }
.gen-settings-toggle-copy { display: flex; flex-direction: column; gap: .15rem; }
.gen-settings-toggle input { accent-color: var(--primary); flex: none; width: 15px; height: 15px; margin: 0; cursor: pointer; }
.customer-select { width: 100%; padding: .5rem .65rem; font-size: .85rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); cursor: pointer; transition: border-color .15s, box-shadow .15s, color .15s; }
.customer-select:hover { border-color: var(--primary); }
.customer-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.customer-select:disabled { background: var(--bg-tertiary); cursor: not-allowed; color: var(--text-muted); }
/* BYRD_TEST flag — paint ONLY the BYRD_TEST entry in the brand red
   so the user can't miss that the playground/sandbox org is
   selected. The previous treatment painted every entry in the
   "Test Organisation" optgroup red; per UX request the red flag
   now belongs to the BYRD_TEST customer ID specifically. The
   `<select>` itself mirrors the picked option's customer id via
   a `data-active-id` attribute (set by `_refreshCustomerSectionAttr`)
   so the closed dropdown can react to the active selection. */
.customer-select option[value="BYRD_TEST"] {
  color: var(--primary);
  font-weight: 600;
}
.customer-select[data-active-id="BYRD_TEST"] {
  color: var(--primary);
  font-weight: 600;
  border-color: var(--primary);
}
.customer-status { font-size: .78rem; padding: .4rem .6rem; border-radius: var(--radius-sm); display: flex; align-items: center; gap: .4rem; line-height: 1.3; }
.customer-status[data-state="ok"] { background: var(--success-light); color: var(--success); border: 1px solid var(--success-light); }
.customer-status[data-state="error"] { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-light); }
.customer-status[data-state="loading"] { background: var(--bg-tertiary); color: var(--text-muted); }
.customer-status .cs-icon { flex: 0 0 auto; font-weight: 700; }
/* Message + signed-in account stack vertically; the icon stays on the
   first line, so the row aligns to the top rather than the centre. */
.customer-status:has(.cs-user) { align-items: flex-start; }
.customer-status .cs-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.customer-status .cs-user { font-size: .72rem; opacity: .8; overflow-wrap: anywhere; }
/* "Log out" of the connected organisation — clears cached credentials
   and disconnects. Lives in the header right next to the org chip and
   is shown only while an organisation is logged in. */
.customer-logout-btn {
  display: inline-flex; align-items: center; gap: .35rem; flex: 0 0 auto;
  padding: .3rem .6rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary);
  font-size: .74rem; font-weight: 600; line-height: 1; cursor: pointer; transition: all .12s;
  white-space: nowrap;
}
.customer-logout-btn[hidden] { display: none; }
.customer-logout-btn svg { width: 14px; height: 14px; }
.customer-logout-btn:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-light); }

/* AI Model selector inside the version dialog. Keeps the dialog's
   table-row layout — selector + helper line + visible "override" hint. */
/* Read-only model row inside the version dialog. Switching the model
   moved to the AI pill in the top bar; this just shows what's active. */
.model-readout { font-size: .82rem; font-weight: 600; color: var(--text); }
.model-readout-hint { font-size: .68rem; color: var(--text-muted); margin-top: .25rem; line-height: 1.3; }
.model-override-badge { font-size: .58rem; font-weight: 700; letter-spacing: .08em; padding: .1rem .35rem; border-radius: var(--radius-sm); background: var(--warn-light); color: var(--warn); border: 1px solid var(--warn); margin-left: .35rem; }

/* Item-lookup status — sits at the start of the attribute editor's
   header row (it is the leftmost element now that the global
   missing-required aggregate pill that used to precede it was
   removed at user request). Only shown when the lookup actually
   succeeded — the user doesn't need to see "not found" since
   they're typically creating a new item. */
.item-lookup-status { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .35rem; font-size: .78rem; padding: .25rem .6rem; border-radius: var(--radius-sm); margin-left: .6rem; line-height: 1.3; max-width: 100%; }
/* "Found" state recoloured 2026-05-28 from green → accent-blue at
   user request. Green collided with the queue's green-CTA family
   (the old Add-to-Queue button, the Upload-to-organisation
   button, the export-XML button) and made it ambiguous whether
   "✓ Article … found" was a status or a CTA. Blue reads as
   informational, leaves green free for actionable verbs, and
   matches the accent-blue family already used by the Load
   Article button / mapped-column border / Source-arrow icon. */
.item-lookup-status[data-state="found"]   { background: var(--accent-blue-light); color: var(--accent-blue); border: 1px solid var(--accent-blue-light); }
.item-lookup-status[data-state="checking"]{ background: var(--bg-tertiary); color: var(--text-muted); }
.item-lookup-status[data-state="error"]   { background: var(--primary-light); color: var(--primary); }
.item-lookup-status .lk-icon { flex: 0 0 auto; font-weight: 700; }
.item-lookup-status .lk-pk { font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace; font-size: .72rem; opacity: .85; }
/* PK badge doubles as the recent-history hover trigger (handlers are
   attached inline). Mirrors the dotted-underline affordance the
   compare-banner used to show so the user can tell it's hoverable.
   Tinted with the accent-blue alpha (matching #2563eb) so the
   hover wash visually rhymes with the surrounding "found" block. */
.item-lookup-status .lk-pk.has-history-tooltip { cursor: help; text-decoration: underline dotted currentColor; text-underline-offset: 3px; padding: .05rem .35rem; background: rgba(37,99,235,.12); border-radius: var(--radius-sm); }
.item-lookup-status .lk-pk.has-history-tooltip:hover { background: rgba(37,99,235,.22); }
/* PRDC-15: validation button → opens the errors/warnings dialog.
   Blue warning-triangle glyph sitting at the end of the status line. */
.item-lookup-status .lk-validate-btn { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: var(--radius-sm); background: var(--accent-blue); color: var(--on-accent); cursor: pointer; box-shadow: 0 1px 2px rgba(15, 23, 42, .2); transition: background .15s, box-shadow .15s, transform .15s; }
.item-lookup-status .lk-validate-btn svg { width: 14px; height: 14px; }
.item-lookup-status .lk-validate-btn:hover { background: #1e40af; color: #fff; transform: translateY(-1px); box-shadow: 0 2px 5px rgba(15, 23, 42, .28); }
.item-lookup-status .lk-validate-btn:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }
/* PRDC-21: recipient-feedback (CICs) button — sits right beside the
   validation triangle. Amber by default (warnings), red when any CIC
   needs action; carries a small count badge. */
.item-lookup-status .lk-cic-btn { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: var(--radius-sm); background: #f59e0b; color: #fff; cursor: pointer; box-shadow: 0 1px 2px rgba(15, 23, 42, .2); transition: background .15s, box-shadow .15s, transform .15s; }
.item-lookup-status .lk-cic-btn.has-action { background: var(--danger); }
.item-lookup-status .lk-cic-btn svg { width: 14px; height: 14px; }
.item-lookup-status .lk-cic-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 5px rgba(15, 23, 42, .28); filter: brightness(.95); }
.item-lookup-status .lk-cic-btn:focus-visible { outline: 2px solid #f59e0b; outline-offset: 2px; }
.item-lookup-status .lk-cic-btn .lk-cic-count { position: absolute; top: -6px; right: -6px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px; background: #111827; color: #fff; font-size: .58rem; font-weight: 700; line-height: 15px; text-align: center; box-shadow: 0 0 0 1.5px var(--surface); }
.cic-dialog .cic-body { display: flex; flex-direction: column; gap: .55rem; }
/* Inline meta-tags appended to the success state — show identifying
   attributes of the matched record (unit descriptor + German short
   description) so users can verify-at-a-glance which item was hit.
   Recoloured to the accent-blue family for the same reason as
   the parent `[data-state="found"]` rule above. */
.item-lookup-status .lk-meta { display: inline-block; padding: .05rem .4rem; border-radius: var(--radius-sm); background: rgba(37,99,235,.18); color: var(--accent-blue); font-size: .7rem; font-weight: 500; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-lookup-status .lk-descriptor { font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace; letter-spacing: .02em; }
/* Last-change chip — same blue palette as the other meta tags but
   slightly muted so it doesn't compete visually with the descriptor /
   desc chips that identify the matched record. */
.item-lookup-status .lk-updated { background: rgba(37,99,235,.1); font-weight: 400; max-width: none; }

/* ============================================================ */
/* Mapping Defaults — custom Key autocomplete dropdown.          */
/* Replaces the bare <datalist> with a section-grouped, badged   */
/* picker so reviewers can find e.g. informationProviderGLN by   */
/* scanning their section, not by remembering exact spelling.    */
/* ============================================================ */
.kv-autocomplete {
  position: fixed;
  display: none;
  z-index: 2200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 360px;
  width: 360px;
  overflow-y: auto;
  font-family: var(--font-sans);
  font-size: .8rem;
}
.kv-autocomplete.visible { display: block; }
.kv-autocomplete .kvac-empty {
  padding: 1rem; text-align: center; color: var(--text-muted);
  font-size: .78rem;
}
.kv-autocomplete .kvac-section-title {
  position: sticky; top: 0;
  padding: .35rem .75rem;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  font-size: .65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted);
}
.kv-autocomplete .kvac-section-title:first-child { border-top: none; }
.kv-autocomplete .kvac-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .75rem;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background .1s, border-color .1s;
}
.kv-autocomplete .kvac-item:hover,
.kv-autocomplete .kvac-item.kvac-active {
  background: var(--accent-blue-light);
  border-left-color: var(--accent-blue);
}
.kv-autocomplete .kvac-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.kv-autocomplete .kvac-label {
  font-family: var(--font-sans);
  font-size: .82rem; font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kv-autocomplete .kvac-key {
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kv-autocomplete mark {
  background: rgba(245, 158, 11, .35);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}
.kv-autocomplete .kvac-badges {
  display: inline-flex; gap: .25rem; flex-shrink: 0;
}
.kv-autocomplete .kvac-badge {
  font-size: .58rem; font-weight: 700;
  padding: .08rem .35rem;
  border-radius: 3px;
  text-transform: uppercase; letter-spacing: .04em;
  line-height: 1.4;
}
.kv-autocomplete .kvac-badge.req  { background: var(--mandatory-empty-bg); color: var(--mandatory-empty-border); }
.kv-autocomplete .kvac-badge.ml   { background: var(--accent-blue-light);  color: var(--accent-blue); }
.kv-autocomplete .kvac-badge.bool { background: var(--accent-light);       color: var(--accent); }
.kv-autocomplete .kvac-badge.len  { background: var(--bg-tertiary);        color: var(--text-muted); font-weight: 600; }

.btn-cheatsheet {
  background: none; border: 1px solid var(--border);
  border-radius: 50%; width: 28px; height: 28px;
  cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--text-muted); transition: all .15s; flex-shrink: 0;
}
.btn-cheatsheet:hover { background: var(--accent-blue-light); color: var(--accent-blue); border-color: var(--accent-blue); }

/* ============================================================ */
/* Header refactor: consolidated help/info popover (replaces the */
/* three side-by-side .btn-help / .btn-cheatsheet / .btn-info    */
/* buttons that used to live in the top bar).                    */
/* ============================================================ */
.help-menu-wrap { position: relative; display: inline-block; }
.btn-help-menu {
  background: none; border: 1px solid var(--border);
  border-radius: 50%; width: 28px; height: 28px;
  cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--text-muted); transition: all .15s; flex-shrink: 0;
}
.btn-help-menu:hover,
.btn-help-menu[aria-expanded="true"] {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
/* UI language switch — a compact code pill (EN / DE) that drops a short
   list of languages. Sized to sit level with the help button beside it. */
.lang-picker-wrap { position: relative; display: inline-block; }
.lang-picker-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 28px; padding: 0 .5rem;
  background: none; border: 1px solid var(--border); border-radius: 7px;
  color: var(--text-secondary);
  font: inherit; font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.lang-picker-trigger:hover,
.lang-picker-trigger[aria-expanded="true"] {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.lang-picker-trigger:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.lang-picker-popover {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .35rem;
  display: none;
  flex-direction: column; gap: 1px;
  z-index: 200;
}
.lang-picker-popover.visible { display: flex; }
.lang-picker-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .5rem .65rem;
  background: none; border: 0; border-radius: 6px;
  text-align: left; cursor: pointer;
  font: inherit; font-size: .82rem; color: var(--text-secondary);
  transition: background .12s, color .12s;
}
.lang-picker-item:hover { background: var(--bg-tertiary); color: var(--text); }
.lang-picker-item.active { color: var(--text); font-weight: 600; }
/* Check column is always present so the two rows stay left-aligned
   whether or not one of them is the active language. */
.lang-picker-item .lpi-check {
  flex: 0 0 14px; width: 14px; height: 14px;
  color: var(--primary); visibility: hidden;
}
.lang-picker-item.active .lpi-check { visibility: visible; }

.help-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .35rem;
  display: none;
  flex-direction: column; gap: 1px;
  z-index: 200;
}
.help-menu.visible { display: flex; }
.help-menu-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .5rem .65rem;
  background: none; border: 0; border-radius: 6px;
  font-size: .82rem; color: var(--text-secondary);
  text-align: left; cursor: pointer;
  transition: background .12s, color .12s;
}
.help-menu-item:hover { background: var(--bg-tertiary); color: var(--text); }
.help-menu-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .8; }
.help-menu-item span { flex: 1; }
.help-menu-kbd {
  font-family: var(--font-mono); font-size: .68rem;
  padding: .05rem .35rem; border: 1px solid var(--border);
  border-radius: 4px; background: var(--bg-tertiary);
  color: var(--text-muted);
}
.help-menu-sep { height: 1px; background: var(--border-subtle); margin: .3rem .2rem; }
/* Header light/dark pill — sits immediately before the EN/DE language
   control. A charcoal thumb slides under the active icon (150–200 ms);
   inactive icons stay transparent on the track. */
.theme-toggle {
  position: relative;
  display: inline-flex; align-items: center;
  height: 28px; padding: 2px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 999px;
  flex-shrink: 0;
}
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--brand-charcoal);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  transition: transform .18s ease;
  pointer-events: none;
  z-index: 0;
}
.theme-toggle[data-active="dark"]::before {
  transform: translateX(22px);
}
.theme-toggle-btn {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-muted);
  cursor: pointer; transition: color .18s ease;
}
.theme-toggle-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.theme-toggle-btn:hover { color: var(--text); }
.theme-toggle-btn.active {
  background: transparent;
  color: #fff;
}
.theme-toggle-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ============================================================ */
/* Header refactor: queue-panel header now hosts export verbs.   */
/* Primary action (Export XML) is visible; secondary (MPIM       */
/* Preprod) lives in a kebab/overflow menu so the panel header   */
/* stays scannable.                                              */
/* ============================================================ */
.qph-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px;
  background: var(--accent-blue); color: var(--on-accent);
  font-size: .68rem; font-weight: 700;
  margin-right: .15rem;
}
.queue-panel-actions {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: .35rem;
}
.queue-panel-actions .btn-export-xml {
  padding: .35rem .7rem;
  font-size: .72rem;
  gap: .35rem;
  border-radius: 6px;
  letter-spacing: .005em;
}
.queue-panel-actions .btn-export-xml svg { width: 13px; height: 13px; }
.queue-overflow-wrap { position: relative; display: inline-block; }
.btn-queue-overflow {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px; height: 28px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all .15s; flex-shrink: 0;
}
.btn-queue-overflow:hover,
.btn-queue-overflow[aria-expanded="true"] {
  background: var(--bg-tertiary);
  color: var(--text);
  border-color: var(--text-muted);
}
.queue-overflow-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .3rem;
  display: none;
  flex-direction: column; gap: 1px;
  z-index: 200;
}
.queue-overflow-menu.visible { display: flex; }
.queue-overflow-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .5rem .65rem;
  background: none; border: 0; border-radius: 6px;
  font-size: .82rem; color: var(--text-secondary);
  text-align: left; cursor: pointer;
  transition: background .12s, color .12s;
}
.queue-overflow-item:hover:not(:disabled) { background: var(--bg-tertiary); color: var(--text); }
.queue-overflow-item:disabled { opacity: .5; cursor: not-allowed; }
.queue-overflow-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .8; }
.queue-overflow-item span { flex: 1; }
/* Thin visual divider that separates the export verbs (top) from
   the destructive Clear queue verb (bottom). 1 px line, half-bleed
   to the menu's inner padding so it visually spans the full width. */
.queue-overflow-divider {
  height: 1px; background: var(--border);
  margin: .25rem -.3rem;
}
/* Destructive variant of the menu item — red-tinted icon + label so
   the Clear queue verb is unmistakable as "this empties your work". */
.queue-overflow-item-danger { color: var(--primary); }
.queue-overflow-item-danger svg { opacity: 1; }
.queue-overflow-item-danger:hover:not(:disabled) { background: var(--primary-light); color: var(--primary); }
.qo-env {
  flex: 0 0 auto !important;
  font-size: .6rem; font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
}

/* Compact inline reset button for the workspace toolbar — same
   visual family as .btn-reset but sized to match .btn-queue. */
.btn-reset-inline {
  padding: .4rem .8rem !important;
  font-size: .78rem !important;
  border-radius: 6px !important;
}
.btn-reset-inline svg { width: 13px; height: 13px; }
.attr-header-row .btn-reset-inline { margin-left: auto; }
.attr-header-row .btn-reset-inline + .btn-queue { margin-left: 0; }

/* ============================================================ */
/* User Guide — in-app onboarding modal (#userGuideBackdrop).    */
/* Trigger: .btn-help in the header. All `.ug-*` rules are       */
/* scoped so they cannot leak to the host page.                  */
/* ============================================================ */
.btn-help {
  background: none; border: 1px solid var(--border);
  border-radius: 50%; width: 28px; height: 28px;
  cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--text-muted); transition: all .15s; flex-shrink: 0;
}
.btn-help:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.user-guide-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: var(--backdrop); backdrop-filter: blur(6px);
  z-index: 1500;
  align-items: center; justify-content: center;
  padding: 1.5rem;
}
.user-guide-backdrop.visible { display: flex; }
.user-guide-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 880px; max-width: 100%;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.user-guide-dialog-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.user-guide-dialog-header h2 {
  font-size: .78rem; font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .06em; text-transform: uppercase;
  margin: 0;
}
.ug-close {
  background: none; border: 1px solid var(--border);
  border-radius: 50%; width: 28px; height: 28px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all .15s;
  flex-shrink: 0;
}
.ug-close:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.user-guide-dialog-body {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* Content rules — all scoped to .ug-root. */
.ug-root { font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif; color: var(--text); line-height: 1.6; font-size: .92rem; }
.ug-root h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; margin: 0 0 .4rem; color: var(--text); }
.ug-root .ug-lead { color: var(--text-secondary); font-size: .95rem; margin: 0 0 1.5rem; }
.ug-root h2 { font-size: 1.05rem; font-weight: 600; margin: 1.8rem 0 .5rem; padding-bottom: .35rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .55rem; }
.ug-root h2 .ug-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: var(--on-accent); font-size: .72rem; font-weight: 600; flex-shrink: 0; }
.ug-root h3 { font-size: .92rem; font-weight: 600; margin: 1.1rem 0 .4rem; color: var(--text); }
.ug-root p { margin: 0 0 .7rem; }
.ug-root ul, .ug-root ol { margin: 0 0 .85rem 0; padding-left: 1.5rem; list-style-position: outside; }
.ug-root ul { list-style-type: disc; }
.ug-root ol { list-style-type: decimal; }
.ug-root li { margin-bottom: .3rem; }
.ug-root strong { color: var(--text); font-weight: 600; }
.ug-root code { font-family: var(--font-mono); font-size: .82em; background: var(--bg-tertiary); padding: .08rem .35rem; border-radius: 4px; color: var(--text); }
.ug-root kbd { font-family: var(--font-mono); font-size: .78em; background: var(--surface); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: .08rem .4rem; color: var(--text); box-shadow: 0 1px 0 rgba(0,0,0,.04); white-space: nowrap; }

.ug-toc { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 8px; padding: .7rem .9rem; margin: 0 0 1.4rem; }
.ug-toc-title { font-size: .7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .45rem; }
.ug-toc ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .25rem 1rem; counter-reset: ug-toc-counter; }
.ug-toc li { margin: 0; counter-increment: ug-toc-counter; font-size: .86rem; }
.ug-toc li::before { content: counter(ug-toc-counter) "."; color: var(--text-muted); margin-right: .4rem; font-variant-numeric: tabular-nums; }
.ug-toc a { color: var(--accent-blue); text-decoration: none; }
.ug-toc a:hover { text-decoration: underline; }

.ug-steps { list-style: none; margin: .5rem 0 1rem; padding: 0; counter-reset: ug-step; }
.ug-steps li { counter-increment: ug-step; position: relative; padding: .55rem .7rem .55rem 2.4rem; background: var(--surface-alt); border: 1px solid var(--border-subtle); border-radius: 8px; margin-bottom: .45rem; }
.ug-steps li::before { content: counter(ug-step); position: absolute; left: .6rem; top: .55rem; width: 22px; height: 22px; background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: var(--on-accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .74rem; font-weight: 600; font-family: var(--font-mono); }

.ug-table { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; font-size: .88rem; }
.ug-table th, .ug-table td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.ug-table th { background: var(--bg-tertiary); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.ug-table td:first-child { font-weight: 600; white-space: nowrap; }

.ug-callout { border-left: 3px solid var(--accent-blue); background: var(--accent-blue-light); padding: .6rem .85rem; border-radius: 0 6px 6px 0; margin: .7rem 0; font-size: .88rem; }
.ug-callout.advanced { border-color: var(--warn); background: var(--warn-light); }
.ug-callout.heads-up { border-color: var(--primary); background: var(--primary-light); }
.ug-callout strong:first-child { text-transform: uppercase; font-size: .72rem; letter-spacing: .06em; color: var(--text-secondary); display: block; margin-bottom: .2rem; }

.ug-tag { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; background: var(--warn-light); color: var(--warn); padding: .12rem .5rem; border-radius: 4px; margin-left: .4rem; vertical-align: middle; }

.ug-anatomy { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: .8rem; font-family: var(--font-mono); font-size: .78rem; color: var(--text-secondary); line-height: 1.5; margin: .5rem 0 1rem; }
.ug-anatomy .ug-zone { display: block; padding: .4rem .6rem; margin-bottom: .35rem; border-radius: 6px; border: 1px dashed var(--border); background: var(--surface); }
.ug-anatomy .ug-zone strong { color: var(--primary); margin-right: .4rem; }
.ug-anatomy .ug-zone:last-child { margin-bottom: 0; }

.ug-qa { margin: .5rem 0; }
.ug-qa-q { font-weight: 600; color: var(--text); margin-top: .85rem; margin-bottom: .25rem; }
.ug-qa-q::before { content: "Q. "; color: var(--accent-blue); }
.ug-qa-a { margin: 0 0 .5rem 1.1rem; color: var(--text-secondary); }

.ug-glossary { margin: .5rem 0; }
.ug-glossary dt { font-family: var(--font-mono); font-weight: 600; color: var(--primary); margin-top: .65rem; }
.ug-glossary dd { margin: .15rem 0 0 1.2rem; color: var(--text-secondary); font-size: .88rem; }

#mappedItemMenu { min-width: 160px; font-weight: 400; }
.bulk-backdrop {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .45);
}
.bulk-box {
  width: min(520px, 92vw); max-height: 86vh; overflow: auto;
  padding: 1.1rem 1.25rem; border-radius: 10px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; gap: .5rem;
}
.bulk-box h3 { margin: 0 0 .25rem; }
.bulk-lbl { font-size: .75rem; font-weight: 600; color: var(--text-secondary); }
.bulk-input { width: 100%; padding: .4rem .55rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.bulk-list { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: .25rem; }
.bulk-row { display: flex; align-items: center; gap: .5rem; padding: .2rem .35rem; font-size: .85rem; cursor: pointer; }
.bulk-row[hidden] { display: none; }
.bulk-row em { margin-left: auto; color: var(--text-secondary); font-size: .75rem; font-style: normal; }
.bulk-check, .bulk-scope label { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.bulk-scope { display: flex; gap: 1rem; flex-wrap: wrap; }
.bulk-preview { min-height: 1.2em; font-size: .8rem; color: var(--text-secondary); }
.bulk-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .25rem; }
.bulk-undo-bar {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 1300;
  display: flex; align-items: center; gap: .9rem;
  padding: .6rem 1rem; border-radius: 8px;
  background: var(--text); color: var(--surface); font-size: .85rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .3);
}
.bulk-undo-bar button { background: transparent; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.bulk-cancel { padding: .4rem .9rem; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; }