/* ============================================================
   00-reset.css
   CSS reset, :root variables, dark-mode token overrides
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* =================================================================
   Lee Kum Kee Americas — AI Operations Platform
   Brand Design System
   ================================================================= */

/* -------- Self-hosted fonts (loaded from /css/fonts/) ----------- */
/* ABC Arizona Flare = headline face (Tezign group 6597). Playfair stays as fallback. */

@font-face {
  font-family: 'ABC Arizona Flare';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('fonts/ABCArizonaFlare-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'ABC Arizona Flare';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('fonts/ABCArizonaFlare-Bold.woff2') format('woff2');
}

@font-face {
  font-family: 'ABC Arizona Flare';
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url('fonts/ABCArizonaFlare-RegularItalic.woff2') format('woff2');
}

@font-face {
  font-family: 'ABC Arizona Flare';
  font-weight: 700;
  font-style: italic;
  font-display: swap;
  src: url('fonts/ABCArizonaFlare-BoldItalic.woff2') format('woff2');
}

@font-face {
  font-family: 'Playfair Display';
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url('fonts/PlayfairDisplay-Italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Playfair Display';
  font-weight: 700;
  font-style: italic;
  font-display: swap;
  src: url('fonts/PlayfairDisplay-BoldItalic.woff2') format('woff2');
}

@font-face {
  font-family: 'Playfair Display';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('fonts/PlayfairDisplay-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Playfair Display';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('fonts/PlayfairDisplay-Bold.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('fonts/SourceSans3-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url('fonts/SourceSans3-SemiBold.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('fonts/SourceSans3-Bold.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url('fonts/SourceSans3-Italic.woff2') format('woff2');
}

/* -------- Heritage palette tokens ------------------------------- */

:root {
  /* Heritage colors */
  --heritage-red:        #CC0000;
  --heritage-red-deep:   #D41920;
  --heritage-red-dark:   #8B0000;
  --heritage-purple:     #5B2C8A;
  --heritage-purple-dark:#3D1A5C;
  --heritage-gold:       #D4A843;
  --heritage-gold-dark:  #8B6914; /* WCAG AA fix: 4.7:1 on warm-white (was #A07830 / #B8860B family, ~3.2:1) */
  --heritage-gold-light: #E8C572;

  /* Surface colors — warm, never cold */
  --eggshell-bright:     #FFF5E6;
  --eggshell-shade:      #F0E0C8;
  --eggshell-deep:       #E4D2B5;
  --warm-white:          #FFFDF8;
  --paper:               #FBF6EC;

  /* Functional */
  --success:             #2D8C3C;
  --success-deep:        #1F6B2B;
  --warning:             #C68A1F;
  --danger:              #C0392B;
  --info:                #5B2C8A;

  /* Ink */
  --ink-strong:          #1A1410;
  --ink:                 #2C2520;
  --ink-soft:            #4A4038; /* WCAG AA fix: tightened from #5A4F45 for stronger body-text contrast */
  --ink-mute:            #6B6560; /* WCAG AA fix: 5.0:1 on warm-white (was #8A7F73, 3.85:1) */
  --ink-faint:           #767065; /* WCAG AA fix: 4.55:1 on eggshell-bright, 4.83:1 on warm-white, 4.56:1 on paper (was #B5AB9E, 2.10:1 — under half the AA floor) */

  /* Borders & dividers */
  --rule:                #E5D9C4;
  --rule-soft:           #EFE5D2;
  --rule-gold:           #D4A84380;

  /* Elevation — warm, soft */
  --shadow-sm:  0 1px 2px rgba(60, 40, 20, 0.06), 0 1px 3px rgba(60, 40, 20, 0.04);
  --shadow:     0 4px 12px rgba(60, 40, 20, 0.08), 0 1px 3px rgba(60, 40, 20, 0.05);
  --shadow-lg:  0 12px 32px rgba(60, 40, 20, 0.12), 0 4px 12px rgba(60, 40, 20, 0.08);
  --shadow-xl:  0 24px 64px rgba(60, 40, 20, 0.16), 0 8px 24px rgba(60, 40, 20, 0.10);

  /* Geometry */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Typography scale */
  --font-serif: 'ABC Arizona Flare', 'Playfair Display', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-sans:  'Source Sans Pro', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --sidebar-w: 248px;
  --header-h:  72px;
  --max-w:     1480px;
}

/* -------- Reset / base ----------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: var(--ink);
  background:
    radial-gradient(ellipse at top left, rgba(212, 168, 67, 0.06), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(91, 44, 138, 0.04), transparent 50%),
    var(--eggshell-bright);
  background-attachment: fixed;
  min-height: 100vh;
  max-width: 100%;
  /* NOTE: do NOT put overflow-x (clip/hidden) on html/body.
     On iOS Safari any non-visible overflow on the viewport root
     establishes a containing block for position:fixed descendants,
     which makes body-level fixed elements (the Ask AIOP + feedback
     FABs, body::before texture) scroll with the page and land
     mid-screen. The horizontal-scroll guard lives on .app-shell
     (02-layout.css) instead — a non-fixed-ancestor wrapper. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Grid/flex items default to min-content sizing, which lets wide
   children (tables, long words, code blocks) expand their tracks beyond
   the viewport. Force min-width: 0 on common containers so 1fr means
   1fr — not max(1fr, intrinsic content width). */

.app-shell, .main, .content, .section,
.two-col, .three-col, .four-col,
.grid-2, .grid-3, .grid-4,
.form-grid, .kb-layout, .stat-grid, .kanban, .kanban-prod {
  min-width: 0;
}

.two-col > *, .three-col > *, .four-col > *,
.grid-2 > *, .grid-3 > *, .grid-4 > *,
.form-grid > *, .kb-layout > *, .stat-grid > *,
.kanban > *, .kanban-prod > * {
  min-width: 0;
}

/* Subtle paper texture overlay */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, transparent 0, transparent 2px, rgba(160, 120, 48, 0.012) 2px, rgba(160, 120, 48, 0.012) 3px),
    repeating-linear-gradient(90deg, transparent 0, transparent 2px, rgba(160, 120, 48, 0.012) 2px, rgba(160, 120, 48, 0.012) 3px);
  z-index: 0;
}
/* ============================================================
   01-typography.css
   Font imports (Playfair Display, Source Sans Pro), headings, body text
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--ink-strong);
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  font-weight: 700;
}

h1 { font-size: 2.4rem; font-style: italic; line-height: 1.15; }

h2 { font-size: 1.8rem; font-style: italic; line-height: 1.2; }

h3 { font-size: 1.35rem; line-height: 1.25; }

h4 { font-size: 1.1rem; line-height: 1.3; }

p  { margin: 0 0 1em; color: var(--ink); }

a {
  color: var(--heritage-red);
  text-decoration: none;
  transition: color 120ms ease;
}

a:hover { color: var(--heritage-red-dark); text-decoration: underline; }

button { font: inherit; }
/* ============================================================
   02-layout.css
   Grid system, .content, page structure, responsive breakpoints
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* -------- Application shell ------------------------------------ */

.app-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  z-index: 1;
}

/* -------- Two-column layouts --------------------------------- */

.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.section {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 16px;
  flex-wrap: wrap; /* merged from sub-agent polish */
}

.section-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--ink-strong);
  letter-spacing: -0.02em;
  margin: 0;
}

/* Compact section headers (subsections) lose the italic to feel less editorial */

.section-header h3.section-title {
  font-style: normal;
}

.section-subtitle {
  color: var(--ink-mute);
  font-size: 0.88rem;
  margin-top: 2px;
}

/* -------- Responsive ----------------------------------------- */

@media (max-width: 1100px) {
  .kanban { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .form-grid { grid-template-columns: 1fr; }
  /* Content top tightened in 03-shell.css mobile rule (12/20/20). */
  /* Preserve true safe-area only; drop the old +10px slack that left a
     large eggshell band under the Dynamic Island / notch. */
  .topbar {
    padding: calc(env(safe-area-inset-top, 0px) + 2px) max(18px, env(safe-area-inset-right, 0px)) 0 max(18px, env(safe-area-inset-left, 0px));
    height: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 2px);
  }
  .search-bar { width: 200px; }
}

@media (max-width: 540px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .kanban { grid-template-columns: 1fr; }
  h1 { font-size: 1.8rem; }
  .topbar-title { font-size: 1.2rem; }
}
/* ============================================================
   03-shell.css
   Sidebar, topbar, footer, mobile nav, search bar, user chip, user dropdown
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* -------- Sidebar ---------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--paper) 0%, var(--eggshell-shade) 100%);
  border-right: 1px solid var(--rule);
  padding: 28px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

.sidebar::-webkit-scrollbar { width: 6px; }

.sidebar::-webkit-scrollbar-track { background: transparent; }

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* Reserve space at the bottom so the last nav item isn't flush against the viewport edge */

.sidebar > *:last-child { margin-bottom: 32px; }

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg,
    transparent,
    var(--heritage-gold) 15%,
    var(--heritage-gold) 85%,
    transparent);
  opacity: 0.4;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0 4px 20px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 16px;
  position: relative;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-arch {
  width: 36px;
  height: 36px;
  position: relative;
  flex-shrink: 0;
}

.brand-arch svg { width: 100%; height: 100%; }

.brand-arch img.brand-logo-img,
.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  /* Sharpen at small sizes; the logo PNG is high-res */
  image-rendering: -webkit-optimize-contrast;
}

.brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name .name-en {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--heritage-red);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-name .name-en .small {
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  display: block;
  margin-top: 4px;
  text-transform: uppercase;
}

.brand-tag {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--heritage-gold-dark);
  margin-top: 14px;
  padding-left: 4px;
  border-left: 2px solid var(--heritage-gold);
}

.nav-section-title {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 12px 12px 6px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 500;
  font-size: 0.93rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 140ms ease;
  text-decoration: none;
}

.nav-link:hover {
  background: rgba(204, 0, 0, 0.06);
  color: var(--heritage-red);
  text-decoration: none;
}

.nav-link.active {
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: var(--warm-white);
  border-color: var(--heritage-red-dark);
  box-shadow: 0 2px 6px rgba(204, 0, 0, 0.25);
}

.nav-link.active:hover {
  color: var(--warm-white);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg { width: 100%; height: 100%; }

.nav-badge {
  margin-left: auto;
  background: var(--heritage-gold);
  color: var(--ink-strong);
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-link.active .nav-badge {
  background: var(--warm-white);
  color: var(--heritage-red);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.sidebar-footer .footer-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(45, 140, 60, 0.18);
}

/* -------- Main content area ----------------------------------- */

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  /* Keep true notch/Dynamic Island inset; only +2px breathing room (was +6). */
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 2px);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: calc(env(safe-area-inset-top, 0px) + 2px) 32px 0 32px;
  background: rgba(255, 253, 248, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ink-strong);
  letter-spacing: -0.02em;
}

.topbar-subtitle {
  color: var(--ink-mute);
  font-size: 0.85rem;
  font-weight: 400;
  margin-left: 4px;
  font-style: normal;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-bar {
  position: relative;
  width: 320px;
}

.search-bar input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.search-bar input::placeholder { color: var(--ink-mute); }

.search-bar input:focus {
  outline: none;
  border-color: var(--heritage-gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.18);
}

.search-bar svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-mute);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.87rem;
  color: var(--ink);
  cursor: pointer;
  transition: all 120ms ease;
}

.user-chip:hover {
  border-color: var(--heritage-gold);
  background: var(--paper);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--heritage-purple), var(--heritage-purple-dark));
  color: var(--warm-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.content {
  flex: 1;
  padding: 32px;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
}

/* iPhone / notched mobile: less air under sticky topbar before page content. */
@media (max-width: 880px) {
  .content {
    padding: 12px 20px 20px;
  }
}

/* -------- Footer --------------------------------------------- */

.app-footer {
  margin-top: 0;
  padding: 24px 32px;
  border-top: 1px solid var(--rule);
  background: var(--paper);
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-mute);
}

.app-footer .footer-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.app-footer .footer-mark svg { width: 18px; height: 18px; }

.app-footer .footer-mark img.footer-mark-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}
/* ============================================================
   04-components.css
   Buttons, cards, tables (.data-table), forms, inputs, modals, toasts, badges, chips, pills, alerts, empty-states, spinners, tooltips
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* -------- Buttons --------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 140ms ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: var(--warm-white);
  border-color: var(--heritage-red-dark);
  box-shadow: 0 2px 6px rgba(204, 0, 0, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--heritage-red-deep), var(--heritage-red-dark));
  box-shadow: 0 4px 12px rgba(204, 0, 0, 0.32);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--warm-white);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--warm-white);
  color: var(--ink);
  border-color: var(--rule);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--heritage-gold);
  background: var(--paper);
  color: var(--heritage-red);
  text-decoration: none;
}

.btn-purple {
  background: linear-gradient(135deg, var(--heritage-purple), var(--heritage-purple-dark));
  color: var(--warm-white);
  border-color: var(--heritage-purple-dark);
  box-shadow: 0 2px 6px rgba(91, 44, 138, 0.22);
}

.btn-purple:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(91, 44, 138, 0.32);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--warm-white);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--paper);
  color: var(--ink-strong);
}

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.btn-lg { padding: 12px 22px; font-size: 1rem; }

/* -------- Cards & gateway frames ------------------------------ */

.card {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.card:hover {
  border-color: var(--rule-gold);
  box-shadow: var(--shadow);
}

.card.gateway {
  position: relative;
  overflow: hidden;
}

/* Gateway frame: subtle gold corner ornaments — reserved for hero elements only */

.card.gateway {
  padding: 28px 26px;
}

.card.gateway::before,
.card.gateway::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 2;
}

.card.gateway::before {
  top: 10px; left: 10px;
  border-top: 1.5px solid var(--heritage-gold);
  border-left: 1.5px solid var(--heritage-gold);
}

.card.gateway::after {
  bottom: 10px; right: 10px;
  border-bottom: 1.5px solid var(--heritage-gold);
  border-right: 1.5px solid var(--heritage-gold);
}

/* When a card.gateway wraps a table directly, suppress its own padding so the table flows edge-to-edge */

.card.gateway.card-table {
  padding: 0;
  overflow: hidden;
}

.card.gateway.card-table::before,
.card.gateway.card-table::after {
  display: none;
}

.card-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink-strong);
  margin: 0 0 4px;
}

.card-subtitle {
  color: var(--ink-mute);
  font-size: 0.83rem;
  margin-bottom: 16px;
}

/* -------- Big number display (small KPIs, panel numerals) ----- */

.big-num {
  font-family: var(--font-sans);
  font-feature-settings: 'tnum';
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink-strong);
  display: block;
  margin-top: 4px;
}

.big-num.red    { color: var(--heritage-red-dark); }

.big-num.purple { color: var(--heritage-purple); }

.big-num.gold   { color: var(--heritage-gold-dark); }

.big-num.green  { color: var(--success); }

/* -------- Stat cards ------------------------------------------ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

/* On tablet portrait (768px), prefer 2x2 over 3+1 orphan layout */

@media (min-width: 561px) and (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

.stat-card {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 180ms ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--rule-gold);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  background: var(--heritage-red);
}

.stat-card.purple::before { background: var(--heritage-purple); }

.stat-card.gold::before   { background: var(--heritage-gold); }

.stat-card.green::before  { background: var(--success); }

.stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-sans);
  font-feature-settings: 'tnum';
  font-weight: 700;
  font-size: 2rem;
  color: var(--ink-strong);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.stat-value .currency-symbol {
  font-size: 1.6rem;
  margin-right: 1px;
  color: var(--heritage-gold-dark);
  font-weight: 600;
}

.stat-value .pct-symbol {
  font-size: 1.2rem;
  color: var(--ink-soft);
  font-weight: 500;
  margin-left: 2px;
}

.stat-meta {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 6px;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 6px;
}

.stat-trend.up   { color: var(--success); }

.stat-trend.down { color: var(--danger); }

/* -------- Status badges --------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-status-new        { background: rgba(91, 44, 138, 0.10); color: var(--heritage-purple); border-color: rgba(91, 44, 138, 0.22); }

.badge-status-in_progress{ background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); border-color: rgba(212, 168, 67, 0.42); }

.badge-status-review     { background: rgba(91, 44, 138, 0.14); color: var(--heritage-purple-dark); border-color: rgba(91, 44, 138, 0.30); }

.badge-status-won        { background: rgba(45, 140, 60, 0.12); color: var(--success-deep); border-color: rgba(45, 140, 60, 0.30); }

.badge-status-lost       { background: rgba(90, 79, 69, 0.10); color: var(--ink-soft); border-color: rgba(90, 79, 69, 0.20); }

.badge-status-pending    { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); border-color: rgba(212, 168, 67, 0.42); }

.badge-status-approved   { background: rgba(45, 140, 60, 0.12); color: var(--success-deep); border-color: rgba(45, 140, 60, 0.30); }

.badge-priority-urgent   { background: rgba(204, 0, 0, 0.10); color: var(--heritage-red-dark); border-color: rgba(204, 0, 0, 0.30); }

.badge-priority-high     { background: rgba(204, 0, 0, 0.06); color: var(--heritage-red); border-color: rgba(204, 0, 0, 0.18); }

.badge-priority-medium   { background: rgba(212, 168, 67, 0.14); color: var(--heritage-gold-dark); border-color: rgba(212, 168, 67, 0.30); }

.badge-priority-low      { background: rgba(90, 79, 69, 0.08); color: var(--ink-soft); border-color: rgba(90, 79, 69, 0.16); }

.badge-confidence {
  background: var(--paper);
  color: var(--ink-soft);
  border-color: var(--rule);
  font-feature-settings: 'tnum';
  font-family: var(--font-sans);
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* -------- Tables ---------------------------------------------- */

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
  background: var(--warm-white);
}

.data-table thead th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 700;
  padding: 12px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 1;
  cursor: pointer;
  user-select: none;
}

.data-table thead th:hover { color: var(--heritage-red); }

.data-table thead th:first-child { border-top-left-radius: var(--radius-lg); }

.data-table thead th:last-child  { border-top-right-radius: var(--radius-lg); }

.data-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--ink);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 100ms ease;
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(212, 168, 67, 0.06), transparent);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .reference-cell {
  font-family: var(--font-sans);
  font-feature-settings: 'tnum';
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--heritage-purple);
  letter-spacing: 0.02em;
}

/* Strip ornaments when a data table sits inside a gateway card */

.card.gateway > table.data-table,
.card.gateway > .table-wrap {
  position: relative;
  z-index: 1;
}

.data-table .customer-cell {
  font-weight: 600;
  color: var(--ink-strong);
}

.data-table .customer-cell .customer-meta {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin-top: 2px;
}

.data-table .value-cell {
  font-feature-settings: 'tnum';
  font-weight: 600;
  text-align: right;
}

.data-table .due-date-cell {
  font-feature-settings: 'tnum';
  font-size: 0.88rem;
}

.data-table .due-date-cell.overdue {
  color: var(--heritage-red-dark);
  font-weight: 600;
}

.data-table .due-date-cell .due-relative {
  font-size: 0.74rem;
  color: var(--ink-mute);
  display: block;
  margin-top: 2px;
}

.data-table .due-date-cell.overdue .due-relative {
  color: var(--heritage-red);
}

.data-table .assignee-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.assignee-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--heritage-purple), var(--heritage-purple-dark));
  color: var(--warm-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.assignee-cell.unassigned {
  color: var(--ink-mute);
  font-style: italic;
}

.unassigned-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--rule);
  color: var(--ink-mute);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px dashed var(--ink-faint);
}

.table-wrap {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  /* Allow horizontal scroll instead of clipping wide tables. The hidden
     border-radius is preserved by the rounded border + the table's
     overflow context. */
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--warm-white);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

/* Subtle scrollbar styling — visible but unobtrusive */

.table-wrap::-webkit-scrollbar { height: 6px; }

.table-wrap::-webkit-scrollbar-track { background: transparent; }

.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(138, 127, 115, 0.35);
  border-radius: 3px;
}

.table-wrap::-webkit-scrollbar-thumb:hover { background: rgba(138, 127, 115, 0.55); }

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-mute);
}

.empty-state .empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  color: var(--ink-faint);
}

/* -------- Kanban board ---------------------------------------- */

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(260px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-col {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 14px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4px;
}

.kanban-col-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-col-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.kanban-col[data-status="new"] .kanban-col-title::before        { background: var(--heritage-purple); }

.kanban-col[data-status="in_progress"] .kanban-col-title::before{ background: var(--heritage-gold); }

.kanban-col[data-status="review"] .kanban-col-title::before     { background: var(--heritage-purple-dark); }

.kanban-col[data-status="won"] .kanban-col-title::before        { background: var(--success); }

.kanban-col[data-status="lost"] .kanban-col-title::before       { background: var(--ink-mute); }

.kanban-col-count {
  font-family: var(--font-sans);
  font-feature-settings: 'tnum';
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--ink-mute);
  background: var(--warm-white);
  border: 1px solid var(--rule);
  padding: 2px 8px;
  border-radius: 999px;
}

.kanban-card {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 140ms ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card:hover {
  border-color: var(--heritage-gold);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.kanban-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kanban-card-ref {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--heritage-purple);
  font-feature-settings: 'tnum';
  letter-spacing: 0.02em;
}

.kanban-card-customer {
  font-weight: 700;
  color: var(--ink-strong);
  font-size: 0.94rem;
  line-height: 1.3;
}

.kanban-card-products {
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--rule);
  font-size: 0.78rem;
  color: var(--ink-mute);
}

.kanban-card-value {
  font-weight: 700;
  color: var(--heritage-red-dark);
  font-feature-settings: 'tnum';
}

/* -------- Toolbar / filters ---------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.view-toggle {
  display: inline-flex;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}

.view-toggle button {
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-radius: 5px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 120ms ease;
}

.view-toggle button.active {
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: var(--warm-white);
  box-shadow: 0 1px 3px rgba(204, 0, 0, 0.25);
}

.filter-select {
  padding: 8px 12px;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 120ms ease;
}

.filter-select:focus,
.filter-select:hover {
  outline: none;
  border-color: var(--heritage-gold);
}

/* -------- Modal / drawer -------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 16, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Above Ask AIOP FAB (9000) + drawer (9001) + toast (9100).
     Phone smoke 2026-07-11: FAB painted over modal footer/Edit. */
  z-index: 9200;
  padding: 24px;
  animation: fadeIn 180ms ease;
}

/* Hide floating Ask AIOP chrome while a modal dialog owns focus —
   prevents FAB/drawer intersection with modal footers on mobile.

   SCOPE (2026-08-04 audit P1-A): presence-driven :has — route() body-class
   hygiene cannot clear it. modal() closes via backdrop.remove() (utils.js),
   never backdrop.hidden=true, so :not([hidden]) was an INERT no-op against
   leaked backdrops. Match a LIVE dialog only: .modal[aria-modal="true"] is
   set on every open modal() call and is gone when the backdrop is removed.
   An empty/orphan .modal-backdrop without an aria-modal dialog no longer
   hides the FAB.
   Deliberately NOT hiding .feedback-fab — global escape hatch
   (Kevin 2026-07-31, tests/feedback-fab-fullscreen.test.js). */
body:has(.modal-backdrop .modal[aria-modal="true"]) .agent-fab,
body:has(.modal-backdrop .modal[aria-modal="true"]) .agent-fab-tooltip {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden;
}

.modal {
  background: var(--warm-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 64px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: slideUp 240ms ease;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--heritage-red),
    var(--heritage-gold) 50%,
    var(--heritage-purple));
}

.modal-wide { max-width: 920px; }

.modal-header {
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ink-strong);
  letter-spacing: -0.02em;
  margin: 0;
}

.modal-subtitle {
  color: var(--ink-mute);
  font-size: 0.88rem;
  margin-top: 2px;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink-mute);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 120ms ease;
}

.modal-close:hover {
  background: var(--paper);
  color: var(--heritage-red);
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--paper);
}

/* -------- Forms ----------------------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 18px;
}

.form-field { display: flex; flex-direction: column; gap: 5px; }

.form-field.span-2 { grid-column: 1 / -1; }

.form-label {
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
}

.form-label .required { color: var(--heritage-red); margin-left: 2px; }

.form-input,
.form-textarea,
.form-select {
  padding: 9px 12px;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  transition: all 120ms ease;
  font-family: var(--font-sans);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--heritage-gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.18);
}

.form-textarea {
  font-family: var(--font-sans);
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.form-textarea.intake {
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-size: 0.84rem;
  min-height: 240px;
  background: var(--paper);
}

.form-help {
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin-top: 2px;
}

/* -------- Detail view ----------------------------------------- */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px 22px;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
  margin-top: 4px;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
}

.detail-value {
  font-size: 0.95rem;
  color: var(--ink-strong);
  font-weight: 500;
}

.detail-value.large {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.2rem;
}

.detail-value.value {
  color: var(--heritage-red-dark);
  font-weight: 700;
  font-feature-settings: 'tnum';
}

/* -------- AI Metadata Bar (Foundry / GPT-5 attribution) ------ */

.ai-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  margin: 8px 0 14px;
  background: linear-gradient(135deg, rgba(123, 80, 144, 0.06), rgba(212, 175, 55, 0.04));
  border: 1px solid rgba(123, 80, 144, 0.18);
  border-radius: 8px;
}

.ai-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: white;
  background: linear-gradient(135deg, var(--heritage-purple), #5e3d70);
  border-radius: 14px;
  text-transform: none;
}

.ai-badge svg { color: var(--heritage-gold); }

.ai-badge-warn {
  background: var(--heritage-gold);
  color: #4a3700;
}

.ai-badge-mute {
  background: var(--rule);
  color: var(--text-mute);
}

.ai-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: white;
  border: 1px solid var(--rule);
  border-radius: 12px;
}

.ai-meta-conf-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 600;
}

.ai-meta-conf-val {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.ai-notes {
  margin: 4px 0 14px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: rgba(212, 175, 55, 0.07);
  border-left: 3px solid var(--heritage-gold);
  border-radius: 4px;
}

.ai-notes strong { color: var(--heritage-purple); }

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* -------- Tabs ----------------------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-mute);
  cursor: pointer;
  transition: all 140ms ease;
  position: relative;
}

.tab:hover { color: var(--ink); }

.tab.active {
  color: var(--heritage-red);
  border-bottom-color: var(--heritage-red);
}

/* -------- Toast / notifications ------------------------------ */

.toast-container {
  position: fixed;
  /* Sit ABOVE the bottom-right FAB stack (agent-fab + feedback-fab, ~48-56px
     tall at bottom:24-28px). Clear them vertically (bottom:92px) AND stack
     above them (z-index > 9001) so toasts — e.g. the language-switch
     notification — never overlap or hide behind the icons. */
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  z-index: 9100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--heritage-red);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 400px;
  font-size: 0.9rem;
  color: var(--ink);
  animation: slideInRight 240ms ease;
}

.toast.success { border-left-color: var(--success); }
/* Xin #137: `warn` was already used by 5 modules (formulation-bot, spec-diff,
   save-to-leespace, formulation-intelligence) but had NO style, so a warning
   rendered identically to plain info. A Master List import that skipped the
   redeem-price column must not look like an unqualified success. */
.toast.warn    { border-left-color: var(--warning, #D4A843); }

.toast.error   { border-left-color: var(--danger); }

.toast.info    { border-left-color: var(--heritage-purple); }

/* Feedback fix-kit (2026-10-21): "Report this" beside a server error id
   (ui/error-report.js, FEEDBACK_ERROR_REPORT_ENABLED only). */
.toast.error-report-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.error-report-notice code { font-size: 0.85em; }
.error-report-actions { display: inline-flex; align-items: center; gap: 4px; }
.error-report-btn { min-height: 44px; }
.error-report-close { min-width: 44px; min-height: 44px; background: none; border: 0; font-size: 1.25rem; line-height: 1; color: var(--ink); cursor: pointer; }

/* -------- Loading states ------------------------------------- */

.loading-shimmer {
  background: linear-gradient(90deg,
    var(--paper) 0%,
    var(--eggshell-shade) 50%,
    var(--paper) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--rule);
  border-top-color: var(--heritage-red);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  display: inline-block;
}

/* -------- Animations ----------------------------------------- */

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* -------- Behind-the-curtain panel --------------------------- */

.lark-panel {
  background: linear-gradient(135deg, rgba(26, 20, 16, 0.95), rgba(60, 40, 20, 0.92));
  color: var(--eggshell-bright);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  position: relative;
  overflow: hidden;
}

.lark-panel::before {
  content: 'AUDIT TRAIL · LARK BASE';
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--font-sans);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  color: var(--heritage-gold);
  font-weight: 700;
}

.lark-panel pre {
  margin: 14px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--eggshell-bright);
}

.lark-panel .key   { color: var(--heritage-gold-light); }

.lark-panel .str   { color: #a8d8b9; }

.lark-panel .num   { color: #f4b884; }

.lark-panel .null  { color: var(--ink-mute); font-style: italic; }

/* -------- Utility --------------------------------------------- */

.hide { display: none !important; }

.flex { display: flex; }

.flex-1 { flex: 1; }

.gap-sm { gap: 8px; }

.gap-md { gap: 14px; }

.text-mute { color: var(--ink-mute); }

.text-strong { color: var(--ink-strong); }

.tnum { font-feature-settings: 'tnum'; }

.uppercase-label { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════
   AUTH: Login page, user menu, role pills, admin panel
   ═══════════════════════════════════════════════════════════════ */

/* ── Role pills (used in shell + admin) ─────────────────────── */

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink-soft);
}

.role-pill.role-admin       { color: var(--heritage-red);    border-color: var(--heritage-red);   background: rgba(204, 0, 0, 0.07); }

.role-pill.role-manager     { color: var(--heritage-purple); border-color: var(--heritage-purple);background: rgba(91, 44, 138, 0.07); }

.role-pill.role-coordinator { color: var(--heritage-gold-dark); border-color: var(--heritage-gold-dark); background: rgba(212, 168, 67, 0.10); }

.role-pill.role-viewer      { color: var(--ink-mute);        border-color: var(--ink-faint);      background: rgba(138, 127, 115, 0.07); }

.user-avatar.role-admin,       .user-avatar-lg.role-admin,       .user-cell-avatar.role-admin,       .persona-avatar.role-admin       { background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark)); }

.user-avatar.role-manager,     .user-avatar-lg.role-manager,     .user-cell-avatar.role-manager,     .persona-avatar.role-manager     { background: linear-gradient(135deg, var(--heritage-purple), var(--heritage-purple-dark)); }

.user-avatar.role-coordinator, .user-avatar-lg.role-coordinator, .user-cell-avatar.role-coordinator, .persona-avatar.role-coordinator { background: linear-gradient(135deg, var(--heritage-gold), var(--heritage-gold-dark)); color: white; }

.user-avatar.role-viewer,      .user-avatar-lg.role-viewer,      .user-cell-avatar.role-viewer,      .persona-avatar.role-viewer      { background: linear-gradient(135deg, var(--ink-mute), var(--ink-soft)); }

/* ── User menu / dropdown (in topbar) ───────────────────────── */

.user-menu {
  position: relative;
}

.user-chip {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  transition: all 0.18s ease;
}

.user-chip:hover {
  border-color: var(--heritage-gold);
  background: var(--paper);
}

.user-chip-name {
  font-size: 0.92rem;
}

.user-chip-caret {
  color: var(--ink-mute);
  margin-left: 2px;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 280px;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(26, 20, 16, 0.16), 0 2px 8px rgba(26, 20, 16, 0.08);
  z-index: 100;
  overflow: hidden;
  animation: dropdownFade 0.16s ease-out;
}

@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--paper), var(--eggshell-shade) 200%);
  border-bottom: 1px solid var(--rule);
}

.user-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.user-dropdown-meta {
  min-width: 0;
}

.user-dropdown-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink-strong);
  margin-bottom: 1px;
}

.user-dropdown-email {
  font-size: 0.82rem;
  color: var(--ink-mute);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.user-dropdown-role {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.user-dropdown-dept {
  font-size: 0.78rem;
  color: var(--ink-mute);
}

.user-dropdown-lang {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 16px;
  border-top: 1px solid var(--rule-soft, rgba(0,0,0,0.06));
  border-bottom: 1px solid var(--rule-soft, rgba(0,0,0,0.06));
}

.user-dropdown-lang-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--ink);
}

.user-dropdown-lang-label svg { opacity: 0.7; }

.user-dropdown-lang-select {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  padding: 4px 8px;
  border: 1px solid var(--rule, rgba(0,0,0,0.14));
  border-radius: 6px;
  background: var(--bg, #fff);
  color: var(--ink);
  cursor: pointer;
  max-width: 150px;
}

.user-dropdown-lang-select:focus {
  outline: 2px solid var(--heritage-red);
  outline-offset: 1px;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  padding: 11px 16px;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}

.user-dropdown-item:hover {
  background: var(--paper);
  color: var(--heritage-red);
  text-decoration: none;
}

.user-dropdown-item svg {
  width: 18px;
  height: 18px;
  color: var(--ink-mute);
  flex-shrink: 0;
}

.user-dropdown-item:hover svg {
  color: var(--heritage-red);
}

.btn-leespace {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 22px;
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: white;
  border: 1px solid var(--heritage-red-dark);
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 14px rgba(204, 0, 0, 0.22);
  position: relative;
}

.btn-leespace:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(204, 0, 0, 0.32);
}

.btn-leespace:active:not(:disabled) { transform: translateY(0); }

.btn-leespace-disabled,
.btn-leespace:disabled {
  background: var(--paper);
  color: var(--ink-mute);
  border: 1px dashed var(--rule);
  cursor: not-allowed;
  box-shadow: none;
  font-weight: 500;
}

.btn-leespace-disabled svg path[fill="#3370FF"],
.btn-leespace:disabled svg path[fill="#3370FF"] { fill: var(--ink-faint); }

.btn-leespace-disabled svg path[fill="#5687FF"],
.btn-leespace:disabled svg path[fill="#5687FF"] { fill: var(--ink-faint); opacity: 0.6; }

.btn-leespace-disabled svg path[fill="#1F58D8"],
.btn-leespace:disabled svg path[fill="#1F58D8"] { fill: var(--ink-mute); }

.btn-leespace-disabled .btn-leespace-status,
.btn-leespace:disabled .btn-leespace-status {
  background: var(--eggshell-shade);
  color: var(--heritage-gold-dark);
}

.btn-leespace-status {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.22);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.persona-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  box-shadow: 0 1px 4px rgba(26, 20, 16, 0.12);
}

.persona-body {
  flex: 1;
  min-width: 0;
}

.persona-name {
  font-weight: 600;
  color: var(--ink-strong);
  font-size: 0.95rem;
  margin-bottom: 1px;
}

.persona-meta {
  font-size: 0.78rem;
  color: var(--ink-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.persona-role-pill {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}

.persona-role-pill.role-admin       { color: var(--heritage-red); }

.persona-role-pill.role-manager     { color: var(--heritage-purple); }

.persona-role-pill.role-coordinator { color: var(--heritage-gold-dark); }

.persona-role-pill.role-viewer      { color: var(--ink-mute); }

.card-h3 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--heritage-purple);
  margin: 0 0 12px;
}

.role-count {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--heritage-red);
  font-size: 1.15rem;
}

.status-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-badge.status-ok   { background: rgba(45, 140, 60, 0.12); color: var(--success-deep); border: 1px solid rgba(45, 140, 60, 0.28); }

.status-badge.status-warn { background: rgba(198, 138, 31, 0.12); color: var(--warning); border: 1px solid rgba(198, 138, 31, 0.32); }

.status-badge.status-err  { background: rgba(192, 57, 43, 0.12); color: var(--danger);  border: 1px solid rgba(192, 57, 43, 0.32); }

.btn-link {
  background: none;
  border: none;
  color: var(--heritage-red);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 4px;
  text-decoration: underline;
  text-decoration-color: rgba(204, 0, 0, 0.3);
  transition: all 0.14s ease;
}

.btn-link:hover { background: rgba(204, 0, 0, 0.06); text-decoration-color: var(--heritage-red); }

.btn-link.btn-danger { color: var(--danger); }

.btn-link.btn-danger:hover { background: rgba(192, 57, 43, 0.06); }

/* Toast (in case toast container exists; tolerant) */

.toast.toast-ok    { background: linear-gradient(135deg, var(--success), var(--success-deep)); color: white; }

.toast.toast-error { background: linear-gradient(135deg, var(--danger), #8b1f15); color: white; }

/* Confidence pill */

.conf-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.conf-pill.conf-green { background: rgba(45, 140, 60, 0.12); color: var(--success-deep); border-color: rgba(45, 140, 60, 0.30); }

.conf-pill.conf-gold  { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); border-color: rgba(212, 168, 67, 0.42); }

.conf-pill.conf-red   { background: rgba(204, 0, 0, 0.12); color: var(--heritage-red-dark); border-color: rgba(204, 0, 0, 0.35); }

.conf-pill.conf-mute  { background: var(--rule-soft); color: var(--ink-mute); }

@keyframes scrim-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes tableNudge {
  0%, 100% { transform: translateY(-50%) translateX(0); opacity: 0.55; }
  50%      { transform: translateY(-50%) translateX(-4px); opacity: 0.9; }
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(204, 0, 0, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(204, 0, 0, 0.08); }
}

.conf-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.conf-high { background: rgba(45, 140, 60, 0.12);  color: var(--success-deep); }

.conf-mid  { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); }

.conf-low  { background: rgba(204, 0, 0, 0.10);    color: var(--heritage-red-dark); }

/* =====================================================================
   Help panel — topbar "?" button + slide-out cheat sheet
   ===================================================================== */

.topbar-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease, transform 120ms ease;
  margin-left: 4px;
}

.topbar-help-btn:hover {
  background: rgba(204, 0, 0, 0.08);
  color: var(--heritage-red);
  border-color: rgba(204, 0, 0, 0.35);
}

.topbar-help-btn:focus-visible {
  outline: 2px solid var(--heritage-red);
  outline-offset: 2px;
}

.topbar-help-btn[aria-expanded="true"] {
  background: var(--heritage-red);
  color: var(--warm-white);
  border-color: var(--heritage-red);
}

.help-panel-scrim {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 16, 0.32);
  border: 0;
  padding: 0;
  cursor: pointer;
  z-index: 1090;
  animation: helpScrimFade 180ms ease;
}

@keyframes helpScrimFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.help-panel {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  background: var(--warm-white, #FFFDF8);
  border-left: 1px solid var(--rule);
  box-shadow: -16px 0 40px rgba(26, 20, 16, 0.18);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.help-panel.open { transform: translateX(0); }

.help-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--rule-soft);
}

.help-panel-eyebrow {
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--heritage-red);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.help-panel-title {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 1.32rem;
  color: var(--ink-strong);
  margin: 0;
  line-height: 1.2;
}

.help-panel-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 140ms ease, color 140ms ease;
}

.help-panel-close:hover { background: var(--eggshell-shade); color: var(--ink-strong); }

.help-panel-close:focus-visible { outline: 2px solid var(--heritage-red); outline-offset: 2px; }

.help-panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 22px 24px;
}

.help-section { margin-bottom: 18px; }

.help-section:last-child { margin-bottom: 0; }

.help-section-title {
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--heritage-red);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 6px 0;
}

.help-section-body {
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.55;
  margin: 0;
}

.help-section-glossary { border-top: 1px dashed var(--rule); padding-top: 14px; margin-top: 22px; }

.help-glossary {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 12px;
  row-gap: 6px;
  margin: 0;
}

.help-glossary dt {
  font-weight: 600;
  color: var(--ink-strong);
  font-size: 0.86rem;
  padding-top: 1px;
}

.help-glossary dd {
  color: var(--ink-soft);
  font-size: 0.86rem;
  margin: 0;
  line-height: 1.5;
}

.help-panel-footer {
  border-top: 1px solid var(--rule-soft);
  padding: 12px 22px;
  background: var(--paper);
}

.help-shortcut {
  color: var(--ink-mute);
  font-size: 0.78rem;
  text-align: center;
}

.help-shortcut kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--warm-white);
  color: var(--ink-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
  margin: 0 2px;
}

/* Mobile: panel becomes near-full-width and a bit shorter footer */

@media (max-width: 640px) {
  .help-panel { width: 100vw; border-left: 0; }
  .help-panel-header { padding: 18px 18px 14px; }
  .help-panel-body { padding: 14px 18px 22px; }
  .help-panel-footer { padding: 10px 18px; }
}

/* Admin-only "Raw Lark Base record" details — keep it tucked away */

.lark-raw-details summary::-webkit-details-marker { color: var(--ink-mute); }

.lark-raw-details[open] summary { margin-bottom: 6px; }

/* Change-group section */

.change-group { margin-top: 18px; }

.change-group-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.change-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink-strong);
  font-family: 'Source Sans Pro', system-ui, sans-serif;
}

.change-group-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 11px;
  color: #fff;
}

.change-group-pill-critical { background: var(--danger); }

.change-group-pill-major    { background: #D4641E; }

.change-group-pill-minor    { background: var(--warning); }

.change-group-pill-cosmetic { background: var(--heritage-purple); }

.change-group-sub {
  font-size: 0.82rem;
  color: var(--ink-mute);
}

.change-group-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Change card */

.change-card {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 12px 14px;
}

.change-card-critical { border-left: 4px solid var(--danger); }

.change-card-major    { border-left: 4px solid #D4641E; }

.change-card-minor    { border-left: 4px solid var(--warning); }

.change-card-cosmetic { border-left: 4px solid var(--heritage-purple); }

.change-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.change-card-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 4px;
  color: #fff;
}

.change-card-pill-critical { background: var(--danger); }

.change-card-pill-major    { background: #D4641E; }

.change-card-pill-minor    { background: var(--warning); }

.change-card-pill-cosmetic { background: var(--heritage-purple); }

.change-card-field {
  font-weight: 700;
  color: var(--ink-strong);
  font-size: 0.96rem;
}

.change-card-section {
  font-size: 0.8rem;
  color: var(--ink-mute);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1px 6px;
}

.change-card-diff {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
  margin: 8px 0;
}

@media (max-width: 720px) {
  .change-card-diff {
    grid-template-columns: 1fr;
  }
  .change-card-arrow { display: none; }
}

.change-card-before,
.change-card-after {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
}

.change-card-before {
  background: rgba(192, 57, 43, 0.06);
  border: 1px solid rgba(192, 57, 43, 0.18);
}

.change-card-after {
  background: rgba(45, 140, 60, 0.06);
  border: 1px solid rgba(45, 140, 60, 0.20);
}

.change-card-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 4px;
}

.change-card-text {
  color: var(--ink-strong);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.change-card-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mute);
  font-size: 1.2rem;
  font-weight: 700;
}

.change-card-impact,
.change-card-action {
  font-size: 0.86rem;
  color: var(--ink);
  line-height: 1.5;
  margin-top: 6px;
}

.change-card-impact strong { color: var(--ink-strong); }

.change-card-action {
  padding: 6px 10px;
  background: var(--paper);
  border-radius: 6px;
  border-left: 2px solid var(--heritage-gold);
}

.change-card-action strong { color: var(--heritage-gold-dark); }

/* ====================================================================
   Polish-pass: shared loading / disclosure / paste-hint / error styles
   Added 2026-05-22 by supporting-module-polish subagent.
   ==================================================================== */

/* Inline spinner that lives inside a button while async work runs. */

.btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -2px;
  animation: spin 600ms linear infinite;
  opacity: 0.85;
}

.btn.is-loading {
  cursor: progress;
}

.btn.is-loading .btn-loading-label {
  font-weight: 500;
}

/* Subtle informational disclosure banner. Tones: info (default), warn. */

.disclosure-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  margin: 0 0 14px 0;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  background: rgba(31, 111, 235, 0.06);
  border: 1px solid rgba(31, 111, 235, 0.18);
  color: var(--ink, #1a1a1a);
}

.disclosure-banner.disclosure-warn {
  background: rgba(212, 175, 55, 0.10);
  border-color: rgba(212, 175, 55, 0.30);
}

.disclosure-banner .disclosure-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.disclosure-banner .disclosure-body {
  flex: 1;
}

.disclosure-banner strong { font-weight: 600; }

/* Small inline "paste from PDF" hint under textareas. */

.paste-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--ink-mute, #6b7280);
}

.paste-hint .paste-hint-icon { opacity: 0.7; }

.paste-hint .paste-hint-link {
  color: var(--heritage-red, #c81e1e);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.paste-hint .paste-hint-link:hover { opacity: 0.8; }

/* Clean error card used by renderErrorCard + module error boundaries. */

.error-card .error-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.error-card .error-card-icon { font-size: 1rem; }

.error-card .error-card-body { font-size: 0.86rem; line-height: 1.5; }

.error-card .error-retry-btn { font-size: 0.82rem; }

/* Coming-soon overlay used by Complaint Video when a real upload is clicked. */

.coming-soon-overlay {
  margin-top: 14px;
  padding: 22px 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), rgba(123, 80, 144, 0.06));
  border: 1px dashed rgba(212, 175, 55, 0.5);
  text-align: center;
}

.coming-soon-overlay .cs-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(212, 175, 55, 0.18);
  color: #8a5a00;
  margin-bottom: 10px;
}

.coming-soon-overlay h4 {
  margin: 0 0 6px 0;
  font-size: 1.05rem;
}

.coming-soon-overlay p {
  margin: 0 auto;
  max-width: 540px;
  color: var(--ink-mute, #6b7280);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ── End DARK MODE AUDIT 2026-05-22 ──────────────────────────────── */

/* GLOBAL SEARCH COMMAND PALETTE — 2026-05-22 */

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  margin-top: 4px;
  z-index: 1000;
  overflow: hidden;
}

.search-bar { position: relative; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.1s;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--bg-hover, #f5f5f5);
}

.search-result-icon { font-size: 18px; width: 24px; text-align: center; }

.search-result-name { font-weight: 500; }

.search-no-match {
  color: var(--ink-soft, #888);
  font-size: 13px;
  cursor: default;
}

@keyframes uz-spin { to { transform: rotate(360deg); } }

/* ────────────────────────────────────────────────────────────────────
   TRANSCRIPT-WIDGET COVERAGE (2026-05-23 polish pass)
   ────────────────────────────────────────────────────────────────────
   Seven modules (rfp, email-triage, label-verify, qc-intelligence,
   vendor-compliance, formulation-bot, deductions) ship transcript-grounded
   widgets with inline <style> blocks that rely on a handful of CSS vars
   (--surface-elevated, --border-subtle, --text-mute, --accent). Those
   vars were never declared, so the inline fallback values — all designed
   for a dark canvas (rgba(255,255,255,0.04), color:#fff form inputs,
   rgba(0,0,0,0.15) sub-cards) — rendered as invisible white-on-white in
   our default light theme. Declaring the vars here once, in both modes,
   makes every transcript widget render correctly without touching the
   per-module style blocks. Light-mode overrides below also recolor the
   sub-card backgrounds + hardcoded white text on inline-styled inputs.
   ─────────────────────────────────────────────────────────────────── */

:root {
  --surface-elevated: var(--warm-white, #FFFDF8);
  --border-subtle:    rgba(60, 40, 20, 0.10);
  --text-mute:        var(--ink-mute, #6B6560);
  --accent:           var(--heritage-gold, #D4A843);
}

/* ── Module-card: missed `background: white` was already covered above
       (line 8872). No additional rule needed.                            */

/* ── Generic .ai-meta-chip and other generic `background: white` cards
       have been mapped above. Spot check: .module-card, .uz-batch-row,
       .uz-mode-toggle, .uz-review-card all already have dark mode rules. */

/* ── Live system status indicator ─────────────────────────────── */

.status-dot.status-green {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(45, 140, 60, 0.18);
}

.status-dot.status-yellow {
  background: #c89b1a;
  box-shadow: 0 0 0 3px rgba(200, 155, 26, 0.18);
  animation: pulse-yellow 2s ease-in-out infinite;
}

.status-dot.status-red {
  background: var(--heritage-red);
  box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.18);
  animation: pulse-red 1.5s ease-in-out infinite;
}

@keyframes pulse-yellow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(200, 155, 26, 0.18); }
  50% { box-shadow: 0 0 0 5px rgba(200, 155, 26, 0.3); }
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.18); }
  50% { box-shadow: 0 0 0 5px rgba(204, 0, 0, 0.3); }
}

#system-status { transition: opacity 0.2s; }

/* ── System status details modal (sidebar status tap) ───────── */

.status-modal {
  max-width: 460px;
  padding: 0;                 /* sections manage their own padding */
  overflow: hidden;           /* body scrolls, chrome stays fixed */
  display: flex;
  flex-direction: column;
}

.status-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.status-modal-head h3 {
  font-size: 17px;
  color: var(--heritage-purple);
}

.status-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  padding: 2px 8px;
  border-radius: 6px;
  color: #888;
  cursor: pointer;
}
.status-modal-close:hover { background: rgba(0, 0, 0, 0.06); color: #333; }

.status-modal-body {
  padding: 14px 20px 16px;
  overflow-y: auto;
  min-height: 120px;
}

.status-modal-loading {
  padding: 28px 0;
  text-align: center;
  font-size: 14px;
  font-style: italic;
  color: #777;
}

.status-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.status-modal-foot a {
  font-size: 13px;
  color: var(--heritage-purple);
  text-decoration: none;
}
.status-modal-foot a:hover { text-decoration: underline; }

/* Overall status banner at top of the body */
.svc-overall {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}
.svc-overall .status-dot { flex-shrink: 0; }
.svc-overall-ok   { background: rgba(45, 140, 60, 0.08); }
.svc-overall-warn { background: rgba(200, 155, 26, 0.10); }
.svc-overall-down { background: rgba(204, 0, 0, 0.08); }

/* One row per service leg: dot + name + detail */
.svc-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.svc-row:last-of-type { border-bottom: none; }
.svc-row .status-dot { margin-top: 6px; flex-shrink: 0; }

.svc-info { min-width: 0; }

.svc-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.svc-detail {
  font-size: 12.5px;
  color: #666;
  line-height: 1.45;
  margin-top: 1px;
  overflow-wrap: break-word;
}

.svc-meta {
  margin-top: 12px;
  font-size: 11.5px;
  color: #999;
  text-align: center;
}

/* Mobile: full-width sheet, comfortable tap targets */
@media (max-width: 600px) {
  .status-modal { max-width: none; max-height: 85vh; }
  .status-modal-head { padding: 14px 16px 12px; }
  .status-modal-body { padding: 12px 16px 14px; }
  .status-modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .status-modal-close { font-size: 26px; padding: 4px 10px; }
  .svc-row { padding: 12px 2px; }
}

#system-status:hover { opacity: 0.8; }
/* ============================================================
   05-page-hero.css
   Shared page-hero component
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ──────────────────────────────────────────────────────────────
   Page Hero — shared header at the top of every page
   ────────────────────────────────────────────────────────────── */

.page-hero {
  position: relative;
  padding: 22px 26px 20px;
  margin: 0 0 22px;
  background:
    linear-gradient(135deg, rgba(212, 168, 67, 0.07), rgba(204, 0, 0, 0.04) 65%, transparent),
    var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.page-hero::before {
  /* Heritage stripe — a slim vertical accent on the left edge */
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg,
    var(--heritage-red) 0%,
    var(--heritage-red-dark) 55%,
    var(--heritage-gold) 100%);
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}

.page-hero::after {
  /* Subtle decorative arch in the upper-right corner, echoing the LKK brand */
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(212, 168, 67, 0.12), transparent 70%);
  pointer-events: none;
}

.page-hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.page-hero-text { min-width: 0; flex: 1; }

.page-hero-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--heritage-red);
  margin-bottom: 4px;
}

.page-hero-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.85rem;
  line-height: 1.18;
  color: var(--ink-strong);
  margin: 0 0 6px;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.page-hero-desc {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.45;
  max-width: 78ch;
}

.page-hero-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.page-hero-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}

.page-hero-metrics:empty { display: none; }

.page-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  color: var(--ink-strong);
  white-space: nowrap;
  transition: transform 140ms ease, box-shadow 140ms ease;
  font-variant-numeric: tabular-nums;
}

.page-hero-badge:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.page-hero-badge svg { opacity: 0.85; }

.page-hero-badge-value {
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
}

.page-hero-badge-label {
  color: var(--ink-soft);
  font-weight: 600;
}

.page-hero-badge.urgent {
  background: rgba(204, 0, 0, 0.08);
  border-color: rgba(204, 0, 0, 0.28);
  color: var(--heritage-red-dark);
}

.page-hero-badge.urgent .page-hero-badge-label { color: var(--heritage-red-dark); opacity: 0.85; }

.page-hero-badge.important {
  background: rgba(212, 168, 67, 0.14);
  border-color: rgba(212, 168, 67, 0.45);
  color: var(--heritage-gold-dark);
}

.page-hero-badge.important .page-hero-badge-label { color: var(--heritage-gold-dark); opacity: 0.9; }

.page-hero-badge.success {
  background: rgba(45, 140, 60, 0.10);
  border-color: rgba(45, 140, 60, 0.30);
  color: var(--success-deep);
}

.page-hero-badge.success .page-hero-badge-label { color: var(--success-deep); opacity: 0.9; }

.page-hero-badge.info {
  background: rgba(91, 44, 138, 0.08);
  border-color: rgba(91, 44, 138, 0.25);
  color: var(--heritage-purple-dark);
}

.page-hero-badge.info .page-hero-badge-label { color: var(--heritage-purple-dark); opacity: 0.9; }

.page-hero-badge.neutral {
  background: rgba(255, 253, 248, 0.85);
  color: var(--ink);
}

.page-hero-timestamp {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--ink-mute);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}

.page-hero-timestamp svg { opacity: 0.7; }

/* mi-signals stale badge (W2 freshness-honesty fix, 2026-08-03).
   The hero used to render "Last synced just now" unconditionally because
   fmtUpdatedShort() was called with no argument. The real _lark.fetchedAt now
   drives the label, and this badge marks the cache as untrustworthy
   (_lark.stale, a lastError, or never fetched). Amber = "the figure next to me
   may be old" — deliberately NOT the red outage tone, matching the
   .mm-health-card-stale precedent. Dark-mode override lives in
   90-dark-mode.css per house convention. */
.mi-sig-stale-badge {
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #7A5A12;
  background: rgba(212, 168, 67, 0.22);
  border: 1px solid rgba(212, 168, 67, 0.55);
  cursor: help;
}

/* Responsive */

@media (max-width: 760px) {
  .page-hero { padding: 18px 18px 16px; }
  .page-hero-title { font-size: 1.45rem; }
  .page-hero-desc { font-size: 0.9rem; }
  .page-hero-row { flex-direction: column; }
  .page-hero-actions { width: 100%; }
  .page-hero-badge {
    padding: 4px 10px;
    font-size: 0.78rem;
  }
  .page-hero::after { width: 90px; height: 90px; right: -30px; top: -30px; }
}

/* ─────────────────────────────────────────────────────────────────── */

/* polish-pass 2026-05-21 — Cross-module consistency safety net        */

/* ─────────────────────────────────────────────────────────────────── */

/* Two early sub-agents (complaint-video, label-verify) wrote their
   own hero markup using .page-hero-content + .page-hero-subtitle
   instead of importing pageHero() from page-hero.js. Until the
   markup is migrated, give the unknown classes the same look as
   .page-hero-text / .page-hero-desc so the heroes feel cohesive
   across the platform. The canonical page-hero.js component is the
   forward path; this is the safety net. */

.page-hero .page-hero-content {
  position: relative;
  z-index: 1;
  min-width: 0;
  flex: 1;
}

.page-hero .page-hero-subtitle {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.45;
  max-width: 78ch;
}

.page-hero .page-hero-subtitle strong,
.page-hero .page-hero-subtitle em {
  color: var(--heritage-purple);
  font-style: normal;
}
/* ============================================================
   06-login.css
   Login page, persona cards, OAuth flow
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  position: relative;
  background:
    radial-gradient(circle at 20% 0%, rgba(212, 168, 67, 0.18), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(204, 0, 0, 0.08), transparent 50%),
    var(--eggshell-bright);
}

.login-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 60px,
      rgba(212, 168, 67, 0.025) 60px,
      rgba(212, 168, 67, 0.025) 61px
    );
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  padding: 48px 44px 32px;
  text-align: center;
  background: var(--warm-white);
  box-shadow: 0 20px 60px rgba(91, 44, 138, 0.12), 0 4px 16px rgba(26, 20, 16, 0.06);
}

.login-mark {
  /* Full LKK corporate lockup (~4:3) — sized for prominence at the top of the card */
  width: auto;
  height: 96px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-mark img.login-logo-img {
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
  /* Sharpen at small sizes */
  image-rendering: -webkit-optimize-contrast;
}

/* Visually-hidden accessible title. The logo lockup already reads
   "LEE KUM KEE 李錦記" graphically, so the H1 only exists for screen readers
   and the document outline — we keep it in the DOM but hide it visually. */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 2.1rem;
  color: var(--ink-strong);
  margin: 0 0 4px;
  line-height: 1.1;
}

.login-title em {
  font-style: italic;
  color: var(--heritage-red);
  font-weight: 700;
}

.login-subtitle {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--heritage-gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin-bottom: 14px;
  display: inline-block;
  padding: 0 12px;
  border-top: 1px solid var(--heritage-gold);
  border-bottom: 1px solid var(--heritage-gold);
  padding-top: 4px;
  padding-bottom: 4px;
}

.login-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0 auto 32px;
  max-width: 360px;
  line-height: 1.5;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 18px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--heritage-gold), transparent);
}

.login-divider span {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--heritage-gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.login-actions {
  margin-bottom: 24px;
}

.login-error {
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.3);
  border-radius: 8px;
  color: var(--danger);
  font-size: 0.88rem;
  text-align: left;
}

.login-demo-section {
  margin-top: 24px;
  text-align: left;
}

.login-demo-title {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.login-demo-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.login-demo-grid::-webkit-scrollbar { width: 6px; }

.login-demo-grid::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

.persona-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transition: all 0.16s ease;
}

.persona-card:hover {
  background: var(--warm-white);
  border-color: var(--heritage-gold);
  transform: translateX(2px);
  box-shadow: 0 2px 10px rgba(212, 168, 67, 0.18);
}

.persona-card.selecting {
  border-color: var(--heritage-red);
  background: rgba(204, 0, 0, 0.04);
  cursor: wait;
}

.login-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 0.75rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}

/* ─────────────────────────────────────────────────────────
   Primary subtitle — now the card's main text line (the redundant
   "Lee Kum Kee Americas" H1 is gone; the logo carries the brand).
   Keeps the gold eyebrow rule treatment but at a more prominent weight/size.
   ───────────────────────────────────────────────────────── */
.login-subtitle.login-subtitle-primary {
  font-size: 0.92rem;
  letter-spacing: 0.18em;
  color: var(--heritage-gold-dark);
  margin-bottom: 16px;
}

/* ─────────────────────────────────────────────────────────
   Language picker — globe trigger + popover, top-right of the card.
   Mirrors the in-app shell switcher; manual override of auto-detection.
   ───────────────────────────────────────────────────────── */
.login-lang {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  text-align: left;
}

.login-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.login-lang-trigger:hover {
  border-color: var(--heritage-gold);
  color: var(--ink-strong);
  background: rgba(212, 168, 67, 0.08);
}

.login-lang-trigger svg { flex: 0 0 auto; }
.login-lang-caret { opacity: 0.7; }

.login-lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  padding: 6px;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(26, 20, 16, 0.14), 0 2px 8px rgba(26, 20, 16, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.login-lang-menu[hidden] { display: none; }

.login-lang-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--ink-strong);
  transition: background 0.12s ease;
}

.login-lang-item:hover {
  background: rgba(212, 168, 67, 0.12);
}

.login-lang-item.is-active {
  color: var(--heritage-red);
  font-weight: 700;
  background: rgba(204, 0, 0, 0.05);
}

/* Dark mode */
[data-theme="dark"] .login-lang-trigger {
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.78);
}
[data-theme="dark"] .login-lang-trigger:hover {
  border-color: var(--heritage-gold);
  color: #fff;
  background: rgba(212, 168, 67, 0.14);
}
[data-theme="dark"] .login-lang-menu {
  background: #2a2420;
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .login-lang-item { color: rgba(255, 255, 255, 0.88); }
[data-theme="dark"] .login-lang-item:hover { background: rgba(212, 168, 67, 0.16); }

/* Mobile — keep the picker comfortably tappable, avoid logo overlap */
@media (max-width: 480px) {
  .login-lang { top: 12px; right: 12px; }
  .login-lang-trigger { padding: 5px 9px; font-size: 0.78rem; }
  .login-lang-menu { min-width: 136px; }
}
/* ============================================================
   07-dashboard.css
   Dashboard KPIs, alerts, activity feed, heatmap, pipeline, demand, disruptions
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ===================================================================
   DASHBOARD COMMAND CENTER (added 2026-05-11)
   Operations dashboard: KPI tiles, sparklines, donut, gauge, heatmap,
   demand pulse, alerts banner, activity feed.
   =================================================================== */

/* Utility colors */

.text-danger  { color: var(--heritage-red); }

.text-success { color: var(--success-deep); }

.text-warning { color: var(--heritage-gold-dark); }

/* ──────────────────────────────────────────────────────────────────
   Dashboard hero
   ────────────────────────────────────────────────────────────────── */

.dash { display: flex; flex-direction: column; gap: 24px; }

.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-soft);
}

.dash-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--heritage-gold-dark);
  margin-bottom: 4px;
}

.dash-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.95rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
  margin: 0 0 4px;
}

.dash-subtitle {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.dash-hero-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .dash-hero { flex-direction: column; align-items: flex-start; gap: 14px; }
  .dash-title { font-size: 1.6rem; }
  .dash-hero-actions { width: 100%; }
  .dash-hero-actions .btn { flex: 1; justify-content: center; }
}

/* ──────────────────────────────────────────────────────────────────
   Alerts banner
   ────────────────────────────────────────────────────────────────── */

.alerts {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.alerts-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-strong);
}

.alerts-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--heritage-red);
  box-shadow: 0 0 0 4px rgba(204, 0, 0, 0.18);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

.alerts-title { color: var(--ink-strong); font-weight: 700; letter-spacing: 0.04em; }

.alerts-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 10px;
}

.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.alert:hover {
  transform: translateY(-1px);
  border-color: var(--rule-gold);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.alert-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--warm-white);
  flex-shrink: 0;
}

.alert-body { flex: 1; min-width: 0; }

.alert-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-strong);
  line-height: 1.25;
}

.alert-detail {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 2px;
  line-height: 1.3;
}

.alert-cta {
  color: var(--ink-mute);
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: transform 120ms ease, color 120ms ease;
}

.alert:hover .alert-cta { transform: translateX(2px); color: var(--heritage-red); }

.alert-critical { border-left: 3px solid var(--heritage-red); }

.alert-critical .alert-icon { background: rgba(204, 0, 0, 0.10); color: var(--heritage-red-dark); }

.alert-warning  { border-left: 3px solid var(--heritage-gold-dark); }

.alert-warning  .alert-icon { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); }

.alert-info     { border-left: 3px solid var(--heritage-purple); }

.alert-info     .alert-icon { background: rgba(91, 44, 138, 0.12); color: var(--heritage-purple); }

.alerts-empty {
  background: linear-gradient(135deg, rgba(45,140,60,0.06), rgba(212,168,67,0.04));
  border: 1px solid rgba(45,140,60,0.18);
}

.alerts-empty-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--success-deep);
  font-weight: 600;
  font-size: 0.92rem;
}

.alerts-empty-inner svg { color: var(--success); }

/* ──────────────────────────────────────────────────────────────────
   KPI tiles (replaces stat-card pattern for dashboard)
   ────────────────────────────────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 520px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-tile {
  display: block;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 16px 18px 14px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 160ms cubic-bezier(0.4, 0, 0.2, 1),
              border-color 160ms ease,
              box-shadow 160ms ease;
}

a.kpi-tile:hover {
  transform: translateY(-2px);
  border-color: var(--rule-gold);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

.kpi-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, transparent 70%, rgba(212, 168, 67, 0.04));
  opacity: 0;
  transition: opacity 200ms ease;
}

a.kpi-tile:hover::after { opacity: 1; }

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.kpi-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-mute);
}

.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 7px;
  flex-shrink: 0;
}

.kpi-icon.tone-red    { background: rgba(204, 0, 0, 0.10);    color: var(--heritage-red); }

.kpi-icon.tone-gold   { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); }

.kpi-icon.tone-purple { background: rgba(91, 44, 138, 0.12);  color: var(--heritage-purple); }

.kpi-icon.tone-green  { background: rgba(45, 140, 60, 0.12);  color: var(--success-deep); }

.kpi-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.kpi-value {
  font-family: var(--font-sans);
  font-feature-settings: 'tnum';
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink-strong);
}

.kpi-prefix {
  font-size: 1.4rem;
  color: var(--heritage-gold-dark);
  margin-right: 1px;
  font-weight: 600;
}

.kpi-suffix {
  font-size: 1.2rem;
  color: var(--ink-soft);
  font-weight: 500;
  margin-left: 2px;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.kpi-trend.up   { color: var(--success-deep); background: rgba(45, 140, 60, 0.12); }

.kpi-trend.down { color: var(--heritage-red-dark); background: rgba(204, 0, 0, 0.10); }

.kpi-trend.flat { color: var(--ink-mute); background: rgba(0, 0, 0, 0.04); }

.kpi-meta {
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.35;
  min-height: 1.2em;
}

.kpi-spark {
  margin-top: 10px;
  margin-left: -2px;
  margin-right: -2px;
}

.kpi-progress {
  margin-top: 10px;
  height: 6px;
  background: var(--rule-soft);
  border-radius: 999px;
  overflow: hidden;
}

.kpi-progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-progress-bar.tone-red    { background: linear-gradient(90deg, var(--heritage-red), var(--heritage-red-deep)); }

.kpi-progress-bar.tone-gold   { background: linear-gradient(90deg, var(--heritage-gold), var(--heritage-gold-dark)); }

.kpi-progress-bar.tone-purple { background: linear-gradient(90deg, var(--heritage-purple), var(--heritage-purple-dark)); }

.kpi-progress-bar.tone-green  { background: linear-gradient(90deg, var(--success), var(--success-deep)); }

/* Sparkline SVG */

.spark {
  display: block;
  width: 100%;
  height: 28px;
}

.spark-line { stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }

.spark.tone-red    .spark-line { stroke: var(--heritage-red); }

.spark.tone-red    .spark-area { fill: rgba(204, 0, 0, 0.12); }

.spark.tone-gold   .spark-line { stroke: var(--heritage-gold-dark); }

.spark.tone-gold   .spark-area { fill: rgba(212, 168, 67, 0.20); }

.spark.tone-purple .spark-line { stroke: var(--heritage-purple); }

.spark.tone-purple .spark-area { fill: rgba(91, 44, 138, 0.12); }

.spark.tone-green  .spark-line { stroke: var(--success); }

.spark.tone-green  .spark-area { fill: rgba(45, 140, 60, 0.12); }

/* ──────────────────────────────────────────────────────────────────
   Visualization row (donut / gauge / bars)
   ────────────────────────────────────────────────────────────────── */

.viz-row {
  display: grid;
  /* Two cards since the RFP Pipeline Health card left (2026-11-01): Production
     Health and QA Velocity fill the row instead of leaving an empty third slot. */
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (max-width: 1100px) { .viz-row { grid-template-columns: 1fr 1fr; } }

@media (max-width: 720px)  { .viz-row { grid-template-columns: 1fr; } }

.viz-card {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.viz-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.viz-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0;
  color: var(--ink-strong);
}

.viz-sub {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.viz-link {
  font-size: 0.82rem;
  color: var(--heritage-red);
  font-weight: 600;
  white-space: nowrap;
}

/* Donut */

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}

.donut {
  width: 130px;
  height: 130px;
  flex-shrink: 0;
}

.donut-num {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 22px;
  fill: var(--ink-strong);
  font-feature-settings: 'tnum';
}

.donut-pct { font-size: 14px; fill: var(--ink-mute); }

.donut-sub {
  font-size: 9px;
  fill: var(--ink-mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.donut-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.donut-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.donut-legend strong {
  color: var(--ink-strong);
  font-weight: 700;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-red   { background: var(--heritage-red); }

.dot-gold  { background: var(--heritage-gold); }

.dot-green { background: var(--success); }

.dot-purple{ background: var(--heritage-purple); }

@media (max-width: 460px) {
  .donut-wrap { flex-direction: column; align-items: stretch; gap: 14px; }
  .donut { margin: 0 auto; }
  .donut-legend li strong { margin-left: auto; }
}

/* Gauge */

.gauge-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gauge {
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
  height: auto;
}

.gauge-num {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 26px;
  fill: var(--ink-strong);
  font-feature-settings: 'tnum';
}

.gauge-sub {
  font-size: 9px;
  fill: var(--ink-mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gauge-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 0.84rem;
  border-top: 1px solid var(--rule-soft);
  padding-top: 10px;
}

.gauge-legend li {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.legend-label { color: var(--ink-soft); }

.legend-val   { font-weight: 700; color: var(--ink-strong); font-variant-numeric: tabular-nums; }

/* Status bars (pipeline health) */

.status-bars {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.status-bar-row { display: flex; flex-direction: column; gap: 5px; }

.status-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.status-bar-label { display: inline-flex; align-items: center; gap: 6px; }

.status-bar-val {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.status-bar-val strong { color: var(--ink-strong); font-weight: 700; }

.status-bar-track {
  height: 7px;
  background: var(--rule-soft);
  border-radius: 999px;
  overflow: hidden;
}

.status-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--heritage-purple);
}

.status-bar-fill.new         { background: var(--heritage-purple); }

.status-bar-fill.in_progress { background: var(--heritage-gold); }

.status-bar-fill.review      { background: var(--heritage-purple-dark); }

.status-bar-fill.won         { background: var(--success); }

.status-bar-fill.lost        { background: var(--ink-faint); }

.status-bar-foot {
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-align: right;
  margin-top: 8px;
}

/* ──────────────────────────────────────────────────────────────────
   Disruption heatmap
   ────────────────────────────────────────────────────────────────── */

.heatmap-card { padding: 0; overflow: hidden; }

.heatmap-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
}

.heatmap {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  font-size: 0.85rem;
}

.heatmap th,
.heatmap td {
  text-align: center;
  padding: 0;
  vertical-align: middle;
}

.heatmap-corner { width: 130px; }

.heatmap-col-head {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding-bottom: 6px;
  white-space: nowrap;
}

.heatmap-row-head {
  text-align: right;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-strong);
  padding-right: 12px;
  white-space: nowrap;
}

.heatmap-cell {
  width: 56px;
  height: 56px;
  background: rgba(204, 0, 0, calc(var(--intensity, 0) * 0.85));
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  position: relative;
  transition: transform 120ms ease;
  cursor: default;
}

.heatmap-cell:not(.empty):hover {
  transform: scale(1.04);
  z-index: 2;
}

.heatmap-cell.empty {
  background: var(--rule-soft);
  border-radius: 6px;
}

.heatmap-cell.empty::before {
  content: '·';
  color: var(--ink-faint);
}

.heatmap-count {
  display: inline-block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
}

.heatmap-total {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-strong);
  padding: 0 6px;
  white-space: nowrap;
}

.heatmap-grand {
  font-weight: 700;
  color: var(--heritage-red-dark);
  padding: 0 6px;
  white-space: nowrap;
}

.heatmap-foot-row td,
.heatmap-foot-row th {
  border-top: 1px solid var(--rule-soft);
  padding-top: 8px;
  font-size: 0.78rem;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 0 14px 12px;
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.heat-swatch {
  display: inline-block;
  width: 16px; height: 12px;
  border-radius: 3px;
  background: rgba(204, 0, 0, calc(var(--intensity, 0) * 0.85));
}

@media (max-width: 720px) {
  .heatmap-cell { width: 44px; height: 44px; font-size: 0.92rem; }
  .heatmap-corner { width: 110px; }
  .heatmap-row-head { font-size: 0.78rem; padding-right: 8px; }
}

/* ──────────────────────────────────────────────────────────────────
   Demand pulse
   ────────────────────────────────────────────────────────────────── */

.demand-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.demand-bar {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--rule-soft);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.region-seg {
  display: block;
  transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.region-seg.empty { background: var(--rule-soft); }

.demand-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 10px;
  font-size: 0.85rem;
}

@media (max-width: 520px) { .demand-legend { grid-template-columns: repeat(2, 1fr); } }

.demand-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.region-name { color: var(--ink-soft); }

.region-count {
  margin-left: auto;
  font-weight: 700;
  color: var(--ink-strong);
}

.demand-recent {
  border-top: 1px solid var(--rule-soft);
  padding-top: 10px;
}

.demand-recent-head {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 8px;
}

.demand-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.demand-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule-soft);
}

.demand-item:last-child { border-bottom: 0; }

.demand-item-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.demand-customer {
  font-weight: 600;
  color: var(--ink-strong);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demand-sku {
  font-size: 0.78rem;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demand-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
}

.chip-east     { background: rgba(204, 0, 0, 0.10);   color: var(--heritage-red-dark); border-color: rgba(204, 0, 0, 0.20); }

.chip-west     { background: rgba(91, 44, 138, 0.10); color: var(--heritage-purple); border-color: rgba(91, 44, 138, 0.20); }

.chip-central  { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); border-color: rgba(212, 168, 67, 0.32); }

.chip-national { background: rgba(45, 140, 60, 0.12); color: var(--success-deep); border-color: rgba(45, 140, 60, 0.22); }

/* ──────────────────────────────────────────────────────────────────
   Polish: typography hierarchy
   ────────────────────────────────────────────────────────────────── */

/* sub-agent duplicate removed — canonical .section-title is at line ~1966 (1.4rem) */

.section-subtitle {
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.35;
}

/* sub-agent duplicate .section-header removed — flex-wrap merged into canonical at line ~1958 */

/* Tighter mobile spacing */

@media (max-width: 720px) {
  .dash { gap: 18px; }
  .kpi-grid, .kpi-grid-ops { gap: 10px; }
  .viz-row { gap: 10px; }
  .viz-card { padding: 14px; }
  .kpi-tile { padding: 14px 14px 12px; }
  .kpi-value { font-size: 1.7rem; }
}

/* ──────────────────────────────────────────────────────────────────
   Empty-state polish
   ────────────────────────────────────────────────────────────────── */

/* sub-agent duplicate removed — canonical .empty-state is at line ~1020 (56px icon) */

/* ──────────────────────────────────────────────────────────────────
   Dashboard polish pass (2nd round)
   ────────────────────────────────────────────────────────────────── */

/* Make alerts always fill rows nicely — 4-up on wide, 2x2 on mid, stacked on tight */

.alerts-list {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1200px) { .alerts-list { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 520px)  { .alerts-list { grid-template-columns: 1fr; } }

/* Heatmap empty-cell: replace "·" placeholder with a subtle hatch pattern */

.heatmap-cell.empty {
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 5px,
      rgba(160, 120, 48, 0.08) 5px,
      rgba(160, 120, 48, 0.08) 6px
    ),
    var(--rule-soft);
}

.heatmap-cell.empty::before { content: ''; }

.heatmap-zero { display: none; }

/* Donut legend: tighter, label-value pairs without unnecessary push */

.donut-legend li {
  justify-content: flex-start;
}

.donut-legend strong {
  margin-left: 6px;
}

/* QA gauge: give it a hero "released this week" number too */

.gauge {
  max-width: 220px;
}

.gauge-num.zero { fill: var(--success-deep); }

/* KPI sparkline padding — never clip the line */

.kpi-spark .spark { padding-bottom: 1px; }

/* Mobile: 2-up KPI tiles instead of 1-up to reduce scroll length */

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi-tile { padding: 12px 12px 10px; }
  .kpi-label { font-size: 0.62rem; letter-spacing: 0.1em; }
  .kpi-value { font-size: 1.45rem; }
  .kpi-prefix { font-size: 1rem; }
  .kpi-suffix { font-size: 0.85rem; }
  .kpi-meta { font-size: 0.72rem; }
  .kpi-trend { font-size: 0.7rem; padding: 1px 5px; }
  .kpi-spark { margin-top: 6px; }
  .spark { height: 22px; }
}

/* On very narrow phones, single column for KPI to keep numbers readable */

@media (max-width: 360px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* Mobile: hide kpi-icon when space is tight to give value more room */

@media (max-width: 480px) {
  .kpi-icon { width: 22px; height: 22px; }
}

/* Heatmap horizontal scroll hint on mobile */

@media (max-width: 720px) {
  .heatmap-wrap { padding: 12px 14px 8px; }
  .heatmap-col-head {
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    transform: rotate(-22deg);
    transform-origin: bottom left;
    padding-bottom: 14px;
    height: 60px;
    vertical-align: bottom;
  }
  .heatmap-corner { width: 92px; }
}

/* Due-soon table: convert to card list on narrow mobile */

@media (max-width: 560px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tr {
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--warm-white);
  }
  .data-table td {
    padding: 4px 0;
    border: 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: right;
  }
  .data-table td::before {
    content: attr(data-label);
    color: var(--ink-mute);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    text-align: left;
  }
  .data-table .reference-cell { font-weight: 700; }
  .data-table .customer-cell { text-align: right; }
  .data-table .customer-meta { font-size: 0.74rem; color: var(--ink-mute); }
}

/* Alerts: tighter padding on mobile */

@media (max-width: 480px) {
  .alerts { padding: 12px; }
  .alert { padding: 10px 12px; gap: 10px; }
  .alert-icon { width: 28px; height: 28px; }
  .alert-title { font-size: 0.88rem; }
  .alert-detail { font-size: 0.76rem; }
}

/* Viz row: stack to single column earlier so cards aren't cramped */

@media (max-width: 920px) {
  .viz-row { grid-template-columns: 1fr; }
}

/* Section header on mobile: stack title + button */

@media (max-width: 520px) {
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .section-header > .btn { width: 100%; justify-content: center; }
}

/* Demand pulse: better mobile legend spacing */

@media (max-width: 480px) {
  .demand-customer { font-size: 0.85rem; }
  .demand-sku { font-size: 0.72rem; }
  .demand-item-meta { font-size: 0.74rem; gap: 6px; }
  .chip { font-size: 0.68rem; padding: 1px 6px; }
}

/* Pipeline status bar value alignment fix */

.status-bar-val { white-space: nowrap; flex-shrink: 0; }

.status-bar-head { gap: 12px; }

/* Better empty-row in heatmap when there are zero overall rows */

.heatmap-card .empty-state { padding: 40px 20px; }

/* ──────────────────────────────────────────────────────────────────
   Polish pass 3: empty states, severity dots, status pill consistency
   ────────────────────────────────────────────────────────────────── */

/* Severity dot-label (used in Disruption tables to avoid pill-on-pill) */

.sev-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.sev-dot-mark {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Kanban empty state — designed, not bleak */

.kanban-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px 16px;
  color: var(--ink-mute);
  font-size: 0.82rem;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 7px,
      rgba(160, 120, 48, 0.04) 7px,
      rgba(160, 120, 48, 0.04) 8px
    );
  border-radius: var(--radius);
  text-align: center;
  font-style: italic;
}

.kanban-empty svg {
  color: var(--ink-faint);
  opacity: 0.7;
}

/* AI risk column header microcopy hint */

.ai-risk-hint {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  text-transform: none;
  margin-left: 4px;
}

/* QA Hold pill: solid red fill so it's distinct from Pending (amber outline) */

.qa-hold {
  background: var(--heritage-red) !important;
  color: #fff !important;
  border-color: var(--heritage-red-deep) !important;
  font-weight: 700;
}

.qa-hold .dot { background: rgba(255,255,255,0.85) !important; }

/* Section dividers — for inline context between sections */

.page-section-note {
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin: 6px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.page-section-note::before {
  content: '';
  flex-shrink: 0;
  width: 3px;
  height: 1em;
  background: var(--heritage-gold);
  border-radius: 2px;
}

/* ── Theme Toggle Button ─────────────────────────────── */

.theme-toggle {
  background: none;
  border: 1px solid var(--border-light, #E5E7EB);
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--text-secondary, #6B7280);
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.theme-toggle:hover { background: var(--surface-alt, #F3F4F6); color: var(--text-primary); }

.theme-icon-dark { display: none; }
/* ============================================================
   08-ai-tools.css
   AI Tools hub, module cards, pillar sections, filter chips
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* =========================================================
   AI TOOLS HUB — the workshop's front door
   ========================================================= */

.ai-tools-hub {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px;
}

.ai-tools-hero {
  text-align: center;
  padding: 28px 24px 26px;
  background:
    radial-gradient(ellipse at top, rgba(212, 175, 55, 0.08), transparent 70%),
    radial-gradient(ellipse at bottom, rgba(123, 80, 144, 0.06), transparent 70%);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: var(--radius-xl, 16px);
  margin-bottom: 24px;
}

.ai-tools-eyebrow {
  margin-bottom: 8px;
}

.ai-tools-eyebrow-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: white;
  background: linear-gradient(135deg, var(--heritage-purple), #5e3d70);
  border-radius: 20px;
  border: 1px solid rgba(123, 80, 144, 0.4);
  box-shadow: 0 2px 12px rgba(123, 80, 144, 0.25);
}

.ai-tools-eyebrow-badge svg {
  color: var(--heritage-gold);
}

.ai-tools-title {
  font-family: 'ABC Arizona Flare', 'Playfair Display', 'Iowan Old Style', Georgia, serif;
  font-size: 36px;
  font-weight: 700;
  font-style: italic;
  color: var(--heritage-red);
  margin: 0 0 6px 0;
  letter-spacing: -0.01em;
}

.ai-tools-subtitle {
  max-width: 720px;
  margin: 0 auto 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}

.ai-tools-subtitle strong {
  color: var(--heritage-purple);
}

.ai-tools-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.ai-tool-stat {
  text-align: center;
}

.ai-tool-stat .stat-num {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-size: 38px;
  font-weight: 700;
  font-style: italic;
  color: var(--heritage-red);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ai-tool-stat .stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 6px;
}

.pillar-section {
  margin-bottom: 40px;
}

.pillar-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--rule);
  /* Heritage-red accent rail (was an inline style in ai-tools.js — moved
     here so dark mode can re-tune it without a specificity fight) */
  border-left: 3px solid var(--heritage-red);
  padding-left: 10px;
}

.pillar-emoji {
  font-size: 22px;
}

.pillar-title {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  font-style: italic;
  color: var(--heritage-red);
  margin: 0;
}

.pillar-count {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-left: auto;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.module-card {
  position: relative;
  background: var(--bg-card, white);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--pillar-color, var(--heritage-purple));
  border-radius: var(--radius-lg, 12px);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.module-card.module-live {
  cursor: pointer;
}

.module-card.module-live:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px var(--pillar-bg);
  border-color: var(--pillar-color);
}

.module-card.module-coming-soon {
  opacity: 0.85;
  background: linear-gradient(180deg, white, rgba(0,0,0,0.02));
}

.module-card.module-coming-soon .module-icon {
  filter: grayscale(40%);
}

.module-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.module-icon {
  font-size: 30px;
  line-height: 1;
}

.module-status {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 11px;
}

.module-status.status-live {
  color: #156833;
  background: rgba(21, 104, 51, 0.10);
  border: 1px solid rgba(21, 104, 51, 0.25);
}

.module-status.status-live::before {
  content: '●';
  margin-right: 4px;
  color: #1aa050;
  animation: pulse-live 2s ease-in-out infinite;
}

/* PWA portrait (2026-07-25): AI Hub was the last route ghosting the sticky
   topbar after SPA nav. Dozens of cards each running infinite pulse-live +
   transform hover transitions is a continuous compositor tax under sticky
   chrome on iOS. Kill the perpetual animation on small portrait viewports;
   keep the solid green live dot. Touch devices also skip hover lifts. */
@media (max-width: 980px) and (orientation: portrait) {
  .module-status.status-live::before {
    animation: none;
  }
  .module-card.module-live:hover,
  .module-card.module-live:active {
    transform: none;
  }
}
@media (hover: none) {
  .module-card.module-live:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: var(--rule);
  }
}

.module-status.status-coming {
  color: #856200;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.35);
}

.module-status.status-planned {
  color: var(--text-mute);
  background: var(--eggshell-shade);
  border: 1px solid var(--rule);
}

.module-name {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px 0;
  line-height: 1.2;
}

.module-tagline {
  font-size: 14px;
  font-style: italic;
  color: var(--pillar-color, var(--heritage-purple));
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.module-description {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  margin: 0 0 14px 0;
  flex-grow: 1;
}

.module-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-mute);
  margin-bottom: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
}

.module-dept {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pillar-color, var(--heritage-purple));
}

.module-stakeholder {
  font-style: italic;
}

.module-stakeholder::before {
  content: '•';
  margin-right: 6px;
}

.module-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.capability-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 11px;
  background: var(--pillar-bg, rgba(123, 80, 144, 0.06));
  color: var(--pillar-color, var(--heritage-purple));
}

.module-card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: 8px;
}

.module-card-footer .text-mute {
  font-size: 12px;
  font-style: italic;
}

.loading-shimmer {
  padding: 60px;
  text-align: center;
  color: var(--text-mute);
  font-style: italic;
}

/* polish-pass 2026-05-21 — equalize module-card row heights on grids
   that wrap to multiple rows. min-height: 280px already exists but
   doesn't equalize. grid-auto-rows: 1fr makes every row equal-height
   so cards on the same row stay aligned even when descriptions vary. */

.module-grid {
  grid-auto-rows: 1fr;
}

.module-card {
  height: 100%;
}

/* polish-pass 2026-05-21 — module-card-footer pinned to bottom for
   alignment when card content is short. The card uses flex-direction
   column, so margin-top:auto pushes the footer down. */

.module-card-footer {
  margin-top: auto;
}

/* polish-pass 2026-05-21 — module-meta should not bunch up at top
   when a card has no capabilities; ensure it sits above footer. */

.module-card .module-capabilities:empty {
  display: none;
}

/* polish-pass 2026-05-21 — AI Tools hub on narrow viewports.
   Breakpoint unified to 640px (2026-07-16): the file previously mixed
   600px and 640px blocks, and this block set the hero title to 40px —
   LARGER than the 36px desktop title. Mobile now scales down to 30px. */

@media (max-width: 640px) {
  .ai-tools-hero {
    /* Tighter under mobile topbar / Dynamic Island — was 28/30. */
    padding: 16px 16px 22px;
    margin-bottom: 16px;
  }
  .ai-tools-title {
    font-size: 30px;
  }
  .ai-tools-subtitle {
    font-size: 14px;
  }
  .ai-tools-stats {
    gap: 22px;
  }
  .ai-tool-stat .stat-num {
    font-size: 30px;
  }
  .module-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .pillar-section {
    margin-bottom: 28px;
  }
}

/* ====================================================================
 * UI POLISH PASS — 2026-05-22 (UI-PolishAgent)
 * Workshop demo polish for AI Tools Hub:
 *   1. Bigger emoji icons on module cards (the visual anchor of the hub)
 *   2. Sidebar section-title visual rhythm (subtle hierarchy refinement)
 *   3. Mild hover lift on .module-card to feel demo-ready
 * APPEND-ONLY — does not rewrite existing rules above.
 * ==================================================================== */

/* 1. Module-card icons: 30px → 56px (~3.5rem). Visual anchor of each card. */

.ai-tools-hub .module-icon,
.module-card .module-icon {
  font-size: 56px;                /* up from 30px */
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--pillar-bg, rgba(123, 80, 144, 0.06));
  /* tiny inner ring keeps the emoji visually contained */
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.03);
  transition: transform 0.18s ease-out, background 0.18s ease-out;
}

.ai-tools-hub .module-card.module-live:hover .module-icon {
  transform: scale(1.06) rotate(-2deg);
}

.ai-tools-hub .module-card.module-coming-soon .module-icon,
.ai-tools-hub .module-card.module-planned .module-icon {
  opacity: 0.55;
  filter: grayscale(0.3);
}

/* Tighter card-header now that the icon is a "tile" */

.ai-tools-hub .module-card .module-card-header {
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}

/* 2. Sidebar section-title — visual rhythm refinement.
 *    Adds a hairline divider above non-first section titles so the
 *    three-group structure (AI Modules / Operations / Market Intel /
 *    Planning) reads clearly without shouting. */

.sidebar .nav-section-title {
  /* keep existing styles, just add separator behavior */
  position: relative;
}

.sidebar .nav-section-title + .nav-section-title,
.sidebar .nav-link + .nav-section-title {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule, rgba(0, 0, 0, 0.08));
}

/* 3. Card hover lift — already present but slightly amplified
 *    on the AI Tools hub so the demo feels tactile. */

.ai-tools-hub .module-card.module-live {
  transition:
    transform 0.18s ease-out,
    box-shadow 0.18s ease-out,
    border-color 0.18s ease-out;
}

.ai-tools-hub .module-card.module-live:hover {
  transform: translateY(-3px);
}

/* Responsive — slightly smaller icon tiles on phones, still demo-grade */

@media (max-width: 640px) {
  .ai-tools-hub .module-icon,
  .module-card .module-icon {
    font-size: 44px;
    width: 52px;
    height: 52px;
    border-radius: 13px;
  }
}

/* "Preview" / "Simulation" badge on AI Tools hub cards. */

.module-card .module-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.16);
  color: #ad6800;
  margin-left: 6px;
  letter-spacing: 0.02em;
}

.module-card .module-preview-badge.module-preview-sim {
  background: rgba(31, 111, 235, 0.10);
  color: #1f4eb6;
}

/* AI TOOLS HUB FILTER BAR — 2026-05-22 */

.ai-tools-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ai-tools-filter-input {
  flex: 0 0 220px;
  padding: 8px 12px;
  border: 1px solid var(--border, #d0d0d0);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card, #fff);
  color: var(--ink, #1a1a1a);
  outline: none;
  transition: border-color 0.2s;
}

.ai-tools-filter-input:focus {
  border-color: var(--heritage-red, #CC0000);
}

.ai-tools-pillar-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pillar-chip {
  padding: 5px 12px;
  border: 1px solid var(--border, #d0d0d0);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  color: var(--ink-soft, #666);
  cursor: pointer;
  transition: all 0.2s;
}

.pillar-chip:hover {
  border-color: var(--ink-soft, #888);
  background: var(--rule-soft, rgba(0, 0, 0, 0.04));
}

.pillar-chip.active {
  background: var(--chip-color, var(--heritage-red, #CC0000));
  color: #fff;
  border-color: var(--chip-color, var(--heritage-red, #CC0000));
}

@media (max-width: 640px) {
  .ai-tools-filter-bar { flex-direction: column; align-items: stretch; }
  .ai-tools-filter-input { flex: 1; }
}

/* ==========================================================================
 *  Final Polish Pass — 2026-05-23
 *  --------------------------------------------------------------------------
 *  Gaps closed before the June 1st demo:
 *    1. AI Tools hub: empty-state when filter matches nothing
 *    2. AI Tools hub: dark-mode coverage for the front door
 *    3. Login page: full dark-mode coverage (was a bright white card on black)
 *    4. Upload zone (.lv-dropzone family): dark-mode coverage
 *
 *  All rules are APPEND-ONLY so the existing cascade is preserved.
 * ========================================================================== */

/* ── AI Tools hub — empty filter state ──────────────────────────── */

.ai-tools-empty {
  text-align: center;
  padding: 48px 24px;
  margin: 24px 0;
  background: linear-gradient(180deg, rgba(123, 80, 144, 0.03), rgba(212, 168, 67, 0.03));
  border: 1px dashed var(--rule);
  border-radius: 12px;
}

.ai-tools-empty .ai-tools-empty-emoji {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.ai-tools-empty h3 {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-strong, var(--ink));
  margin: 0 0 6px;
}

.ai-tools-empty p {
  color: var(--text-mute);
  margin: 0 0 16px;
  font-size: 14px;
}

/* Mobile: ensure pillar chips don't push the filter input off-screen,
   and give every hub control a real 44px tap target (task bar: WCAG/Apple
   HIG). Scoped selectors beat the platform-wide 40px floor in
   97-mobile-optimize.css without touching other modules. ───────────── */

@media (max-width: 640px) {
  .ai-tools-filter-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .ai-tools-pillar-chips {
    flex-wrap: wrap;
    gap: 6px;
  }
  .ai-tools-pillar-chips .pillar-chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 13px;
    padding: 6px 14px;
  }
  .ai-tools-filter-bar .ai-tools-filter-input {
    min-height: 44px;
  }
  .ai-tools-hub .ai-tools-request-btn {
    min-height: 44px;
  }
  .module-card {
    padding: 18px 18px 14px;
    min-height: auto;
  }
}

/* ───────────────────────────────────────────────────────────────────────
 * AI Hub super-sections (2026-06-15): two top-level bands — Agents + Tools.
 * Agents get a distinct gold accent + slightly elevated card treatment so
 * they read as the flagship, end-to-end tier above the single-task Tools.
 * ─────────────────────────────────────────────────────────────────────── */

.hub-supersection {
  margin-bottom: 36px;
}

.hub-supersection-header {
  margin: 0 0 16px;
}

.hub-supersection-title {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.hub-supersection-sub {
  margin: 0;
  font-size: 14px;
  color: var(--text-mute, #6b6b6b);
}

/* Agents band — gold accent rail + warm wash so it stands apart from Tools. */
.hub-supersection-agents {
  position: relative;
  padding: 20px 20px 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(212, 168, 67, 0.10) 0%, rgba(212, 168, 67, 0.02) 100%);
  border: 1px solid rgba(212, 168, 67, 0.30);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.hub-supersection-agents .hub-supersection-title {
  color: #B8860B; /* deep gold */
}

/* Agent cards: gold left-accent + subtle lift to distinguish from tool cards.
 * The Agents section wrapper carries .hub-agents-section so we only restyle
 * cards inside it, leaving the Tools grid on the standard heritage-red look. */
.hub-agents-section .module-card {
  border-left: 4px solid #D4A843;
  box-shadow: 0 2px 10px rgba(184, 134, 11, 0.12);
}

.hub-agents-section .module-card.module-live:hover {
  box-shadow: 0 6px 20px rgba(184, 134, 11, 0.20);
  transform: translateY(-2px);
}

/* "Agent" filter chip echoes the gold accent when active. */
.ai-tools-pillar-chips .pillar-chip[data-dept="Agents"].active {
  background: #D4A843;
  border-color: #D4A843;
  color: #1a1a1a;
}

@media (max-width: 640px) {
  .hub-supersection-agents {
    padding: 16px 14px 6px;
  }
  .hub-supersection-title {
    font-size: 22px;
  }
}

/* Request a New Module button — ghost pill on heritage red. Previously
   unstyled (cursor:pointer only) — it rendered as a default browser
   button on the platform's front door. */
.ai-tools-actions {
  margin-top: 16px;
}

.ai-tools-request-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--heritage-red);
  background: transparent;
  border: 1.5px solid var(--heritage-red);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.ai-tools-request-btn:hover {
  background: var(--heritage-red);
  color: #fff;
  box-shadow: 0 4px 14px rgba(204, 0, 0, 0.25);
}

.ai-tools-request-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* Department-scope explanation note (coordinators/viewers whose module
   list is filtered). Styling moved out of ai-tools.js inline cssText so
   dark mode can cover it. */
.ai-tools-dept-note {
  margin: 12px 0 16px;
  padding: 10px 14px;
  border-left: 3px solid var(--heritage-gold);
  background: rgba(212, 175, 55, 0.08);
  border-radius: var(--radius-sm, 4px);
  color: #4a3a10;
  font-size: 14px;
  line-height: 1.5;
}

/* Keyboard focus rings — heritage-gold, matching the platform-wide
   convention from 96-polish-v4.css (.btn / .nav-link / .tab). */
.pillar-chip:focus-visible,
.ai-tools-filter-input:focus-visible,
.ai-tools-request-btn:focus-visible {
  outline: 2px solid var(--heritage-gold);
  outline-offset: 2px;
}
/* ============================================================
   09-rfp.css
   RFP Inbox module
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* -------- AI extraction preview ------------------------------ */

.extraction-preview {
  background: linear-gradient(135deg, rgba(91, 44, 138, 0.04), rgba(212, 168, 67, 0.06));
  border: 1px solid rgba(91, 44, 138, 0.16);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-top: 16px;
  position: relative;
}

.extraction-preview::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  width: 12px;
  height: 12px;
  border-top: 1.5px solid var(--heritage-gold);
  border-left: 1.5px solid var(--heritage-gold);
}

.extraction-preview::after {
  content: '';
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 12px;
  height: 12px;
  border-bottom: 1.5px solid var(--heritage-gold);
  border-right: 1.5px solid var(--heritage-gold);
}

.extraction-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.extraction-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--heritage-purple);
  margin: 0;
  flex: 1;
}

.confidence-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.confidence-bar {
  width: 80px;
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
}

.confidence-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--heritage-gold), var(--success));
  transition: width 400ms ease;
}

.confidence-bar-fill.low { background: var(--danger); }

.confidence-bar-fill.medium { background: var(--heritage-gold); }

/* Light-mode rescue for the inline `rgba(0,0,0,0.15)` and `rgba(0,0,0,0.2)`
   sub-cards / form fields used inside transcript widgets. Without this
   override the metric tiles and inline inputs look like dark glass on the
   warm-paper background — incongruent and slightly buggy-looking. */

.rfp-lifecycle-card .metric,
.rfp-rules-card .metric,
.et-inline-card .metric,
.et-inline-card .et-template-row,
.vc-inline-card .metric,
.ded-inline-card .metric {
  background: rgba(60, 40, 20, 0.05) !important;
  border: 1px solid rgba(60, 40, 20, 0.08);
}

/* Heading + table-text legibility inside the inline cards. The cards inherit
   page color (.ink/--ink) by default, which is fine in light mode, but the
   table TD borders and source-cite copy needs theme-aware tuning. */

.rfp-lifecycle-card,
.rfp-rules-card,
.et-inline-card,
.lv-inline-card,
.qc-inline-card,
.vc-inline-card,
.fb-inline-card,
.ded-inline-card {
  color: var(--ink, #2C2520);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(60, 40, 20, 0.06));
}

/* Badge legibility — the inline `badge-critical` uses `color:#ff6b6b` which
   is fine in dark mode but a touch screaming on warm paper. Tone it. */

.rfp-lifecycle-card .badge-critical,
.rfp-rules-card .badge-critical,
.et-inline-card .badge-critical,
.lv-inline-card .badge-critical,
.qc-inline-card .badge-critical,
.vc-inline-card .badge-critical,
.fb-inline-card .badge-critical,
.ded-inline-card .badge-critical {
  background: rgba(204, 0, 0, 0.10) !important;
  color: var(--heritage-red, #CC0000) !important;
}

.rfp-lifecycle-card .badge-ok,
.et-inline-card .badge-ok,
.qc-inline-card .badge-ok,
.vc-inline-card .badge-ok {
  background: rgba(45, 140, 60, 0.10) !important;
  color: var(--success-deep, #1F6B2B) !important;
}

/* The .badge-warning is gold-on-gold-tint, which works in both modes,
   so we only tighten the gold token reference. */

.rfp-lifecycle-card .badge-warning,
.qc-inline-card .badge-warning,
.vc-inline-card .badge-warning,
.fb-inline-card .badge-warning {
  background: rgba(212, 168, 67, 0.14) !important;
  color: var(--heritage-gold-dark, #8B6914) !important;
}

/* Stage-pip pipeline (RFP lifecycle). Light-mode visibility for the
   non-active pips so the pipeline reads as a chain, not a row of ghosts. */

.rfp-lifecycle-card .stage-pip {
  background: rgba(60, 40, 20, 0.04) !important;
  border-color: rgba(60, 40, 20, 0.10) !important;
  color: var(--ink-soft, #4A4038);
}

.rfp-lifecycle-card .stage-pip.active {
  background: var(--heritage-gold, #D4A843) !important;
  border-color: var(--heritage-gold-dark, #8B6914) !important;
  color: #1A1410 !important;
}

/* ============================================================
   Extracted from public/js/ui/rfps.js — ensureLifecycleStyles()
   BASE styles for RFP lifecycle + customer rules cards.
   (Light-mode rescue overrides + theme-aware tuning are above.)
   ============================================================ */

.rfp-lifecycle-card,
.rfp-rules-card {
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 16px;
}

.rfp-lifecycle-card h3,
.rfp-rules-card h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rfp-lifecycle-card .stage-pipeline {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.rfp-lifecycle-card .stage-pip {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rfp-lifecycle-card .stage-pip.active {
  background: var(--accent, #d4a843);
  color: #000;
  font-weight: 600;
}

.rfp-lifecycle-card .metric-row,
.rfp-rules-card .metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* NOTE: .metric base background is overridden above by the light-mode
   rescue (.rfp-lifecycle-card .metric { background: rgba(60,40,20,0.05) !important; }).
   The dark-mode counterpart is in 90-dark-mode.css. */
.rfp-lifecycle-card .metric,
.rfp-rules-card .metric {
  padding: 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
}

.rfp-lifecycle-card .metric-value,
.rfp-rules-card .metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent, #d4a843);
}

.rfp-lifecycle-card .metric-label,
.rfp-rules-card .metric-label {
  font-size: 11px;
  color: var(--text-mute, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rfp-lifecycle-card .source-cite,
.rfp-rules-card .source-cite {
  font-size: 11px;
  color: var(--text-mute, #888);
  font-style: italic;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.rfp-lifecycle-card .badge-warning {
  background: rgba(212, 168, 67, 0.15);
  color: var(--accent, #d4a843);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.rfp-empty-state {
  padding: 14px;
  font-size: 12px;
  color: var(--text-mute, #888);
  font-style: italic;
}

/* ============================================================
   ORDER INTELLIGENCE (order-intelligence) — dedicated module styles
   ------------------------------------------------------------
   order-intelligence is the rfp module's modern surface. The JS
   (public/js/ui/order-intelligence.js) sets layout inline and
   references `--oi-tint-*` CSS variables (with hardcoded fallbacks).
   This block makes those tints theme-aware and adds the module's
   OWN responsive breakpoints (768px / 480px) so the dedicated
   source file carries mobile responsiveness rather than relying
   solely on the global 97-mobile-optimize.css overrides.
   ============================================================ */

/* Theme-aware tint tokens consumed by the JS inline styles.
   Light (default) values mirror the JS fallbacks; 90-dark-mode.css
   can override these for dark surfaces. */
:root {
  --oi-tint-blue:        #e8f4fd;
  --oi-tint-green:       #dff5e6;
  --oi-tint-red:         #fde5e5;
  --oi-tint-red-text:    #a01616;
  --oi-tint-yellow:      #fff8d8;
  --oi-tint-yellow-text: #7a6900;
  --oi-tint-grey:        #f0f0f0;
}

.oi-main-layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 18px;
  align-items: start;
}

.oi-side {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 200px);
  overflow: auto;
}

.oi-list-item {
  border-radius: var(--radius-md, 8px);
  transition: background 160ms ease, border-color 160ms ease;
}

.oi-list-item:hover,
.oi-list-item:focus-within {
  background: rgba(60, 40, 20, 0.04);
}

/* ── Tablet / small-laptop: collapse the sidebar + main to one column.
      768px is the standard module breakpoint (matches 20-deductions.css
      and 31-sales-analytics.css). */
@media (max-width: 768px) {
  .oi-main-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .oi-side {
    position: static;
    max-height: 60vh;
    overflow: auto;
  }

  /* Pipeline + bulk-date controls keep their intrinsic width so they
     don't stretch awkwardly across a narrow row. */
  #oi-bulk-all-dates,
  #oi-show-pipeline {
    flex: 0 0 auto;
  }

  /* Detail-header action buttons (Add to Calendar / Save to LeeSpace /
     Re-extract) grow to fill the row instead of becoming tiny pills. */
  #oi-main .card .btn {
    flex: 1 1 auto;
    min-width: 120px;
  }
}

/* ── Phone: tighten padding, let the upload zone shrink, and make
      line-item tables horizontally scrollable instead of overflowing. */
@media (max-width: 480px) {
  .oi-main-layout {
    gap: 10px;
  }

  #oi-upload-zone {
    min-height: 200px !important;
    padding: 14px !important;
  }

  .oi-side {
    max-height: 50vh;
  }

  #oi-main table,
  #oi-detail table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #oi-main table th,
  #oi-main table td,
  #oi-detail table th,
  #oi-detail table td {
    font-size: 0.82rem;
    padding: 6px 8px;
  }

  /* Stack the detail-header action buttons full-width on phones. */
  #oi-main .card .btn {
    flex: 1 1 100%;
    min-width: 0;
  }
}
/* ============================================================
   10-hr.css
   HR Forms module
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ──────────────────────────────────────────────────────────────────
   HR mini panel
   ────────────────────────────────────────────────────────────────── */

.hr-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.hr-mini-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hr-mini-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.hr-mini-num {
  font-family: var(--font-sans);
  font-feature-settings: 'tnum';
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: -0.025em;
  color: var(--ink-strong);
  line-height: 1.05;
}

.hr-mini-num.red    { color: var(--heritage-red-dark); }

.hr-mini-num.gold   { color: var(--heritage-gold-dark); }

.hr-mini-num.purple { color: var(--heritage-purple); }

.hr-mini-num.green  { color: var(--success-deep); }

/* Make HR mini panel match denser spacing of demand pulse */

.hr-mini { padding: 18px; }

@media (max-width: 480px) {
  .hr-mini-grid { gap: 10px; }
  .hr-mini-num { font-size: 1.4rem; }
}

/* ============================================================
 * California HR Compliance — banner, badge, and detail notes
 * ============================================================ */

/* Top-of-page compliance banner (HR view, People Ops only) */

.compliance-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 12px 0 18px;
  padding: 14px 18px;
  background: linear-gradient(0deg, rgba(212, 168, 67, 0.08), rgba(212, 168, 67, 0.05));
  border: 1px solid rgba(212, 168, 67, 0.32);
  border-left: 3px solid var(--gold, #D4A843);
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-strong, #2C2418);
  position: relative;
}

.compliance-banner-icon {
  font-size: 1.55rem;
  line-height: 1;
  flex: 0 0 auto;
  margin-top: 1px;
  opacity: 0.88;
}

.compliance-banner-body { flex: 1; min-width: 0; }

.compliance-banner-title {
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink-strong, #2C2418);
  letter-spacing: 0.01em;
}

.compliance-banner-text {
  color: var(--ink-soft, #4A3F2E);
  font-size: 0.86rem;
}

.compliance-banner-text strong { color: var(--ink-strong, #2C2418); font-weight: 600; }

.compliance-banner-more {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: flex-start;
  font-size: 0.82rem;
}

.compliance-banner-more summary {
  cursor: pointer;
  color: var(--ink-soft, #4A3F2E);
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  padding: 2px 6px;
  border-radius: 4px;
  user-select: none;
}

.compliance-banner-more summary:hover { background: rgba(212, 168, 67, 0.12); }

.compliance-banner-more[open] {
  flex-basis: 100%;
  margin-top: 8px;
  margin-left: 38px; /* align under the body text, past the icon */
}

.compliance-banner-list {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--ink-soft, #4A3F2E);
  font-size: 0.82rem;
  line-height: 1.55;
}

.compliance-banner-list li { margin-bottom: 4px; }

/* Small ⚖️ badge on flagged rows + inline in banner text */

.ca-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92em;
  margin-left: 4px;
  opacity: 0.86;
  cursor: help;
  vertical-align: baseline;
}

.ca-badge.inline-badge {
  background: rgba(212, 168, 67, 0.18);
  border: 1px solid rgba(212, 168, 67, 0.4);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.78rem;
  margin-left: 2px;
  color: var(--ink-strong, #2C2418);
  font-weight: 500;
}

/* Per-record compliance note inside the detail modal */

.compliance-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 14px 0 4px;
  padding: 12px 14px;
  background: rgba(212, 168, 67, 0.07);
  border: 1px solid rgba(212, 168, 67, 0.28);
  border-radius: 6px;
  font-size: 0.86rem;
}

.compliance-note-icon { font-size: 1.25rem; line-height: 1; opacity: 0.85; }

.compliance-note-title {
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  font-weight: 600;
  color: var(--ink-strong, #2C2418);
  margin-bottom: 3px;
  font-size: 0.92rem;
}

.compliance-note-text { color: var(--ink-soft, #4A3F2E); line-height: 1.5; }
/* ============================================================
   11-vendor-compliance.css
   Vendor Compliance module
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ============================================================
 * VENDOR COMPLIANCE
 * ============================================================ */

.vc-summary-chips {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: 6px;
}

.vc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
}

.vc-chip-expired  { background: rgba(192, 57, 43, 0.12); color: var(--danger); border: 1px solid rgba(192, 57, 43, 0.25); }

.vc-chip-expiring { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); border: 1px solid rgba(212, 168, 67, 0.35); }

.vc-chip-total    { background: var(--rule-soft); color: var(--ink-soft); border: 1px solid var(--rule); }

.vc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  white-space: nowrap;
}

.vc-badge-expired  { background: rgba(192, 57, 43, 0.14);  color: var(--danger); border: 1px solid rgba(192, 57, 43, 0.30); }

.vc-badge-expiring { background: rgba(212, 168, 67, 0.20); color: var(--heritage-gold-dark); border: 1px solid rgba(212, 168, 67, 0.40); }

.vc-badge-active   { background: rgba(45, 140, 60, 0.12);  color: var(--success-deep); border: 1px solid rgba(45, 140, 60, 0.30); }

.vc-badge-pending  { background: rgba(91, 44, 138, 0.10);  color: var(--heritage-purple); border: 1px solid rgba(91, 44, 138, 0.25); }

.vc-days {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
}

.vc-days-expired  { color: var(--danger); }

.vc-days-expiring { color: var(--heritage-gold-dark); }

.vc-days-warning  { color: #8B6914; opacity: 0.85; }

.vc-days-active   { color: var(--ink-soft); font-weight: 500; }

/* Row tinting on the certificates table — left-border accent */

.vc-table tbody tr.vc-row-expired  { background: linear-gradient(90deg, rgba(192, 57, 43, 0.10) 0%, rgba(192, 57, 43, 0.04) 4px, transparent 4px); }

.vc-table tbody tr.vc-row-expiring { background: linear-gradient(90deg, rgba(212, 168, 67, 0.14) 0%, rgba(212, 168, 67, 0.05) 4px, transparent 4px); }

.vc-table tbody tr.vc-row-warning  { background: linear-gradient(90deg, rgba(212, 168, 67, 0.06) 0%, rgba(212, 168, 67, 0.02) 4px, transparent 4px); }

.vc-table tbody tr.vc-row-active   { /* default */ }

.vc-table tbody tr.vc-row-unknown  { opacity: 0.75; }

.vc-table tbody tr:hover {
  background-color: rgba(212, 168, 67, 0.08);
}

/* The vendor-compliance, label-verify, and formulation-bot widgets render
   inline-styled <input>/<select>/<textarea> with hardcoded
   `color:#fff;background:rgba(0,0,0,0.2)` for dark mode. In light mode the
   white text is invisible on the dark sub-card. Force a readable pair. */

.vc-inline-card input[type="number"],
.vc-inline-card input[type="text"],
.vc-inline-card select,
.vc-inline-card textarea,
.lv-inline-card input[type="number"],
.lv-inline-card input[type="text"],
.lv-inline-card select,
.lv-inline-card textarea,
.fb-inline-card input[type="number"],
.fb-inline-card input[type="text"],
.fb-inline-card select,
.fb-inline-card textarea {
  color: var(--ink, #2C2520) !important;
  background: rgba(60, 40, 20, 0.04) !important;
  border-color: rgba(60, 40, 20, 0.14) !important;
}

/* ============================================================
   Extracted from public/js/ui/vendor-compliance.js — ensureVcInlineStyles()
   Inline card visuals for should-cost calculator and compliance widgets.
   ============================================================ */

.vc-inline-card {
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 16px;
}

.vc-inline-card h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
}

.vc-inline-card .metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.vc-inline-card .metric {
  padding: 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
}

.vc-inline-card .metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent, #d4a843);
}

.vc-inline-card .metric-label {
  font-size: 11px;
  color: var(--text-mute, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vc-inline-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.vc-inline-card table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-mute, #888);
  text-transform: uppercase;
}

.vc-inline-card table td {
  padding: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.vc-inline-card .badge-ok {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.vc-inline-card .badge-warning {
  background: rgba(212, 168, 67, 0.15);
  color: var(--accent, #d4a843);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.vc-inline-card .badge-critical {
  background: rgba(204, 0, 0, 0.15);
  color: #ff6b6b;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.vc-inline-card .source-cite {
  font-size: 11px;
  color: var(--text-mute, #888);
  font-style: italic;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.vc-empty-state {
  padding: 14px;
  font-size: 12px;
  color: var(--text-mute, #888);
  font-style: italic;
}
/* ============================================================
   12-qc-intelligence.css
   QC Intelligence: KPIs, charts, predictions, recent batches, loading
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ===================================================================== */

/* Formulation Bot — R&D archive search                                  */

/* ===================================================================== */

/* Input card */

.formulation-bot-input-card {
  background: linear-gradient(180deg, var(--paper) 0%, var(--eggshell-bright) 100%);
  border-left: 4px solid var(--heritage-purple);
}

.formulation-bot-prompt {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  align-items: stretch;
}

.formulation-bot-prompt-input {
  flex: 1;
  font-size: 1rem;
  padding: 12px 16px;
}

.formulation-bot-prompt .btn {
  padding: 10px 22px;
  font-size: 0.95rem;
  white-space: nowrap;
}

/* Sample question chip row */

.formulation-bot-sample-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: nowrap;
}

.formulation-bot-sample-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

#fb-refresh-samples {
  padding: 4px 8px;
  min-height: auto;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}

.formulation-bot-stats {
  margin-top: 12px;
  font-size: 0.82rem;
  padding-top: 10px;
  border-top: 1px dashed var(--eggshell-deep);
}

/* Conversation column */

.formulation-bot-conversation {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Empty state */

.formulation-bot-empty {
  text-align: center;
  padding: 36px 24px;
  background: var(--paper);
  border: 1px dashed var(--eggshell-deep);
}

.formulation-bot-empty-icon {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 10px;
}

.formulation-bot-empty-title {
  font-family: 'ABC Arizona Flare', 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--ink-strong);
  margin: 0 0 8px 0;
}

.formulation-bot-empty-sub {
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 auto 14px auto;
  line-height: 1.55;
}

.formulation-bot-empty-examples {
  text-align: left;
  display: inline-block;
  background: rgba(91, 44, 138, 0.04);
  padding: 12px 18px 12px 18px;
  border-radius: 8px;
  margin-top: 6px;
  border-left: 3px solid var(--heritage-purple);
}

.formulation-bot-empty-examples ul {
  margin: 6px 0 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
}

.formulation-bot-empty-examples li {
  margin: 4px 0;
  line-height: 1.5;
}

/* Smaller button helper (used by retry) */

.btn-xs {
  padding: 4px 10px;
  font-size: 0.78rem;
  min-height: auto;
}

/* Responsive */

@media (max-width: 720px) {
  .formulation-bot-prompt {
    flex-direction: column;
  }

  .formulation-bot-sample-row {
    flex-wrap: wrap;
  }

  .fb-source-card-header {
    flex-wrap: wrap;
  }

  .fb-source-card-meta {
    width: 100%;
    margin-top: 4px;
  }
}

/* polish-pass 2026-05-21 — Empty state consistency. Some modules use
   .empty-state with .empty-icon, others put icon inline. Ensure
   .empty-state always reads as a clean centered block with breathing
   room, whether or not it has an icon. */

.empty-state {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.empty-state h3 {
  margin: 4px 0 2px;
}

.empty-state p {
  margin: 0;
  max-width: 48ch;
}

/* ============================================================
   Extracted from public/js/ui/qc-intelligence.js — injectStyles()
   Charts, line cards, insights, predictions, recent batches, loading.
   ============================================================ */

.qc-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.qc-chart-wide { grid-column: 1 / -1; }

@media (max-width: 900px) {
  .qc-charts-grid { grid-template-columns: 1fr; }
}

.qc-chart-card {
  background: var(--warm-white, #fff);
  border: 1px solid var(--rule, rgba(0, 0, 0, 0.08));
  border-radius: var(--radius-lg, 10px);
  padding: 16px;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.04));
}

.qc-chart-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-strong, #1a1a1a);
  margin-bottom: 10px;
}

.qc-line-chart {
  width: 100%;
  height: 200px;
  display: block;
}

.qc-line-path { stroke: var(--heritage-red, #CC0000); stroke-width: 2; }
.qc-grid-line { stroke: rgba(0, 0, 0, 0.06); stroke-width: 1; }
.qc-ref-line { stroke: rgba(45, 140, 60, 0.45); stroke-width: 1; }
.qc-axis-label { font-size: 10px; fill: var(--ink-mute, #6B7280); font-family: var(--font-sans, system-ui); }
.qc-spark-dot { fill: var(--heritage-red, #CC0000); }

.qc-chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--ink-mute, #6B7280);
}

.qc-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.qc-legend-swatch { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.qc-legend-line { background: var(--heritage-red, #CC0000); }
.qc-legend-ref { background: rgba(45, 140, 60, 0.45); }

/* Bar charts */
.qc-bar-list { display: flex; flex-direction: column; gap: 8px; }

.qc-bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  gap: 10px;
  align-items: center;
  font-size: 0.88rem;
}

.qc-bar-label { color: var(--ink-strong, #1a1a1a); }

.qc-bar-track {
  background: rgba(0, 0, 0, 0.04);
  height: 14px;
  border-radius: 4px;
  overflow: hidden;
}

.qc-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.qc-bar-red    { background: var(--heritage-red, #CC0000); }
.qc-bar-gold   { background: var(--heritage-gold-dark, #B8861A); }
.qc-bar-purple { background: var(--heritage-purple, #5B2C8A); }
.qc-bar-green  { background: var(--success-deep, #1F7A2E); }
.qc-bar-value { font-weight: 700; font-feature-settings: 'tnum'; text-align: right; }

/* Per-line cards */
.qc-lines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.qc-line-card {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--rule, rgba(0, 0, 0, 0.08));
  border-left: 3px solid var(--ink-mute, #6B7280);
  border-radius: var(--radius, 8px);
  padding: 12px 14px;
}

.qc-line-card-green { border-left-color: var(--success-deep, #1F7A2E); }
.qc-line-card-gold  { border-left-color: var(--heritage-gold-dark, #B8861A); }
.qc-line-card-red   { border-left-color: var(--heritage-red, #CC0000); }

.qc-line-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.qc-line-card-name { font-weight: 700; color: var(--ink-strong, #1a1a1a); }
.qc-line-card-meta { font-size: 0.78rem; color: var(--ink-mute, #6B7280); }
.qc-line-card-rate { text-align: right; }

.qc-line-card-rate-val {
  font-family: var(--font-sans, system-ui);
  font-feature-settings: 'tnum';
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--ink-strong, #1a1a1a);
}

.qc-line-card-delta {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  display: inline-block;
  margin-top: 4px;
}

.qc-delta-up { background: rgba(45, 140, 60, 0.12); color: var(--success-deep, #1F7A2E); }
.qc-delta-down { background: rgba(204, 0, 0, 0.10); color: var(--heritage-red-dark, #A30000); }
.qc-delta-flat { background: rgba(0, 0, 0, 0.04); color: var(--ink-mute, #6B7280); }

.qc-line-spark { margin-top: 8px; }
.qc-mini-spark { width: 100%; height: 30px; }
.qc-mini-spark polyline { stroke-width: 1.6; }
.qc-mini-spark-green polyline { stroke: var(--success-deep, #1F7A2E); }
.qc-mini-spark-gold polyline { stroke: var(--heritage-gold-dark, #B8861A); }
.qc-mini-spark-red polyline { stroke: var(--heritage-red, #CC0000); }
.qc-mini-spark-purple polyline { stroke: var(--heritage-purple, #5B2C8A); }

/* Insights */
.qc-insights {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.qc-insight-card {
  background: var(--warm-white, #fff);
  border: 1px solid var(--rule, rgba(0, 0, 0, 0.08));
  border-left: 4px solid var(--ink-mute, #6B7280);
  border-radius: var(--radius, 8px);
  padding: 14px 16px;
}

.qc-insight-red    { border-left-color: var(--heritage-red, #CC0000);     background: rgba(204, 0, 0, 0.025); }
.qc-insight-gold   { border-left-color: var(--heritage-gold-dark, #B8861A); background: rgba(212, 168, 67, 0.04); }
.qc-insight-purple { border-left-color: var(--heritage-purple, #5B2C8A);  background: rgba(91, 44, 138, 0.025); }

.qc-insight-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.qc-sev-pill {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
}

.qc-sev-red    { background: rgba(204, 0, 0, 0.12);    color: var(--heritage-red-dark, #A30000); }
.qc-sev-gold   { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark, #B8861A); }
.qc-sev-purple { background: rgba(91, 44, 138, 0.12);  color: var(--heritage-purple, #5B2C8A); }

.qc-cat-pill {
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-mute, #6B7280);
  text-transform: capitalize;
}

.qc-conf-chip {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(91, 44, 138, 0.10);
  color: var(--heritage-purple, #5B2C8A);
  margin-left: auto;
}

.qc-insight-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-strong, #1a1a1a);
  margin-bottom: 4px;
}

.qc-insight-desc { color: var(--ink-soft, #4B5563); font-size: 0.92rem; }
.qc-insight-lines { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

.qc-line-chip {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule, rgba(0, 0, 0, 0.08));
}

.qc-line-red    { background: rgba(204, 0, 0, 0.08);    color: var(--heritage-red-dark, #A30000); border-color: rgba(204, 0, 0, 0.25); }
.qc-line-gold   { background: rgba(212, 168, 67, 0.12); color: var(--heritage-gold-dark, #B8861A); border-color: rgba(212, 168, 67, 0.35); }
.qc-line-purple { background: rgba(91, 44, 138, 0.08);  color: var(--heritage-purple, #5B2C8A); border-color: rgba(91, 44, 138, 0.25); }
.qc-line-green  { background: rgba(45, 140, 60, 0.10);  color: var(--success-deep, #1F7A2E); border-color: rgba(45, 140, 60, 0.30); }

.qc-insight-action {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(91, 44, 138, 0.06);
  border-radius: var(--radius, 8px);
  font-size: 0.9rem;
}

.qc-action-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--heritage-purple, #5B2C8A);
  display: block;
  margin-bottom: 2px;
}

/* Predictions */
.qc-predictions-block { margin-top: 18px; }

.qc-predictions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}

.qc-pred-card {
  background: var(--warm-white, #fff);
  border: 1px solid var(--rule, rgba(0, 0, 0, 0.08));
  border-radius: var(--radius, 8px);
  padding: 12px 14px;
}

.qc-pred-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.qc-pred-metric { font-weight: 700; color: var(--ink-strong, #1a1a1a); }

.qc-pred-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  justify-content: space-between;
  font-size: 0.86rem;
}

.qc-pred-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute, #6B7280);
  font-weight: 700;
}

.qc-pred-value { font-weight: 600; color: var(--ink-strong, #1a1a1a); }

.qc-pred-trend {
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: capitalize;
  font-size: 0.84rem;
}

.qc-pred-trend-green { background: rgba(45, 140, 60, 0.12); color: var(--success-deep, #1F7A2E); }
.qc-pred-trend-gold  { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark, #B8861A); }
.qc-pred-trend-red   { background: rgba(204, 0, 0, 0.10); color: var(--heritage-red-dark, #A30000); }

.qc-pred-rationale {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--rule, rgba(0, 0, 0, 0.06));
  font-size: 0.82rem;
  color: var(--ink-soft, #4B5563);
}

/* Celebrations */
.qc-celebrations {
  margin-top: 18px;
  background: rgba(45, 140, 60, 0.05);
  border: 1px solid rgba(45, 140, 60, 0.18);
  border-radius: var(--radius-lg, 10px);
  padding: 14px 16px;
}

.qc-celebration-list {
  margin: 6px 0 0;
  padding-left: 20px;
  color: var(--success-deep, #1F7A2E);
}

.qc-celebration-list li { margin: 3px 0; }

/* Block titles */
.qc-block-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 4px 0 8px;
  color: var(--ink-strong, #1a1a1a);
}

.qc-block-title svg { color: var(--heritage-purple, #5B2C8A); }

/* Loading + error + cached */
.qc-loading {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 18px;
  background: rgba(91, 44, 138, 0.04);
  border-radius: var(--radius, 8px);
  overflow: hidden;
  position: relative;
  z-index: 1;
  contain: layout;
}

.qc-loading > div:not(.spinner) {
  transform: none;
  writing-mode: horizontal-tb;
}

.qc-loading strong,
.qc-loading .text-mute {
  display: block;
  transform: none;
  white-space: normal;
  word-break: break-word;
}

.qc-loading .spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(91, 44, 138, 0.18);
  border-top-color: var(--heritage-purple, #5B2C8A);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.spinner-sm { width: 14px; height: 14px; border-width: 2px; }

@keyframes spin { to { transform: rotate(360deg); } }

.qc-error {
  background: rgba(204, 0, 0, 0.04);
  border: 1px solid rgba(204, 0, 0, 0.18);
  padding: 14px 16px;
  border-radius: var(--radius, 8px);
}

.qc-empty {
  padding: 18px;
  text-align: center;
  color: var(--ink-mute, #6B7280);
  font-size: 0.92rem;
}

.qc-cached-pill {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink-mute, #6B7280);
}

.qc-trend-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.qc-trend-red   { background: rgba(204, 0, 0, 0.10); color: var(--heritage-red-dark, #A30000); }
.qc-trend-gold  { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark, #B8861A); }
.qc-trend-green { background: rgba(45, 140, 60, 0.12); color: var(--success-deep, #1F7A2E); }

/* Recent batches table */
.qc-recent-table-wrap {
  background: var(--warm-white, #fff);
  border: 1px solid var(--rule, rgba(0, 0, 0, 0.08));
  border-radius: var(--radius-lg, 10px);
  overflow: hidden;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.04));
}

.qc-recent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.qc-recent-table thead th {
  background: rgba(0, 0, 0, 0.03);
  text-align: left;
  padding: 10px 14px;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute, #6B7280);
  font-weight: 700;
}

.qc-recent-table thead th.num { text-align: right; }
.qc-recent-table tbody td { padding: 9px 14px; border-top: 1px solid var(--rule, rgba(0, 0, 0, 0.05)); }
.qc-recent-table tbody td.num { text-align: right; font-feature-settings: 'tnum'; }
.qc-recent-table tbody tr:hover { background: rgba(204, 0, 0, 0.02); }

.text-success { color: var(--success-deep, #1F7A2E); }
.text-danger  { color: var(--heritage-red-dark, #A30000); }
.qc-rate-green { color: var(--success-deep, #1F7A2E); }
.qc-rate-gold  { color: var(--heritage-gold-dark, #B8861A); }
.qc-rate-red   { color: var(--heritage-red-dark, #A30000); }
.qc-badge-empty { background: rgba(0, 0, 0, 0.04); color: var(--ink-mute, #6B7280); border-color: transparent; }

/* Health banner color overrides on top of impact-banner */
.qc-health-green .impact-banner-icon { color: var(--success-deep, #1F7A2E); }
.qc-health-gold  .impact-banner-icon { color: var(--heritage-gold-dark, #B8861A); }
.qc-health-red   .impact-banner-icon { color: var(--heritage-red-dark, #A30000); }

/* ============================================================
   Extracted from public/js/ui/qc-intelligence.js — ensureQcInlineStyles()
   Inline card visuals for Predictive QC Panel.
   ============================================================ */

.qc-inline-card {
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 16px;
}

.qc-inline-card h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
}

.qc-inline-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.qc-inline-card table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-mute, #888);
  text-transform: uppercase;
}

.qc-inline-card table td {
  padding: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.qc-inline-card .badge-ok {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.qc-inline-card .badge-warning {
  background: rgba(212, 168, 67, 0.15);
  color: var(--accent, #d4a843);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.qc-inline-card .badge-critical {
  background: rgba(204, 0, 0, 0.15);
  color: #ff6b6b;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.qc-inline-card .source-cite {
  font-size: 11px;
  color: var(--text-mute, #888);
  font-style: italic;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.qc-empty-state {
  padding: 14px;
  font-size: 12px;
  color: var(--text-mute, #888);
  font-style: italic;
}
/* ============================================================
   13-email-triage.css
   Email Triage module
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ============================================================
   Email Triage (Module: email-triage)
   ============================================================ */

.et-table tbody tr.et-row-urg-high td { box-shadow: inset 3px 0 0 var(--danger, #c0392b); }

.et-table tbody tr.et-row-urg-medium td { box-shadow: inset 3px 0 0 var(--heritage-gold, #D4A843); }

.et-table tbody tr.et-row-urg-low td { box-shadow: inset 3px 0 0 var(--border, #e5e7eb); }

.et-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.et-badge-high   { background: rgba(192,57,43,0.14); color: var(--danger, #c0392b); border: 1px solid rgba(192,57,43,0.30); }

.et-badge-medium { background: rgba(212,168,67,0.18); color: #8a6a1f; border: 1px solid rgba(212,168,67,0.35); }

.et-badge-low    { background: rgba(45,140,60,0.12); color: var(--success-deep, #2d8c3c); border: 1px solid rgba(45,140,60,0.30); }

/* Wave 1a (ET-P0-2): typographic category chip — the single category
   identity. Uppercase text on paper with a 4-tone left tick:
   red = Complaint · gold = money (Order / Pricing / Distributor) ·
   ink = product & logistics · mute = General/unknown. Replaces both the
   emoji glyph system and the old .et-cat-badge. */
.et-cat-chip {
  display: inline-block;
  padding: 2px 8px 2px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.35;
  color: var(--ink, #2C2520);
  background: var(--paper, #FBF6EC);
  border: 1px solid var(--eggshell-shade, #F0E0C8);
  border-left: 3px solid var(--eggshell-shade, #F0E0C8);
  border-radius: 4px;
  white-space: nowrap;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.et-cat-red  { border-left-color: var(--heritage-red, #CC0000); }
.et-cat-gold { border-left-color: var(--heritage-gold-dark, #8B6914); }
.et-cat-ink  { border-left-color: var(--ink-strong, #1A1410); }
.et-cat-mute { color: var(--ink-mute, #6B6560); }

.et-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Wave 0 (ET-P0-4): "awaiting a human" reads gold, not purple. */
.et-status-pending   { background: rgba(212,168,67,0.16); color: var(--heritage-gold-dark, #8B6914); border: 1px solid rgba(212,168,67,0.38); }

.et-status-approved  { background: rgba(45,140,60,0.12); color: var(--success-deep, #2d8c3c); border: 1px solid rgba(45,140,60,0.30); }

.et-status-escalated { background: rgba(192,57,43,0.14); color: var(--danger, #c0392b); border: 1px solid rgba(192,57,43,0.30); }

.et-status-archived  { background: rgba(120,120,120,0.10); color: var(--ink-soft, #555); border: 1px solid rgba(120,120,120,0.25); }

.et-summary-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.et-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(0,0,0,0.04);
  color: var(--ink-soft, #555);
}

.et-chip-high    { background: rgba(192,57,43,0.14);  color: var(--danger, #c0392b); }

.et-chip-pending { background: rgba(212,168,67,0.16);  color: var(--heritage-gold-dark, #8B6914); }

.et-chip-total   { background: rgba(0,0,0,0.05); }

.et-classify-row {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-top: 12px; padding: 10px 14px;
  background: var(--surface-soft, #f8f6f0);
  border-radius: 8px;
}

.et-route-chip {
  font-size: 0.86rem;
  color: var(--ink-soft, #555);
  margin-left: auto;
}

/* `pre` rendered inside email-triage template rows uses a hardcoded
   `color: var(--text-mute, #aaa)`. The fallback `#aaa` is too low-contrast
   on warm paper; ensure our `--text-mute` var supplies a better default. */

.et-inline-card .et-template-row pre {
  color: var(--ink-soft, #4A4038) !important;
}

/* ============================================================
   Extracted from public/js/ui/email-triage.js — ensureEmailTriageInlineStyles()
   Inline card visuals for template library, analytics, and overdue queue.
   ============================================================ */

.et-inline-card {
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 16px;
}

.et-inline-card h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
}

.et-inline-card .metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.et-inline-card .metric {
  padding: 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
}

.et-inline-card .metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent, #d4a843);
}

.et-inline-card .metric-label {
  font-size: 11px;
  color: var(--text-mute, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.et-inline-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.et-inline-card table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-mute, #888);
  text-transform: uppercase;
}

.et-inline-card table td {
  padding: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.et-inline-card .badge-critical {
  background: rgba(204, 0, 0, 0.15);
  color: #ff6b6b;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.et-inline-card .badge-ok {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.et-inline-card .source-cite {
  font-size: 11px;
  color: var(--text-mute, #888);
  font-style: italic;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.et-empty-state {
  padding: 14px;
  font-size: 12px;
  color: var(--text-mute, #888);
  font-style: italic;
}

.et-template-row {
  padding: 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}

.et-template-row:hover {
  border-color: var(--accent, #d4a843);
}

/* ─────────────────────────────────────────────────────────────
   PHASE 1 (2026-06-18): auto-ingestion + approve-before-send UI.
   Badges for auto-triaged rows, low-confidence flags, the reply
   lifecycle, and the human-approval card inside the detail modal.
   ───────────────────────────────────────────────────────────── */
.et-row-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }

/* Wave 0 (ET-P0-4): auto-ingested is a neutral provenance note, not a
   purple AI identity. */
.et-auto-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; line-height: 1;
  padding: 2px 6px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.05); color: var(--ink-soft, #4A4038);
  border: 1px solid rgba(0, 0, 0, 0.14);
}
.et-auto-source { opacity: 0.7; font-weight: 500; text-transform: uppercase; letter-spacing: 0.02em; }

.et-review-flag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; line-height: 1;
  padding: 2px 6px; border-radius: 10px;
  background: rgba(212, 168, 67, 0.18); color: #b8860b;
  border: 1px solid rgba(212, 168, 67, 0.4);
}
.et-row-needs-review { box-shadow: inset 3px 0 0 #d4a843; }

.et-reply-badge {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 600; line-height: 1;
  padding: 2px 7px; border-radius: 10px;
}
.et-reply-draft    { background: rgba(120, 120, 120, 0.16); color: #888; border: 1px solid rgba(120,120,120,0.3); }
.et-reply-approved { background: rgba(40, 167, 69, 0.16);   color: #28a745; border: 1px solid rgba(40,167,69,0.35); }
.et-reply-sent     { background: rgba(0, 123, 255, 0.16);   color: #2b8aef; border: 1px solid rgba(0,123,255,0.35); }

.et-reply-card {
  margin-top: 18px; padding: 16px 18px;
  border-radius: 10px; border: 1px solid var(--border-subtle, rgba(0,0,0,0.1));
  background: var(--bg-soft, #f8f6f0);
  /* Stack head → playbook → field → guard → actions as a clean column.
     Without this, desktop textareas fall back to cols=20 (~20ch wide)
     and float as a bare white island over the card (2026-07-21). */
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.et-reply-card-draft    { border-left: 4px solid var(--heritage-gold, #D4A843); }
.et-reply-card-approved { border-left: 4px solid #28a745; }
.et-reply-card-sent     { border-left: 4px solid #2b8aef; }
.et-reply-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 0; /* gap on card owns spacing */
  min-width: 0;
}
.et-reply-head .text-mute {
  flex: 1 1 12rem;
  min-width: 0;
  line-height: 1.4;
}
.et-reply-final {
  margin: 0; padding: 14px 16px; border-radius: 8px;
  background: rgba(0,0,0,0.04); font-size: 0.92rem; line-height: 1.55; white-space: pre-wrap;
  max-height: 420px; overflow-y: auto;
  width: 100%; box-sizing: border-box;
}
/* Draft field wrapper — label + textarea as one stacked unit */
.et-reply-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  width: 100%;
}
.et-reply-field .form-label {
  margin: 0;
}
/* Draft reply editor — readable full-width working surface.
   Desktop global .form-textarea has NO width:100% (only mobile ≤640px
   does). Without an explicit width here the UA cols=20 default wins and
   the field renders as a tiny floating white rectangle. */
.et-reply-card-draft #et-reply-draft,
.et-reply-card-draft textarea.form-textarea,
.et-detail-pane textarea.form-textarea[data-edit="suggested_reply"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 220px;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 14px 16px;
  resize: vertical;
  /* Distinct surface from the eggshell card so the editor reads as a field */
  background: var(--warm-white, #FFFEFA);
  border: 1px solid var(--rule, #E8DFCF);
  border-radius: var(--radius, 8px);
  color: var(--ink, #1A1410);
}
.et-reply-card-draft #et-reply-draft:focus,
.et-reply-card-draft textarea.form-textarea:focus,
.et-detail-pane textarea.form-textarea[data-edit="suggested_reply"]:focus {
  outline: none;
  border-color: var(--heritage-gold, #D4A843);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.18);
}
.et-reply-note { margin-top: 0; font-size: 0.8rem; color: var(--text-mute, #888); font-style: italic; }

/* The no-auto-send notice — deliberately loud so it can't be missed. */
.et-reply-guard {
  margin-top: 0; padding: 10px 12px; border-radius: 8px;
  font-size: 0.84rem; font-weight: 600;
  background: rgba(204, 0, 0, 0.08); color: #cc0000;
  border: 1px solid rgba(204, 0, 0, 0.25);
  line-height: 1.4;
}
.et-reply-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
}

/* ─────────────────────────────────────────────────────────────
   P1 INBOX MVP (2026-07-08): split-pane inbox — list rail +
   detail pane, tabs, per-user unread, stars, keyboard nav.
   Pattern borrowed from Workspace ws-root (rail/main split,
   mobile single-view swap via .show-detail).
   ───────────────────────────────────────────────────────────── */

.et-inbox-section { display: flex; flex-direction: column; gap: 14px; }

/* Toolbar: tabs + search + filters + paste button */
.et-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 12px 16px;
}
.et-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.et-tab {
  appearance: none; border: none; background: transparent; cursor: pointer;
  padding: 8px 14px; min-height: 38px; border-radius: 8px;
  font-size: 0.88rem; font-weight: 600; color: var(--ink-soft, #555);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.12s ease, color 0.12s ease;
}
.et-tab:hover { background: rgba(0,0,0,0.05); }
.et-tab.active {
  background: rgba(204,0,0,0.08); color: var(--heritage-red, #CC0000);
}
.et-tab-count {
  font-size: 0.72rem; font-weight: 700; line-height: 1;
  min-width: 0; padding: 0; border-radius: 9px;
}
.et-tab-count.has-count {
  background: rgba(0,0,0,0.08); color: inherit;
  padding: 3px 7px; min-width: 18px; text-align: center;
}
.et-tab.active .et-tab-count.has-count { background: rgba(204,0,0,0.14); }
.et-toolbar-controls {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-left: auto;
}
.et-search { min-width: 200px; padding: 8px 12px; }

/* Split pane
   B4 (2026-07-20): detail/reply was too thin for real CS work.
   Narrow the list rail, give detail ~2× flex weight, taller workspace. */
.et-root {
  display: flex; align-items: stretch;
  border: 1px solid var(--border, #e5e7eb); border-radius: 12px;
  background: var(--surface, #fff);
  overflow: hidden;
  height: clamp(520px, calc(100dvh - 300px), 960px);
}
.et-rail {
  width: clamp(260px, 28vw, 320px); min-width: 240px; flex: 0 0 auto;
  border-right: 1px solid var(--border, #e5e7eb);
  display: flex; flex-direction: column;
  background: var(--surface-soft, #fbfaf6);
}
.et-list { flex: 1; overflow-y: auto; }
.et-list-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; font-size: 0.8rem;
  border-top: 1px solid var(--border, #e5e7eb);
}
.et-detail-pane {
  flex: 2 1 0;
  overflow-y: auto;
  padding: 24px 28px 36px;
  min-width: 0;
  max-width: 100%;
}

/* List rows */
.et-item {
  position: relative;
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 12px 12px 16px; min-height: 64px;
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.06));
  cursor: pointer;
  transition: background 0.1s ease;
}
.et-item:hover { background: rgba(0,0,0,0.03); }
.et-item.selected {
  background: rgba(204,0,0,0.06);
  box-shadow: inset 3px 0 0 var(--heritage-red, #CC0000);
}
.et-item-urg-high   { border-left: 3px solid var(--danger, #c0392b); }
.et-item-urg-medium { border-left: 3px solid var(--heritage-gold, #D4A843); }
.et-item-urg-low    { border-left: 3px solid var(--border, #e5e7eb); }
.et-item.selected.et-item-urg-high,
.et-item.selected.et-item-urg-medium,
.et-item.selected.et-item-urg-low { border-left-color: var(--heritage-red, #CC0000); }

.et-unread-dot {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--heritage-red, #CC0000);
  display: none;
}
.et-item.unread .et-unread-dot { display: block; }
.et-item.unread .et-item-sender,
.et-item.unread .et-item-subject { font-weight: 700; color: var(--ink, #1a1a1a); }

.et-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700; color: #fff;
  letter-spacing: 0.02em; user-select: none;
}
.et-avatar-lg { width: 46px; height: 46px; font-size: 0.95rem; }
.et-av-0 { background: #CC0000; }
.et-av-1 { background: #1A3A5C; }
.et-av-2 { background: #B8860B; }
.et-av-3 { background: #2d8c3c; }
.et-av-4 { background: #1f6f8b; }
.et-av-5 { background: #A0522D; }

.et-item-main { flex: 1; min-width: 0; }
.et-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.et-item-sender {
  font-size: 0.88rem; font-weight: 600; color: var(--ink, #222);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.et-item-date { font-size: 0.74rem; color: var(--ink-soft, #777); flex-shrink: 0; }
.et-item-subject {
  font-size: 0.84rem; color: var(--ink, #333); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.et-item-snippet {
  font-size: 0.78rem; color: var(--ink-soft, #777); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.et-item-badges {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 5px;
}
.et-item-amount { font-size: 0.76rem; font-weight: 700; color: var(--success-deep, #2d8c3c); }

/* Wave 1a (ET-P1-4): waiting-time badge next to the row date — hidden
   under 8h, neutral to 24h, gold past 24h, red past 48h. */
.et-age-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
  border-radius: 8px;
}
.et-age-ink  { color: var(--ink-soft, #4A4038); background: rgba(0,0,0,0.05); }
.et-age-gold { color: var(--heritage-gold-dark, #8B6914); background: rgba(212,168,67,0.18); border: 1px solid rgba(212,168,67,0.35); }
.et-age-red  { color: var(--heritage-red, #CC0000); background: rgba(204,0,0,0.10); border: 1px solid rgba(204,0,0,0.28); }

/* Wave 1a (ET-P1-4): mailbox source chip — CS (gold tick) vs AI (ink tick),
   so the two pilot queues are tellable apart per row. */
.et-mb-chip {
  display: inline-block;
  padding: 1px 6px 1px 5px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.35;
  color: var(--ink-soft, #4A4038);
  background: var(--paper, #FBF6EC);
  border: 1px solid var(--eggshell-shade, #F0E0C8);
  border-left: 3px solid var(--eggshell-shade, #F0E0C8);
  border-radius: 4px;
}
.et-mb-cs { border-left-color: var(--heritage-gold-dark, #8B6914); }
.et-mb-ai { border-left-color: var(--ink-strong, #1A1410); }

/* Wave 1a (ET-P1-4): snippet honesty — rows without customer text show a
   quiet placeholder instead of our own reply. */
.et-snippet-none { color: var(--ink-mute, #6B6560); font-style: italic; }

/* Wave 1a: corrections-trends chip + count pairing. */
.et-trends-cat { display: inline-flex; align-items: center; gap: 4px; }
.et-trends-count { font-size: 0.74rem; font-weight: 600; color: var(--ink-soft, #4A4038); }

.et-star {
  appearance: none; border: none; background: transparent; cursor: pointer;
  font-size: 1.05rem; line-height: 1; color: var(--ink-soft, #999);
  padding: 6px; min-width: 32px; min-height: 32px; border-radius: 8px;
  flex-shrink: 0; align-self: center;
  transition: color 0.12s ease, transform 0.12s ease;
}
.et-star:hover { color: var(--heritage-gold, #D4A843); transform: scale(1.12); }
.et-star.starred { color: var(--heritage-gold, #D4A843); }
.et-star-lg { font-size: 1.4rem; min-width: 44px; min-height: 44px; }

/* Duplicate badge (body-hash dedup) */
.et-dup-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; line-height: 1;
  padding: 2px 6px; border-radius: 10px;
  background: rgba(31,111,139,0.14); color: #1f6f8b;
  border: 1px solid rgba(31,111,139,0.32);
}

/* #35: complaint-alert status chip (detail view) */
.et-alert-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; line-height: 1;
  padding: 2px 6px; border-radius: 10px;
  background: rgba(120,120,120,0.12); color: #555;
  border: 1px solid rgba(120,120,120,0.28);
}
.et-alert-chip.et-alert-sent { background: rgba(45,140,60,0.14); color: #2d8c3c; border-color: rgba(45,140,60,0.32); }
.et-alert-chip.et-alert-queued { background: rgba(212,168,67,0.16); color: #8b6914; border-color: rgba(212,168,67,0.34); }
.et-alert-chip.et-alert-failed { background: rgba(204,0,0,0.12); color: #cc0000; border-color: rgba(204,0,0,0.30); }
.et-alert-chip.et-alert-suppressed,
.et-alert-chip.et-alert-disabled { background: rgba(120,120,120,0.10); color: #888; border-color: rgba(120,120,120,0.24); }

/* #36: volume granularity toggle (dashboard) */
.et-vol-gran-btn {
  font-size: 11px; font-weight: 600; line-height: 1;
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--ink-soft, #777);
  border: 1px solid var(--border, rgba(0,0,0,0.14));
}
.et-vol-gran-btn.active {
  background: #CC0000; color: #fff; border-color: #CC0000;
}

/* List empty state */
.et-list-empty {
  padding: 42px 20px; text-align: center; color: var(--ink-soft, #777);
  font-size: 0.9rem;
}
.et-list-empty-icon { font-size: 2rem; margin-bottom: 8px; }

/* Detail pane */
.et-back-btn { display: none; margin-bottom: 10px; }
.et-detail-head-row { display: flex; gap: 14px; align-items: flex-start; }
.et-detail-who { flex: 1; min-width: 0; }
.et-detail-sender { font-size: 1rem; font-weight: 700; color: var(--ink, #222); }
.et-detail-addr { font-weight: 400; font-size: 0.84rem; color: var(--ink-soft, #777); margin-left: 6px; word-break: break-all; }
.et-detail-subject { font-size: 1.06rem; font-weight: 600; margin-top: 3px; color: var(--ink, #1a1a1a); }
.et-detail-time { font-size: 0.8rem; margin-top: 3px; }
.et-detail-badges {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 14px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
}
.et-detail-grid { margin-top: 16px; }
.et-body-card {
  margin-top: 18px; border: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
  border-radius: 10px; overflow: hidden;
}
.et-body-label {
  padding: 10px 14px; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-soft, #777); background: var(--surface-soft, #f8f6f0);
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
}
.et-body-pre {
  margin: 0; padding: 18px 20px; font-size: 0.92rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  max-height: min(52vh, 560px); overflow-y: auto;
  background: var(--surface, #fff); color: var(--ink, #333);
}
/* Next-steps freeform field (when no draft card) — full width, same as approve card. */
.et-detail-pane .form-field textarea.form-textarea[data-edit="suggested_reply"] {
  min-height: 160px;
}
.et-detail-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
  flex-wrap: wrap;
}
.et-detail-actions-right { display: flex; gap: 10px; flex-wrap: wrap; }
.et-detail-empty {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  color: var(--ink-soft, #777); padding: 30px;
}
.et-detail-empty-icon { font-size: 2.6rem; margin-bottom: 10px; }
.et-detail-empty-title { font-size: 1.02rem; font-weight: 600; color: var(--ink, #333); margin-bottom: 4px; }

.et-kbd-hint { font-size: 0.76rem; text-align: right; padding: 0 4px; }

/* Paste modal */
.et-paste-modal .form-textarea.intake { min-height: 220px; }

/* Comfortable mid-width: keep split but bias harder to detail */
@media (min-width: 901px) and (max-width: 1200px) {
  .et-rail { width: clamp(240px, 26vw, 290px); min-width: 220px; }
  .et-detail-pane { padding: 20px 22px 32px; }
}

/* ── Mobile (≤900px): list-only, tap-to-detail ── */
@media (max-width: 900px) {
  .et-root { height: calc(100dvh - 260px); min-height: 460px; }
  .et-rail { width: 100%; min-width: 0; flex: 1 1 auto; border-right: none; }
  .et-detail-pane { display: none; flex: none; }
  .et-root.show-detail .et-rail { display: none; }
  .et-root.show-detail .et-detail-pane {
    display: block;
    padding: 18px 16px 28px;
    flex: 1 1 auto;
  }
  .et-body-pre { max-height: min(48vh, 480px); font-size: 0.9rem; }
  .et-reply-card-draft #et-reply-draft,
  .et-reply-card-draft textarea.form-textarea { min-height: 200px; }
  .et-back-btn { display: inline-flex; min-height: 44px; }
  .et-item { min-height: 72px; padding-top: 14px; padding-bottom: 14px; }
  .et-star { min-width: 44px; min-height: 44px; }
  .et-tab { min-height: 44px; }
  .et-toolbar-controls { margin-left: 0; width: 100%; }
  .et-search { flex: 1; min-width: 0; }
  .et-paste-btn { min-height: 44px; }
  .et-kbd-hint { display: none; }
  .et-detail-actions .btn { min-height: 44px; }
}

/* ═══════════ P2: Human Loop (2026-07-08) ═══════════ */

/* Select-all-on-page header row in the list rail */
.et-rail-select {
  display: flex; align-items: center; padding: 6px 12px;
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
  background: var(--surface-soft, #f8f6f0);
}
.et-select-label {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 0.76rem; font-weight: 600; color: var(--ink-soft, #777);
  min-height: 28px;
}
.et-select-label input { cursor: pointer; }

/* Per-row selection checkbox */
.et-check {
  flex-shrink: 0; align-self: center; cursor: pointer;
  width: 15px; height: 15px; accent-color: var(--heritage-red, #CC0000);
}

/* Assignee chip on list rows */
.et-assignee-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; line-height: 1;
  padding: 2px 6px; border-radius: 10px;
  background: rgba(212,168,67,0.16); color: #8a6d1f;
  border: 1px solid rgba(212,168,67,0.4);
  max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* "Assigned to me" quick filter */
.et-mine-btn.active {
  background: var(--heritage-red, #CC0000); color: #fff;
  border-color: var(--heritage-red, #CC0000);
}

/* Correct-this button in the detail badge strip */
.et-correct-btn { margin-left: auto; }

/* Corrections trend chip + modal */
.et-corrections-btn { white-space: nowrap; }
.et-trends-subhead {
  margin: 16px 0 8px 0; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft, #777);
}
.et-trends-cats { display: flex; gap: 8px; flex-wrap: wrap; }
.et-trends-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.et-trends-table th {
  text-align: left; padding: 6px 8px; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; color: var(--ink-soft, #777);
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
}
.et-trends-table td {
  padding: 8px; vertical-align: top;
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.06));
}

/* Bulk action toolbar — anchored to the bottom of the split pane */
.et-bulk-bar {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 12px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, rgba(0,0,0,0.14));
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  z-index: 30; max-width: calc(100% - 24px);
}
.et-bulk-bar[hidden] { display: none; }
/* Kimi3 audit F1 (2026-07-20): author display:flex on .et-root/.et-dash
   beats the UA [hidden]{display:none} rule, so Dashboard tab could never
   hide the inbox under the fullscreen flex shell. Same pattern as bulk-bar. */
.et-root[hidden],
.et-dash[hidden] { display: none !important; }
.et-bulk-count {
  font-size: 0.84rem; font-weight: 700; color: var(--heritage-red, #CC0000);
  white-space: nowrap;
}
.et-bulk-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.et-bulk-archive { color: var(--danger, #c0392b); }
.et-bulk-assign { max-width: 160px; }
.et-root { position: relative; }

/* Mobile: bulk bar slides in from the bottom (Gmail/Outlook pattern) */
@media (max-width: 900px) {
  .et-bulk-bar {
    position: fixed; left: 0; right: 0; bottom: 0; transform: none;
    border-radius: 12px 12px 0 0; max-width: none;
    flex-direction: column; align-items: stretch; gap: 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    animation: et-bulk-slide-up 0.18s ease-out;
  }
  .et-bulk-actions { justify-content: space-between; }
  .et-bulk-bar .btn { min-height: 44px; }
  .et-bulk-assign { min-height: 44px; max-width: none; flex: 1; }
  .et-check { width: 20px; height: 20px; }
  .et-mine-btn { min-height: 44px; }
}
@keyframes et-bulk-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════
   P3 — Threading + Dashboard (2026-07-08)
   ══════════════════════════════════════════════════════════════ */

/* Thread indicator chip on list rows */
.et-thread-chip {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 0.7rem; font-weight: 600;
  color: var(--ink-soft, #4A4038);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px; padding: 1px 6px;
  white-space: nowrap;
}

/* Thread section in the detail pane */
.et-thread-section { margin-top: 16px; }
.et-thread-list { margin-top: 10px; }
.et-thread-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap; margin-bottom: 6px;
}
.et-thread-title { font-weight: 700; font-size: 0.86rem; }
.et-thread-actions { display: flex; gap: 6px; }
.et-thread-archive-btn { color: var(--danger, #c0392b); }
.et-thread-items {
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 10px; overflow: hidden;
}
.et-thread-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.06));
}
.et-thread-item:last-child { border-bottom: none; }
.et-thread-item:hover { background: var(--surface-hover, rgba(0,0,0,0.03)); }
.et-thread-item.current { background: rgba(212, 168, 67, 0.1); cursor: default; }
.et-thread-item .et-unread-dot { visibility: hidden; }
.et-thread-item.unread .et-unread-dot { visibility: visible; }
.et-thread-item-main { flex: 1; min-width: 0; }
.et-thread-item-top { display: flex; justify-content: space-between; gap: 8px; }
.et-thread-item-sender { font-weight: 600; font-size: 0.82rem; }
.et-thread-item.unread .et-thread-item-sender { font-weight: 800; }
.et-thread-item-date { font-size: 0.72rem; color: var(--text-mute, #888); white-space: nowrap; }
.et-thread-item-snippet {
  font-size: 0.76rem; color: var(--text-mute, #888);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.et-thread-current {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  color: var(--heritage-gold, #D4A843); white-space: nowrap;
}

/* Dashboard tab */
.et-dash { display: flex; flex-direction: column; gap: 16px; }
.et-dash-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.et-dash-metric { padding: 16px; }
.et-dash-metric-value {
  font-size: 1.6rem; font-weight: 800;
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  color: var(--heritage-red, #CC0000);
}
.et-dash-metric-label { font-size: 0.82rem; font-weight: 600; margin-top: 2px; }
.et-dash-metric-sub { font-size: 0.74rem; margin-top: 2px; }
.et-dash-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}
.et-dash-card { padding: 16px; }
.et-dash-card-title { font-size: 0.95rem; margin: 0 0 10px 0; }
/* Wave 3 (ET-P2-2): eggshell plot background — charts sit on paper, not
   stark white; the ECharts canvas is transparent so this shows through. */
.et-dash-chart { height: 260px; background: var(--paper, #FBF6EC); border-radius: 8px; }

/* Wave 3 (ET-P2-2): queue-health lead metric — gold rule at rest, heritage
   red when something has actually waited past 24h. */
.et-dash-waiting { border-left: 3px solid var(--heritage-gold, #D4A843); }
.et-dash-waiting .et-dash-metric-value { color: var(--success-deep, #1F6B2B); }
.et-dash-waiting-hot { border-left-color: var(--heritage-red, #CC0000); }
.et-dash-waiting-hot .et-dash-metric-value { color: var(--heritage-red, #CC0000); }
[data-theme="dark"] .et-dash-chart { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .et-dash-waiting .et-dash-metric-value { color: #6fbf7a; }
[data-theme="dark"] .et-dash-waiting-hot .et-dash-metric-value { color: #ff6b6b; }
.et-dash-empty { padding: 24px 8px; text-align: center; font-size: 0.84rem; }
.et-dash-dedup-row { font-size: 0.86rem; margin-bottom: 4px; }
.et-dash-dedup-row strong { color: var(--heritage-red, #CC0000); }

/* Poller health widget */
.et-poller-mailbox { margin-bottom: 10px; }
.et-poller-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.8rem; margin-bottom: 2px; flex-wrap: wrap;
}
.et-poller-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto;
}
.et-poller-green  { background: #2D9F2D; box-shadow: 0 0 0 3px rgba(45, 159, 45, 0.18); }
.et-poller-yellow { background: #D4A843; box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.22); }
.et-poller-red    { background: #CC0000; box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.18); }

/* Dark mode */
[data-theme="dark"] .et-cat-chip,
[data-theme="dark"] .et-mb-chip {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--ink, #ddd);
}
[data-theme="dark"] .et-cat-red  { border-left-color: var(--heritage-red-deep, #D41920); }
[data-theme="dark"] .et-cat-gold,
[data-theme="dark"] .et-mb-cs { border-left-color: var(--heritage-gold, #D4A843); }
[data-theme="dark"] .et-cat-ink,
[data-theme="dark"] .et-mb-ai { border-left-color: rgba(255, 255, 255, 0.55); }
[data-theme="dark"] .et-cat-mute { color: var(--ink-mute, #999); }
[data-theme="dark"] .et-age-ink { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .et-thread-chip { background: rgba(212, 168, 67, 0.14); color: var(--heritage-gold-light, #E8C572); }
[data-theme="dark"] .et-thread-item.current { background: rgba(212, 168, 67, 0.12); }
[data-theme="dark"] .et-dash-metric-value { color: #ff6b6b; }
[data-theme="dark"] .et-dash-dedup-row strong { color: #ff6b6b; }

/* Mobile */
@media (max-width: 900px) {
  .et-dash-chart { height: 220px; }
  .et-thread-actions .btn { min-height: 40px; }
}

/* ── Wave 3 (ET-P2-3): collapsible detail sections on mobile ──
   Desktop: heads hidden, bodies always visible — zero layout change.
   Mobile (≤900px, the module's list→detail breakpoint): each section gets a
   tappable head; collapsing hides the body. Class-based so widening the
   viewport mid-session restores the full desktop layout automatically. */
.et-sect-head { display: none; }
@media (max-width: 900px) {
  .et-sect {
    border: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
    border-radius: 10px; margin-top: 14px; padding: 0 12px 12px;
  }
  .et-sect-head {
    display: flex; align-items: center; justify-content: space-between;
    width: calc(100% + 24px); margin: 0 -12px; padding: 12px 14px;
    min-height: 44px; border: none; background: none; cursor: pointer;
    font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--ink-soft, #4A4038);
    font-family: inherit; text-align: left;
  }
  .et-sect-chev { transition: transform 0.15s ease; color: var(--ink-mute, #6B6560); }
  .et-sect-collapsed .et-sect-chev { transform: rotate(-90deg); }
  .et-sect-collapsed { padding-bottom: 0; }
  .et-sect-collapsed .et-sect-body { display: none; }
  .et-sect .et-detail-grid { margin-top: 4px; }
  .et-sect .et-body-card { margin-top: 4px; }
}

/* ── Wave 3 (ET-P2-4): keyboard shortcut overlay ('?') ── */
.et-kbd-overlay {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  background: rgba(26, 20, 16, 0.45); cursor: pointer;
}
.et-kbd-panel {
  background: var(--paper, #FBF6EC); border-radius: 12px;
  border-top: 3px solid var(--heritage-gold, #D4A843);
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  padding: 20px 24px; min-width: 280px; max-width: 90vw;
}
.et-kbd-title {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-size: 1.05rem; font-weight: 700; color: var(--ink-strong, #1A1410);
  margin-bottom: 12px;
}
.et-kbd-row {
  display: flex; align-items: center; gap: 14px;
  font-size: 0.88rem; color: var(--ink, #2C2520); margin-bottom: 7px;
}
.et-kbd-row kbd {
  flex: 0 0 52px; text-align: center; font-size: 0.78rem; font-weight: 700;
  padding: 3px 6px; border-radius: 6px;
  background: var(--eggshell-shade, #F0E0C8);
  border: 1px solid var(--border-subtle, rgba(0,0,0,0.12));
  color: var(--ink-strong, #1A1410);
}
.et-kbd-dismiss { font-size: 0.74rem; margin-top: 12px; text-align: center; }
[data-theme="dark"] .et-kbd-panel { background: #2a241e; }
[data-theme="dark"] .et-kbd-title { color: #f0e8dc; }
[data-theme="dark"] .et-kbd-row { color: #ddd; }
[data-theme="dark"] .et-kbd-row kbd { background: rgba(255,255,255,0.08); color: #eee; }

/* B7 (2026-07-20): always-on draft-only / human-approve banner.
   Brand pattern mirrors .lv-reg-banner — eggshell + gold left rule,
   NOT the purple AI look. */
/* Wave 0 (ET-P0-5): compressed into a slim gold-left "seal" — always on,
   title and body flow on one line where space allows. */
.et-handler-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 2px;
  margin: 0 0 14px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(212, 168, 67, 0.35);
  border-left: 4px solid var(--heritage-gold, #D4A843);
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.08), rgba(250, 246, 237, 0.5));
}
.et-handler-banner-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--heritage-gold-dark, #8B6914);
  white-space: nowrap;
}
.et-handler-banner-body {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-soft, #555);
  flex: 1;
  min-width: 240px;
}
[data-theme="dark"] .et-handler-banner {
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.10), rgba(212, 168, 67, 0.03));
}

/* B6 (2026-07-20): one-line urgency rubric helper under the detail
   urgency select. */
.et-urgency-hint {
  margin-top: 4px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--ink-mute, #888);
}

/* ═══ ET Wave 2a (2026-07-20) — workflow integrity ═══ */

/* P1-6: honest terminal + failure states. Resolved is a QUIET green chip
   (done, not celebratory); a failed ingest is a red-outline alert chip that
   can never be mistaken for healthy Pending Review. */
.et-status-resolved {
  background: rgba(45, 140, 60, 0.08);
  color: var(--success-deep, #1F6B2B);
  border: 1px solid rgba(45, 140, 60, 0.24);
}
.et-status-error {
  background: transparent;
  color: var(--heritage-red, #CC0000);
  border: 1.5px solid rgba(204, 0, 0, 0.55);
}

/* P1-6: failed-ingest explainer + retry, top of the detail pane. */
.et-error-card {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 4px;
  padding: 10px 14px;
  border-left: 4px solid var(--heritage-red, #CC0000);
  border-radius: 6px;
  background: rgba(204, 0, 0, 0.05);
}
.et-error-card-text {
  flex: 1;
  min-width: 220px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink, #2C2520);
}

/* P1-2: gold corrected-field dot — this value was overridden by a human;
   the tooltip carries what the AI originally said. */
.et-corrected-dot {
  color: var(--heritage-gold-dark, #8B6914);
  font-size: 0.6rem;
  vertical-align: 2px;
  cursor: help;
}

/* ── ET Wave 2b (P1-3): Insert playbook ────────────────────────────
   The picker is a quiet library card catalog: eggshell rows, gold on
   hover, the AI-suggested playbook wearing a small gold chip. Nothing
   here competes with Approve, nothing here sends. */
.et-playbook-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0; /* .et-reply-card gap owns spacing */
  min-width: 0;
}
.et-playbook-hint {
  font-size: 0.78rem;
  color: var(--ink-mute, #6B6560);
}
.et-playbook-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(52vh, 460px);
  overflow-y: auto;
  padding-right: 2px;
}
.et-playbook-row {
  border: 1px solid var(--eggshell-shade, #F0E0C8);
  border-left: 3px solid var(--eggshell-shade, #F0E0C8);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--paper, #FBF6EC);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.et-playbook-row:hover,
.et-playbook-row:focus-visible {
  border-color: var(--heritage-gold, #D4A843);
  border-left-color: var(--heritage-gold-dark, #8B6914);
  background: var(--eggshell-bright, #FFF5E6);
  outline: none;
}
.et-playbook-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.et-playbook-name {
  font-size: 0.84rem;
  color: var(--ink-strong, #1A1410);
}
.et-playbook-suggested {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--heritage-gold-dark, #8B6914);
  background: rgba(212, 168, 67, 0.16);
  border: 1px solid rgba(212, 168, 67, 0.4);
  border-radius: 4px;
  padding: 1px 6px;
}
.et-playbook-preview {
  font-size: 0.72rem;
  line-height: 1.45;
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink-soft, #4A4038);
  max-height: 72px;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   ET FULL-PAGE SHELL (2026-07-20) — Workspace takeover pattern.
   Mirrors 33-workspace.css .ws-root / body.ws-open: fixed full-viewport
   surface, slim glass topbar, work area fills the remaining height.
   Heritage Red #CC0000 · Gold #D4A843 · eggshell — zero AI-purple.
   ═══════════════════════════════════════════════════════════════════ */
.et-app {
  position: fixed;
  inset: 0;
  z-index: 50;                     /* above the SPA shell, below toasts/drawer */
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at top left, rgba(212,168,67,0.05), transparent 55%),
    var(--eggshell-bright, #FFF5E6);
  overflow: hidden;
  font-family: var(--font-sans);
}

/* Ask-AIOP FAB collides with the takeover (z-index 9000+ vs our 50) and ET
   has no in-shell chat to trade off against, but a floating chat bubble over
   a fixed triage surface is chrome noise — keep .agent-fab hidden. :has()
   for the modern baseline + body.et-open class fallback (mirror of ws-open /
   EDGE-F4). */
body:has(.et-app) .agent-fab,
body:has(.et-app) .agent-fab-tooltip,
body.et-open .agent-fab,
body.et-open .agent-fab-tooltip { display: none !important; }

/* FEEDBACK FAB IS DELIBERATELY *NOT* HIDDEN (2026-07-31, Kevin).
   Regression history: this block used to hide .feedback-fab too. The
   `.feedback-module-strip` in .et-app-foot is a thumbs/rating strip, NOT the
   feedback drawer — so hiding the FAB left no way to file a bug or idea from
   a full-screen module. Feedback is a global escape hatch and must survive
   every takeover. If you re-add `.feedback-fab` above,
   tests/feedback-fab-fullscreen.test.js will fail. Reposition it instead.

   Ask-AIOP is hidden here, so feedback takes the primary bottom-right slot
   (its default `right: 92px` only exists to sit LEFT of the 56px agent FAB).
   .et-app-foot is in normal flow inside the fixed shell, so the FAB floats
   clear of it. */
body:has(.et-app) .feedback-fab,
body.et-open .feedback-fab {
  right: calc(24px + env(safe-area-inset-right, 0px));
  z-index: 9001;                   /* above .et-app (50) + et rail/scrim (900) */
}
body:has(.et-app) .feedback-fab-tooltip,
body.et-open .feedback-fab-tooltip {
  right: calc(24px + env(safe-area-inset-right, 0px));
}

/* NARROW, INTENTIONAL EXCEPTIONS — the only places ET may hide the FAB.
   Both are transient surfaces that OWN the bottom-right, not the module
   itself, so feedback is still reachable one dismissal away.
     1. .et-kbd-overlay ('?' shortcut sheet) is a true modal at z-index 900;
        without this the 9001 FAB floats over the scrim (same rationale as
        .modal-backdrop hiding .agent-fab in 04-components.css).
     2. .et-bulk-bar goes `position: fixed; left/right: 0; bottom: 0` ≤900px
        (Gmail pattern) — the FAB would land on top of its buttons. */
body:has(.et-kbd-overlay) .feedback-fab,
body:has(.et-kbd-overlay) .feedback-fab-tooltip {
  display: none !important;
}
@media (max-width: 900px) {
  body:has(.et-bulk-bar:not([hidden])) .feedback-fab,
  body:has(.et-bulk-bar:not([hidden])) .feedback-fab-tooltip {
    display: none !important;
  }
}
@media (max-width: 700px) {
  /* Mirror the mobile .agent-fab inset convention it replaces. */
  body:has(.et-app) .feedback-fab,
  body.et-open .feedback-fab,
  body:has(.et-app) .feedback-fab-tooltip,
  body.et-open .feedback-fab-tooltip {
    right: max(16px, env(safe-area-inset-right, 0px));
  }
}

/* FULLSCREEN SHELL HIDE (2026-07-21):
   .et-app is position:fixed over the SPA, but the sticky shell .topbar
   (Email Triage + subtitle + user chip) still painted underneath / through
   the glass topbar — double header, clipped title, misaligned chrome.
   Hide the SPA shell chrome entirely while ET owns the viewport. */
body.et-open .sidebar,
body.et-open .sidebar-scrim,
body.et-open .topbar,
body.et-open #system-status-banner-root,
body:has(.et-app) .sidebar,
body:has(.et-app) .sidebar-scrim,
body:has(.et-app) .topbar,
body:has(.et-app) #system-status-banner-root {
  display: none !important;
}
body.et-open,
body:has(.et-app) {
  overflow: hidden;
}
/* Kill .content padding/max-width tax under the fixed surface so nothing
   peeks around the edges on wide desktops. */
body.et-open .main > .content,
body:has(.et-app) .main > .content {
  padding: 0;
  max-width: none;
  margin: 0;
}

/* Toast readability above the takeover (same pattern as body.ws-open). */
body.et-open .toast-container .toast {
  background: var(--warm-white, #ffffff);
  color: var(--ink, #1a1a1a);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
[data-theme="dark"] body.et-open .toast-container .toast {
  background: var(--bg-secondary, #2a2d3a);
  color: var(--text-primary, #e8e8ec);
  border-color: var(--border-light, #3a3d4a);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* ── Slim topbar (glass, matches .ws-topbar) ── */
.et-topbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--rule, #E8DFCF);
  background: rgba(255,253,248,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-width: 0;
  /* Single row — never wrap into a clipped second line under the seal. */
  flex-wrap: nowrap;
  overflow: hidden;
}
.et-exit-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px 0 9px;
  background: var(--warm-white, #FFFDF8);
  border: 1px solid var(--rule, #E8DFCF); border-radius: 999px;
  color: var(--ink-soft, #555); cursor: pointer;
  font-family: var(--font-sans); font-size: 13px; font-weight: 600;
  flex: 0 0 auto;
  transition: border-color .14s ease, color .14s ease, background .14s ease;
}
.et-exit-btn:hover { border-color: var(--heritage-gold, #D4A843); color: var(--ink-strong, #241C15); background: var(--eggshell-shade, #F4EBDD); }
.et-exit-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold, rgba(212,168,67,0.35)); }
.et-exit-btn svg { stroke: currentColor; flex: 0 0 auto; }
.et-exit-label { line-height: 1; }

.et-topbar-title {
  display: flex; align-items: center; gap: 12px;
  flex: 1 1 auto; min-width: 0;
  overflow: hidden;
  /* The italic serif name's first glyph leans left past its box; 3px of
     padding inside the clip (cancelled by the negative margin, so nothing
     moves) keeps the overflow:hidden from shaving it. */
  padding-left: 3px;
  margin-left: -3px;
}
.et-topbar-name {
  font-family: var(--font-serif); font-style: italic; font-weight: 700;
  font-size: 18px; letter-spacing: -0.02em;
  color: var(--ink-strong, #241C15);
  white-space: nowrap;
  flex: 0 0 auto;
}
/* Draft-only seal: the always-on governance one-liner (was the full-width
   .et-handler-banner card). Gold left rule, one line, body ellipsizes;
   the full text rides the title attribute. */
.et-draft-seal {
  display: inline-flex; align-items: baseline; gap: 8px;
  flex: 1 1 auto; min-width: 0;
  max-width: 100%;
  padding: 3px 10px 3px 8px;
  border-left: 3px solid var(--heritage-gold, #D4A843);
  background: rgba(212,168,67,0.08);
  border-radius: 0 8px 8px 0;
  overflow: hidden;
}
.et-draft-seal-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase; white-space: nowrap;
  color: var(--heritage-gold-dark, #8B6914);
  flex: 0 0 auto;
}
.et-draft-seal-body {
  font-size: 0.76rem; line-height: 1.3;
  color: var(--ink-soft, #555);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1 1 auto; min-width: 0;
  /* was 42vw — collided with shell topbar + metrics and looked clipped */
  max-width: none;
}
.et-topbar-spacer { flex: 1 1 auto; }
.et-topbar-metrics {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  background: rgba(0,0,0,0.04);
  border: 1px solid var(--rule, #E8DFCF);
  white-space: nowrap; flex: 0 0 auto;
}
.et-topbar-metrics[hidden] { display: none; }
.et-topbar-metrics.is-hot {
  background: rgba(204,0,0,0.06);
  border-color: rgba(204,0,0,0.18);
}
.et-topbar-metric-value { font-weight: 800; font-size: 1rem; color: var(--ink-strong, #241C15); }
.et-topbar-metrics.is-hot .et-topbar-metric-value { color: var(--heritage-red, #CC0000); }
.et-topbar-metric-label { font-size: 0.74rem; font-weight: 600; color: var(--ink-soft, #555); }

/* ── Work surface: toolbar + split pane fill the remaining height ── */
.et-app-body {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 18px 0;
}
/* Toolbar keeps its framed look (was .card) without the section stack.
   Desktop: stack tabs on row 1, controls on row 2 so search/filters never
   crush into a single clipped strip next to 6 tabs. */
.et-app .et-toolbar {
  flex: 0 0 auto;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.et-app .et-tabs {
  width: 100%;
  flex-wrap: wrap;
}
.et-app .et-toolbar-controls {
  margin-left: 0;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.et-app .et-search {
  flex: 1 1 220px;
  min-width: 160px;
  max-width: 420px;
}
.et-app .et-toolbar-controls .filter-select {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}
.et-app .et-toolbar-controls .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
/* Kill the 300px height tax: the split pane flexes into whatever the
   viewport gives it (beats the base clamp() and the ≤900px calc()). */
.et-app .et-root {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}
/* Dashboard view fills the same slot and scrolls internally. */
.et-app .et-dash {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  padding-bottom: 16px;
}
/* Slim footer row: kbd hint + module-feedback strip share one line. */
.et-app-foot {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 4px 2px 8px;
}
.et-app-foot .feedback-module-strip { margin: 0; }

/* ====================================================================
   ET full-page shell dark mode (Kimi3 audit F2, 2026-07-20)
   Same class of fix as Workspace 90-dark-mode.css .ws-root remap:
   .et-app is a self-contained fixed surface built on warm tokens that
   are NOT globally remapped in dark mode. Scope the remap here.
   ==================================================================== */
[data-theme="dark"] .et-app {
  --eggshell-bright: var(--bg-primary);
  --eggshell-shade:  var(--surface-hover);
  --eggshell-deep:   var(--surface-alt);
  --warm-white:      var(--surface);
  --paper:           var(--bg-secondary);
  --ink-strong: var(--text-primary);
  --ink:        var(--text-primary);
  --ink-soft:   var(--text-secondary);
  --ink-mute:   var(--text-muted);
  --ink-faint:  var(--text-muted);
  --rule:      var(--border-light);
  --rule-soft: var(--border-light);
  /* Common surface aliases used by legacy ET rules */
  --surface:      var(--bg-secondary);
  --surface-soft: var(--bg-secondary);
  --border:       var(--border-light);
  --border-subtle: rgba(255,255,255,0.06);
  --text-mute:    var(--text-muted);
  background:
    radial-gradient(ellipse at top left, rgba(212,168,67,0.06), transparent 55%),
    var(--bg-primary);
}
[data-theme="dark"] .et-topbar {
  background: rgba(26,29,39,0.85);
  border-bottom-color: var(--border-light);
}
[data-theme="dark"] .et-exit-btn {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-secondary);
}
[data-theme="dark"] .et-exit-btn:hover {
  border-color: var(--heritage-gold);
  color: var(--text-primary);
  background: var(--surface-hover);
}
[data-theme="dark"] .et-draft-seal { background: rgba(212,168,67,0.10); }
[data-theme="dark"] .et-topbar-metrics {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.12);
}
[data-theme="dark"] .et-app .et-toolbar {
  background: var(--surface);
  border-color: var(--border-light);
}
[data-theme="dark"] .et-app .et-root,
[data-theme="dark"] .et-root {
  background: var(--surface);
  border-color: var(--border-light);
}
[data-theme="dark"] .et-rail {
  background: linear-gradient(180deg, var(--surface), var(--bg-secondary));
  border-right-color: var(--border-light);
}
[data-theme="dark"] .et-detail-pane {
  background: var(--surface);
  color: var(--text-primary);
}
[data-theme="dark"] .et-list-footer {
  border-top-color: var(--border-light);
}
[data-theme="dark"] .et-item:hover { background: var(--surface-hover); }
[data-theme="dark"] .et-item.selected {
  background: rgba(204,0,0,0.12);
}
[data-theme="dark"] .et-search,
[data-theme="dark"] .et-app .filter-select {
  background: var(--surface-alt);
  color: var(--text-primary);
  border-color: var(--border-medium);
}
[data-theme="dark"] .et-app-foot { color: var(--text-muted); }

/* ── Mobile ≤900px: safe-area topbar, 44px exit, seal collapses to title ── */
@media (max-width: 900px) {
  .et-topbar {
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    gap: 8px;
  }
  .et-exit-btn {
    min-width: 44px; height: 44px; padding: 0; justify-content: center;
    border-radius: 12px;
  }
  .et-exit-label { display: none; }
  .et-topbar-name { font-size: 16px; }
  .et-draft-seal-body { display: none; }   /* title attr still carries it */
  .et-topbar-metrics { padding: 3px 10px; }
  .et-app-body { padding: 8px 10px 0; gap: 8px; }
  .et-app-foot { padding: 2px 2px calc(4px + env(safe-area-inset-bottom, 0px)); }
}

/* ── Phone ≤640px: name and seal stack, both fully visible (2026-10-25) ──
   Layout sweep: at 390px the name, the seal and the "Needs action" pill did
   not fit on one row. The seal was hard-clipped ("HUMAN-IN-THE-LO" in en,
   "HU" in es), and because .et-topbar-title overflowed by a few px, a tab
   click scrolled that overflow:hidden box sideways, so in es the title lost
   its first letter under the back button. Now the seal sits on a small second
   line under the name inside the same 44px-high row: nothing overflows, the
   seal reads in full, and on a very narrow screen it ends in an ellipsis
   instead of a hard cut. */
@media (max-width: 640px) {
  .et-topbar-title {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
  }
  .et-topbar-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 15px;
    line-height: 1.2;
  }
  .et-draft-seal {
    flex: 0 0 auto;
    padding: 1px 8px 1px 6px;
  }
  .et-draft-seal-title {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.7rem;
  }
}
/* ============================================================
   14-label-verify.css
   Label Verification (Vision AI) module
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ============================================================
   Label Verification (Vision AI) — drop zones, status, findings
   ============================================================ */

/* --- Drop-zone card spacing parity with other module cards --- */

/* B9 (2026-07-20): HQ quarterly reg pack notice */
.lv-reg-banner {
  margin: 0 0 14px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(212, 168, 67, 0.35);
  border-left: 4px solid var(--heritage-gold, #D4A843);
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.08), rgba(250, 246, 237, 0.5));
}
.lv-reg-banner-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink, #222);
  margin-bottom: 4px;
}
.lv-reg-banner-body {
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--ink-soft, #555);
}

/* B11 (2026-07-20): admin regulatory pack manager */
.lv-reg-packs {
  margin: 0 0 14px;
  border: 1px solid rgba(212, 168, 67, 0.30);
  border-radius: 10px;
  background: var(--card-bg, #fff);
}
.lv-reg-packs > summary {
  cursor: pointer;
  padding: 10px 16px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft, #555);
  list-style: none;
  user-select: none;
}
.lv-reg-packs > summary::-webkit-details-marker { display: none; }
.lv-reg-packs > summary::before { content: '▸ '; color: var(--heritage-red, #CC0000); }
.lv-reg-packs[open] > summary::before { content: '▾ '; }
.lv-reg-packs-body { padding: 0 16px 14px; }
.lv-reg-packs-hint { font-size: 0.8rem; line-height: 1.4; margin-bottom: 10px; }
.lv-reg-docs-list { font-size: 0.84rem; }
.lv-reg-doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
  flex-wrap: wrap;
}
.lv-reg-doc-row:last-child { border-bottom: none; }
.lv-reg-doc-name { font-weight: 600; word-break: break-all; }
.lv-reg-doc-meta { margin-left: auto; white-space: nowrap; }
.lv-reg-packs-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
  font-size: 0.8rem;
}
@media (max-width: 640px) {
  .lv-reg-doc-meta { margin-left: 0; width: 100%; }
}

.lv-drop-card { height: 100%; }

/* Wave 0 (LV-P0-b): the two dropzones carry the module's core metaphor —
   ARTWORK (heritage red) vs SPEC (heritage gold). Purple removed. */
.lv-dropzone {
  position: relative;
  margin-top: 14px;
  min-height: 200px;
  padding: 22px;
  border: 2px dashed rgba(74, 64, 56, 0.28);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(251, 246, 236, 0.6), rgba(212, 168, 67, 0.04));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  outline: none;
}

.lv-zone-artwork { border-color: rgba(204, 0, 0, 0.30); }
.lv-zone-spec    { border-color: rgba(212, 168, 67, 0.45); }

.lv-dropzone:hover, .lv-dropzone:focus {
  border-color: var(--heritage-gold-dark, #8B6914);
  background: linear-gradient(135deg, rgba(251, 246, 236, 0.9), rgba(212, 168, 67, 0.08));
}
.lv-zone-artwork:hover, .lv-zone-artwork:focus {
  border-color: var(--heritage-red, #CC0000);
  background: linear-gradient(135deg, rgba(204, 0, 0, 0.04), rgba(251, 246, 236, 0.8));
}
.lv-zone-spec:hover, .lv-zone-spec:focus {
  border-color: var(--heritage-gold-dark, #8B6914);
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.10), rgba(251, 246, 236, 0.8));
}

.lv-dropzone-hover {
  border-color: var(--heritage-gold) !important;
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.14), rgba(251, 246, 236, 0.8)) !important;
  transform: scale(1.01);
}

.lv-dropzone-filled {
  cursor: default;
  border-style: solid;
  border-color: rgba(74, 64, 56, 0.22);
  background: white;
  padding: 12px;
}

.lv-dropzone-prompt { color: var(--ink-soft); }

.lv-dropzone-icon { line-height: 1; margin-bottom: 8px; color: var(--ink-mute, #6B6560); }
.lv-zone-artwork .lv-dropzone-icon { color: var(--heritage-red, #CC0000); }
.lv-zone-spec .lv-dropzone-icon { color: var(--heritage-gold-dark, #8B6914); }

.lv-dropzone-text { font-size: 0.95rem; color: var(--text); font-weight: 500; }

.lv-dropzone-sub  { font-size: 0.82rem; color: var(--text-mute); margin-top: 6px; }

.lv-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.lv-preview-img {
  max-width: 100%;
  max-height: 280px;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--rule);
  background: #fafafa;
}

.lv-preview-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--text);
  flex-wrap: wrap;
  justify-content: center;
}

.lv-preview-meta .text-mute { font-size: 0.8rem; }

.lv-replace-btn { padding: 3px 10px !important; font-size: 12px !important; }

/* --- Spec sub-tabs (image vs text) --- */

.lv-spec-tabs {
  display: flex;
  gap: 4px;
  margin-top: 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.lv-spec-tab {
  padding: 7px 14px;
  background: transparent;
  border: none;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.lv-spec-tab:hover { color: var(--text); }

.lv-spec-tab.active {
  color: var(--heritage-red, #CC0000);
  border-bottom-color: var(--heritage-red, #CC0000);
  font-weight: 600;
}

/* --- Demo grid --- */

.lv-demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.lv-demo-card {
  background: white;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
  font: inherit;
  color: inherit;
}

.lv-demo-card:hover {
  border-color: var(--heritage-red, #CC0000);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(204, 0, 0, 0.08);
}

.lv-demo-card-active {
  border-color: var(--heritage-red, #CC0000);
  background: linear-gradient(135deg, rgba(204, 0, 0, 0.03), rgba(212, 168, 67, 0.05));
}

.lv-demo-icon { line-height: 1; color: var(--ink-mute, #6B6560); }
.lv-demo-card:hover .lv-demo-icon,
.lv-demo-card-active .lv-demo-icon { color: var(--heritage-red, #CC0000); }

.lv-demo-label { font-weight: 600; margin-top: 6px; color: var(--text); }

.lv-demo-sub   { font-size: 0.82rem; color: var(--text-mute); margin-top: 4px; line-height: 1.45; }

.lv-demo-expected {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.lv-demo-expected-fail    { background: rgba(204, 0, 0, 0.08); color: var(--heritage-red-dark, #8B0000); }

.lv-demo-expected-warning { background: rgba(212, 168, 67, 0.16); color: var(--heritage-gold-dark, #8B6914); }

.lv-demo-expected-pass    { background: rgba(45, 140, 60, 0.10); color: var(--success-deep, #1F6B2B); }

.lv-preview-title { font-weight: 600; font-size: 0.86rem; margin-bottom: 6px; color: var(--heritage-red-dark, #8B0000); }

.lv-preview-text {
  background: #fafafa;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 260px;
  overflow: auto;
  color: var(--text);
}

/* --- Loading card --- */

.lv-loading-card {
  border-left: 4px solid var(--heritage-gold, #D4A843);
  margin-top: 18px;
}

/* --- Status banner (PASS / WARNING / FAIL) --- */

.lv-status-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 2px solid var(--rule);
  border-left-width: 6px;
  border-radius: 10px;
  background: white;
  margin-top: 4px;
}

.lv-status-pass    { background: linear-gradient(90deg, rgba(45, 140, 60, 0.07), white); }

.lv-status-warning { background: linear-gradient(90deg, rgba(212, 168, 67, 0.10), white); }

.lv-status-fail    { background: linear-gradient(90deg, rgba(204, 0, 0, 0.06), white); }

.lv-status-emoji {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.lv-status-body { flex: 1; }

.lv-status-label {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.lv-status-summary {
  font-size: 0.95rem;
  color: var(--text);
  margin-top: 4px;
  line-height: 1.45;
}

/* --- Findings --- */

.lv-section-h {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  color: var(--heritage-red, #CC0000);
  margin: 18px 0 10px;
  font-size: 1.05rem;
}

.lv-finding {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--text-mute);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: white;
}

.lv-finding-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.lv-severity-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: white;
}

.lv-finding-field {
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.lv-finding-compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
  margin: 10px 0 8px;
}

.lv-compare-col {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 8px 10px;
}

.lv-compare-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  margin-bottom: 4px;
  font-weight: 600;
}

.lv-compare-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.lv-compare-label-val { color: var(--heritage-red-dark, #8B0000); }

/* What the label currently says */

.lv-compare-spec-val  { color: var(--success-deep, #1F6B2B); }

/* What the spec wants */

.lv-compare-arrow {
  align-self: center;
  font-size: 0.86rem;
  color: var(--text-mute);
  font-weight: 600;
  font-style: italic;
}

.lv-finding-issue, .lv-finding-action {
  font-size: 0.88rem;
  color: var(--text);
  margin-top: 6px;
  line-height: 1.5;
}

/* Wave 0 (LV-P0-b): action block = gold left rule + subtle gold tint. */
.lv-finding-action {
  padding: 6px 10px;
  background: rgba(212, 168, 67, 0.10);
  border-left: 3px solid var(--heritage-gold, #D4A843);
  border-radius: 4px;
  margin-top: 8px;
}

/* --- Verified elements card --- */

.lv-elements-card { margin-top: 14px; background: rgba(45, 140, 60, 0.04); border-color: rgba(45, 140, 60, 0.18); }

.lv-element-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.lv-element-chip {
  display: inline-block;
  padding: 3px 10px;
  background: white;
  border: 1px solid rgba(45, 140, 60, 0.32);
  border-radius: 14px;
  font-size: 0.78rem;
  color: var(--success-deep, #1F6B2B);
  font-weight: 500;
}

/* --- Mobile-friendly stack for findings comparison --- */

@media (max-width: 720px) {
  .lv-finding-compare { grid-template-columns: 1fr; }
  .lv-compare-arrow { display: none; }
}

.uz-zone .lv-dropzone-text { font-weight: 600; }

/* ============================================================
   Extracted from public/js/ui/label-verify.js — ensureLabelVerifyInlineStyles()
   Inline card visuals for cost impact calculator.
   ============================================================ */

/* Wave 0 (LV-P0-c): light eggshell card — the old dark-surface styling is
   gone. Headline number in heritage red, Playfair title, brand controls. */
.lv-inline-card {
  background: var(--paper, #FBF6EC);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 18px;
}

.lv-inline-card h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
}

.lv-cost-title {
  font-family: var(--font-serif, 'ABC Arizona Flare', 'Playfair Display', Georgia, serif);
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--ink-strong, #1A1410);
}

.lv-cost-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.lv-cost-field {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft, #4A4038);
}

.lv-cost-field .form-input,
.lv-cost-field .form-select {
  width: 100%;
  margin-top: 4px;
}

.lv-cost-result { margin-top: 14px; }

.lv-cost-total-card {
  background: white;
  border: 1px solid rgba(204, 0, 0, 0.18);
  border-left: 4px solid var(--heritage-red, #CC0000);
  border-radius: 8px;
  padding: 14px 16px;
}

.lv-cost-total {
  font-family: var(--font-serif, 'ABC Arizona Flare', 'Playfair Display', Georgia, serif);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--heritage-red, #CC0000);
  line-height: 1.1;
}

.lv-cost-total-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-mute, #6B6560);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.lv-cost-table { margin-top: 10px; }
.lv-cost-table td:last-child { text-align: right; font-weight: 600; }

.lv-cost-message {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(212, 168, 67, 0.10);
  border-left: 3px solid var(--heritage-gold, #D4A843);
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink, #2C2520);
}

.lv-inline-card .source-cite {
  font-size: 11px;
  color: var(--ink-mute, #6B6560);
  font-style: italic;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.lv-inline-card .badge-critical {
  background: rgba(204, 0, 0, 0.10);
  color: var(--heritage-red-dark, #8B0000);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.lv-inline-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lv-inline-card table td {
  padding: 6px 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ============================================================
   Wave 1b (2026-07-20) — results actionability + vendor export
   LV-P1-c findings toolbar · LV-P1-d run details + radar chip ·
   LV-P1-b vendor copy/export · LV-P1-f readiness two-tick
   ============================================================ */

/* --- LV-P1-f: readiness two-tick checklist --- */

.lv-readiness {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.86rem;
}

.lv-ready-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--ink-mute, #6B6560);
}

.lv-ready-dot { font-size: 0.95rem; line-height: 1; }

.lv-ready-artwork .lv-ready-dot { color: rgba(204, 0, 0, 0.45); }
.lv-ready-spec    .lv-ready-dot { color: rgba(139, 105, 20, 0.55); }

.lv-ready-item.lv-ready-done { color: var(--ink, #2C2520); }
.lv-ready-artwork.lv-ready-done .lv-ready-dot { color: var(--heritage-red, #CC0000); font-weight: 800; }
.lv-ready-spec.lv-ready-done    .lv-ready-dot { color: var(--heritage-gold-dark, #8B6914); font-weight: 800; }

.lv-ready-hint { font-size: 0.82rem; }

/* --- LV-P1-d: run details collapse (telemetry out of the analyst's face) --- */

.lv-run-details {
  margin: 6px 0 2px;
  font-size: 0.8rem;
  color: var(--ink-mute, #6B6560);
}

.lv-run-details > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: inline-block;
}
.lv-run-details > summary::-webkit-details-marker { display: none; }
.lv-run-details > summary::before { content: '▸ '; color: var(--heritage-gold-dark, #8B6914); }
.lv-run-details[open] > summary::before { content: '▾ '; }

.lv-run-details-body {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 0 2px 14px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 0.76rem;
}

.lv-radar-chip {
  border-color: rgba(212, 168, 67, 0.5) !important;
  background: rgba(212, 168, 67, 0.10) !important;
  color: var(--heritage-gold-dark, #8B6914) !important;
  font-weight: 600;
}

/* --- LV-P1-c: findings toolbar --- */

.lv-findings-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--paper, #FBF6EC);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 10px;
}

.lv-sev-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.lv-sev-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: white;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft, #4A4038);
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.lv-sev-chip:disabled { opacity: 0.45; cursor: default; }

.lv-sev-chip-critical { color: var(--heritage-red, #CC0000); border-color: rgba(204, 0, 0, 0.35); }
.lv-sev-chip-major    { color: var(--heritage-red-dark, #8B0000); border-color: rgba(139, 0, 0, 0.3); }
.lv-sev-chip-minor    { color: var(--heritage-gold-dark, #8B6914); border-color: rgba(139, 105, 20, 0.35); }
.lv-sev-chip-cosmetic { color: var(--ink-soft, #4A4038); border-color: rgba(74, 64, 56, 0.25); }

.lv-sev-chip:not(:disabled):hover { background: rgba(212, 168, 67, 0.08); }

/* Gold active state per brief */
.lv-sev-chip-active,
.lv-sev-chip-active:not(:disabled):hover {
  background: rgba(212, 168, 67, 0.16);
  border-color: var(--heritage-gold-dark, #8B6914);
  box-shadow: 0 0 0 1px var(--heritage-gold-dark, #8B6914) inset;
}

.lv-sev-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink, #2C2520);
  font-size: 0.72rem;
  text-align: center;
}

.lv-page-select {
  width: auto;
  padding: 4px 28px 4px 10px;
  font-size: 0.8rem;
}

.lv-toolbar-spacer { flex: 1; }

.lv-page-tile { cursor: pointer; border-radius: 8px; padding: 4px; }
.lv-page-tile:hover, .lv-page-tile:focus-visible {
  background: rgba(212, 168, 67, 0.10);
  outline: none;
}

.lv-finding-head .lv-copy-vendor {
  margin-left: auto;
  padding: 2px 9px !important;
  font-size: 11.5px !important;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .lv-findings-toolbar { padding: 8px 10px; }
  .lv-finding-head { flex-wrap: wrap; }
  .lv-finding-head .lv-copy-vendor { margin-left: 0; }
}

/* --- Wave 2c (LV-P1-a): History tab --- */
/* Calm eggshell rows, verdict in brand palette, actions right-aligned.
   No purple, no gradients — audit-trail register. */

.lv-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.lv-history-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lv-history-empty {
  padding: 18px 6px;
  text-align: center;
}

.lv-history-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: var(--paper, #FBF6EC);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-left: 3px solid var(--eggshell-shade, #F0E0C8);
  border-radius: 10px;
}

.lv-history-row:hover {
  background: var(--eggshell-bright, #FFF5E6);
}

.lv-hist-status {
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding-top: 2px;
  min-width: 92px;
}

.lv-history-row:has(.lv-hist-status-fail)    { border-left-color: var(--heritage-red, #CC0000); }
.lv-history-row:has(.lv-hist-status-warning) { border-left-color: var(--heritage-gold, #D4A843); }
.lv-history-row:has(.lv-hist-status-pass)    { border-left-color: var(--success, #2D8C3C); }

.lv-hist-main {
  flex: 1;
  min-width: 0;
}

.lv-hist-subject {
  font-weight: 600;
  color: var(--ink-strong, #1A1410);
  overflow-wrap: anywhere;
}

.lv-hist-meta {
  font-size: 0.8rem;
  margin-top: 2px;
}

.lv-hist-summary {
  font-size: 0.82rem;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lv-hist-noresult {
  font-size: 0.76rem;
  font-style: italic;
  margin-top: 3px;
}

.lv-hist-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.lv-hist-reopened {
  margin-top: 16px;
  font-size: 0.82rem;
  padding: 6px 10px;
  background: rgba(212, 168, 67, 0.10);
  border-left: 3px solid var(--heritage-gold-dark, #8B6914);
  border-radius: 6px;
}

@media (max-width: 640px) {
  .lv-history-row { flex-direction: column; gap: 6px; }
  .lv-hist-status { min-width: 0; }
  .lv-hist-actions { justify-content: flex-start; }
}

/* --- Wave 2d (LV-P1-e): spec extraction preview --- */
/* Eggshell panel, gold accents — a trust helper on the ② spec card.
   No purple, no gradients, compliance register. */

.lv-extract-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.lv-extract-confirmed {
  color: var(--success-deep, #1F6B2B);
  font-size: 0.8rem;
  font-weight: 600;
}

.lv-reuse-spec { margin-top: 10px; }

.lv-reuse-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid rgba(139, 105, 20, 0.4);
  background: rgba(212, 168, 67, 0.10);
  color: var(--heritage-gold-dark, #8B6914);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.lv-reuse-chip:hover {
  background: rgba(212, 168, 67, 0.18);
  border-color: var(--heritage-gold-dark, #8B6914);
}

.lv-extract-panel {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--paper, #FBF6EC);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-left: 3px solid var(--heritage-gold-dark, #8B6914);
  border-radius: 10px;
}

.lv-extract-title {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--heritage-red-dark, #8B0000);
}

.lv-extract-note {
  margin-top: 4px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.lv-extract-dl {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 5px 16px;
  margin: 12px 0 0;
  font-size: 0.86rem;
}

.lv-extract-dl dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute, #6B6560);
  align-self: baseline;
  padding-top: 2px;
}

.lv-extract-dl dd {
  margin: 0;
  color: var(--ink-strong, #1A1410);
  overflow-wrap: anywhere;
}

.lv-extract-sub-h {
  margin-top: 12px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--heritage-gold-dark, #8B6914);
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(212, 168, 67, 0.4);
}

.lv-extract-nutrition {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 12px;
  margin-top: 8px;
}

.lv-extract-nut-cell {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 6px;
}

.lv-extract-nut-key {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute, #6B6560);
}

.lv-extract-nut-val {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-strong, #1A1410);
}

.lv-extract-claims {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.lv-extract-claim {
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(212, 168, 67, 0.12);
  border: 1px solid rgba(139, 105, 20, 0.3);
  color: var(--ink, #2C2520);
  font-size: 0.78rem;
  font-weight: 600;
}

.lv-extract-raw { margin-top: 12px; }

.lv-extract-raw summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft, #4A4038);
}

.lv-extract-raw .lv-preview-text {
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
}

.lv-extract-btns {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .lv-extract-dl { grid-template-columns: 1fr; gap: 2px; }
  .lv-extract-dl dd { margin-bottom: 8px; }
}

/* --- LV-P1-b: Lee Kum Kee branded print/PDF report --- */
/* Same mechanism as the Recipe Workbench kitchen sheet: hidden node on
   screen; @media print hides the app and shows only the report. Heritage
   Red rule, Playfair wordmark + verdict, gold hairlines — capabilities-
   template craft bar, not generic browser print. */

.lv-print-report { display: none; }

@media print {
  body.lv-printing > *:not(.lv-print-report) { display: none !important; }
  body.lv-printing .lv-print-report {
    display: block !important;
    padding: 28px 30px;
    color: #1A1410;
    background: #fff;
    font-size: 10.5pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .lv-print-report .lvp-head {
    border-bottom: 3pt solid #CC0000;   /* Heritage Red rule */
    padding-bottom: 10px;
    margin-bottom: 16px;
  }
  .lv-print-report .lvp-brand {
    font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 15pt;
    font-weight: 800;
    color: #CC0000;
    letter-spacing: 0.04em;
  }
  .lv-print-report .lvp-title {
    margin: 6px 0 2px;
    font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 21pt;
    font-weight: 700;
    color: #1A1410;
  }
  .lv-print-report .lvp-subline {
    font-size: 8.5pt;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8B6914;                     /* gold accent */
  }

  .lv-print-report .lvp-verdict {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 10px 14px;
    border-left: 6pt solid #6B6560;
    background: #FBF6EC;                /* eggshell */
    margin-bottom: 14px;
  }
  .lv-print-report .lvp-verdict-word {
    font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
    font-size: 20pt;
    font-weight: 700;
    letter-spacing: 0.1em;
  }
  .lv-print-report .lvp-verdict-pass    { border-left-color: #1F6B2B; }
  .lv-print-report .lvp-verdict-pass    .lvp-verdict-word { color: #1F6B2B; }
  .lv-print-report .lvp-verdict-warning { border-left-color: #8B6914; }
  .lv-print-report .lvp-verdict-warning .lvp-verdict-word { color: #8B6914; }
  .lv-print-report .lvp-verdict-fail    { border-left-color: #CC0000; }
  .lv-print-report .lvp-verdict-fail    .lvp-verdict-word { color: #CC0000; }
  .lv-print-report .lvp-verdict-summary { font-size: 10.5pt; color: #2C2520; }

  .lv-print-report .lvp-meta {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    margin-bottom: 16px;
  }
  .lv-print-report .lvp-meta th {
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 7.5pt;
    color: #6B6560;
    padding: 4px 14px 4px 0;
    white-space: nowrap;
  }
  .lv-print-report .lvp-meta td { padding: 4px 24px 4px 0; color: #1A1410; }

  .lv-print-report .lvp-h2 {
    font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
    font-size: 13pt;
    font-weight: 700;
    color: #8B0000;
    margin: 16px 0 8px;
    padding-bottom: 3px;
    border-bottom: 1pt solid #D4A843;   /* gold hairline */
  }

  .lv-print-report .lvp-findings {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.8pt;
  }
  .lv-print-report .lvp-findings th {
    text-align: left;
    font-size: 7.5pt;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B6560;
    border-bottom: 1.5pt solid #1A1410;
    padding: 5px 8px;
  }
  .lv-print-report .lvp-findings td {
    padding: 6px 8px;
    border-bottom: 0.75pt solid #d8d2c6;
    vertical-align: top;
  }
  .lv-print-report .lvp-findings tr { break-inside: avoid; }
  .lv-print-report .lvp-sev { font-weight: 700; text-transform: uppercase; font-size: 8pt; white-space: nowrap; }
  .lv-print-report .lvp-sev-critical { color: #CC0000; }
  .lv-print-report .lvp-sev-major    { color: #8B0000; }
  .lv-print-report .lvp-sev-minor    { color: #8B6914; }
  .lv-print-report .lvp-sev-cosmetic { color: #4A4038; }
  .lv-print-report .lvp-page { white-space: nowrap; }
  .lv-print-report .lvp-none { text-align: center; color: #1F6B2B; font-weight: 600; padding: 14px 8px; }

  /* FB-178: scope column. The printed report is the artifact that leaves the
     building, so a curated market cue must read as visibly secondary to a
     spec-gate finding even in black-and-white. Market rows get a lighter,
     italic scope cell on an eggshell tint; spec rows stay ink-solid. */
  .lv-print-report .lvp-scope {
    white-space: nowrap;
    font-size: 7.8pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #2C2520;
  }
  .lv-print-report .lvp-scope-market td { background: #FBF6EC; }
  .lv-print-report .lvp-scope-market .lvp-scope {
    color: #8B6914;
    font-style: italic;
    font-weight: 600;
  }
  .lv-print-report .lvp-market-note {
    margin: -6px 0 14px;
    padding: 6px 12px;
    border-left: 2.25pt solid #8B6914;
    background: #FBF6EC;
    font-size: 8.5pt;
    font-style: italic;
    color: #6B6560;
  }

  .lv-print-report .lvp-elements { font-size: 8.5pt; color: #2C2520; line-height: 1.7; }

  .lv-print-report .lvp-honesty {
    margin: -6px 0 14px;
    padding: 6px 12px;
    border-left: 2.25pt solid #D4A843;
    background: #FBF6EC;                /* eggshell */
    font-size: 8.5pt;
    font-style: italic;
    color: #8B6914;                     /* gold-dark — caution, not alarm */
  }

  .lv-print-report .lvp-foot {
    margin-top: 20px;
    padding-top: 8px;
    border-top: 0.75pt solid #D4A843;
    font-size: 8pt;
    font-style: italic;
    color: #6B6560;
  }
}

/* ── S6: Brand Library sourcing (Label Verify × DAM) ──────────────────────
   Ghost entry button + selected-asset chip under each zone, plus the
   results-header honesty line. Brand tokens only — no purple, no approval
   wording. */
.lv-dam-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.lv-dam-chip-wrap { display: inline-flex; min-width: 0; }
.lv-dam-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid var(--heritage-gold, #D4A843);
  border-radius: 999px;
  background: rgba(212, 168, 67, 0.10);
  font-size: 0.8rem;
  color: var(--ink, #2C2520);
}
.lv-dam-chip-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lv-dam-chip-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #8B6914;
  border: 1px solid rgba(139, 105, 20, 0.35);
  border-radius: 4px;
  padding: 0 4px;
  white-space: nowrap;
}
.lv-dam-chip-x {
  border: none;
  background: none;
  cursor: pointer;
  color: #6B6560;
  font-size: 0.8rem;
  line-height: 1;
  padding: 2px;
}
.lv-dam-chip-x:hover { color: var(--heritage-red, #CC0000); }
.lv-dam-honesty {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 3px solid var(--heritage-gold, #D4A843);
  background: rgba(212, 168, 67, 0.08);
  border-radius: 0 6px 6px 0;
  font-size: 0.84rem;
  color: #4A4038;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.lv-dam-honesty-icon { flex: none; margin-top: 1px; color: var(--heritage-gold-dark, #8B6914); line-height: 1; }
.lv-dam-honesty-lines { flex: 1; min-width: 0; }

/* ── S6 polish: zone-integrated browse buttons, fidelity badges, inline ──
   notes. Artwork chrome tints heritage red; spec chrome tints gold-dark —
   the same accents as their dropzones, so DAM entry feels native to the
   ①/② workflow rather than bolted on. */
.lv-dam-browse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border-color: transparent;
}
.lv-dam-browse svg { flex: none; }
.lv-dam-row-artwork .lv-dam-browse { color: var(--heritage-red, #CC0000); }
.lv-dam-row-artwork .lv-dam-browse:hover,
.lv-dam-row-artwork .lv-dam-browse:focus-visible {
  background: rgba(204, 0, 0, 0.06);
  color: var(--heritage-red, #CC0000);
  border-color: rgba(204, 0, 0, 0.30);
}
.lv-dam-row-spec .lv-dam-browse { color: var(--heritage-gold-dark, #8B6914); }
.lv-dam-row-spec .lv-dam-browse:hover,
.lv-dam-row-spec .lv-dam-browse:focus-visible {
  background: rgba(212, 168, 67, 0.10);
  color: var(--heritage-gold-dark, #8B6914);
  border-color: rgba(139, 105, 20, 0.35);
}

/* Fidelity badge pair — preview (gold, caution) vs original (green, full
   bytes). Never imply fidelity: both states are always labeled. */
.lv-dam-chip-badge--original {
  color: var(--success, #2D8C3C);
  border-color: rgba(45, 140, 60, 0.35);
}

/* Zone slot: pre-verify honesty sub-copy + dismissible error notes. */
.lv-dam-zone-slot:empty { display: none; }
.lv-dam-zone-note {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--heritage-gold-dark, #8B6914);
}
.lv-dam-zone-note svg { flex: none; }
.lv-dam-note {
  margin-top: 6px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-left: 3px solid var(--heritage-red, #CC0000);
  background: rgba(204, 0, 0, 0.05);
  border-radius: 0 6px 6px 0;
  font-size: 0.84rem;
  color: #4A4038;
}
.lv-dam-note-body { flex: 1; min-width: 0; }
.lv-dam-note-x {
  flex: none;
  border: none;
  background: none;
  cursor: pointer;
  color: #6B6560;
  font-size: 0.8rem;
  line-height: 1;
  padding: 2px;
}
.lv-dam-note-x:hover { color: var(--heritage-red, #CC0000); }

/* Mobile: thumb-first DAM chrome — taller browse button, chips that wrap
   without overflowing the card, and a clear control with a real tap target. */
@media (max-width: 768px) {
  .lv-dam-row { gap: 6px; }
  .lv-dam-browse { min-height: 38px; }
  .lv-dam-chip { max-width: 100%; padding: 4px 6px 4px 10px; }
  .lv-dam-chip-name { max-width: 140px; }
  .lv-dam-chip-x { min-width: 30px; min-height: 30px; margin: -4px -2px -4px 0; }
  .lv-dam-note, .lv-dam-zone-note { font-size: 0.8rem; }
}

/* ── FB-178 (2026-08-05, Alice Zhou): target market compliance ────────────
   "label verification appears to be verified against internal documents. If
   the tool can be used to perform global countries labeling compliance
   checking, it would help."

   Visual contract, and it is a contract not a preference:
   the artwork-vs-approved-SPEC gate is the thing that stops a print run, so
   spec chrome stays heritage-red/ink-solid and every market affordance is
   rendered in the gold "advisory" register — chips, badges, honesty bands
   and print rows alike. A reviewer must never be able to mistake a curated
   checklist cue for a spec rejection, at a glance, on any surface. */

.lv-market-card { border-left: 3px solid var(--heritage-gold, #D4A843); }
.lv-market-optional {
  margin-left: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft, #4A4038);
  opacity: 0.72;
}

.lv-market-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.lv-market-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: white;
  font: inherit;
  font-size: 0.79rem;
  cursor: pointer;
  color: var(--ink-soft, #4A4038);
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
.lv-market-chip:not(:disabled):hover { background: rgba(212, 168, 67, 0.08); }
.lv-market-chip:disabled { opacity: 0.42; cursor: default; }
.lv-market-chip-code { font-weight: 800; letter-spacing: 0.02em; }
.lv-market-chip-name { font-weight: 500; }
.lv-market-chip-on,
.lv-market-chip-on:not(:disabled):hover {
  border-color: var(--heritage-gold-dark, #8B6914);
  background: rgba(212, 168, 67, 0.16);
  color: #4A4038;
  box-shadow: inset 0 0 0 1px rgba(139, 105, 20, 0.28);
}

/* Coverage tier badge — the honesty signal rides ON the chip, so a reviewer
   sees how thin our grounding is at the moment they choose, not afterwards. */
.lv-market-chip-tier {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 8px;
}
.lv-market-tier-baseline { background: rgba(45, 140, 60, 0.14);  color: #1F6B2B; }
.lv-market-tier-radar    { background: rgba(212, 168, 67, 0.22); color: #8B6914; }
.lv-market-tier-advisory { background: rgba(74, 64, 56, 0.12);   color: #4A4038; }

.lv-market-selected { margin-top: 10px; font-size: 0.82rem; }

.lv-market-honesty {
  margin-top: 12px;
  padding: 9px 12px;
  border-left: 3px solid var(--heritage-gold-dark, #8B6914);
  background: rgba(212, 168, 67, 0.08);
  border-radius: 0 6px 6px 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #4A4038;
}
.lv-market-honesty strong { color: var(--heritage-gold-dark, #8B6914); margin-right: 5px; }

.lv-market-demo-note {
  margin-top: 10px;
  font-size: 0.82rem;
  padding: 7px 12px;
  border-left: 3px solid var(--heritage-gold, #D4A843);
  background: rgba(212, 168, 67, 0.07);
  border-radius: 0 6px 6px 0;
}

/* Results: declared-market chips in the meta bar. */
.lv-market-result-chip { font-weight: 600; }

/* Results: the market honesty band. Sits under the verdict beside the DAM
   preview honesty line — same class of claim-limiting statement. */
.lv-market-honesty-result { margin-top: 8px; }
.lv-market-honesty-head { font-weight: 700; color: var(--heritage-gold-dark, #8B6914); }
.lv-market-honesty-body { margin-top: 3px; }
.lv-market-honesty-limit {
  margin-top: 5px;
  font-size: 0.78rem;
  font-style: italic;
  color: #6B6560;
}

/* Finding scope badges. Spec = ink-solid (gating). Market = gold outline
   (advisory). Never the reverse. */
.lv-scope-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 9px;
  white-space: nowrap;
}
.lv-scope-spec {
  background: rgba(74, 64, 56, 0.1);
  color: #2C2520;
}
.lv-scope-market {
  background: transparent;
  color: var(--heritage-gold-dark, #8B6914);
  border: 1px dashed rgba(139, 105, 20, 0.55);
}
/* A market-scoped finding card is dimmer and dashed — secondary by design. */
.lv-finding-scope-market {
  border-left-style: dashed;
  opacity: 0.94;
}

/* Scope filter chips — same toggle idiom as the severity chips. */
.lv-scope-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.lv-scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 14px;
  border: 1px dashed rgba(139, 105, 20, 0.4);
  background: white;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft, #4A4038);
  transition: border-color 120ms ease, background 120ms ease;
}
.lv-scope-chip[data-scope="spec"] { border-style: solid; border-color: rgba(0, 0, 0, 0.16); }
.lv-scope-chip:hover { background: rgba(212, 168, 67, 0.08); }
.lv-scope-chip-active,
.lv-scope-chip-active:hover {
  border-color: var(--heritage-gold-dark, #8B6914);
  background: rgba(212, 168, 67, 0.18);
}

/* History rows: declared-market chips inline with the subject. */
.lv-hist-markets { display: inline-flex; gap: 4px; margin-left: 8px; flex-wrap: wrap; }
.lv-hist-market-chip {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(212, 168, 67, 0.18);
  color: #8B6914;
  white-space: nowrap;
}

/* Mobile: chips wrap without overflowing; tap targets stay honest. */
@media (max-width: 768px) {
  .lv-market-chips { gap: 6px; }
  .lv-market-chip { min-height: 38px; padding: 6px 10px; font-size: 0.76rem; }
  .lv-market-chip-name { display: none; }   /* code + tier is enough on narrow */
  .lv-market-honesty, .lv-market-demo-note { font-size: 0.79rem; }
  .lv-scope-chip { min-height: 34px; }
  .lv-hist-markets { margin-left: 0; margin-top: 4px; }
}
/* ============================================================
   15-spec-diff.css
   Spec Manual Diff module
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* =========================================================
   Spec Manual Diff module
   ========================================================= */

.spec-diff-twin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 880px) {
  .spec-diff-twin { grid-template-columns: 1fr; }
}

.spec-diff-text {
  min-height: 280px;
  font-family: 'SF Mono', ui-monospace, 'Cascadia Code', Consolas, 'Liberation Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.spec-diff-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  margin-top: 16px;
  background: linear-gradient(180deg, rgba(91, 44, 138, 0.04), rgba(91, 44, 138, 0.01));
  border: 1px solid rgba(91, 44, 138, 0.18);
  border-radius: 10px;
}

.spec-diff-loading .spinner {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  flex-shrink: 0;
}

.spec-diff-error {
  margin-top: 16px;
  border-left: 4px solid var(--danger);
}

.spec-diff-empty {
  margin-top: 14px;
  padding: 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(45, 140, 60, 0.06), rgba(45, 140, 60, 0.02));
  border: 1px solid rgba(45, 140, 60, 0.22);
  color: var(--ink);
}

/* Overall-impact banner */

.impact-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  margin: 14px 0 18px;
  border: 1px solid transparent;
  font-family: 'Source Sans Pro', system-ui, sans-serif;
}

.impact-banner-icon { font-size: 1.6rem; line-height: 1; }

.impact-banner-title {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}

.impact-banner-sub {
  font-size: 0.88rem;
  opacity: 0.85;
  margin-top: 2px;
}

.impact-banner-critical {
  background: linear-gradient(180deg, rgba(192, 57, 43, 0.10), rgba(192, 57, 43, 0.04));
  border-color: rgba(192, 57, 43, 0.32);
  color: #6B1A12;
}

.impact-banner-major {
  background: linear-gradient(180deg, rgba(212, 100, 30, 0.10), rgba(212, 100, 30, 0.04));
  border-color: rgba(212, 100, 30, 0.30);
  color: #7A3E12;
}

.impact-banner-minor {
  background: linear-gradient(180deg, rgba(198, 138, 31, 0.10), rgba(198, 138, 31, 0.04));
  border-color: rgba(198, 138, 31, 0.30);
  color: #6F4A10;
}

.impact-banner-cosmetic {
  background: linear-gradient(180deg, rgba(91, 44, 138, 0.06), rgba(91, 44, 138, 0.02));
  border-color: rgba(91, 44, 138, 0.22);
  color: var(--heritage-purple-dark);
}

.impact-banner-none {
  background: linear-gradient(180deg, rgba(45, 140, 60, 0.10), rgba(45, 140, 60, 0.04));
  border-color: rgba(45, 140, 60, 0.30);
  color: #1F5A28;
}
/* ============================================================
   17-complaint-video.css
   Complaint Video module
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ═══════════════════════════════════════════════════════════════════ */

/* Complaint Video module                                              */

/* ═══════════════════════════════════════════════════════════════════ */

/* Demo case grid */

.cv-demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.cv-demo-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  padding: 16px;
  background: white;
  border: 2px solid rgba(91, 44, 138, 0.10);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
}

.cv-demo-card:hover {
  border-color: var(--heritage-purple);
  box-shadow: 0 6px 16px rgba(91, 44, 138, 0.12);
  transform: translateY(-2px);
}

.cv-demo-card-active {
  border-color: var(--heritage-purple);
  background: linear-gradient(180deg, rgba(91, 44, 138, 0.04), white);
  box-shadow: 0 6px 16px rgba(91, 44, 138, 0.14);
}

.cv-demo-icon {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.cv-demo-name {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
}

.cv-demo-customer {
  font-size: 0.9rem;
  color: var(--heritage-purple);
  font-weight: 600;
}

.cv-demo-line {
  font-size: 0.84rem;
  color: var(--ink);
  opacity: 0.7;
}

.cv-demo-time {
  font-size: 0.86rem;
  color: var(--ink);
  margin-top: 4px;
}

.cv-demo-sev {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cv-demo-sev-high { background: #fff1f0; color: #a8071a; }

.cv-demo-sev-medium { background: #fffbe6; color: #ad6800; }

.cv-demo-sev-low { background: #e6f7ff; color: #0050b3; }

/* Detail card */

.cv-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .cv-detail-grid { grid-template-columns: 1fr; }
}

.cv-detail-customer {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heritage-purple-dark);
  margin-top: 8px;
}

.cv-detail-time {
  font-size: 0.92rem;
  color: var(--ink);
  margin-top: 2px;
}

.cv-detail-line {
  font-size: 0.86rem;
  color: var(--ink);
  opacity: 0.75;
  margin-top: 2px;
}

.cv-detail-desc {
  margin: 10px 0;
  padding: 10px 12px;
  background: rgba(91, 44, 138, 0.04);
  border-left: 3px solid var(--heritage-purple);
  border-radius: 6px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.cv-detail-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 8px 0 0 0;
  font-size: 0.85rem;
}

.cv-detail-meta dt {
  color: var(--ink);
  opacity: 0.6;
  font-weight: 600;
}

.cv-detail-meta dd {
  color: var(--ink);
  margin: 0;
}

/* Frame strip */

.cv-frame-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.cv-frame-thumb {
  position: relative;
  margin: 0;
  background: white;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.18s ease;
}

.cv-frame-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 320 / 180;
  object-fit: cover;
}

.cv-frame-thumb figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  font-size: 0.8rem;
  background: rgba(91, 44, 138, 0.02);
  border-top: 1px solid rgba(0,0,0,0.05);
}

.cv-frame-flagged {
  border-color: var(--heritage-gold);
  box-shadow: 0 2px 8px rgba(212, 168, 67, 0.18);
}

.cv-frame-primary {
  border-color: var(--heritage-purple);
  box-shadow: 0 4px 12px rgba(91, 44, 138, 0.22);
  transform: translateY(-1px);
}

.cv-frame-primary-tag {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--heritage-purple);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.cv-frame-sev {
  position: absolute;
  top: 8px; right: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Primary frame card (large) */

.cv-primary-card {
  margin-top: 14px;
  border-left: 4px solid var(--heritage-purple);
}

.cv-primary-frame {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-top: 12px;
}

@media (max-width: 700px) {
  .cv-primary-frame { grid-template-columns: 1fr; }
}

.cv-primary-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 2px solid rgba(91, 44, 138, 0.16);
}

.cv-primary-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.95rem;
}

/* Context (complaint vs AI conclusion) */

.cv-context-card { margin-top: 14px; }

.cv-context-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 800px) {
  .cv-context-grid { grid-template-columns: 1fr; }
}

.cv-context-h {
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--heritage-purple);
  margin-bottom: 8px;
}

.cv-context-body {
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--ink);
}

.cv-context-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--ink);
  opacity: 0.7;
  margin-top: 8px;
}

.cv-context-notes {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(212, 168, 67, 0.08);
  border-left: 3px solid var(--heritage-gold);
  border-radius: 6px;
  font-size: 0.86rem;
  color: var(--ink);
}

/* Recommended action card */

.cv-action-card {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 12px;
  padding: 16px 18px;
  background: linear-gradient(90deg, rgba(91, 44, 138, 0.06), transparent);
  border-left: 4px solid var(--heritage-purple);
}

.cv-action-icon {
  font-size: 1.6rem;
  color: var(--heritage-purple);
  font-weight: 700;
}

.cv-action-h {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--heritage-purple);
  margin-bottom: 2px;
}

.cv-action-body {
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--ink);
  font-weight: 500;
}

/* Status banner reuse — pass/warning/fail aliases */

.cv-status-pass    { background: linear-gradient(90deg, rgba(82, 196, 26, 0.06), white); }

.cv-status-warning { background: linear-gradient(90deg, rgba(212, 168, 67, 0.10), white); }

.cv-status-fail    { background: linear-gradient(90deg, rgba(245, 34, 45, 0.06), white); }

/* Finding frame thumbnail inside card */

.cv-finding-frame {
  margin: 10px 0;
  max-width: 280px;
}

.cv-finding-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Match / no-match pill in finding head */

.cv-match-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-left: 8px;
}

.cv-match-yes { background: #f6ffed; color: #237804; border: 1px solid #b7eb8f; }

.cv-match-no  { background: #fafafa; color: #595959; border: 1px solid #d9d9d9; }

/* Custom mode form */

.cv-custom-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.cv-custom-form .form-label { margin-top: 6px; }

.cv-custom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 600px) {
  .cv-custom-row { grid-template-columns: 1fr; }
}

/* Roadmap (upload stub) */

.cv-roadmap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.cv-roadmap-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(212, 168, 67, 0.08);
  border-left: 3px solid var(--heritage-gold);
  border-radius: 6px;
  font-size: 0.9rem;
}

.cv-roadmap-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--heritage-gold);
  color: white;
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* Mode pill (for custom-complaint result header) */

.cv-mode-pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(91, 44, 138, 0.08);
  border: 1px solid rgba(91, 44, 138, 0.16);
  color: var(--heritage-purple-dark);
  font-size: 0.82rem;
  font-weight: 600;
}

/* Loading card */

.cv-loading-card {
  border-left: 4px solid var(--heritage-purple);
}
/* ============================================================
   18-file-convert.css
   File Converter module
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ─── File Format Converter ────────────────────────────────────────── */

/* Vertical rhythm: the module is a 4-step wizard (source → template → target
   → run). Every step card used to carry its own inline margin-top, which
   drifted (14px / 18px / 10px) and read as uneven gutters. One token, one
   gap. */

.fc-step-card,
.fc-run-card,
.fc-history-card { margin-top: 14px; }

.fc-history-card { margin-top: 18px; }

/* Sub-blocks inside a step card (starter chips, saved-template picker). */
.fc-subsection { margin: 10px 0 12px; }
.fc-subsection:last-child { margin-bottom: 0; }

.fc-saved-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fc-saved-row .form-select {
  flex: 1 1 auto;
  min-width: 0;          /* was min-width:200px inline — that forced overflow
                            on a 320px phone instead of shrinking. */
}

/* Format picker grid — radio cards */

.fc-format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 4px;
  align-items: stretch;   /* even card heights per row — long descriptions no
                             longer leave short neighbours floating. */
}

.fc-format-card {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border: 2px solid var(--border, #e5e7eb);
  border-radius: 10px;
  cursor: pointer;
  background: var(--surface, #fff);
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}

/* Keyboard parity: the real <input type=radio> is hidden, so without this the
   card is invisible to keyboard users tabbing the format list. */
.fc-format-card:focus-within {
  outline: 2px solid var(--heritage-purple, #5B2C8A);
  outline-offset: 2px;
}

.fc-format-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.fc-format-icon {
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}

.fc-format-card:hover {
  border-color: var(--heritage-purple, #5B2C8A);
  background: var(--surface-soft, #fafafa);
}

.fc-format-card-active {
  border-color: var(--heritage-purple, #5B2C8A);
  background: rgba(91, 44, 138, 0.06);
  box-shadow: 0 0 0 3px rgba(91, 44, 138, 0.08);
}

.fc-format-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink, #1a1a1a);
  flex: 1;
  min-width: 0;
}

.fc-format-desc {
  font-size: 0.82rem;
  color: var(--ink-soft, #555);
  margin-top: 4px;
  line-height: 1.4;
  /* Cap at 2 lines so one verbose format ("Excel workbook with typed
     columns…") can't set the height for the whole row. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fc-format-ext {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.74rem;
  color: var(--ink-mute, #888);
  background: var(--surface-soft, #f4f4f4);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Preview table — scrollable, sticky header */

.fc-table-wrap {
  max-height: 480px;
  overflow: auto;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  margin-top: 8px;
  background: var(--surface, #fff);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;   /* stop the page from scrolling once the
                                     preview hits its end (mobile) */
}

.fc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  font-family: var(--font-mono, ui-monospace, monospace);
}

.fc-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-soft, #f7f7f7);
  border-bottom: 2px solid var(--border, #e5e7eb);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink-soft, #444);
  white-space: nowrap;
  z-index: 1;
}

.fc-table tbody td {
  border-bottom: 1px solid var(--border-soft, #f0f0f0);
  padding: 6px 12px;
  vertical-align: top;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-table tbody tr:hover { background: var(--surface-soft, #fafafa); }

.fc-table tbody tr:nth-child(even) { background: rgba(0, 0, 0, 0.015); }

/* Raw payload (collapsed details) */

.fc-raw-preview {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--surface-soft, #f7f7f7);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  line-height: 1.5;
  max-height: 360px;
  overflow: auto;
  white-space: pre;
  color: var(--ink, #1a1a1a);
}

/* Drive badge / link */

.fc-drive-chip {
  text-decoration: none;
  color: var(--heritage-purple, #5B2C8A) !important;
  background: rgba(91, 44, 138, 0.08);
  border-color: rgba(91, 44, 138, 0.25);
  font-weight: 500;
}

.fc-drive-chip:hover {
  background: rgba(91, 44, 138, 0.15);
}

.fc-drive-link {
  color: var(--heritage-purple, #5B2C8A);
  text-decoration: none;
  font-weight: 500;
}

.fc-drive-link:hover { text-decoration: underline; }

/* History table */

/* Header row of the history CARD (title + refresh button). */
.fc-history-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.fc-history-head-text { min-width: 0; }
.fc-history-head .card-title { font-size: 0.95rem; }
.fc-history-head .btn { flex: 0 0 auto; }

/* The scroll container. Horizontal overflow is contained HERE so a wide
   history table can never push the whole page sideways. */
.fc-history-wrap {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* Long histories get a sticky header + capped height so the table scrolls
   inside its card instead of running the page down 25 rows. */
.fc-history-table-wrap {
  max-height: 460px;
  overflow-y: auto;
}

.fc-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.fc-history-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft, #f7f7f7);
  border-bottom: 2px solid var(--border, #e5e7eb);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--ink-soft, #444);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.fc-history-table thead th.num,
.fc-history-table tbody td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;   /* digits line up column-wise */
}

.fc-history-table tbody td {
  border-bottom: 1px solid var(--border-soft, #f0f0f0);
  padding: 7px 10px;
  color: var(--ink, #1a1a1a);
  white-space: nowrap;
}

/* Source is the only free-text column; let it ellipsize rather than force the
   table wider than the card. */
.fc-history-table tbody td.fc-h-source {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fc-history-table tbody td.fc-h-file,
.fc-history-table tbody td.fc-h-drive { white-space: nowrap; }

.fc-history-table tbody td.fc-h-actions { text-align: right; }

.fc-history-table .fc-delete-log {
  color: var(--heritage-red, #CC0000);
  font-size: 11px;
  padding: 2px 6px;
  line-height: 1;
}

.fc-history-table tbody tr:hover { background: var(--surface-soft, #fafafa); }

/* Row-level focus ring so keyboard users can see where the delete lands. */
.fc-history-table tbody tr:focus-within { background: var(--surface-soft, #f4f4f4); }

/* ─── Run toolbar ────────────────────────────────────────────────── */
/* Three zones: actions (left) · readiness text (flexible middle) · drive
   toggle (right). The old markup used margin-left:auto on BOTH the readiness
   span and the drive slot, so at mid widths they collided. */

.fc-toolbar {
  display: flex;
  gap: 10px 14px;
  align-items: center;
  flex-wrap: wrap;
}

.fc-toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.fc-readiness {
  flex: 1 1 200px;
  min-width: 0;
  font-size: 0.85rem;
  /* Readiness copy is generated ('Ready — 3 files, 1.2 MB → XLSX'); it must
     degrade to an ellipsis instead of wrapping the toolbar into 3 rows. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-drive-slot { flex: 0 0 auto; }

.fc-drive-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.fc-drive-label input[type="checkbox"] { accent-color: var(--heritage-red, #CC0000); }

.fc-drive-off { color: var(--ink-mute, #999); font-size: 0.85rem; }

/* Format pill in history */

.fc-fmt-pill {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(91, 44, 138, 0.1);
  color: var(--heritage-purple, #5B2C8A);
  border-radius: 4px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ─── Starter templates (Slice 2) ──────────────────────────────────────── */
/* Built-in column sets. Visually lighter than the format cards so they read
   as "shortcut", not as a second required choice. */

.fc-starter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.fc-starter-chip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 9px;
  background: var(--surface, #fff);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.fc-starter-chip:hover {
  border-color: var(--heritage-purple, #5B2C8A);
  background: rgba(91, 44, 138, 0.03);
}

.fc-starter-chip:focus-visible {
  outline: 2px solid var(--heritage-purple, #5B2C8A);
  outline-offset: 2px;
}

.fc-starter-chip-active {
  border-color: var(--heritage-purple, #5B2C8A);
  border-width: 2px;
  background: rgba(91, 44, 138, 0.06);
}

.fc-starter-icon { font-size: 1.1rem; line-height: 1.2; flex-shrink: 0; }

.fc-starter-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.fc-starter-name { font-weight: 600; font-size: 0.88rem; }

.fc-starter-desc {
  font-size: 0.78rem;
  color: var(--ink-mute, #666);
  line-height: 1.35;
}

.fc-starter-cols {
  font-size: 0.74rem;
  color: var(--heritage-purple, #5B2C8A);
  font-weight: 600;
}

/* ─── History: stored-output download ──────────────────────────────────── */
/* A row either has a real file behind it (link) or honestly says it doesn't
   (muted label). There is deliberately no third, clickable-but-dead state. */

.fc-output-link {
  color: var(--heritage-purple, #5B2C8A);
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
}

.fc-output-link:hover { text-decoration: underline; }

.fc-not-retained {
  font-size: 0.78rem;
  font-style: italic;
  opacity: 0.7;
  cursor: help;
}

/* ─── Results: download CTA hierarchy ────────────────────────────────── */

.fc-result-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

/* Completeness signals (Complete Read v1) ------------------------------- */
/* How completely the SOURCE was read — chunking, weak pages, engine. These sit
   between the AI meta bar and the success banner so the user sees "here is how
   I read your file" before "here is your file".

   `flex-wrap: wrap` is load-bearing, not cosmetic: an engine name plus an
   8-number weak-page list overflows 375px, and this module's own polish tests
   forbid a horizontal-scroll regression. Chips wrap into rows instead. */

.fc-completeness {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.fc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
  /* Let a long engine list break rather than push the panel wide. */
  min-width: 0;
  overflow-wrap: anywhere;
  background: var(--surface-soft, #f5f5f5);
  color: var(--ink-soft, #555);
  border: 1px solid transparent;
  cursor: help;
}

/* Chunked is INFORMATIONAL, not a warning — chunking is the good outcome (we
   read the whole document instead of truncating it). Purple, not gold. */
.fc-chip-chunked {
  background: rgba(91, 44, 138, 0.08);
  color: var(--heritage-purple, #5B2C8A);
  border-color: rgba(91, 44, 138, 0.18);
}

/* Weak pages IS a caution: those pages had little extractable text, so numbers
   from them deserve a human glance. Gold language, same as .fc-warnings. */
.fc-chip-weak {
  background: rgba(212, 168, 67, 0.13);
  color: #8a6100;
  border-color: rgba(212, 168, 67, 0.35);
}

/* AUDIT#1 C-5: TRUNCATED is the strongest caution this row can carry — rows are
   actually MISSING. Same gold family as weak pages (this is a "look at this",
   not a hard error — the file is still usable), but heavier weight and a solid
   border so it reads as the dominant chip when both are present. Deliberately
   NOT red: red says "failed", and the conversion did not fail, it under-read. */
.fc-chip-truncated {
  background: rgba(212, 168, 67, 0.22);
  color: #7a5500;
  border-color: rgba(212, 168, 67, 0.6);
  font-weight: 700;
}

.fc-chip-engine,
.fc-chip-pages {
  background: var(--surface-soft, #f5f5f5);
  color: var(--ink-soft, #555);
  border-color: var(--border, #e5e5e5);
}

/* History row: completeness rides UNDER the filename rather than adding an
   eleventh column to an already-10-column table. */
.fc-h-complete {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.75;
  color: var(--heritage-purple, #5B2C8A);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Complete Read v2: conflict chips ──────────────────────────────────

   A conflict is a DECISION the converter made that changed the shape of the
   data — a money column it refused to merge, headers it folded together, a cap
   it hit. Until v2 these lived only in the generic "things to check" list where
   a skipped money column read like a footnote. Own row, above the banner, so it
   is seen before the file is downloaded.

   Deliberately a DIFFERENT row from .fc-completeness: that row answers "how did
   you read it", this one answers "what did you change". Merging them would let a
   neutral "37 pages read" chip sit beside "money column skipped" at equal
   weight. */

.fc-conflicts {
  display: flex;
  flex-wrap: wrap;   /* load-bearing, same reason as .fc-completeness */
  gap: 6px;
  margin-top: 8px;
}

/* Gold caution, heavier than the weak-pages chip: this is not "look twice at
   these numbers", it is "a column you expected is not in the output". Still not
   red — the file converted; a decision inside it needs review. */
.fc-chip-conflict {
  background: rgba(212, 168, 67, 0.2);
  color: #7a5500;
  border-color: rgba(212, 168, 67, 0.55);
  font-weight: 700;
}

/* The overflow chip is a control-ish affordance (its tooltip holds the hidden
   sentences), so it reads quieter than a real conflict. */
.fc-chip-conflict-more {
  background: rgba(212, 168, 67, 0.1);
  font-weight: 600;
}

/* ─── Complete Read v2: partial-read banner ─────────────────────────────

   THE ONE RED THING IN THIS MODULE. Red is reserved for "content is missing
   from the file you are about to download" — not for weak pages, not for
   chunking, not for a failed Drive upload. If anything else ever turns red,
   this banner stops meaning what it means.

   A clean read renders NOTHING here (renderPartialBanner returns ''), which is
   why there is no matching success style: success must look exactly like v1. */

.fc-partial-banner {
  margin-top: 12px;
  border-left: 4px solid var(--danger, #c81e1e);
  background: rgba(200, 30, 30, 0.06);
}

.fc-partial-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--danger, #c81e1e);
  font-size: 1rem;
}

.fc-partial-icon { font-size: 1.1rem; }

.fc-partial-sub {
  margin-top: 4px;
  color: var(--ink, #1a1a1a);
  font-size: 0.9rem;
  line-height: 1.5;
}

.fc-partial-reasons {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--ink-soft, #555);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* The summary banner keeps its layout on a partial read but must not read as a
   celebration — the ✅ is swapped for ⚠️ in the JS and the purple/gold wash is
   neutralized here so the red banner above it stays the loudest thing. */
.fc-summary-partial {
  background: rgba(0, 0, 0, 0.02) !important;
  border-left: 4px solid rgba(200, 30, 30, 0.35);
}

/* ─── Complete Read v2: weak-page re-read ───────────────────────────────

   Sits directly BELOW the download banner: the user should see their file
   first, then the offer to improve it. Above the banner it would read as a
   blocker ("do this before you can download"), which is false — the current
   result is already downloadable and the re-read never touches it. */

.fc-reread {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  border-left: 4px solid var(--heritage-purple, #5B2C8A);
  background: rgba(91, 44, 138, 0.04);
}

.fc-reread-copy { flex: 1 1 260px; min-width: 0; }

.fc-reread-title {
  font-weight: 600;
  color: var(--ink, #1a1a1a);
}

.fc-reread-sub {
  margin-top: 3px;
  color: var(--ink-soft, #555);
  font-size: 0.87rem;
  line-height: 1.5;
}

.fc-reread-actions { flex: 0 0 auto; }

/* Outcome line is full-width beneath both: it can be a two-clause sentence
   ("pages 12–13 recovered · page 14 still unreadable") that must never be
   ellipsized — the second clause is the honest half. */
.fc-reread-outcome { flex: 1 1 100%; }

.fc-reread-result {
  margin-top: 4px;
  font-size: 0.87rem;
  line-height: 1.5;
  font-weight: 600;
}

.fc-reread-result-ok      { color: #1f7a3d; }
.fc-reread-result-partial { color: #8a6100; }
.fc-reread-result-err     { color: var(--danger, #c81e1e); }

/* AUDIT#1 B-MED1: which pages THIS click covers, and how many remain. The panel
   used to imply one button re-read every weak page, which 413'd above the cap. */
.fc-reread-batch-note {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--text-muted, #6b7280);
}

/* AUDIT#1 B1: the money gate refused to merge. This is a FAILURE surface, not a
   success one — the recovered rows are offered as a separate download so a
   recovered amount is never silently dropped behind a green toast. */
.fc-reread-refused-why {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--text-muted, #6b7280);
}
.fc-reread-only-dl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.875rem;
}

/* ─── Complete Read v2: history "reuse" action ──────────────────────────

   Rides in the EXISTING "File" cell beside Download — not a new 11th column
   (the mobile card layout keys off the 10 data-labelled cells), and NOT in the
   actions cell: on mobile that cell is position:absolute in the card's top-right
   corner with exactly 48px reserved for the ✕, so a second control there would
   render on top of the "When" text. Both controls in this cell are
   non-destructive, which is also why the destructive ✕ stays isolated. */
.fc-convert-like { margin-left: 6px; }

/* The success banner is the moment the user came for. Make the download read
   as the primary action, not as one of two equal ghost buttons. */
.fc-result-actions .btn-primary { font-weight: 600; }

/* Warnings block: this used to be muted body text that people scrolled past.
   It is now a real callout — same weight as the result, gold rail. */
.fc-warnings {
  margin-top: 12px;
  border-left: 4px solid var(--heritage-gold, #D4A843);
  background: rgba(212, 168, 67, 0.07);
}

.fc-warnings-title {
  font-weight: 600;
  color: var(--ink, #1a1a1a);
}

.fc-warnings ul {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--ink-soft, #555);
  line-height: 1.6;
}

/* ─── Batch summary rows ────────────────────────────────────────────── */

.fc-batch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.fc-batch-tick { color: var(--success, #2e7d32); flex: 0 0 auto; }

.fc-batch-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-batch-rows { flex: 0 0 auto; font-size: 0.8rem; }
.fc-batch-row .fc-batch-download { flex: 0 0 auto; }

/* ═══════════════════════════════════════════════════════════════
   MOBILE
   Targets: 390×844 (iPhone 14), 375×812 (iPhone 13 mini / X), 320 (SE).
   Rule of the file: nothing may cause horizontal PAGE scroll. Wide content
   scrolls inside its own container or restacks.
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {

  /* Starter chips single-column so descriptions stay readable. */
  .fc-starter-grid { grid-template-columns: 1fr; }

  /* Format cards: 2-up compact. minmax(210px) would force a single column at
     375px AND overflow at 320px — an explicit 2-col grid is predictable. */
  .fc-format-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .fc-format-card {
    padding: 10px 11px;
    min-height: 44px;              /* thumb-friendly tap target */
  }

  .fc-format-card-row { flex-wrap: wrap; gap: 6px; }
  .fc-format-name { font-size: 0.9rem; }
  .fc-format-ext  { font-size: 0.7rem; }

  /* Descriptions are the first thing to go on a phone — the label + extension
     already say what the format is. */
  .fc-format-desc { display: none; }

  /* Toolbar restacks: primary CTA full-width, secondary actions share a row. */
  .fc-toolbar { gap: 10px; }

  .fc-toolbar-actions {
    width: 100%;
    gap: 8px;
  }

  .fc-toolbar-actions > #fc-convert-btn {
    flex: 1 1 100%;
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .fc-toolbar-actions > .btn:not(#fc-convert-btn) {
    flex: 1 1 0;
    justify-content: center;
    min-height: 44px;
  }

  .fc-readiness {
    flex: 1 1 100%;
    white-space: normal;           /* on its own row it can breathe */
    order: 3;
  }

  .fc-drive-slot {
    flex: 1 1 100%;
    order: 4;
  }

  /* Drive toggle is a control, not a caption — give it a real hit area. */
  .fc-drive-label { min-height: 44px; }
  .fc-drive-label input[type="checkbox"] { width: 18px; height: 18px; }

  /* Saved-template picker stacks so the select isn't squeezed to ~90px. */
  .fc-saved-row { flex-wrap: wrap; }
  .fc-saved-row .form-select { flex: 1 1 100%; }
  .fc-saved-row .btn { flex: 0 0 auto; min-height: 40px; }

  /* Result preview: shorter viewport → shorter table before internal scroll. */
  .fc-table-wrap { max-height: 320px; }
  .fc-table tbody td { max-width: 200px; }
  .fc-raw-preview { max-height: 240px; font-size: 0.74rem; }

  /* ── History → card list ──────────────────────────────────────────
     A 10-column table cannot be made usable at 375px by scrolling alone — the
     Download control would live permanently off-screen, which is the ONE
     control this module exists to deliver. Each row becomes a card and every
     cell carries its own label via data-label. */

  .fc-history-wrap {
    overflow-x: visible;
    border: 0;
    border-radius: 0;
  }

  .fc-history-table-wrap {
    max-height: none;
    overflow-y: visible;
  }

  .fc-history-table,
  .fc-history-table tbody,
  .fc-history-table tr,
  .fc-history-table td {
    display: block;
    width: auto;
  }

  /* Header row is meaningless once cells are labelled individually. */
  .fc-history-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .fc-history-table tr {
    position: relative;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--surface, #fff);
  }

  .fc-history-table tr:last-child { margin-bottom: 0; }

  .fc-history-table tbody td {
    border: 0;
    padding: 3px 0;
    white-space: normal;
    max-width: none;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 0.86rem;
  }

  .fc-history-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ink-mute, #888);
  }

  /* Cells with no label (the delete action) shouldn't render an empty rail. */
  .fc-history-table tbody td:not([data-label])::before { content: none; }

  .fc-history-table tbody td.num { text-align: right; }

  .fc-history-table tbody td.fc-h-source {
    max-width: none;
    overflow: hidden;
  }

  /* The source filename is the card's identity — promote it, drop its label. */
  .fc-history-table tbody td.fc-h-source { font-weight: 600; }

  /* Download must be unmissable on a phone: full-width pill, 44px tall.
     v2: the cell wraps so the Reuse control can drop to its own line at the
     narrowest widths instead of crushing the Download pill. */
  .fc-history-table tbody td.fc-h-file { padding-top: 8px; flex-wrap: wrap; }

  .fc-history-table .fc-output-link {
    flex: 1 1 auto;
    text-align: center;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(91, 44, 138, 0.09);
    border: 1px solid rgba(91, 44, 138, 0.28);
    font-size: 0.86rem;
  }

  /* Delete moves to the card corner so it can't be fat-fingered while
     reaching for Download. */
  .fc-history-table tbody td.fc-h-actions {
    position: absolute;
    top: 2px;
    right: 4px;
    padding: 0;
    display: block;
  }

  /* The delete button is absolutely positioned over the card's top-right
     corner, which is the same band the first cell ("When") occupies. Reserve
     that corner so the relative-time value can never render underneath the ✕.
     Must stay >= the button's hit target + its right offset. */
  .fc-history-table tbody td.fc-h-when { padding-right: 48px; }

  .fc-history-table .fc-delete-log {
    min-width: 44px;
    min-height: 44px;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  /* History card header: refresh button drops below the title text. */
  .fc-history-head { flex-wrap: wrap; }
  .fc-history-head .btn { min-height: 40px; }

  /* Batch/result rows: give the per-file download room instead of crushing
     the filename to three characters. */
  .fc-result-actions { width: 100%; }
  .fc-result-actions .btn { flex: 1 1 0; justify-content: center; min-height: 44px; }

  /* Per-file batch rows wrap: name on top, download full-width beneath. */
  .fc-batch-row { flex-wrap: wrap; row-gap: 6px; }
  .fc-batch-name { flex: 1 1 auto; }
  .fc-batch-row .fc-batch-download {
    flex: 1 1 100%;
    justify-content: center;
    min-height: 40px;
  }

  /* Queue list items: filename ellipsizes, remove stays reachable. */
  #fc-queue li { gap: 6px; }

  /* v2 re-read: the CTA drops to its own full-width row instead of being
     squeezed to three characters beside the explanation. */
  .fc-reread-actions { width: 100%; }
  .fc-reread-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  /* v2 history reuse button: real tap target, sitting beside the full-width
     Download pill in the File cell (which is already a flex row on mobile). */
  .fc-history-table .fc-convert-like {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.86rem;
  }
}

/* Narrow phones (iPhone SE class, 320–400px). */
@media (max-width: 400px) {
  /* One format per row — two columns at 320px leaves ~140px per card, which
     truncates every label. */
  .fc-format-grid { grid-template-columns: 1fr; }

  .fc-history-table tr { padding: 9px 10px; }
  .fc-history-table tbody td { font-size: 0.84rem; }
  .fc-table-wrap { max-height: 260px; }

  /* At 320px a weak-page list can still be the widest thing on screen. Let it
     wrap inside the chip instead of widening the results panel. */
  .fc-chip { white-space: normal; }
  .fc-h-complete { white-space: normal; }

  /* v2: at 320px the Download pill plus the Reuse button cannot share a line.
     Let Reuse drop beneath it rather than shrinking both to icons. */
  .fc-history-table .fc-convert-like {
    margin-left: 0;
    margin-top: 6px;
    flex: 1 1 100%;
  }
}

/* Safe area: keep the primary CTA and the last history card clear of the
   iOS home indicator when the module is the bottom of the scroll. */
@supports (padding: max(0px)) {
  @media (max-width: 640px) {
    [data-module="file-convert"] .fc-history-card {
      margin-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }
  }
}
/* ============================================================
   19-seo-intelligence.css
   SEO / Agentic Search Intelligence module
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ============================================================
   SEO / Agentic Search Intelligence (Module: seo-intelligence)
   ============================================================ */

.seo-bigscore {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--font-display, 'ABC Arizona Flare', 'Playfair Display', serif);
}

.seo-bigscore-num { font-size: 2rem; font-weight: 700; line-height: 1; }

.seo-bigscore-label { font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.78; margin-top: 4px; }

.seo-score-high { background: rgba(45,140,60,0.14); color: var(--success-deep, #2d8c3c); border: 1px solid rgba(45,140,60,0.28); }

.seo-score-mid  { background: rgba(212,168,67,0.18); color: #8a6a1f; border: 1px solid rgba(212,168,67,0.35); }

.seo-score-low  { background: rgba(192,57,43,0.14); color: var(--danger, #c0392b); border: 1px solid rgba(192,57,43,0.30); }

.seo-mini-score {
  display: inline-block;
  min-width: 38px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.86rem;
  text-align: center;
}

.seo-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

.seo-badge-first { background: rgba(45,140,60,0.18); color: var(--success-deep, #2d8c3c); border: 1px solid rgba(45,140,60,0.32); }

.seo-badge-top   { background: rgba(45,140,60,0.10); color: var(--success-deep, #2d8c3c); border: 1px solid rgba(45,140,60,0.24); }

.seo-badge-ok    { background: rgba(91,44,138,0.10); color: var(--heritage-purple, #5B2C8A); border: 1px solid rgba(91,44,138,0.20); }

.seo-badge-miss  { background: rgba(192,57,43,0.12); color: var(--danger, #c0392b); border: 1px solid rgba(192,57,43,0.28); }

.seo-acc { font-weight: 600; }

.seo-acc-high { color: var(--success-deep, #2d8c3c); }

.seo-acc-mid  { color: #8a6a1f; }

.seo-acc-low  { color: var(--danger, #c0392b); }

.seo-comp-chip {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 4px;
  background: rgba(0,0,0,0.05);
  color: var(--ink-soft, #444);
  font-size: 0.78rem;
}

.seo-comp-chip-lkk {
  background: rgba(204,0,0,0.10);
  color: var(--heritage-red, #CC0000);
  font-weight: 600;
}

.seo-response-box {
  padding: 12px 14px;
  background: var(--surface-soft, #f8f6f0);
  border-left: 3px solid var(--heritage-purple, #5B2C8A);
  border-radius: 6px;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 240px;
  overflow-y: auto;
}

.seo-gap-card,
.seo-brief-card {
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid;
}

.seo-gap-card   { background: rgba(212,168,67,0.10); border-left-color: var(--heritage-gold, #D4A843); }

.seo-brief-card { background: rgba(91,44,138,0.07);  border-left-color: var(--heritage-purple, #5B2C8A); }

.seo-gap-title, .seo-brief-title { font-weight: 600; font-size: 0.86rem; margin-bottom: 4px; }

.seo-gap-body, .seo-brief-body { font-size: 0.88rem; line-height: 1.5; color: var(--ink, #1a1a1a); }

.seo-aggregate-stats { display: flex; flex-direction: column; gap: 4px; font-size: 0.96rem; }

.seo-aggregate-stats strong { color: var(--heritage-purple, #5B2C8A); font-size: 1.1rem; }

.seo-summary-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.seo-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 600;
}

.seo-chip-first   { background: rgba(45,140,60,0.16); color: var(--success-deep, #2d8c3c); }

.seo-chip-mention { background: rgba(91,44,138,0.10); color: var(--heritage-purple, #5B2C8A); }

.seo-chip-total   { background: rgba(0,0,0,0.05); color: var(--ink-soft, #555); }

.spinner-inline {
  display: inline-block;
  width: 12px; height: 12px;
  border-width: 2px;
  vertical-align: middle;
  margin-right: 6px;
}

/* ============================================================
   Extracted from public/js/ui/seo-intelligence.js — ensureSeoInlineStyles()
   Inline card visuals for category scores + competitive gap matrix.
   ============================================================ */

.seo-inline-card {
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 16px;
}

.seo-inline-card h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
}

.seo-inline-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.seo-inline-card table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-mute, #888);
  text-transform: uppercase;
}

.seo-inline-card table td {
  padding: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.seo-inline-card .seo-cat-row.win td { background: rgba(46, 204, 113, 0.04); }
.seo-inline-card .seo-cat-row.loss td { background: rgba(204, 0, 0, 0.04); }
.seo-inline-card .seo-cat-gap { font-weight: 700; }
.seo-inline-card .seo-cat-gap.win { color: #2ecc71; }
.seo-inline-card .seo-cat-gap.loss { color: #ff6b6b; }
.seo-inline-card .seo-cat-trend.up { color: #2ecc71; }
.seo-inline-card .seo-cat-trend.down { color: #ff6b6b; }
.seo-inline-card .seo-cat-trend.flat { color: var(--text-mute, #888); }

.seo-inline-card .seo-strategy {
  margin-top: 14px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
}

.seo-inline-card .seo-strategy li { margin: 4px 0; }

.seo-inline-card .source-cite {
  font-size: 11px;
  color: var(--text-mute, #888);
  font-style: italic;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.seo-empty-state {
  padding: 14px;
  font-size: 12px;
  color: var(--text-mute, #888);
  font-style: italic;
}

/* ============================================================
   MULTI-ENGINE PROBE (2026-05-24)
   Engine grid: ChatGPT · GPT-5.5 (OpenAI only since 2026-12-01; Grok,
   DeepSeek and Meta AI are retired and appear only in saved probes)
   Each card uses --engine-accent set inline.
   ============================================================ */

.seo-probe-shell {
  margin-top: 16px;
  padding: 16px;
  background: var(--eggshell, #faf6ed);
  border: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
  border-radius: 14px;
}

.seo-probe-shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.seo-probe-shell-title {
  margin: 0;
  font-family: var(--font-display, 'ABC Arizona Flare', 'Playfair Display', serif);
  font-size: 1.15rem;
  color: var(--heritage-red, #cc0000);
}

.seo-probe-shell-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text-mute, #777);
}

.seo-engine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.seo-engine-card {
  background: #fff;
  border: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
  border-left: 4px solid var(--engine-accent, #888);
  border-radius: 10px;
  padding: 12px 14px;
  transition: box-shadow 180ms ease, transform 180ms ease;
  position: relative;
  overflow: hidden;
}

.seo-engine-card-done {
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.seo-engine-card-done:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.seo-engine-card-error {
  opacity: 0.7;
  background: rgba(0,0,0,0.02);
}

/* Saved probe row from a retired engine (read-only history). */
.seo-engine-card-retired {
  opacity: 0.75;
  filter: grayscale(0.6);
}

.seo-engine-retired-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(0,0,0,0.08);
  color: var(--text-muted, #666);
  vertical-align: middle;
}

.seo-engine-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.seo-engine-icon {
  font-size: 1.3rem;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--engine-accent, #888);
  color: #fff;
  border-radius: 6px;
  flex-shrink: 0;
}

.seo-engine-meta { flex: 1; min-width: 0; }

.seo-engine-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-strong, #222);
  line-height: 1.2;
}

.seo-engine-deploy {
  font-size: 0.72rem;
  color: var(--text-mute, #888);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -0.01em;
}

.seo-engine-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-mute, #777);
}

.seo-engine-status[data-status="error"] {
  color: var(--danger, #c0392b);
}

.seo-engine-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--engine-accent, #888);
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: seo-engine-spin 0.8s linear infinite;
}

@keyframes seo-engine-spin {
  to { transform: rotate(360deg); }
}

.seo-engine-score-wrap {
  text-align: right;
  flex-shrink: 0;
}

.seo-engine-score {
  font-family: var(--font-display, 'ABC Arizona Flare', 'Playfair Display', serif);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 8px;
  display: inline-block;
  min-width: 50px;
  text-align: center;
}

.seo-engine-score-label {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute, #888);
  margin-top: 2px;
}

.seo-engine-body {
  font-size: 0.86rem;
  color: var(--text, #333);
}

.seo-engine-loading {
  font-size: 0.82rem;
  color: var(--text-mute, #888);
  font-style: italic;
}

.seo-engine-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.seo-engine-latency {
  font-size: 0.74rem;
  color: var(--text-mute, #888);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.seo-engine-section {
  margin-top: 8px;
}

.seo-engine-section-label {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-mute, #888);
  margin-bottom: 4px;
}

.seo-engine-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.seo-engine-response {
  margin-top: 10px;
  border-top: 1px dashed var(--border-subtle, rgba(0,0,0,0.08));
  padding-top: 8px;
}

.seo-engine-response summary {
  font-size: 0.82rem;
  color: var(--engine-accent, #888);
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}

.seo-engine-response-body {
  margin-top: 8px;
  padding: 10px;
  background: rgba(0,0,0,0.03);
  border-radius: 6px;
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text, #333);
  max-height: 280px;
  overflow-y: auto;
}

.seo-engine-gap,
.seo-engine-brief {
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.03);
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.4;
}

.seo-engine-gap { border-left: 3px solid var(--warning, #d4a843); }
.seo-engine-brief { border-left: 3px solid var(--engine-accent, #888); }

.seo-engine-error {
  padding: 8px 10px;
  background: rgba(192, 57, 43, 0.06);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--danger, #c0392b);
  font-style: italic;
}

.seo-engine-done-badge {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(45,140,60,0.12);
  color: var(--success-deep, #2d8c3c);
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ── Composite block (synthesis output) ──────────────────── */

.seo-composite {
  background: linear-gradient(135deg, rgba(204,0,0,0.04) 0%, rgba(91,44,138,0.04) 100%);
  border: 1px solid var(--border-subtle, rgba(0,0,0,0.10));
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.seo-composite-headline {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.seo-composite-score {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  padding: 14px 18px;
  border-radius: 12px;
  font-family: var(--font-display, 'ABC Arizona Flare', 'Playfair Display', serif);
  border: 2px solid currentColor;
}

.seo-composite-num {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
}

.seo-composite-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.78;
  margin-top: 4px;
}

.seo-composite-meta {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 220px;
}

.seo-composite-stat { display: flex; flex-direction: column; }

.seo-composite-stat-num {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-strong, #222);
}

.seo-composite-stat-label {
  font-size: 0.72rem;
  color: var(--text-mute, #888);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.seo-consistency-high   { color: var(--success-deep, #2d8c3c); }
.seo-consistency-medium { color: #8a6a1f; }
.seo-consistency-low    { color: var(--danger, #c0392b); }

.seo-composite-insight,
.seo-composite-rec {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.seo-composite-insight-label,
.seo-composite-rec-label {
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--heritage-red, #cc0000);
}

.seo-composite-lift {
  font-size: 0.78rem;
  color: var(--text-mute, #777);
  font-style: italic;
}

.seo-composite-actions {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.04);
  border-radius: 8px;
}

.seo-composite-actions summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--heritage-purple, #5b2c8a);
}

.seo-composite-actions ul {
  margin: 8px 0 0 20px;
  padding: 0;
  font-size: 0.84rem;
  line-height: 1.6;
}

.seo-composite-consensus {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.03);
  border-radius: 6px;
  font-size: 0.84rem;
}

.seo-composite-consensus-label {
  display: inline-block;
  margin-right: 6px;
  font-weight: 600;
  color: var(--text-mute, #666);
}

.seo-batch-progress {
  margin-top: 10px;
  width: 100%;
  height: 4px;
  background: rgba(0,0,0,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.seo-batch-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--heritage-red, #cc0000), var(--heritage-purple, #5b2c8a));
  transition: width 240ms ease;
}

.spinner-sm {
  width: 12px;
  height: 12px;
  display: inline-block;
  vertical-align: -2px;
}

/* ── Dark mode adjustments ──────────────────────────────── */
/* App theme: [data-theme="dark"] rules live in 90-dark-mode.css
   (was @media prefers-color-scheme — OS-keyed anti-pattern). */

/* Class-based dark mode (some sites toggle .dark on <html>) */
html.dark .seo-probe-shell,
.dark-mode .seo-probe-shell {
  background: var(--surface-1, #1a1a1f);
  border-color: rgba(255,255,255,0.08);
}
html.dark .seo-engine-card,
.dark-mode .seo-engine-card {
  background: var(--surface-2, #22222a);
  border-color: rgba(255,255,255,0.08);
}
html.dark .seo-engine-name,
.dark-mode .seo-engine-name { color: #f0f0f0; }
html.dark .seo-engine-body,
.dark-mode .seo-engine-body { color: #ccc; }
html.dark .seo-engine-response-body,
html.dark .seo-engine-gap,
html.dark .seo-engine-brief,
html.dark .seo-composite-actions,
html.dark .seo-composite-consensus,
.dark-mode .seo-engine-response-body,
.dark-mode .seo-engine-gap,
.dark-mode .seo-engine-brief,
.dark-mode .seo-composite-actions,
.dark-mode .seo-composite-consensus {
  background: rgba(255,255,255,0.04);
  color: #ccc;
}
html.dark .seo-composite,
.dark-mode .seo-composite {
  background: linear-gradient(135deg, rgba(204,0,0,0.10) 0%, rgba(91,44,138,0.10) 100%);
  border-color: rgba(255,255,255,0.1);
}
html.dark .seo-composite-stat-num,
.dark-mode .seo-composite-stat-num { color: #f0f0f0; }
html.dark .seo-composite-insight,
html.dark .seo-composite-rec,
.dark-mode .seo-composite-insight,
.dark-mode .seo-composite-rec {
  background: rgba(255,255,255,0.04);
}
/* ============================================================
   20-deductions.css
   Deductions Extractor module
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ============================================================
   Deductions Extractor (Module: deductions)
   ============================================================ */

.ded-table tbody tr.ded-row-dispute td,
.ded-extract-table tbody tr.ded-row-dispute td {
  box-shadow: inset 3px 0 0 var(--danger, #c0392b);
  background: rgba(192,57,43,0.03);
}

.ded-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ded-status-pending   { background: rgba(212,168,67,0.18); color: #8a6a1f; border: 1px solid rgba(212,168,67,0.35); }

.ded-status-accepted  { background: rgba(120,120,120,0.12); color: var(--ink-soft, #555); border: 1px solid rgba(120,120,120,0.25); }

.ded-status-disputed  { background: rgba(192,57,43,0.14); color: var(--danger, #c0392b); border: 1px solid rgba(192,57,43,0.30); }

.ded-status-resolved  { background: rgba(45,140,60,0.12); color: var(--success-deep, #2d8c3c); border: 1px solid rgba(45,140,60,0.30); }

.ded-reason-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 500;
  background: rgba(91,44,138,0.08);
  color: var(--heritage-purple, #5B2C8A);
}

.ded-reason-unknown {
  background: rgba(192,57,43,0.10);
  color: var(--danger, #c0392b);
}

.ded-dispute-flag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  background: rgba(192,57,43,0.12);
  color: var(--danger, #c0392b);
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

.ded-summary-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.ded-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 600;
}

.ded-chip-dispute { background: rgba(192,57,43,0.14); color: var(--danger, #c0392b); }

.ded-chip-pending { background: rgba(212,168,67,0.18); color: #8a6a1f; }

.ded-chip-total   { background: rgba(0,0,0,0.05); color: var(--ink-soft, #555); }

.ded-mini-input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--border-soft, #f0f0f0);
  border-radius: 4px;
  background: transparent;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--ink, #1a1a1a);
}

.ded-mini-input:focus {
  outline: none;
  border-color: var(--heritage-purple, #5B2C8A);
  background: var(--surface, #fff);
}

.ded-mini-num { text-align: right; }

.ded-extract-table { font-size: 0.84rem; }

.ded-extract-table thead th { font-size: 0.74rem; }

.ded-extract-table tbody td { padding: 4px 6px; vertical-align: middle; }

/* ============================================================
   Extracted from public/js/ui/deductions.js — ensureDedInlineStyles()
   Inline card visuals for Deductions Recovery Dashboard.
   ============================================================ */

.ded-inline-card {
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 16px;
}

.ded-inline-card h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
}

.ded-inline-card .metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.ded-inline-card .metric {
  padding: 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
}

.ded-inline-card .metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent, #d4a843);
}

.ded-inline-card .metric-label {
  font-size: 11px;
  color: var(--text-mute, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ded-inline-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ded-inline-card table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-mute, #888);
  text-transform: uppercase;
}

.ded-inline-card table td {
  padding: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.ded-inline-card .source-cite {
  font-size: 11px;
  color: var(--text-mute, #888);
  font-style: italic;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.ded-empty-state {
  padding: 14px;
  font-size: 12px;
  color: var(--text-mute, #888);
  font-style: italic;
}

/* ── Distributor Backups (Davidson) ───────────────────────────────── */
.ded-backup-empty {
  padding: 16px 14px;
  font-size: 13px;
  color: var(--text-mute, #888);
  text-align: center;
  border: 1px dashed var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  margin-top: 12px;
}

.ded-backup-charge {
  border: 1px solid var(--border-subtle, #eee);
  padding: 6px 8px;
  margin: 4px 0;
  border-radius: 4px;
  font-size: 12px;
}

/* Mobile: stack the Distributor Backups upload controls + results so they
   never overflow the card on narrow viewports. */
@media (max-width: 768px) {
  #ded-backups-card {
    margin-top: 16px;
  }
  #ded-backups-card .ded-backup-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  #ded-backups-card .ded-backup-controls .btn {
    width: 100%;
  }
  #ded-backups-card .ded-backup-controls #ded-backup-status {
    margin-left: 0;
    text-align: center;
  }
  #ded-backup-result,
  #ded-backup-export {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #ded-backup-export .btn {
    width: 100%;
  }
  .ded-backup-charge {
    font-size: 11px;
    word-break: break-word;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   DEDUCTIONS TAB SPLIT — Workbench (Fanny/Jarcinio) | Distributor Backups (Greg)
   CSS-only tabs. Heritage Red active indicator. Mobile: scrollable.
   ───────────────────────────────────────────────────────────────────── */
.ded-tabs {
  display: flex;
  gap: 4px;
  margin: 4px 0 20px;
  border-bottom: 1px solid #e5e5e5;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ded-tabs::-webkit-scrollbar { display: none; }

.ded-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.ded-tab:hover { color: #374151; }
.ded-tab .ded-tab-emoji { font-size: 16px; line-height: 1; }

.ded-tab.is-active {
  color: var(--heritage-red, #CC0000);
  border-bottom-color: var(--heritage-red, #CC0000);
}

.ded-tab-pane[hidden] { display: none !important; }

/* aiop-pr223-fix-1016 (H1): the "Attach documents" label is a .btn, and
   .btn { display:inline-flex } outranks the UA [hidden] rule, so without this
   kill every reader saw the button. Writers get it via label.hidden = false. */
#ded-wb-docs-attach[hidden] { display: none !important; }

/* feedback #510 (2026-10-29): the same rule for every workbench button.
   Without it, "Download ZIFI0074", "Reopen for changes" and the empty merge
   button showed on checks that were never approved, and "Review & approve"
   stayed on approved ones. A manager clicked Download on an AR-only check,
   got a page saying the check was approved, and the server refused the file. */
#ded-pane-workbench .btn[hidden] { display: none !important; }

@media (max-width: 640px) {
  .ded-tabs { gap: 0; }
  .ded-tab {
    flex: 1 0 auto;
    justify-content: center;
    padding: 11px 14px;
    font-size: 13px;
  }
}

/* ── W1 Lane B: adapter-fallback transparency ────────────────────────
   Shown when no adapter recognized a backup and the Davidson template
   parsed it anyway. The amounts on screen may be wrong, so this reads as
   a warning (amber), not an info chip. */
.ded-bk-fallback-warn {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0 4px;
  padding: 11px 13px;
  border: 1px solid #E0A800;
  border-left: 4px solid #E0A800;
  border-radius: 6px;
  background: #FFF8E5;
  color: #5A4300;
}
.ded-bk-fallback-warn .ded-warn-icon { font-size: 17px; line-height: 1.2; }
.ded-bk-fallback-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}
.ded-bk-fallback-body { font-size: 12.5px; line-height: 1.45; }

.ded-bk-fallback-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid #E0A800;
  border-radius: 9px;
  background: #FFF8E5;
  color: #5A4300;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}

@media (prefers-color-scheme: dark) {
  .ded-bk-fallback-warn { background: #3A2E05; color: #FFE7A3; border-color: #B98A00; border-left-color: #B98A00; }
  .ded-bk-fallback-chip { background: #3A2E05; color: #FFE7A3; border-color: #B98A00; }
}
/* ============================================================
   20-logistics-intelligence.css
   Logistics Intelligence module — tabs, metric cards, tables,
   upload progress, share bars. Mirrors the deductions tab UX +
   sales-analytics metric-card pattern.
   Heritage Red #E02923 accent · Purple #5C087E headings.
   ============================================================ */

/* ── Toolbar / period selector ───────────────────────────── */
.li-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.li-period-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.li-period-wrap .filter-select {
  min-width: 200px;
}
.li-period-banner {
  font-size: 12px;
  color: var(--text-mute, #6b6b6b);
  margin-bottom: 12px;
  font-family: var(--font-mono, monospace);
}

/* ── Tab bar (mirrors .ded-tabs) ─────────────────────────── */
.li-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--border, #e5e2dc);
  margin-bottom: 18px;
}
.li-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-mute, #6b6b6b);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.li-tab:hover { color: var(--text, #2a2a2a); }
.li-tab.is-active {
  color: var(--heritage-red, #E02923);
  border-bottom-color: var(--heritage-red, #E02923);
  font-weight: 600;
}
.li-tab-emoji { font-size: 15px; }

.li-pane { min-height: 200px; }

/* ── Metric card grid (mirrors sales-analytics) ──────────── */
.li-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.li-metric-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e2dc);
  border-left: 4px solid var(--border, #e5e2dc);
  border-radius: 10px;
  padding: 16px 18px;
}
.li-metric-value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text, #2a2a2a);
  font-variant-numeric: tabular-nums;
}
.li-metric-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-mute, #6b6b6b);
  margin-top: 6px;
}
.li-metric-sub {
  font-size: 11px;
  margin-top: 4px;
}
/* Tone accents on the left border + value color */
.li-tone-success { border-left-color: #1B7F38; }
.li-tone-success .li-metric-value { color: #1B7F38; }
.li-tone-important { border-left-color: var(--gold, #D4A843); }
.li-tone-urgent { border-left-color: var(--heritage-red, #E02923); }
.li-tone-urgent .li-metric-value { color: var(--heritage-red, #E02923); }
.li-tone-info { border-left-color: var(--purple, #5C087E); }
.li-tone-neutral { border-left-color: #b9b4ab; }

/* ── Cards / titles ──────────────────────────────────────── */
.li-pane .card-title {
  color: var(--purple, #5C087E);
}
.li-briefing-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text, #2a2a2a);
}
.li-md-h1 { margin: 0 0 10px; font-family: var(--font-serif, Georgia, serif); font-style: italic; font-size: 1.35rem; color: var(--purple, #5C087E); }
.li-md-h2 { margin: 16px 0 8px; font-family: var(--font-serif, Georgia, serif); font-style: italic; font-size: 1.1rem; color: var(--purple, #5C087E); }
.li-md-h3 { margin: 12px 0 6px; font-weight: 600; font-size: 1rem; }
.li-md-ul { margin: 6px 0 12px; padding-left: 22px; }
.li-briefing-body p { margin: 8px 0; }

/* ── Tables ──────────────────────────────────────────────── */
.li-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 10px;
}
.li-table thead th {
  text-align: left;
  padding: 8px 10px;
  background: var(--row-alt, #faf8f4);
  border-bottom: 2px solid var(--border, #e5e2dc);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-mute, #6b6b6b);
  white-space: nowrap;
}
.li-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #eee);
  vertical-align: middle;
}
.li-table tbody tr:hover { background: var(--row-hover, #fbfaf7); }
.li-table .mono { font-family: var(--font-mono, monospace); font-variant-numeric: tabular-nums; }

.li-rate-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border, #e5e2dc);
}
.li-rate-pill.li-tone-success { background: #e7f5ec; border-color: #9fd6b1; color: #1B7F38; }
.li-rate-pill.li-tone-important { background: #fbf3dd; border-color: #e7cf8f; color: #8a6d12; }
.li-rate-pill.li-tone-urgent { background: #fde9e7; border-color: #f3a99f; color: var(--heritage-red, #E02923); }
.li-rate-pill.li-tone-neutral { background: #f4f2ee; color: #6b6b6b; }

.li-rootcause { margin-top: 12px; font-size: 12px; line-height: 1.5; }

/* ── Concentration share bars ────────────────────────────── */
.li-share-bar {
  display: inline-block;
  width: 90px;
  height: 8px;
  background: var(--border, #ece9e3);
  border-radius: 4px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 8px;
}
.li-share-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple, #5C087E), var(--heritage-red, #E02923));
  border-radius: 4px;
}

/* ── Upload tab ──────────────────────────────────────────── */
.li-upload-progress { margin-top: 14px; }
.li-progress-track {
  height: 8px;
  background: var(--border, #ece9e3);
  border-radius: 4px;
  overflow: hidden;
}
.li-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--heritage-red, #E02923), var(--gold, #D4A843));
  border-radius: 4px;
  transition: width .4s ease;
}
.li-progress-label {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-mute, #6b6b6b);
  display: flex;
  align-items: center;
  gap: 6px;
}

.li-upload-success .li-success-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.li-success-badge { font-weight: 600; color: #1B7F38; }
.li-success-period {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  font-size: 15px;
  color: var(--purple, #5C087E);
}
.li-success-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.li-sheet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.li-sheet-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--row-alt, #f4f2ee);
  border: 1px solid var(--border, #e5e2dc);
  font-family: var(--font-mono, monospace);
}
.li-warnings { margin-top: 10px; font-size: 12px; }
.li-warnings summary { cursor: pointer; color: var(--gold, #8a6d12); }
.li-warnings ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-mute, #6b6b6b); }

.li-history-table { margin-top: 4px; }

/* ── Empty / error states ────────────────────────────────── */
.li-empty, .li-error {
  text-align: center;
  padding: 40px 24px;
}
.li-empty-icon { font-size: 40px; margin-bottom: 8px; }
.li-empty-title {
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  color: var(--purple, #5C087E);
  margin: 0 0 8px;
}

/* ── Mobile responsive ───────────────────────────────────── */
@media (max-width: 768px) {
  .li-metric-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .li-success-stats { grid-template-columns: 1fr; }
  .li-metric-value { font-size: 1.4rem; }
  .li-tabs { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .li-tab { padding: 9px 11px; font-size: 13px; }
  .li-toolbar { gap: 10px; }
  .li-period-wrap .filter-select { min-width: 0; width: 100%; }
  .li-table { font-size: 12px; }
  .li-table thead th, .li-table tbody td { padding: 6px 7px; }
  .li-share-bar { width: 50px; }
}
@media (max-width: 480px) {
  .li-metric-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Briefing redesign — attention callout, RYG glance strip,
   WoW trend arrows, per-section action lines (CONSULTATION §3.4)
   Palette only: --heritage-red, --gold, --purple, #1B7F38.
   ============================================================ */
.li-brief-section { margin: 18px 0; }
.li-brief-h2 {
  font-family: var(--font-serif, Georgia, serif); font-style: italic;
  font-size: 1.1rem; color: var(--purple, #5C087E);
  margin: 0 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid #efe9dd;
}
.li-brief-meta { font-size: 13px; margin: 8px 0 0; }
.li-brief-provenance { font-size: 11px; font-style: italic; margin-top: 16px; }

/* Attention callout */
.li-attention {
  border-radius: 10px; padding: 14px 16px; margin: 0 0 18px;
  background: #fffaf2; border: 1px solid #f0e2c4;
  border-left: 4px solid var(--gold, #D4A843);
}
.li-attention.is-critical { background: #fdf2f0; border-color: #f3c9c2; border-left-color: var(--heritage-red, #E02923); }
.li-attention.is-clear { background: #f1f8f3; border-color: #cfe8d6; border-left-color: #1B7F38; }
.li-attention.is-unknown { background: #f4f4f5; border-color: #dcdce0; border-left-color: #8a8a93; }
.li-attention-title { font-weight: 700; margin: 0 0 8px; display: flex; gap: 8px; align-items: center; }
.li-attention-item { display: flex; gap: 8px; padding: 6px 0; border-top: 1px dashed #ece4d4; font-size: 0.93rem; line-height: 1.5; }
.li-attention-item:first-of-type { border-top: none; }
.li-attention-dot { flex: 0 0 auto; }
.li-attention-action { color: #6b6b6b; font-style: italic; }

/* RYG glance strip — reuse li-metric-card grid; add a status dot */
.li-glance-tile .li-glance-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }
.li-glance-tile.is-good { border-left-color: #1B7F38; }
.li-glance-tile.is-good .li-glance-dot { background: #1B7F38; }
.li-glance-tile.is-watch { border-left-color: var(--gold, #D4A843); }
.li-glance-tile.is-watch .li-glance-dot { background: var(--gold, #D4A843); }
.li-glance-tile.is-crit { border-left-color: var(--heritage-red, #E02923); }
.li-glance-tile.is-crit .li-glance-dot { background: var(--heritage-red, #E02923); }

/* Trend arrows — color encodes good/bad, not up/down */
.li-trend { font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.li-trend-good { color: #1B7F38; }
.li-trend-bad { color: var(--heritage-red, #E02923); }
.li-trend-flat { color: #9a948a; }

/* Per-section action line */
.li-action-line {
  margin-top: 8px; padding: 8px 10px; border-radius: 6px;
  background: #faf7f0; border-left: 3px solid var(--purple, #5C087E);
  font-size: 0.9rem; color: #3a2f22;
}

/* md-table fallback inherits li-table; ensure block + scroll on mobile */
.li-md-table { display: table; width: 100%; }

@media (max-width: 640px) {
  .li-brief-section { overflow-x: auto; }
  .li-attention-item { flex-direction: column; gap: 2px; }
}

/* ── Monthly cost x service scorecard (step 1) ───────────── */
.li-freight-banner {
  margin: 8px 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fbf3dd;
  border: 1px solid #e7cf8f;
  color: #6b5410;
  font-size: 13px;
}
.li-freight-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }
.li-freight-table tr.li-below-target td { background: #fdf3f1; }
/* ============================================================
   21-admin.css
   Admin panel, user management, module access
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ═══════════════════════════════════════════════════════════════
   ADMIN PAGE
   ═══════════════════════════════════════════════════════════════ */

.admin-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
}

.admin-sidebar {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 12px 8px;
  position: sticky;
  top: 16px;
}

.admin-sidebar-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--heritage-purple);
  padding: 6px 10px 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 6px;
}

.admin-tab {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 9px 12px;
  margin: 1px 0;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.14s ease;
}

.admin-tab:hover { background: var(--paper); color: var(--heritage-red); }

.admin-tab.active {
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: white;
  font-weight: 600;
}

.admin-content { min-width: 0; }

.admin-h2 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.55rem;
  color: var(--ink-strong);
  margin: 0 0 18px;
}

.admin-h2 em { font-style: italic; color: var(--heritage-red); }

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.admin-stat-card {
  text-align: center;
  padding: 22px 16px;
}

.admin-stat-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 8px;
  color: var(--heritage-gold-dark);
}

.admin-stat-icon svg { width: 100%; height: 100%; }

.admin-stat-value {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--ink-strong);
  line-height: 1;
  margin-bottom: 4px;
}

.admin-stat-label {
  font-size: 0.78rem;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 760px) {
  .admin-cards-row { grid-template-columns: 1fr; }
}

.admin-roles-list,
.admin-info-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-role-row,
.admin-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed var(--rule);
}

.admin-role-row:last-child,
.admin-info-row:last-child { border-bottom: none; }

.admin-info-label {
  font-size: 0.86rem;
  color: var(--ink-mute);
}

.admin-info-value {
  font-weight: 600;
  color: var(--ink-strong);
  font-size: 0.92rem;
}

/* User cell (in tables) */

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.user-cell-name {
  font-weight: 600;
  color: var(--ink-strong);
}

/* Role select inline */

.role-select {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.14s ease;
}

.role-select:hover:not(:disabled) { border-color: var(--heritage-gold); }

.role-select:focus { outline: 2px solid var(--heritage-gold); outline-offset: 1px; }

.role-select:disabled { background: var(--paper); color: var(--ink-mute); cursor: not-allowed; }

.entity-pill {
  display: inline-block;
  padding: 2px 8px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--heritage-purple);
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════════════
   ADMIN REVAMP (2026-06) — 5-tab adoption-first redesign
   Adoption · Users & Roles · Activity · Feedback · Settings
   Brand: Heritage Red #CC0000 · Gold #D4A843 · Purple #5B2C8A
   ═══════════════════════════════════════════════════════════════ */

/* Page heading block shared across tabs */
.admin-page-head { margin-bottom: 20px; }
.admin-page-head .admin-h2 { margin-bottom: 4px; }
.admin-sub {
  color: var(--ink-mute);
  font-size: 0.92rem;
  margin: 0;
  max-width: 760px;
}

/* ── Hero stat strip (Adoption + Feedback tabs) ───────────────── */
.adopt-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.adopt-hero-card {
  padding: 18px 18px 16px;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.adopt-hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg, var(--heritage-red), var(--heritage-gold));
}

.adopt-hero-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  font-weight: 600;
  margin-bottom: 6px;
}

.adopt-hero-value {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--ink-strong);
  line-height: 1;
  margin-bottom: 4px;
}

.adopt-hero-sub {
  font-size: 0.78rem;
  color: var(--ink-mute);
}

/* ── Two-column card row ──────────────────────────────────────── */
.adopt-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 860px) {
  .adopt-row { grid-template-columns: 1fr; }
}

.adopt-card { padding: 18px; }
.adopt-card-wide { margin-bottom: 16px; }

.adopt-card-h {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink-strong);
  margin: 0 0 4px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.adopt-card-sub {
  font-size: 0.82rem;
  color: var(--ink-mute);
  margin: 0 0 14px;
}

.adopt-hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--heritage-gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Split bars (Agents vs Tools, feedback by type/status) ────── */
.adopt-split { margin-bottom: 12px; }
.adopt-split:last-child { margin-bottom: 0; }

.adopt-split-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 5px;
  color: var(--ink);
}

.adopt-split-track {
  height: 9px;
  background: var(--rule-soft);
  border-radius: 6px;
  overflow: hidden;
}

.adopt-split-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

/* ── Ranked bars (top modules, super-users, departments) ──────── */
.adopt-bars { display: flex; flex-direction: column; gap: 11px; }

.adopt-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.adopt-bar-label {
  font-size: 0.88rem;
  color: var(--ink-strong);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adopt-bar-val {
  font-size: 0.8rem;
  flex-shrink: 0;
}

.adopt-bar-track {
  height: 7px;
  background: var(--rule-soft);
  border-radius: 5px;
  overflow: hidden;
}

.adopt-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--heritage-red), var(--heritage-gold));
  border-radius: 5px;
  transition: width 0.4s ease;
}

.adopt-rank {
  display: inline-block;
  min-width: 18px;
  font-weight: 700;
  color: var(--heritage-gold-dark);
  font-size: 0.8rem;
}

/* ── Daily trend mini-bars ────────────────────────────────────── */
.adopt-trend {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  padding-top: 10px;
  overflow-x: auto;
}

.adopt-trend-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 0 14px;
  min-width: 10px;
}

.adopt-trend-bar {
  width: 100%;
  max-width: 18px;
  background: linear-gradient(180deg, var(--heritage-gold), var(--heritage-red));
  border-radius: 3px 3px 0 0;
  transition: height 0.3s ease;
}

.adopt-trend-x {
  font-size: 0.62rem;
  color: var(--ink-faint);
  margin-top: 4px;
  transform: rotate(-45deg);
  transform-origin: center;
  white-space: nowrap;
}

.adopt-empty {
  padding: 18px;
  text-align: center;
  font-size: 0.88rem;
  font-style: italic;
}

.adopt-foot { font-size: 0.8rem; margin-top: 12px; }

/* ── Kind badges (agent / tool) ───────────────────────────────── */
.kind-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.kind-agent { background: #F6E3E3; color: var(--heritage-red-dark); }
.kind-tool  { background: #F3ECD8; color: var(--heritage-gold-dark); }

/* ── Users table extras ───────────────────────────────────────── */
.users-table .user-modules-btn { white-space: nowrap; }

.user-modules-drawer td { background: var(--paper); padding: 0; }

.user-modules-panel { padding: 14px 16px; }

.user-modules-head {
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--ink-strong);
  /* Reset-to-defaults (2026-07-06): flex row so the reset button can sit at
     the right edge (margin-left:auto) and wrap cleanly on mobile. */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.role-pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-pill.role-admin       { background: #F6E3E3; color: var(--heritage-red-dark); }
.role-pill.role-manager     { background: #EEE6F5; color: var(--heritage-purple); }
.role-pill.role-coordinator { background: #F3ECD8; color: var(--heritage-gold-dark); }
.role-pill.role-viewer      { background: var(--rule-soft); color: var(--ink-soft); }

.user-modules-table { width: 100%; }
.admin-reason-cell { max-width: 280px; }
.admin-override-cell { white-space: nowrap; }
.admin-override-cell .btn { margin-right: 4px; }

/* ── Floor (workspace) access drawer — Train 4, 2026-07-25 ─────────
   A sibling of the module drawer, not a section inside it: floors decide which
   building you may enter, module overrides decide which rooms. Same visual
   language so the two read as peers in the Users table. */
.users-table .user-floors-btn { white-space: nowrap; }
.user-floors-drawer td { background: var(--paper); padding: 0; }
.user-floors-panel { padding: 14px 16px; }
.user-floors-table { width: 100%; }

.admin-floors-note {
  margin: 0 0 10px;
  font-size: 0.84rem;
  max-width: 78ch;
  line-height: 1.45;
}

.floor-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
}
.floor-check input[type="checkbox"] { margin-top: 3px; flex: 0 0 auto; }

/* The money floor is the one row where a mis-click has financial consequences,
   so it is visually distinct rather than just another checkbox. */
.admin-floor-row.is-money-floor td:first-child {
  box-shadow: inset 3px 0 0 var(--heritage-red);
}
.floor-money-badge { margin-left: 6px; }

.floor-source-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 9px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--rule-soft);
  color: var(--ink-soft);
}
.floor-source-badge.floor-source-admin_grant { background: #F6E3E3; color: var(--heritage-red-dark); }
.floor-source-badge.floor-source-bootstrap   { background: #F3ECD8; color: var(--heritage-gold-dark); }

.admin-floors-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.admin-floors-actions .floors-dirty-hint { margin-left: auto; }

/* ── Users toolbar (search / filter / sort) ──────────────── */
.users-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.users-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.users-search-input {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--ink);
  min-width: 220px;
  transition: border-color 0.14s ease;
}

.users-search-input:hover { border-color: var(--heritage-gold); }
.users-search-input:focus { outline: 2px solid var(--heritage-gold); outline-offset: 1px; }

.users-neverlogin-toggle {
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
  text-transform: none !important;
  font-weight: 500 !important;
  font-size: 0.85rem !important;
  color: var(--ink) !important;
}

.users-count {
  margin-left: auto;
  font-size: 0.82rem;
  white-space: nowrap;
  align-self: center;
}

/* ── Activity filters ─────────────────────────────────────────── */
.activity-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  padding: 14px 16px;
}

.activity-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.activity-split-toggle {
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
  text-transform: none !important;
  font-weight: 500 !important;
  font-size: 0.85rem !important;
  color: var(--ink) !important;
}

.activity-split-summary:not(:empty) { margin-top: 0; }

/* ── Settings: nav config ─────────────────────────────────────── */
.settings-section-label {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--heritage-purple);
  margin-bottom: 10px;
}

.nav-config-grid { margin-bottom: 8px; }

@media (max-width: 900px) {
  .nav-config-grid { grid-template-columns: 1fr !important; }
}

.nav-module-row.dragging { opacity: 0.4 !important; }
.nav-module-row.drag-over {
  border-color: var(--heritage-gold) !important;
  box-shadow: 0 0 0 2px var(--rule-gold);
}
.nav-module-row.drag-blocked {
  border-color: var(--danger) !important;
  cursor: not-allowed;
}

.preset-row { transition: border-color 0.14s ease; }
.preset-row:hover { border-color: var(--heritage-gold); }

/* status-badge / status-ok / status-warn are defined in 04-components.css */

/* ─── Scheduled Jobs (Settings tab) ─────────────────────────────── */
.sched-card { margin-bottom: 8px; }
.sched-table { width: 100%; }
.sched-table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--heritage-purple); padding: 10px 12px; text-align: left;
}
.sched-table td { padding: 12px; vertical-align: top; }
.sched-job-name { font-weight: 600; }
.sched-row-disabled { opacity: 0.6; }

.sched-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.sched-success  { background: rgba(34,139,34,0.12);  color: #1b7a1b; }
.sched-failed   { background: rgba(204,0,0,0.12);    color: var(--heritage-red); }
.sched-running  { background: rgba(212,168,67,0.16); color: #9a7415; }
.sched-disabled { background: rgba(0,0,0,0.06);      color: #777; }
.sched-idle     { background: rgba(0,0,0,0.05);      color: #888; }

.sched-btn { margin-left: 6px; }
.sched-table .sched-btn:first-of-type { margin-left: 0; }

/* Edit modal */
.sched-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.sched-modal {
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  padding: 22px; background: var(--eggshell, #faf6ef);
}
.sched-field { display: block; margin-bottom: 12px; }
.sched-field > span {
  display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.4px; color: var(--heritage-purple);
}
.sched-field input,
.sched-field select,
.sched-field textarea {
  width: 100%; padding: 7px 10px; border: 1px solid rgba(0,0,0,0.18);
  border-radius: 6px; font-size: 14px; box-sizing: border-box;
  font-family: inherit; background: #fff;
}
.sched-field textarea { font-family: monospace; font-size: 13px; resize: vertical; }

/* Scheduler product picker (friendly name search → injects product_id) */
.sched-product-picker .sched-pp-wrap { position: relative; }
.sched-pp-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  max-height: 240px; overflow-y: auto; margin-top: 2px;
  background: #fff; border: 1px solid rgba(0,0,0,0.16); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.sched-pp-item {
  padding: 8px 11px; cursor: pointer; border-bottom: 1px solid rgba(0,0,0,0.05);
  font-size: 13px; line-height: 1.3;
}
.sched-pp-item:last-child { border-bottom: none; }
.sched-pp-item:hover { background: rgba(204,0,0,0.06); }
.sched-pp-selected { min-height: 16px; }

@media (max-width: 720px) {
  .sched-table thead { display: none; }
  .sched-table tr { display: block; border-bottom: 1px solid rgba(0,0,0,0.1); padding: 8px 0; }
  .sched-table td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 12px; }
  .sched-table td::before {
    content: attr(data-label); font-weight: 600; color: var(--heritage-purple);
    font-size: 11px; text-transform: uppercase;
  }
  .sched-table td[data-label="Actions"] { justify-content: flex-start; flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════════════
   STEP 2 (2026-06-15) — Per-scheduled-job AI cost attribution.
   Adoption-tab "Scheduled job costs" table + the "Cost (30d)" column on the
   Settings-tab Scheduled Jobs table.
   ═══════════════════════════════════════════════════════════════════════ */

/* Adoption tab — scheduled job costs card */
.sjc-card { margin-top: 16px; }
.sjc-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.sjc-table th,
.sjc-table td { padding: 8px 12px; border-bottom: 1px solid rgba(0,0,0,0.07); font-size: 13px; }
.sjc-table th { text-align: left; color: var(--heritage-purple); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.sjc-table td:first-child { font-weight: 500; }
.sjc-num { text-align: right; font-variant-numeric: tabular-nums; }
.sjc-cost { font-weight: 600; color: var(--heritage-red); }
.sjc-table tfoot td { border-top: 2px solid rgba(0,0,0,0.12); border-bottom: none; }
.sjc-empty { text-align: center; padding: 18px 12px; font-style: italic; }

/* Settings tab — Cost (30d) column on the Scheduled Jobs table */
.sched-table th.sched-cost-col { text-align: right; }
.sched-table td.sched-cost-cell { text-align: right; font-variant-numeric: tabular-nums; }
.sched-cost { color: var(--heritage-red); font-weight: 600; font-size: .9em; }

@media (max-width: 720px) {
  .sjc-table thead { display: none; }
  .sjc-table tr { display: block; border-bottom: 1px solid rgba(0,0,0,0.1); padding: 8px 0; }
  .sjc-table td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 12px; }
  .sjc-table tfoot td { display: flex; }
  .sched-table td.sched-cost-cell { text-align: left; }
}

/* ── STEP 3 (2026-06-15): Job proposals + budget management ── */
.sched-prop-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 10px;
  background: #FFF4D6;
  color: #8a6d00;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}
.sched-prop-table td[data-label="Status"] { white-space: nowrap; }

/* Budget management table */
.budget-mgmt-card .budget-table th,
.budget-mgmt-card .budget-table td { font-size: 13px; }
.budget-table td[data-label="Scope"] { font-weight: 500; }
.budget-edit-btn { font-size: 12px; }
.budget-row:hover { background: rgba(91, 44, 138, 0.03); }

@media (max-width: 720px) {
  .budget-table thead { display: none; }
  .budget-table tr { display: block; border-bottom: 1px solid rgba(0,0,0,0.1); padding: 8px 0; }
  .budget-table td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 12px; }
}

/* ── Admin ops cards (Usage & Cost + System Status, first-class) ──
   Settings tab: 2-up grid of proper cards replacing the old mute
   "More settings" footnote. Adoption tab: usage summary card. */
.admin-ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.admin-ops-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease;
}
.admin-ops-card:hover,
.admin-ops-card:focus-within {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
  transform: translateY(-1px);
}
.admin-ops-card:focus-visible {
  outline: 2px solid var(--heritage-red);
  outline-offset: 2px;
}
.admin-ops-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-ops-card-icon { font-size: 22px; line-height: 1; }
.admin-ops-card-title {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-size: 17px;
  margin: 0;
}
.admin-ops-card-body {
  font-size: 13px;
  color: var(--ink-soft, #555);
  margin: 0;
  flex: 1;
}
.admin-ops-card-meta { font-size: 12px; }
.admin-ops-card-cta {
  align-self: flex-start;
  min-height: 34px;
}
/* Adoption tab: usage summary stats row inside the card */
.admin-ops-stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin: 4px 0 2px;
}
.admin-ops-stat-val {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-size: 24px;
  color: var(--heritage-red);
  line-height: 1.15;
}
.admin-ops-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-mute, #777);
}
@media (max-width: 720px) {
  .admin-ops-grid { grid-template-columns: 1fr; }
  .admin-ops-card-cta { align-self: stretch; width: 100%; min-height: 44px; }
  .admin-ops-stats { gap: 16px; }
}

/* ── Azure actuals card (Admin · Usage & Cost, 2026-07-17) ──────────
   Invoice-class Cost Management snapshot above the AI-estimate charts.
   Chips inherit --rule / card tokens so dark mode needs no overrides. */
.azure-actuals-card .azure-bucket-chip { background: var(--paper, transparent); }
@media (max-width: 720px) {
  .azure-actuals-card .azure-actuals-hero { flex-direction: column; align-items: flex-start; gap: 4px; }
  .azure-actuals-card .azure-bucket-chip { width: 100%; justify-content: space-between; }
  .azure-actuals-card #azure-refresh { align-self: stretch; width: 100%; min-height: 44px; }
}

/* ── AI usage (#/admin-usage) period toolbar ─────────────────────────────
   Layout sweep 2026-10-25: the toolbar was inline-styled and did not wrap.
   On a 390px phone the period chips ran off the right edge ("All recorded
   AI us…", en/es) and in zh-HK the refresh button was cut off. Same look on
   desktop/tablet (the row fits there, so nothing wraps); on narrow screens
   the chips wrap inside their own box and the refresh button stays visible. */
.usage-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.usage-toolbar .usage-period-label { font-size: 13px; white-space: nowrap; }
.usage-toolbar .usage-period-tabs { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.usage-toolbar .usage-refresh { margin-left: auto; }

@media (max-width: 640px) {
  /* Basis 0 keeps label, chips and refresh on one line; the chips wrap
     inside the remaining width instead of pushing everything off-screen. */
  .usage-toolbar .usage-period-tabs { flex: 1 1 0; min-width: 10rem; }
}
/* ============================================================
   22-upload-zone.css
   Shared upload zone, batch progress, drag-and-drop
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ============================================================
   Document Intelligence — shared upload zone (upload-zone.js)
   Re-uses .lv-dropzone family for the dashed-border + hover state.
   Add module-specific overrides in .uz-* classes only.
   ============================================================ */

.uz-wrap { margin-top: 6px; }

.uz-zone { min-height: 150px; padding: 18px; }

.uz-zone .uz-prompt { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.uz-zone .uz-extracted-by {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-mute, #6B7280);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.85;
}

.uz-zone-filled { padding: 14px; }

.uz-zone-filled .uz-filled-icon { color: var(--success, #1B7F38); margin-bottom: 4px; }

.uz-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 10px 0 4px;
  color: var(--text-mute, #6B7280);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.uz-divider::before,
.uz-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.uz-divider span { padding: 0 12px; }

.uz-meta { margin-top: 8px; font-size: 0.82rem; }

.uz-meta-error    { color: var(--danger, #c81e1e); }

.uz-meta-success  { color: var(--ink-soft, #4B5563); }

.uz-meta-loading  { color: var(--ink-soft, #4B5563); }

.uz-spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(91, 44, 138, 0.25);
  border-top-color: var(--heritage-purple, #5B2C8A);
  border-radius: 50%;
  vertical-align: -2px;
  margin-right: 6px;
  animation: uz-spin 700ms linear infinite;
}

.uz-source-chip {
  background: rgba(91, 44, 138, 0.06);
  border: 1px solid rgba(91, 44, 138, 0.18);
  color: var(--heritage-purple, #5B2C8A);
}

.uz-chip-detail { color: var(--text-mute, #6B7280); font-weight: 400; }

/* Dark mode: [data-theme="dark"] rules live in 90-dark-mode.css
   (was @media prefers-color-scheme — OS-keyed, broke app light + OS dark). */

/* Twin upload — spec-diff uses two zones side-by-side. Wrap them in
   .uz-twin to reduce the vertical footprint compared to stacking. */

.uz-twin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 720px) {
  .uz-twin { grid-template-columns: 1fr; }
}

/* ============================================================================
 * Batch upload (uploadZone batch: true) — added by batch-upload-build
 * ========================================================================== */

.uz-batch-wrap { display: flex; flex-direction: column; gap: 12px; }

.uz-batch-zone { min-height: 140px; }

.uz-batch-summary {
  font-size: 13px;
  color: var(--ink-soft, #555);
  padding: 4px 2px;
}

.uz-batch-summary strong { color: var(--ink, #111); }

.uz-batch-failed-badge { color: var(--danger, #C0392B); font-weight: 600; }

/* Progress bar */

.uz-batch-progress {
  width: 100%;
  height: 8px;
  background: rgba(0,0,0,0.06);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.uz-batch-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success, #2D8C3C), var(--success-deep, #1F6B2B));
  transition: width 0.4s ease-out;
  border-radius: 999px;
}

/* File rows */

.uz-batch-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 6px;
  background: rgba(0,0,0,0.015);
}

.uz-batch-list:empty { display: none; }

.uz-batch-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface, #fff);
  font-size: 13px;
  transition: background 0.2s, border-color 0.2s;
  border: 1px solid transparent;
}

.uz-batch-row[data-status="extracting"],
.uz-batch-row[data-status="analyzing"] {
  background: rgba(91, 44, 138, 0.05);
  border-color: rgba(91, 44, 138, 0.18);
}

.uz-batch-row[data-status="complete"] {
  background: rgba(45, 140, 60, 0.05);
  border-color: rgba(45, 140, 60, 0.18);
}

.uz-batch-row[data-status="failed"],
.uz-batch-row[data-status="cancelled"] {
  background: rgba(192, 57, 43, 0.05);
  border-color: rgba(192, 57, 43, 0.18);
}

.uz-batch-status { font-size: 16px; text-align: center; }

.uz-batch-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uz-batch-size {
  font-size: 11px;
  color: var(--ink-soft, #777);
  font-variant-numeric: tabular-nums;
}

.uz-batch-error {
  color: var(--danger, #C0392B);
  font-size: 11px;
  font-weight: 500;
  grid-column: 1 / -1;
  padding-left: 34px;
  margin-top: 2px;
}

.uz-batch-remove {
  background: transparent;
  border: 1px solid rgba(0,0,0,0.12);
  color: var(--ink-soft, #888);
  border-radius: 999px;
  width: 22px; height: 22px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.uz-batch-remove:hover { background: var(--danger, #C0392B); color: #fff; border-color: var(--danger, #C0392B); }

/* Actions bar */

.uz-batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 4px;
}

.uz-batch-actions .btn { white-space: nowrap; }

.uz-batch-final {
  font-weight: 600;
  margin-right: auto;
}

.uz-batch-status-line {
  display: flex; align-items: center; gap: 8px;
  padding: 12px; font-size: 13px;
  color: var(--ink-soft, #555);
}

/* Review panel */

.uz-batch-review {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(0,0,0,0.02);
  border: 1px solid rgba(0,0,0,0.06);
  margin-top: 8px;
}

.uz-review-h4 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.uz-review-card {
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface, #fff);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s, background 0.2s;
}

.uz-review-card-approved {
  border-color: var(--success, #2D8C3C);
  background: rgba(45, 140, 60, 0.04);
}

.uz-review-card-rejected {
  opacity: 0.55;
  border-style: dashed;
}

.uz-review-card-failed {
  border-color: rgba(192, 57, 43, 0.40);
  background: rgba(192, 57, 43, 0.04);
}

.uz-review-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
}

.uz-review-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.08);
}

.uz-review-badge-ok {
  background: rgba(45, 140, 60, 0.12);
  color: var(--success-deep, #1F6B2B);
}

.uz-review-summary { font-size: 13px; color: var(--ink, #222); }

.uz-review-error   { font-size: 12px; color: var(--danger, #C0392B); }

.uz-review-failed {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0,0,0,0.10);
}

.uz-review-failed h5 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--danger, #C0392B);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.uz-review-card-actions { display: flex; gap: 6px; }

.btn.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Batch / single mode toggle */

.uz-mode-toggle {
  display: inline-flex;
  background: rgba(0,0,0,0.05);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  margin-bottom: 10px;
}

.uz-mode-toggle button {
  border: none;
  background: transparent;
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft, #555);
  transition: background 0.18s, color 0.18s;
}

.uz-mode-toggle button[aria-pressed="true"] {
  background: var(--surface, #fff);
  color: var(--ink, #111);
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}
/* ============================================================
   23-activity.css
   Activity feed styles
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* -------- Activity feed -------------------------------------- */

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 0.88rem;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rule);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--heritage-purple);
}

.activity-content { flex: 1; }

.activity-text { color: var(--ink); }

.activity-time { font-size: 0.78rem; color: var(--ink-mute); margin-top: 2px; }

/* ──────────────────────────────────────────────────────────────────
   Activity feed (enhanced)
   ────────────────────────────────────────────────────────────────── */

.activity-card { padding: 6px 16px; }

.activity-card .activity-list { padding: 0; margin: 0; list-style: none; }

.activity-card .activity-item {
  display: flex;
  gap: 11px;
  padding: 9px 0;
  align-items: flex-start;
  border-bottom: 1px solid var(--rule-soft);
}

.activity-card .activity-item:last-child { border-bottom: 0; }

.activity-card .activity-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
}

.activity-icon.tone-purple { background: rgba(91, 44, 138, 0.10); color: var(--heritage-purple); }

.activity-icon.tone-gold   { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); }

.activity-icon.tone-red    { background: rgba(204, 0, 0, 0.10);    color: var(--heritage-red); }

.activity-icon.tone-green  { background: rgba(45, 140, 60, 0.12);  color: var(--success-deep); }

.activity-text {
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.35;
}

.activity-verb {
  font-weight: 700;
  color: var(--ink-strong);
}

.activity-entity {
  color: var(--ink-soft);
  margin: 0 2px;
}

.activity-ref {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.84em;
  color: var(--heritage-purple);
  font-weight: 600;
  background: rgba(91, 44, 138, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.activity-time {
  font-size: 0.76rem;
  color: var(--ink-mute);
  margin-top: 2px;
  letter-spacing: 0.01em;
}

/* Activity feed: cap height on desktop so it doesn't dominate */

@media (min-width: 1100px) {
  .activity-card { max-height: 580px; overflow-y: auto; }
  .activity-card::-webkit-scrollbar { width: 6px; }
  .activity-card::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
}

/* polish-pass 2026-05-21 — Activity feed empty-state should feel
   inviting, not bare. */

.activity-feed-empty-hint {
  font-size: 0.85rem;
  color: var(--ink-mute);
  margin-top: 6px;
  font-style: italic;
}

/* ============================================================
   Extracted from public/js/ui/activity-feed.js — pageStyles()
   Activity feed page (.af-*) — header, stats, event stream,
   dashboard widget, mini-list. Dark-mode tweaks live in
   public/css/src/90-dark-mode.css.
   ============================================================ */

.af-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 0 32px;
}

.af-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 6px 4px 4px;
}

.af-header-text .dash-title { margin: 2px 0 6px; }
.af-server-time { font-size: 11px; color: var(--text-mute, #888); margin-left: 6px; }
.af-header-actions { display: flex; gap: 8px; align-items: center; }

.af-filter {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--rule, #e5e5e5);
  background: var(--card-bg, #fff);
  color: var(--text, #222);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.af-filter:hover { border-color: var(--heritage-purple, #5B2C8A); }

.af-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  margin: 0 4px 0 6px;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55);
  animation: af-pulse 1.8s infinite;
  vertical-align: middle;
}

.af-live-label {
  color: #4ade80;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@keyframes af-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(74, 222, 128, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0   rgba(74, 222, 128, 0); }
}

/* Stats row */
.af-stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.af-stat-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--rule, #e8e8e8);
  border-radius: 12px;
  padding: 14px 16px;
}

.af-stat-wide { grid-column: span 2; min-width: 320px; }

.af-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute, #888);
}

.af-stat-value {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-size: 36px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--heritage-red, #CC0000);
  margin: 4px 0 2px;
}

.af-stat-foot { font-size: 12px; color: var(--text-mute, #888); }
.af-stat-bars { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }

.af-stat-bar {
  display: grid;
  grid-template-columns: 130px 1fr 36px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.af-stat-bar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text, #333);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.af-stat-bar-track {
  height: 8px;
  background: var(--rule, #eee);
  border-radius: 4px;
  overflow: hidden;
}

.af-stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.af-stat-bar-fill-red    { background: linear-gradient(90deg, #CC0000, #ff4444); }
.af-stat-bar-fill-gold   { background: linear-gradient(90deg, #D4A843, #f0c060); }
.af-stat-bar-fill-purple { background: linear-gradient(90deg, #5B2C8A, #8859B5); }
.af-stat-bar-fill-green  { background: linear-gradient(90deg, #2d8f4e, #4ade80); }
.af-stat-bar-count { text-align: right; font-weight: 600; color: var(--text, #333); }

/* Event stream */
.af-stream-wrap .section-header { margin-bottom: 10px; }
.af-stream-count { font-size: 12px; color: var(--text-mute, #888); }

.af-stream {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.af-event {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--rule, #e8e8e8);
  border-left: 3px solid var(--rule, #e8e8e8);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.af-event:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  border-color: var(--rule-strong, #d4d4d4);
}

.af-event-red    { border-left-color: #CC0000; }
.af-event-gold   { border-left-color: #D4A843; }
.af-event-purple { border-left-color: #5B2C8A; }
.af-event-green  { border-left-color: #2d8f4e; }

.af-event-fresh { animation: af-flash 2.4s ease-out; }

@keyframes af-flash {
  0%   { background: rgba(74, 222, 128, 0.18); }
  100% { background: var(--card-bg, #fff); }
}

.af-event-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  letter-spacing: 0.04em;
  background: var(--heritage-purple, #5B2C8A);
}

.af-avatar-red    { background: #CC0000; }
.af-avatar-gold   { background: #B88A1A; }
.af-avatar-purple { background: #5B2C8A; }
.af-avatar-green  { background: #2d8f4e; }

.af-event-body { min-width: 0; }

.af-event-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text, #333);
}

.af-user { font-weight: 600; color: var(--text, #222); }
.af-verb { color: var(--text-mute, #777); font-style: italic; }

.af-module {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--rule, #f0f0f0);
  color: var(--text, #333);
  font-size: 11.5px;
  font-weight: 500;
}

.af-module-icon { font-size: 12px; line-height: 1; }

.af-event-entity {
  margin: 4px 0;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text, #222);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.af-event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-mute, #888);
}

.af-time { font-weight: 500; }
.af-dept { color: var(--text-mute, #888); }
.af-dept::before { content: '·'; margin-right: 6px; opacity: 0.5; }

.af-conf {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
}

.af-conf-high { background: rgba(74, 222, 128, 0.18); color: #1a6b34; }
.af-conf-med  { background: rgba(212, 168, 67, 0.18); color: #7a5a14; }
.af-conf-low  { background: rgba(204, 0, 0, 0.14);   color: #a00000; }
.af-conf-mini { padding: 1px 6px; border-radius: 4px; font-weight: 600; font-size: 10px; }

.af-model {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10.5px;
  background: rgba(91, 44, 138, 0.08);
  color: var(--heritage-purple, #5B2C8A);
  padding: 2px 6px;
  border-radius: 4px;
}

.af-elapsed { font-size: 11px; color: var(--text-mute, #888); }
.af-elapsed::before { content: '·'; margin-right: 6px; opacity: 0.5; }

/* ── Dashboard widget (compact) ── */
.af-widget .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.af-widget-card {
  padding: 4px 8px;
  border-radius: 10px;
}

.af-view-all {
  font-size: 12px;
  font-weight: 600;
  color: var(--heritage-purple, #5B2C8A);
  text-decoration: none;
}

.af-view-all:hover { text-decoration: underline; }

.af-mini-list { list-style: none; padding: 0; margin: 0; }

.af-mini {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  padding: 9px 8px;
  border-bottom: 1px solid var(--rule-soft, #f3f3f3);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.af-mini:last-child { border-bottom: none; }
.af-mini:hover { background: rgba(91, 44, 138, 0.04); }

.af-mini-icon { font-size: 16px; line-height: 1.3; }
.af-mini-body { min-width: 0; }
.af-mini-line { font-size: 12.5px; }

.af-mini-entity {
  font-size: 13px;
  font-weight: 500;
  color: var(--text, #222);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.af-mini-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--text-mute, #888);
  margin-top: 2px;
}

.af-mini-module { color: var(--heritage-purple, #5B2C8A); font-weight: 500; }
/* ============================================================
   24-knowledge.css
   Knowledge base
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* =====================================================================
   KNOWLEDGE BASE — index + reader layout
   ===================================================================== */

.kb-section { padding: 0; }

.kb-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 980px) {
  .kb-layout { grid-template-columns: 1fr; }
  .kb-sidebar { position: static; max-height: none; }
}

/* ── Mobile / PWA optimizations ─────────────────────────────────── */
@media (max-width: 600px) {
  .kb-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 env(safe-area-inset-right, 0) 0 env(safe-area-inset-left, 0);
  }

  .kb-sidebar {
    position: static;
    max-height: none;
    padding-right: 0;
  }

  .kb-reader {
    padding: 20px 16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    min-height: auto;
  }

  .kb-article-title {
    font-size: 1.45rem;
  }

  .kb-article-body {
    font-size: 0.94rem;
    line-height: 1.65;
  }

  .kb-article-body h1 { font-size: 1.3rem; }
  .kb-article-body h2 { font-size: 1.15rem; }
  .kb-article-body h3 { font-size: 1rem; }

  .kb-article-header {
    padding-bottom: 14px;
    margin-bottom: 18px;
  }

  .kb-code {
    padding: 12px 14px;
    font-size: 0.8rem;
    border-radius: 6px;
  }

  /* Landing page mobile */
  .kb-landing-hero {
    padding-bottom: 16px;
    margin-bottom: 16px;
  }

  .kb-landing-sub {
    font-size: 0.9rem;
  }

  .kb-landing-pinned {
    padding: 16px 18px;
    margin-bottom: 16px;
  }

  .kb-landing-pin-title {
    font-size: 1.15rem;
  }

  .kb-landing-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .kb-landing-card {
    padding: 14px 16px;
    border-radius: 8px;
  }

  /* Touch targets — min 44px */
  .kb-item {
    padding: 14px 16px;
    min-height: 44px;
  }

  .kb-landing-card {
    min-height: 44px;
  }

  .kb-landing-pinned {
    min-height: 44px;
  }

  /* Tags wrap better on mobile */
  .kb-tags {
    gap: 4px;
  }

  .kb-tag {
    font-size: 0.68rem;
    padding: 2px 6px;
  }

  /* Back button for article view on mobile */
  .kb-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--heritage-red);
    font-weight: 600;
    padding: 8px 0;
    margin-bottom: 8px;
    min-height: 44px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* Disclaimer responsive */
  .kb-disclaimer,
  .kb-article-disclaimer {
    font-size: 12px !important;
    padding: 10px 12px !important;
  }
}

/* ── PWA standalone / fullscreen ─────────────────────────────────── */
@media (display-mode: standalone) {
  .kb-reader {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
  }

  .kb-landing {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}

/* ── Dynamic Island safe area ───────────────────────────────────── */
@supports (padding-top: env(safe-area-inset-top)) {
  @media (max-width: 600px) {
    .kb-article-header {
      padding-top: env(safe-area-inset-top, 0);
    }
  }
}

/* ── Landscape phone ────────────────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  .kb-reader {
    padding: 16px 20px;
    min-height: auto;
  }

  .kb-article-title {
    font-size: 1.3rem;
  }

  .kb-landing-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.kb-sidebar {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 4px;
}

.kb-index { display: flex; flex-direction: column; gap: 22px; }

.kb-cat-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-soft);
}

.kb-item {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 8px;
  transition: all 0.14s ease;
}

.kb-item:hover {
  border-color: var(--heritage-gold);
  background: rgba(212, 168, 67, 0.04);
  transform: translateY(-1px);
}

.kb-item.active {
  border-left: 3px solid var(--heritage-red);
  background: rgba(204, 0, 0, 0.03);
}

.kb-item-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink-strong);
  margin-bottom: 4px;
  line-height: 1.3;
}

.kb-item-summary {
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.45;
  margin-bottom: 6px;
}

.kb-item-meta {
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.kb-reader {
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  padding: 40px 48px;
  min-height: 500px;
}

.kb-article-header { border-bottom: 1px solid var(--rule-soft); padding-bottom: 20px; margin-bottom: 28px; }

.kb-article-cat {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--heritage-red);
  margin-bottom: 6px;
}

.kb-article-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink-strong);
  line-height: 1.2;
  margin: 0 0 10px;
}

.kb-article-meta {
  font-size: 0.84rem;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.kb-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

.kb-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(91, 44, 138, 0.06);
  color: var(--heritage-purple);
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}

.kb-article-body {
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--ink-strong);
}

.kb-article-body h1, .kb-article-body h2, .kb-article-body h3 {
  font-family: var(--font-serif);
  color: var(--ink-strong);
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  line-height: 1.25;
}

.kb-article-body h1 { font-size: 1.55rem; font-weight: 700; }

.kb-article-body h2 { font-size: 1.3rem; font-weight: 700; font-style: italic; }

.kb-article-body h3 { font-size: 1.08rem; font-weight: 600; }

.kb-article-body p { margin: 0 0 1em; }

.kb-article-body ul, .kb-article-body ol { padding-left: 1.4em; margin: 0 0 1.2em; }

.kb-article-body li { margin-bottom: 0.4em; }

.kb-article-body blockquote {
  border-left: 3px solid var(--heritage-gold);
  background: rgba(212, 168, 67, 0.04);
  padding: 10px 16px;
  margin: 1em 0;
  font-style: italic;
  color: var(--ink-soft);
}

.kb-article-body hr {
  border: none;
  border-top: 1px solid var(--rule-soft);
  margin: 2em 0;
}

.kb-inline-code {
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  background: rgba(91, 44, 138, 0.06);
  color: var(--heritage-purple);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.88em;
}

.kb-code {
  background: var(--ink-strong);
  color: #F0E0C8;
  padding: 16px 20px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 1.2em 0;
}

.kb-code code { background: transparent; color: inherit; padding: 0; }

.kb-article-footer { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--rule-soft); }

/* Knowledge Base landing page */

.kb-landing { padding: 0; }

.kb-landing-hero { padding-bottom: 28px; border-bottom: 1px solid var(--rule-soft); margin-bottom: 28px; }

.kb-landing-sub {
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 12px 0 0;
  max-width: 640px;
}

.kb-landing-pinned {
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.06), rgba(204, 0, 0, 0.04));
  border: 1px solid rgba(212, 168, 67, 0.30);
  border-radius: 10px;
  padding: 22px 24px;
  margin-bottom: 28px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.kb-landing-pinned:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,0.08); }

.kb-landing-pin-tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--heritage-gold-dark);
  margin-bottom: 8px;
}

.kb-landing-pin-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 0 0 8px;
  line-height: 1.25;
}

.kb-landing-pin-summary { font-size: 0.94rem; color: var(--ink-soft); line-height: 1.55; margin-bottom: 10px; }

.kb-landing-pin-meta { font-size: 0.82rem; color: var(--ink-mute); }

.kb-landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 16px;
}

.kb-landing-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kb-landing-card:hover {
  transform: translateY(-2px);
  border-color: var(--heritage-gold);
  box-shadow: 0 6px 14px rgba(0,0,0,0.06);
}

.kb-landing-card-cat {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--heritage-red);
}

.kb-landing-card-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink-strong);
  line-height: 1.3;
}

.kb-landing-card-summary { font-size: 0.84rem; color: var(--ink-soft); line-height: 1.5; flex: 1; }

.kb-landing-card-meta { font-size: 0.74rem; color: var(--ink-mute); margin-top: 6px; }
/* ============================================================
   25-plan.css
   30/60/90 Plan view (page removed; kept for safety)
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* =====================================================================
   30/60/90 PLAN
   ===================================================================== */

.plan-phase-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

@media (max-width: 740px) {
  .plan-phase-summary { grid-template-columns: 1fr; }
}

.phase-card {
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  padding: 18px 20px;
}

.phase-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.phase-card-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink-strong);
  margin-top: 2px;
}

.phase-card-meta {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.phase-section { margin-top: 24px; margin-bottom: 8px; }

.phase-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-soft);
}

.phase-section-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.phase-section-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.18rem;
  margin: 0;
  color: var(--ink-strong);
}

.phase-section-tag { font-size: 0.82rem; }

.kr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.kr-card {
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
}

.kr-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.06); border-color: var(--heritage-gold); }

.kr-card.kr-status-complete { border-left: 3px solid var(--success); }

.kr-card.kr-status-in_progress { border-left: 3px solid var(--heritage-gold); }

.kr-card.kr-status-blocked { border-left: 3px solid var(--heritage-red); }

.kr-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.kr-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.kr-status-badge.kr-status-not_started { background: var(--rule-soft); color: var(--ink-mute); }

.kr-status-badge.kr-status-in_progress { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); }

.kr-status-badge.kr-status-complete    { background: rgba(45, 140, 60, 0.12); color: var(--success-deep); }

.kr-status-badge.kr-status-blocked     { background: rgba(204, 0, 0, 0.10); color: var(--heritage-red-dark); }

.kr-title {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--ink-strong);
  line-height: 1.3;
  margin-bottom: 6px;
}

.kr-definition {
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.45;
  margin-bottom: 12px;
  flex: 1;
}

.kr-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  padding-top: 8px;
  border-top: 1px solid var(--rule-soft);
}

.kr-owner { font-weight: 600; color: var(--heritage-purple); }

.kr-risk {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--heritage-red-dark);
  padding: 6px 10px;
  background: rgba(204, 0, 0, 0.04);
  border-radius: 4px;
}

/* Risk + Stakeholder lists */

.risk-list, .stakeholder-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }

.risk-item {
  padding: 12px 14px;
  border: 1px solid var(--rule-soft);
  border-radius: 8px;
  background: var(--surface);
}

.risk-item.risk-high     { border-left: 3px solid var(--heritage-red); }

.risk-item.risk-medium   { border-left: 3px solid var(--heritage-gold); }

.risk-item.risk-critical { border-left: 3px solid var(--heritage-red-dark); }

.risk-item.risk-low      { border-left: 3px solid var(--heritage-purple); }

.risk-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }

.risk-title { font-weight: 700; font-size: 0.92rem; color: var(--ink-strong); }

.risk-mitigation { font-size: 0.84rem; color: var(--ink-soft); line-height: 1.45; }

.stakeholder-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--rule-soft);
  border-radius: 8px;
  background: var(--surface);
  gap: 10px;
}

.stakeholder-name { font-weight: 700; font-size: 0.94rem; color: var(--ink-strong); }

.stakeholder-role { font-size: 0.82rem; margin-top: 2px; }

.stakeholder-meta { text-align: right; }

.stakeholder-cadence {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(91, 44, 138, 0.08);
  color: var(--heritage-purple);
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: capitalize;
}

/* ═══════════════════════════════════════════════════════════════
   PWA + MOBILE RESPONSIVE — appended 2026-05-11
   Goal: every view usable on a 375px-wide phone, touch targets ≥44px,
   sidebar collapses to hamburger, tables become cards, dashboard cards
   stack to single column, kanban stacks, search collapses to button.
   ═══════════════════════════════════════════════════════════════ */

/* ── Hamburger menu button (hidden on desktop) ──────────────────── */

.topbar-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 140ms ease, border-color 140ms ease;
}

.topbar-menu-btn:hover,
.topbar-menu-btn:active {
  background: rgba(204, 0, 0, 0.08);
  color: var(--heritage-red);
}

.topbar-menu-btn svg { width: 22px; height: 22px; }

/* ── Mobile search button (hidden on desktop) ───────────────────── */

.topbar-search-btn {
  display: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.topbar-search-btn:hover { background: rgba(204, 0, 0, 0.08); color: var(--heritage-red); }

.topbar-search-btn svg { width: 20px; height: 20px; }

/* ── Sidebar scrim (overlay) ────────────────────────────────────── */

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 5, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 19;
  border: 0;
  padding: 0;
  cursor: pointer;
  animation: scrim-fade-in 200ms ease forwards;
}

/* ── Topbar titles wrapper for ellipsis ─────────────────────────── */

.topbar-titles {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar-titles .topbar-title,
.topbar-titles .topbar-subtitle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── PWA force-update — stage 1: non-dismissible sticky bar ───────
   FB-177 (2026-08-05). Replaces the old .pwa-update-toast. There is no
   dismiss affordance by design: a user on a stale build must move forward.
   z-index 9999 keeps it above the feedback FAB (9001). */

.pwa-update-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  z-index: 9999;
  max-width: calc(100vw - 32px);
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: var(--warm-white);
  border: 1px solid var(--heritage-red-dark);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(139, 0, 0, 0.32);
  padding: 12px 14px;
  opacity: 0;
  transition: opacity 220ms ease, transform 260ms cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}

.pwa-update-bar.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.pwa-update-bar-body {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-update-bar-text {
  display: flex;
  flex-direction: column;
  font-size: 0.88rem;
  line-height: 1.25;
}

.pwa-update-bar-text strong { font-size: 0.95rem; font-weight: 700; }

.pwa-update-bar-text span { opacity: 0.85; }

.pwa-update-bar-btn {
  background: var(--warm-white);
  color: var(--heritage-red);
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 36px;
  white-space: nowrap;
}

.pwa-update-bar-btn:hover { background: var(--eggshell-bright); }

.pwa-update-bar-btn:disabled { opacity: 0.7; cursor: wait; }

/* ── PWA force-update — stage 2: full-screen hard block ───────────
   z-index 100000 sits above EVERYTHING including the feedback FAB (9001)
   and the sticky bar (9999). Deliberate: version currency outranks feedback.
   The FAB stays in the DOM (standing rule: never removed) but is covered and
   non-interactive while the block is up — a stale client must not keep
   operating. See RESULT-BUILD.md "FAB decision". */

.pwa-update-block {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 12, 12, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.pwa-update-block.show {
  opacity: 1;
  pointer-events: auto;
}

/* 2026-11-01: `display: flex` above beat the browser's [hidden] rule, so the
   never-shown blocker was always rendered (transparent, full screen) and
   always exposed to screen readers and browser agents as an aria-modal
   "Update required" dialog over the login screen. Hidden means gone. */
.pwa-update-bar[hidden],
.pwa-update-block[hidden] {
  display: none;
}

.pwa-update-block-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: var(--warm-white);
  border: 1px solid var(--heritage-red-dark);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  padding: 32px 28px;
}

.pwa-update-block-card h2 {
  margin: 12px 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--warm-white);
}

.pwa-update-block-card p {
  margin: 0 0 22px;
  font-size: 0.92rem;
  line-height: 1.5;
  opacity: 0.88;
}

.pwa-update-block-btn {
  background: var(--warm-white);
  color: var(--heritage-red);
  border: 0;
  border-radius: 999px;
  padding: 12px 28px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  min-height: 44px;
}

.pwa-update-block-btn:hover { background: var(--eggshell-bright); }

.pwa-update-block-btn:disabled { opacity: 0.7; cursor: wait; }

/* Freeze background scroll while the hard block is up. */
body.pwa-update-blocking { overflow: hidden; }

/* iOS PWA: respect safe areas
   Note: the .topbar safe-area-inset-top is handled inline in the .topbar
   rule (and overridden in mobile breakpoints) — see ≤980px and ≤880px
   media queries. This block covers footer + sidebar + bottom-fixed UI. */

@supports (padding: env(safe-area-inset-top)) {
  .app-footer {
    padding-bottom: max(20px, calc(env(safe-area-inset-bottom) + 8px));
  }
  .sidebar {
    padding-top: max(28px, env(safe-area-inset-top));
    /* Landscape: respect inset-left so sidebar content clears notch when
       iPhone is rotated with notch on the left. */
    padding-left: max(20px, env(safe-area-inset-left));
  }
  /* PWA update bar: lift above home indicator on devices with one. */
  .pwa-update-bar {
    bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  }
  /* Dampen iOS rubber-banding on the document in standalone mode so the
     page doesn't bounce and reveal the background. Inner scrollable
     panels (sidebar, etc.) already use overscroll-behavior: contain. */
  html, body {
    overscroll-behavior-y: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   NAV DRAWER breakpoint: ≤ 1280px — collapse sidebar, show hamburger
   Canonical nav width; keep shell.js nav-link matchMedia and the drawer
   close-button query below in sync (pwa-shell-selfheal.test.js pins both).
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    height: 100vh;
    padding-top: env(safe-area-inset-top, 0px);
    width: min(86vw, 320px);
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(.2, .8, .2, 1);
    z-index: 20;
    overflow-y: auto;
    box-shadow: 0 0 0 transparent;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.22);
  }
  .topbar-menu-btn { display: inline-flex; }
  .sidebar-scrim { display: block; }
  .sidebar-scrim[hidden] { display: none; }
}

/* Content/topbar compact styling stays at its existing breakpoint. */
@media (max-width: 980px) {
  /* PWA-safe topbar padding on mobile: preserve true safe-area inset only.
     Keep +2px breathing room (was +10). This file loads AFTER 02-layout/03-shell,
     so a larger slack here silently undid the Dynamic Island tighten. */
  .topbar {
    padding: calc(env(safe-area-inset-top, 0px) + 2px) max(14px, env(safe-area-inset-right, 0px)) 0 max(14px, env(safe-area-inset-left, 0px));
    gap: 10px;
    height: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 2px);
  }
  .topbar-title { font-size: 1.15rem; }
  .topbar-subtitle { font-size: 0.78rem; }
  .content { padding: 18px 16px; }
  /* Two-column / multi-column layouts collapse */
  .two-col,
  .three-col,
  .four-col,
  .form-grid { grid-template-columns: 1fr !important; }
}

/* ═══════════════════════════════════════════════════════════════
   Breakpoint: ≤ 720px — tablet portrait / large phone
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 720px) {
  :root {
    --header-h: 60px;
  }
  /* Collapse search bar to icon-button on small screens */
  .topbar-search-btn { display: inline-flex; }
  .search-bar {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 0;
    border-top: 1px solid var(--rule);
    width: auto;
    padding: 10px 14px;
    background: var(--warm-white);
    z-index: 6;
    box-shadow: var(--shadow);
  }
  .search-bar.open { display: flex; align-items: center; gap: 8px; }
  .search-bar input { width: 100%; min-height: 40px; }
  .topbar { position: sticky; }

  /* Topbar action buttons trim down */
  .topbar-actions { gap: 6px; }

  /* User chip → just avatar on mobile (name hidden) */
  .user-chip-name { display: none; }
  .user-chip-caret { display: none; }
  .user-chip {
    padding: 4px;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
  }

  /* Stat grid → 1 col on phones, 2 col on phablets */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }

  /* Kanban → single column stack */
  .kanban,
  .kanban-prod { grid-template-columns: 1fr !important; gap: 12px; }
  .kanban-col { min-height: auto; }

  /* All multi-col grids → 1 col */
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr !important; }

  /* Cards reduce padding */
  .card { padding: 16px; }

  /* H1 sizing */
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
}

/* ═══════════════════════════════════════════════════════════════
   Breakpoint: ≤ 560px — phone portrait (the critical one: 375px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 560px) {
  .content { padding: 14px 12px; }
  .stat-grid { grid-template-columns: 1fr; }

  /* Forms: full width inputs */
  input, select, textarea {
    font-size: 16px; /* prevent iOS zoom on focus */
    min-height: 44px;
  }
  button,
  .btn,
  .nav-link,
  .user-dropdown-item {
    min-height: 44px;
  }
  .nav-link { font-size: 1rem; padding: 12px 14px; }
  .nav-icon { width: 20px; height: 20px; }

  /* Hide topbar subtitle (too tight on phones) */
  .topbar-subtitle { display: none; }
  .topbar-title { font-size: 1.05rem; }

  /* Footer compact */
  .app-footer {
    flex-direction: column;
    gap: 6px;
    text-align: center;
    padding: 14px 12px;
    font-size: 0.72rem;
  }

  /* Tables → card view */
  .table-wrap.responsive-cards {
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  /* Universal table-as-cards pattern: assumes <th> headers as cell labels via data-label.
     For tables not annotated, fall back to horizontal scroll. */
  table.data-table.cards,
  .table-wrap table.data-table {
    /* Default to horizontal scroll on small screens */
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  table.data-table.cards thead { display: none; }
  table.data-table.cards,
  table.data-table.cards tbody,
  table.data-table.cards tr,
  table.data-table.cards td {
    display: block;
    white-space: normal;
  }
  table.data-table.cards tr {
    background: var(--warm-white);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
  }
  table.data-table.cards td {
    padding: 6px 0;
    border: 0;
    position: relative;
  }
  table.data-table.cards td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-mute);
    font-weight: 600;
    margin-bottom: 2px;
  }

  /* Dialogs / modals: full-screen-friendly */
  .modal,
  .dialog {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    height: 100dvh;
    height: 100vh;
  }
  .modal-overlay { padding: 0; }

  /* Brand name compresses */
  .brand-name .name-en { font-size: 1rem; }
  .brand-tag { font-size: 0.62rem; }

  /* PWA force-update bar on phone */
  .pwa-update-bar {
    bottom: 16px;
    left: 12px;
    right: 12px;
    transform: translateX(0) translateY(20px);
    max-width: none;
  }
  .pwa-update-bar.show { transform: translateX(0) translateY(0); }
  .pwa-update-bar-body { flex-wrap: wrap; }
  .pwa-update-bar-btn { width: 100%; }

  /* Hard block on phone — card fills the width. */
  .pwa-update-block { padding: 16px; }
  .pwa-update-block-card { padding: 26px 20px; }
}

/* ═══════════════════════════════════════════════════════════════
   Touch device tweaks (regardless of width)
   ═══════════════════════════════════════════════════════════════ */

@media (hover: none) and (pointer: coarse) {
  /* Larger tap targets for all interactive elements */
  .btn,
  button.btn,
  .icon-btn,
  .ghost-btn,
  .primary-btn {
    min-height: 44px;
    min-width: 44px;
  }
  .nav-link { padding-top: 11px; padding-bottom: 11px; }
  /* Remove hover lift effects that misfire on touch */
  .stat-card:hover { transform: none; }
  .kanban-card:hover { transform: none; }
}

/* ─── Login page mobile fixes ─────────────────────────────────── */

@media (max-width: 560px) {
  /* Global overflow guard — scoped to the shell wrapper, NOT html/body.
     overflow-x:hidden on html/body breaks position:fixed on iOS Safari
     (containing-block bug) and was floating the FABs mid-screen. The
     guard belongs on .app-shell, which is not a fixed-positioning
     ancestor of the body-level FABs. */
  html, body { max-width: 100vw; }
  .app-shell { overflow-x: clip; max-width: 100vw; }
  .login-page { padding: 14px 10px; min-height: 100dvh; }
  .login-card.card.gateway,
  .login-card {
    padding: 22px 16px 16px;
    max-width: 100%;
    border-radius: 16px;
  }
  .login-mark { height: 72px; margin-bottom: 14px; }
  .login-title { font-size: 1.55rem; }
  .login-subtitle { font-size: 0.66rem; letter-spacing: 0.14em; padding: 4px 8px; }
  .login-tagline {
    font-size: 0.85rem;
    margin-bottom: 20px;
    max-width: 100%;
    padding: 0 2px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    line-height: 1.45;
  }
  .login-divider { margin: 18px 0 14px; }
  .btn-leespace { padding: 12px 14px; font-size: 0.92rem; }
  .btn-leespace-status { font-size: 0.62rem; padding: 2px 6px; }
  .login-demo-grid { max-height: 60vh; }
  .login-demo-grid .demo-user-card {
    padding: 10px 12px !important;
  }
  .persona-card { padding: 10px 12px; gap: 10px; min-height: 56px; }
  .persona-avatar { width: 36px; height: 36px; font-size: 0.85rem; }
  .persona-name { font-size: 0.9rem; }
  .persona-meta { font-size: 0.7rem; }
  .persona-role-pill { font-size: 0.58rem; padding: 2px 6px; letter-spacing: 0.02em; }
  .login-footer { font-size: 0.7rem; padding: 16px 0 8px; }
}

/* ─── Generic table horizontal scroll on small + tablet screens ───
   The base .table-wrap rule already enables overflow-x: auto everywhere.
   On tablet portrait + phone, we additionally:
     - keep table cells nowrap (so meaningful scroll affordance triggers),
     - reduce padding,
     - expose the swipe-hint badge injected by mobile-shims.js when the
       table actually overflows. */

@media (max-width: 1024px) {
  .table-wrap {
    position: relative;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap table.data-table th,
  .table-wrap table.data-table td {
    white-space: nowrap;
  }
}

@media (max-width: 720px) {
  .table-wrap table.data-table th,
  .table-wrap table.data-table td {
    padding-left: 12px;
    padding-right: 12px;
    font-size: 0.85rem;
  }
}

/* Wrap-level "swipe" hint badge — visible whenever the JS shim has
   injected it (i.e., the table actually overflows on tablet portrait or
   phone widths). Arrow points to the hidden content direction (→). */

.table-wrap-shell .table-wrap-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--heritage-gold-dark);
  margin: 4px 0 6px;
  padding: 3px 8px;
  background: rgba(212, 168, 67, 0.12);
  border-radius: 999px;
}

.table-wrap-shell .table-wrap-hint::before {
  content: 'swipe';
  font-size: 0.62rem;
  font-weight: 700;
  margin-right: 2px;
  letter-spacing: 0.08em;
}

.table-wrap-shell .table-wrap-hint::after {
  content: '→';
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
}

.table-wrap-shell .table-wrap-hint { padding: 3px 10px; }

/* ─── Hamburger menu: explicit close button in sidebar ──────────── */

.sidebar-close-btn {
  display: none;
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  right: 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  z-index: 21;
}

.sidebar-close-btn:hover {
  background: rgba(204, 0, 0, 0.08);
  color: var(--heritage-red);
}

.sidebar-close-btn svg { width: 20px; height: 20px; }

/* Same NAV DRAWER breakpoint as above and shell.js nav-link matchMedia. */
@media (max-width: 1280px) {
  .sidebar-close-btn { display: inline-flex; }
  .sidebar .brand { padding-right: 48px; } /* leave room for close button */
}

/* ─── Table scroll shell: gradient fade affordance ──────────────── */

.table-wrap-shell {
  position: relative;
}

.table-wrap-shell .table-wrap-fade {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 48px;
  pointer-events: none;
  /* Strong solid-to-transparent fade in the warm-white surface color so
     content visibly dissolves into the right edge. Layered with a faint
     gold tint to keep the brand feel. */
  background:
    linear-gradient(to right,
      rgba(255, 253, 248, 0) 0%,
      rgba(255, 253, 248, 0.7) 55%,
      rgba(255, 253, 248, 0.98) 100%),
    linear-gradient(to right,
      rgba(212, 168, 67, 0) 0%,
      rgba(212, 168, 67, 0.06) 100%);
  transition: opacity 180ms ease;
  z-index: 2;
  border-top-right-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* Animated nudge arrow at the right edge to signal scroll direction */

.table-wrap-shell .table-wrap-fade::after {
  content: '›';
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--heritage-red);
  opacity: 0.85;
  line-height: 1;
  animation: tableNudge 1.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .table-wrap-shell .table-wrap-fade::after { animation: none; }
}

/* On wide desktop, no fade needed (tables fit). The shim only injects the
   shell when the table actually overflows, so this is mostly belt-and-
   suspenders. The shell only mounts up to 1024px (see mobile-shims.js). */

@media (min-width: 1025px) {
  .table-wrap-shell .table-wrap-fade { display: none; }
}

/* ─── Section header wraps cleanly on mobile ────────────────────── */

@media (max-width: 720px) {
  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .section-header > div.flex {
    flex-wrap: wrap;
    gap: 8px;
  }
  .section-header .btn {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .section-title { font-size: 1.2rem; }
}

/* ─── Filter rows wrap cleanly on mobile ────────────────────────── */

@media (max-width: 720px) {
  .filter-bar,
  .filters,
  .filter-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .filter-bar > *,
  .filters > *,
  .filter-row > * {
    flex: 1 1 calc(50% - 4px);
    min-width: 130px;
  }
  /* Inputs that should always take full width */
  .filter-bar input[type="search"],
  .filter-bar input.form-input,
  .filters input[type="search"],
  .filters input.form-input {
    flex-basis: 100%;
  }
  /* Action buttons (New …) stay compact */
  .filter-bar .btn-primary,
  .filters .btn-primary {
    flex: 0 0 auto;
  }
}

/* ─────────────────────────────────────────────────
 * Inline editing affordances (writeback layer)
 * ───────────────────────────────────────────────── */

.inline-edit-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background-color 120ms ease;
}

.inline-edit-wrap:hover {
  background-color: rgba(204, 0, 0, 0.04);
}

.inline-edit-wrap:hover .inline-edit-caret {
  opacity: 0.85 !important;
}

.inline-edit-wrap.editing {
  background-color: transparent;
  padding: 0;
  margin: 0;
}

.inline-edit-caret {
  transition: opacity 120ms ease;
}

.inline-edit-select {
  border: 1.5px solid var(--heritage-red);
  border-radius: 6px;
  outline: none;
}

.btn-new-record {
  background: var(--heritage-red);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  transition: background 120ms ease, transform 60ms ease;
}

.btn-new-record:hover {
  background: #a30000;
}

.btn-new-record:active {
  transform: translateY(1px);
}

/* Toast variants are defined in 04-components.css (light bg + colored
 * left border) and 90-dark-mode.css. A previous rule here set a GLOBAL
 * dark navy background (#243040) on .toast.info — toasts render in the
 * body-level #toast-container portal, so the rule leaked to every info
 * toast app-wide, producing dark-ink-on-dark-navy in light mode (Kevin's
 * unreadable Workspace export toast, 2026-07-08). Removed: info toasts
 * fall back to the standard readable style. */
/* ============================================================
   26-production.css
   Production, QA, demand, market intel pages
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* =================================================================
   OPERATIONS EXPANSION — Production / QA / Disruptions / Demand
   Knowledge Base / 30-60-90 Plan
   ================================================================= */

/* --- Production-specific status badges --- */

.badge-po-new        { background: rgba(91, 44, 138, 0.10); color: var(--heritage-purple); border-color: rgba(91, 44, 138, 0.22); }

.badge-po-in_progress{ background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); border-color: rgba(212, 168, 67, 0.42); }

.badge-po-won        { background: rgba(45, 140, 60, 0.12); color: var(--success-deep); border-color: rgba(45, 140, 60, 0.30); }

.badge-po-urgent     { background: rgba(204, 0, 0, 0.12); color: var(--heritage-red-dark); border-color: rgba(204, 0, 0, 0.35); }

/* Kanban column accents for production statuses */

.kanban-prod .kanban-col[data-status="released"]    .kanban-col-title::before { background: var(--heritage-purple); }

.kanban-prod .kanban-col[data-status="in-process"]  .kanban-col-title::before { background: var(--heritage-gold); }

.kanban-prod .kanban-col[data-status="confirmed"]   .kanban-col-title::before { background: var(--success); }

.kanban-prod .kanban-col[data-status="disrupted"]   .kanban-col-title::before { background: var(--heritage-red); }

/* Disrupted highlighting */

.po-card.po-disrupted {
  border-left: 3px solid var(--heritage-red);
  background: rgba(204, 0, 0, 0.03);
}

.po-warn {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(204, 0, 0, 0.05);
  border-left: 3px solid var(--heritage-red);
  border-radius: 4px;
  color: var(--heritage-red-dark);
  font-size: 0.8rem;
  line-height: 1.4;
  font-style: italic;
}

tr.row-disrupted { background: rgba(204, 0, 0, 0.04); }

tr.row-disrupted:hover { background: rgba(204, 0, 0, 0.08); }

/* Stat-card red variant */

.stat-card.red::before { background: var(--heritage-red); }

/* --- Demand signal type badges --- */

.type-badge { font-size: 0.74rem; letter-spacing: 0.04em; }

.type-badge.type-green  { background: rgba(45, 140, 60, 0.12); color: var(--success-deep); border-color: rgba(45, 140, 60, 0.30); }

.type-badge.type-gold   { background: rgba(212, 168, 67, 0.18); color: var(--heritage-gold-dark); border-color: rgba(212, 168, 67, 0.42); }

.type-badge.type-purple { background: rgba(91, 44, 138, 0.12); color: var(--heritage-purple); border-color: rgba(91, 44, 138, 0.28); }

.type-badge.type-red    { background: rgba(204, 0, 0, 0.08); color: var(--heritage-red); border-color: rgba(204, 0, 0, 0.22); }

/* ══════════════ Utility classes — inline-style lift (2026-07-16 polish) ══════════════
   Static style="..." patterns from production.js lifted to token-aware classes.
   Residual inline styles are runtime-dynamic only: upload progress width,
   product-family accent colors, heat-cell heat alpha. Dark variants included
   for every lifted color that was light-only. */

/* --- spacing --- */
.prod-mt-2  { margin-top: 2px; }
.prod-mt-4  { margin-top: 4px; }
.prod-mt-6  { margin-top: 6px; }
.prod-mt-8  { margin-top: 8px; }
.prod-mt-10 { margin-top: 10px; }
.prod-mt-12 { margin-top: 12px; }
.prod-mt-14 { margin-top: 14px; }
.prod-mt-16 { margin-top: 16px; }
.prod-mt-18 { margin-top: 18px; }
.prod-mb-6  { margin-bottom: 6px; }
.prod-mb-10 { margin-bottom: 10px; }
.prod-mb-12 { margin-bottom: 12px; }
.prod-mb-14 { margin-bottom: 14px; }
.prod-ml-4  { margin-left: 4px; }
.prod-ml-6  { margin-left: 6px; }
.prod-m-0       { margin: 0; }
.prod-m-0-0-4   { margin: 0 0 4px; }
.prod-m-0-0-8   { margin: 0 0 8px; }
.prod-m-0-0-10  { margin: 0 0 10px; }
.prod-m-0-0-12  { margin: 0 0 12px; }
.prod-m-0-0-14  { margin: 0 0 14px; }
.prod-m-0-0-18  { margin: 0 0 18px; }
.prod-m-6-0-10  { margin: 6px 0 10px; }
.prod-m-8-0-4   { margin: 8px 0 4px; }
.prod-m-8-0-10  { margin: 8px 0 10px; }
.prod-m-14-0-8  { margin: 14px 0 8px; }
.prod-m-18-0-8  { margin: 18px 0 8px; }
.prod-m-14-0-0  { margin: 14px 0 0; }

/* --- type --- */
.prod-fs-62  { font-size: 0.62rem; }
.prod-fs-66  { font-size: 0.66rem; }
.prod-fs-70  { font-size: 0.7rem; }
.prod-fs-72  { font-size: 0.72rem; }
.prod-fs-74  { font-size: 0.74rem; }
.prod-fs-76  { font-size: 0.76rem; }
.prod-fs-78  { font-size: 0.78rem; }
.prod-fs-80  { font-size: 0.8rem; }
.prod-fs-82  { font-size: 0.82rem; }
.prod-fs-84  { font-size: 0.84rem; }
.prod-fs-85  { font-size: 0.85rem; }
.prod-fs-86  { font-size: 0.86rem; }
.prod-fs-88  { font-size: 0.88rem; }
.prod-fs-90  { font-size: 0.9rem; }
.prod-fs-92  { font-size: 0.92rem; }
.prod-fs-95  { font-size: 0.95rem; }
.prod-fs-100 { font-size: 1rem; }
.prod-fs-105 { font-size: 1.05rem; }
.prod-fs-115 { font-size: 1.15rem; }
.prod-fs-14  { font-size: 1.4rem; }
.prod-fs-20  { font-size: 2rem; }
.prod-fs-22  { font-size: 2.2rem; }
.prod-fw-600 { font-weight: 600; }
.prod-fw-700 { font-weight: 700; }
.prod-fw-400 { font-weight: 400; }
.prod-mono   { font-family: var(--font-mono, monospace); }
.prod-tar    { text-align: right; }
.prod-tac    { text-align: center; }
.prod-serif  { font-family: var(--font-serif); font-style: italic; }
.prod-hidden { display: none; }
.prod-cursor { cursor: pointer; }
.prod-wrap   { flex-wrap: wrap; }
.prod-gap-8  { gap: 8px; }
.prod-gap-10 { gap: 10px; }
.prod-maxw-540 { max-width: 540px; }

/* --- small stat cards in summary strips --- */
.prod-pad-10    { padding: 10px; }
.prod-pad-1012  { padding: 10px 12px; }
.prod-pad-1014  { padding: 10px 14px; }
.prod-pad-12    { padding: 12px; }
.prod-pad-1214  { padding: 12px 14px; }
.prod-pad-14    { padding: 14px; }
.prod-pad-16    { padding: 16px; }
.prod-pad-18    { padding: 18px; }
.prod-stat-num-11 { font-size: 1.1rem; font-weight: 600; }
.prod-stat-num-13 { font-size: 1.3rem; font-weight: 600; }
.prod-stat-num-14 { font-size: 1.4rem; font-weight: 600; }
.prod-stat-num-15 { font-size: 1.5rem; font-weight: 600; }

/* --- responsive auto-fit grids (collapse to 1 col on narrow viewports) --- */
.prod-grid-fit-140  { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.prod-grid-fit-140b { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.prod-grid-fit-150  { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.prod-grid-fit-180  { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.prod-grid-fit-200  { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.prod-grid-fit-220  { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* --- flex rows --- */
.prod-flex-between   { display: flex; justify-content: space-between; align-items: baseline; }
.prod-flex-between-c { display: flex; justify-content: space-between; align-items: center; }
.prod-flex-row       { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.prod-flex-wrap-6    { display: flex; flex-wrap: wrap; gap: 6px; }
.prod-flex-wrap-8    { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- severity tones (closed set: high / medium / low) --- */
.prod-sev-high   { background: rgba(204,0,0,0.08);   color: #CC0000; }
.prod-sev-medium { background: rgba(212,168,67,0.12); color: #D4A843; }
.prod-sev-low    { background: rgba(91,140,90,0.10);  color: #5B8C5A; }
[data-theme="dark"] .prod-sev-high { color: #ff8a7a; }
[data-theme="dark"] .prod-sev-low  { color: #6fd598; }
.prod-accent-high   { border-left: 4px solid #CC0000; }
.prod-accent-medium { border-left: 4px solid #D4A843; }
.prod-accent-low    { border-left: 4px solid #5B8C5A; }
.prod-accent-sm-danger  { border-left: 3px solid #CC0000; }
.prod-accent-sm-gold    { border-left: 3px solid #D4A843; }
.prod-accent-sm-success { border-left: 3px solid #5B8C5A; }
.prod-accent-danger     { border-left: 4px solid #CC0000; }
.prod-accent-danger-var { border-left: 4px solid var(--danger, #C0392B); }
.prod-accent-warn       { border-left: 4px solid #D4A843; }
.prod-accent-purple     { border-left: 4px solid var(--heritage-purple, #5B2C8A); }

/* --- conditional number / text colors (dark-safe) --- */
.prod-num-danger     { color: #CC0000; }
.prod-num-gold       { color: #D4A843; }
.prod-num-gold-dark  { color: #8B6914; }
.prod-num-success    { color: #5B8C5A; }
.prod-num-muted      { color: var(--text-mute); }
.prod-text-danger    { color: var(--heritage-red, #CC0000); }
.prod-text-gold      { color: #D4A843; }
.prod-text-gold-dark { color: #8B6914; }
.prod-text-purple    { color: var(--heritage-purple, #5B2C8A); }
.prod-text-success   { color: #5B8C5A; }
[data-theme="dark"] .prod-num-danger    { color: #ff8a7a; }
[data-theme="dark"] .prod-num-gold-dark { color: #e8c87a; }
[data-theme="dark"] .prod-num-success   { color: #6fd598; }
[data-theme="dark"] .prod-text-danger    { color: #ff8a7a; }
[data-theme="dark"] .prod-text-gold-dark { color: #e8c87a; }
[data-theme="dark"] .prod-text-purple    { color: #c9a7f5; }
[data-theme="dark"] .prod-text-success   { color: #6fd598; }

/* --- shared chips --- */
.prod-chip-purple { background: rgba(91,44,138,0.10); color: var(--heritage-purple, #5B2C8A); }
.prod-persona-chip { padding: 1px 6px; border-radius: 4px; font-weight: 600; }
[data-theme="dark"] .prod-chip-purple { background: rgba(155,109,217,0.18); color: #c9a7f5; }

/* --- brand-red ghost buttons (Save to LeeSpace / QI calendar) --- */
.prod-btn-red { color: var(--heritage-red, #CC0000); border-color: var(--heritage-red, #CC0000); }
[data-theme="dark"] .prod-btn-red { color: #ff8a7a; border-color: rgba(255,138,122,0.55); }

/* --- empty / upload state --- */
.prod-dropzone-tall  { min-height: 260px; flex-direction: column; }
.prod-dropzone-modal { min-height: 200px; flex-direction: column; }
.prod-progress-track { background: var(--surface-alt, var(--rule-soft, #EFE5D2)); border-radius: 4px; height: 8px; margin-top: 8px; overflow: hidden; }
.prod-progress-fill  { background: var(--heritage-red, #CC0000); height: 100%; transition: width .25s; }
.prod-err-list { margin: 8px 0 0; padding-left: 20px; font-size: 0.82rem; }

/* --- dashboard header --- */
.prod-source-note { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.prod-btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.prod-shimmer-80  { height: 80px; }
.prod-shimmer-320 { height: 320px; }

/* --- insights hero --- */
.prod-insights-hero {
  padding: 18px 20px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(204,0,0,0.04), rgba(212,168,67,0.06));
  border-left: 4px solid var(--heritage-red, #CC0000);
}
[data-theme="dark"] .prod-insights-hero {
  background: linear-gradient(135deg, rgba(204,0,0,0.12), rgba(212,168,67,0.10));
}
.prod-hero-flex { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.prod-hero-text { flex: 1; min-width: 280px; }
.prod-hero-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.prod-hero-sub { margin: 4px 0 0; font-size: 0.92rem; line-height: 1.45; }
.prod-empty-center    { padding: 24px; text-align: center; }
.prod-empty-center-lg { padding: 28px; text-align: center; }

/* --- ask history + ask dialog --- */
.prod-ask-panel { padding: 16px; margin-bottom: 16px; border-left: 4px solid var(--heritage-purple, #5B2C8A); }
.prod-ask-head  { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.prod-ask-item  { padding: 10px 0; border-bottom: 1px dashed var(--border-soft, var(--rule-soft, #EFE5D2)); }
.prod-ask-q { font-size: 0.86rem; font-weight: 600; color: var(--heritage-purple, #5B2C8A); }
[data-theme="dark"] .prod-ask-q { color: #c9a7f5; }
.prod-ask-a { font-size: 0.88rem; line-height: 1.5; margin-top: 6px; white-space: pre-wrap; }
.prod-ask-textarea { width: 100%; padding: 10px 12px; font-size: 0.92rem; resize: vertical; }
.prod-ask-example { font-size: 0.76rem; padding: 4px 10px; }
.prod-answer-md { font-size: 0.92rem; line-height: 1.55; }
.prod-pre-wrap { white-space: pre-wrap; }

/* --- finding / signal cards --- */
.prod-finding-card { padding: 16px 18px; margin-bottom: 12px; }
.prod-signal-card  { padding: 16px; margin-bottom: 12px; }
.prod-finding-evidence { margin: 8px 0 10px; font-size: 0.86rem; line-height: 1.5; color: var(--text); }
.prod-suggested {
  padding: 10px 12px;
  background: rgba(91,44,138,0.06);
  border-left: 3px solid var(--heritage-purple, #5B2C8A);
  font-size: 0.84rem;
  line-height: 1.45;
  margin-bottom: 10px;
}
[data-theme="dark"] .prod-suggested { background: rgba(155,109,217,0.14); }
.prod-details-summary { cursor: pointer; font-size: 0.82rem; color: var(--text-mute); padding: 4px 0; }
.prod-table-sm { font-size: 0.82rem; }

/* --- QI calendar chip (JS hooks .prod-qi-cal-chip) --- */
.prod-qi-cal-chip {
  padding: 2px 8px;
  font-size: 0.7rem;
  color: var(--heritage-red, #CC0000);
  border: 1px solid var(--heritage-red, #CC0000);
  border-radius: 999px;
  background: transparent;
}
[data-theme="dark"] .prod-qi-cal-chip { color: #ff8a7a; border-color: rgba(255,138,122,0.55); }

/* --- floor view --- */
.prod-floor-toolbar { margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.prod-cook-card { padding: 12px; margin-bottom: 10px; cursor: default; }
.prod-line-card { padding: 14px; margin-bottom: 12px; }
.prod-wc-mono { font-weight: 700; font-family: var(--font-mono, monospace); }
.prod-sfg-name { margin-top: 6px; font-size: 0.88rem; line-height: 1.35; }
.prod-feeds { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-soft, var(--rule-soft, #EFE5D2)); }
.prod-feeds-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; }
.prod-feed-chips { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.prod-cookonly { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border-soft, var(--rule-soft, #EFE5D2)); font-size: 0.74rem; color: var(--text-mute); }
.prod-changeover {
  margin: 6px 0;
  padding: 4px 8px;
  background: rgba(212,168,67,0.12);
  border-left: 3px solid #D4A843;
  font-size: 0.74rem;
  color: #8B6914;
}
[data-theme="dark"] .prod-changeover { background: rgba(212,168,67,0.18); color: #e8c87a; }
.prod-line-run {
  padding: 10px;
  border-radius: 6px;
  background: var(--surface, var(--paper, #FBF6EC));
  margin-bottom: 6px;
}
.prod-noqi { font-size: 0.74rem; color: var(--heritage-red, #CC0000); }
[data-theme="dark"] .prod-noqi { color: #ff8a7a; }
.prod-remark { font-size: 0.72rem; margin-top: 4px; font-style: italic; }
.prod-line-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft, var(--rule-soft, #EFE5D2));
}
.prod-floor-layout { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 16px; }
@media (max-width: 720px) {
  .prod-floor-layout { grid-template-columns: 1fr; }
}
.prod-h-note { font-style: normal; font-weight: 400; }

/* --- week heatmap --- */
.prod-heat-card  { padding: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.prod-heat-table { border-collapse: collapse; }
.prod-heat-th    { padding: 8px 4px; text-align: center; font-size: 0.78rem; min-width: 64px; }
.prod-heat-th-l  { padding: 8px 10px; text-align: left; }
.prod-heat-th-r  { padding: 8px 10px; text-align: right; border-left: 1px solid var(--border-soft, var(--rule-soft, #EFE5D2)); }
.prod-heat-thdate { font-weight: 400; font-size: 0.72rem; }
.prod-heat-cell  { padding: 6px 4px; text-align: center; cursor: pointer; min-width: 64px; }
.prod-heat-empty { padding: 6px 4px; text-align: center; background: var(--surface-alt, var(--rule-soft, #EFE5D2)); color: var(--text-mute); font-size: 0.7rem; }
.prod-heat-chg   { font-size: 0.62rem; color: #8B6914; }
[data-theme="dark"] .prod-heat-chg { color: #e8c87a; }
.prod-heat-units { font-size: 0.66rem; opacity: 0.85; }
.prod-heat-linecell { padding: 6px 10px; font-family: var(--font-mono, monospace); font-size: 0.82rem; font-weight: 600; }
.prod-heat-linedesc { font-size: 0.7rem; font-weight: 400; font-family: var(--font-sans, sans-serif); }
.prod-heat-totalcell { padding: 6px 10px; text-align: right; font-size: 0.82rem; border-left: 1px solid var(--border-soft, var(--rule-soft, #EFE5D2)); }
.prod-heat-footrow  { border-top: 2px solid var(--border, var(--rule, #E5D9C4)); }
.prod-heat-daytotal { padding: 8px 10px; font-weight: 600; background: var(--surface-alt, var(--rule-soft, #EFE5D2)); }
.prod-heat-footcell { padding: 6px 4px; text-align: center; font-size: 0.78rem; background: var(--surface-alt, var(--rule-soft, #EFE5D2)); }
.prod-heat-fillcell { padding: 6px 10px; background: var(--surface-alt, var(--rule-soft, #EFE5D2)); }
.prod-legend { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; margin-top: 10px; flex-wrap: wrap; }
.prod-legend-light { background: rgba(204,0,0,0.15); padding: 2px 8px; border-radius: 3px; }
.prod-legend-mid   { background: rgba(204,0,0,0.45); padding: 2px 8px; border-radius: 3px; color: #fff; }
.prod-legend-heavy { background: rgba(204,0,0,0.85); padding: 2px 8px; border-radius: 3px; color: #fff; }

/* --- order coverage --- */
.prod-unscheduled { padding: 16px; margin-top: 14px; border-left: 4px solid #D4A843; }
.prod-family-search { max-width: 220px; padding: 6px 10px; font-size: 0.85rem; }

/* --- product deep-dive --- */
.prod-qi-stats { display: flex; gap: 24px; align-items: baseline; }

/* --- markdown renderer (weekly brief) --- */
.prod-md-h1 { margin: 0 0 10px; font-family: var(--font-serif); font-style: italic; font-size: 1.4rem; }
.prod-md-h2 { margin: 18px 0 8px; font-family: var(--font-serif); font-style: italic; font-size: 1.1rem; }
.prod-md-h3 { margin: 14px 0 6px; font-family: var(--font-serif); font-style: italic; }
.prod-md-quote { border-left: 3px solid var(--border, var(--rule, #E5D9C4)); padding: 4px 10px; margin: 6px 0; color: var(--text-mute); }
.prod-md-ul { margin: 6px 0 10px; padding-left: 22px; }

/* --- save-to-LeeSpace dialog (hardcoded #f0faf0/#fff0f0 → dark-safe tints) --- */
.prod-save-col { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.prod-save-check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.prod-checkbox { width: 16px; height: 16px; }
.prod-save-status { min-height: 32px; }
.prod-save-footer { display: flex; gap: 10px; justify-content: flex-end; }
.prod-save-confirm { background: var(--heritage-red, #CC0000); border-color: var(--heritage-red, #CC0000); }
.prod-save-ok {
  padding: 10px 12px;
  background: rgba(45,140,60,0.08);
  border-radius: 6px;
  border-left: 4px solid #5B8C5A;
}
.prod-save-ok-strong { color: #5B8C5A; }
[data-theme="dark"] .prod-save-ok { background: rgba(45,140,60,0.16); }
[data-theme="dark"] .prod-save-ok-strong { color: #6fd598; }
.prod-save-err {
  padding: 10px 12px;
  background: rgba(204,0,0,0.06);
  border-radius: 6px;
  border-left: 4px solid var(--heritage-red, #CC0000);
}
[data-theme="dark"] .prod-save-err { background: rgba(204,0,0,0.14); }

/* =================================================================
   PRODUCTION INTELLIGENCE — manufacturing polish pass (2026-07-31)

   Added for the Patrick / PMC floor intro. Everything here replaces an
   inline style that previously lived inside a JS template literal, so the
   palette is defined once and dark mode works. See DESIGN.md (B7).
   ================================================================= */

/* --- tone scale, shared by numbers / percentages / bars / badges --------- */
[data-tone="danger"]  { color: var(--heritage-red); font-weight: 600; }
[data-tone="warn"]    { color: var(--heritage-gold-dark); font-weight: 600; }
[data-tone="success"] { color: var(--success-deep); font-weight: 600; }
[data-tone="plan"]    { color: var(--heritage-purple); font-weight: 600; }
[data-tone="muted"]   { color: var(--text-mute, var(--ink-mute)); }
[data-tone="plain"]   { color: var(--text, var(--ink)); }
[data-theme="dark"] [data-tone="danger"]  { color: #ff8a7a; }
[data-theme="dark"] [data-tone="warn"]    { color: var(--heritage-gold-light); }
[data-theme="dark"] [data-tone="success"] { color: #6fd598; }
[data-theme="dark"] [data-tone="plan"]    { color: #c9a6f0; }

/* Tabular figures so quantity columns align on the decimal. */
.prod-num, .prod-pct, .prod-progress-cell { font-variant-numeric: tabular-nums; }

/* --- week context bar: plan-vs-actuals + cross-week honesty -------------- */
.prod-context-bar {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 12px;
}
.prod-context-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.prod-mode-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; letter-spacing: 0.01em;
  border: 1px solid transparent;
}
.prod-mode-actual {
  background: rgba(45,140,60,0.10); color: var(--success-deep);
  border-color: rgba(45,140,60,0.28);
}
.prod-mode-plan {
  background: rgba(91,44,138,0.10); color: var(--heritage-purple);
  border-color: rgba(91,44,138,0.26);
}
.prod-mode-mixed {
  background: rgba(212,168,67,0.14); color: var(--heritage-gold-dark);
  border-color: rgba(212,168,67,0.40);
}
[data-theme="dark"] .prod-mode-actual { background: rgba(45,140,60,0.18); color: #6fd598; }
[data-theme="dark"] .prod-mode-plan   { background: rgba(91,44,138,0.22); color: #c9a6f0; }
[data-theme="dark"] .prod-mode-mixed  { background: rgba(212,168,67,0.20); color: var(--heritage-gold-light); }

.prod-context-warn {
  padding: 8px 12px; border-radius: 6px;
  background: rgba(212,168,67,0.10);
  border-left: 3px solid var(--heritage-gold);
  font-size: 0.8rem; line-height: 1.45;
  color: var(--heritage-gold-dark);
}
[data-theme="dark"] .prod-context-warn { background: rgba(212,168,67,0.16); color: var(--heritage-gold-light); }

.prod-toolbar-main { flex-wrap: wrap; gap: 10px; row-gap: 10px; }
.prod-period-selector { display: inline-flex; align-items: center; gap: 8px; }
.prod-period-label { font-size: 13px; }

/* --- plant pills (replaces the bare <select> on the floor view) ---------- */
.prod-plant-pills { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.prod-plant-pill {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  gap: 1px; padding: 6px 12px;
  border: 1px solid var(--border, var(--border-light));
  border-radius: 8px; background: var(--surface, var(--warm-white));
  cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
  line-height: 1.2; text-align: left;
}
.prod-plant-pill:hover:not([disabled]) {
  border-color: var(--heritage-red); transform: translateY(-1px);
}
.prod-plant-pill.active {
  border-color: var(--heritage-red);
  background: rgba(204,0,0,0.06);
  box-shadow: inset 0 0 0 1px rgba(204,0,0,0.18);
}
.prod-plant-pill[disabled] { opacity: 0.45; cursor: not-allowed; }
.prod-plant-letter { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em; }
.prod-plant-meta   { font-size: 0.68rem; color: var(--text-mute, var(--ink-mute)); }
[data-theme="dark"] .prod-plant-pill.active { background: rgba(204,0,0,0.16); }

/* --- "today" affordances on the floor date strip ------------------------- */
.prod-date-today { position: relative; }
.prod-today-dot {
  display: inline-block; width: 6px; height: 6px; margin-left: 5px;
  border-radius: 50%; background: var(--heritage-red); vertical-align: middle;
}
.prod-floor-note {
  margin: 8px 0 0; padding: 8px 12px; border-radius: 6px;
  background: var(--surface-alt, rgba(0,0,0,0.03));
  font-size: 0.8rem; color: var(--text-mute, var(--ink-mute));
}
[data-theme="dark"] .prod-floor-note { background: rgba(255,255,255,0.05); }

/* --- fill/pack run card (was fully inline-styled) ------------------------ */
.prod-run {
  padding: 10px; border-radius: 6px; margin-bottom: 6px;
  background: var(--surface, var(--warm-white));
  border-left: 4px solid var(--prod-family-color, var(--ink-faint));
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.prod-run:hover { transform: translateX(2px); box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.prod-run:focus-visible { outline: 2px solid var(--heritage-red); outline-offset: 2px; }
.prod-run-chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px;
}
.prod-run-sfg {
  font-size: 0.7rem; font-family: var(--font-mono, ui-monospace, monospace);
  opacity: 0.85; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 240px;
}

/* Product-family accent palette. `--prod-family-color` drives the run card
   border and the family badge, so one token controls both. */
[data-family-tone="red"]    { --prod-family-color: var(--heritage-red);    --prod-family-bg: rgba(204,0,0,0.10); }
[data-family-tone="brown"]  { --prod-family-color: #8B4513;               --prod-family-bg: rgba(139,69,19,0.10); }
[data-family-tone="gold"]   { --prod-family-color: var(--heritage-gold-dark); --prod-family-bg: rgba(212,168,67,0.14); }
[data-family-tone="purple"] { --prod-family-color: var(--heritage-purple); --prod-family-bg: rgba(91,44,138,0.10); }
[data-family-tone="green"]  { --prod-family-color: var(--success-deep);    --prod-family-bg: rgba(45,140,60,0.10); }
[data-family-tone="orange"] { --prod-family-color: #C2620E;               --prod-family-bg: rgba(230,126,34,0.12); }
[data-family-tone="slate"]  { --prod-family-color: #566573;               --prod-family-bg: rgba(86,101,115,0.10); }
[data-theme="dark"] [data-family-tone="brown"]  { --prod-family-color: #d2a679; }
[data-theme="dark"] [data-family-tone="gold"]   { --prod-family-color: var(--heritage-gold-light); }
[data-theme="dark"] [data-family-tone="purple"] { --prod-family-color: #c9a6f0; }
[data-theme="dark"] [data-family-tone="green"]  { --prod-family-color: #6fd598; }
[data-theme="dark"] [data-family-tone="orange"] { --prod-family-color: #f0a35e; }
[data-theme="dark"] [data-family-tone="slate"]  { --prod-family-color: #9fb0c0; }

.prod-family-badge {
  font-size: 0.7rem;
  background: var(--prod-family-bg, rgba(86,101,115,0.10));
  color: var(--prod-family-color, #566573);
  border-color: color-mix(in srgb, var(--prod-family-color, #566573) 30%, transparent);
}

/* --- cook→fill readiness chips (B2) ------------------------------------- */
.prod-ready-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.prod-ready-cook  { background: rgba(45,140,60,0.10);  color: var(--success-deep);        border-color: rgba(45,140,60,0.26); }
.prod-ready-wip   { background: rgba(91,44,138,0.09);  color: var(--heritage-purple);     border-color: rgba(91,44,138,0.22); }
.prod-ready-stock { background: rgba(86,101,115,0.10); color: #566573;                    border-color: rgba(86,101,115,0.24); }
[data-theme="dark"] .prod-ready-cook  { background: rgba(45,140,60,0.20);  color: #6fd598; }
[data-theme="dark"] .prod-ready-wip   { background: rgba(91,44,138,0.24);  color: #c9a6f0; }
[data-theme="dark"] .prod-ready-stock { background: rgba(159,176,192,0.16); color: #9fb0c0; }

/* --- QI release badges (weekend releases surfaced on the floor) ---------- */
.prod-qi-badge {
  font-size: 0.72rem; color: var(--text-mute, var(--ink-mute));
  padding: 2px 6px; border-radius: 4px;
}
.prod-qi-weekend {
  background: rgba(212,168,67,0.16);
  color: var(--heritage-gold-dark); font-weight: 600;
}
[data-theme="dark"] .prod-qi-weekend { background: rgba(212,168,67,0.24); color: var(--heritage-gold-light); }

/* --- order status chips + progress bars (B3 yield rail) ------------------ */
.prod-status-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.prod-status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border, var(--border-light));
  background: var(--surface, var(--warm-white));
  font-size: 0.78rem; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.prod-status-chip:hover:not([disabled]) { border-color: var(--heritage-red); }
.prod-status-chip.active {
  border-color: var(--heritage-red); background: rgba(204,0,0,0.07); font-weight: 600;
}
.prod-status-chip[disabled] { opacity: 0.4; cursor: not-allowed; }
.prod-chip-count {
  font-variant-numeric: tabular-nums; font-size: 0.72rem;
  padding: 0 5px; border-radius: 999px;
  background: rgba(0,0,0,0.06); color: var(--text-mute, var(--ink-mute));
}
[data-theme="dark"] .prod-status-chip.active { background: rgba(204,0,0,0.18); }
[data-theme="dark"] .prod-chip-count { background: rgba(255,255,255,0.10); }

.prod-progress-cell { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.prod-bar {
  flex: 1; height: 7px; border-radius: 999px; overflow: hidden;
  background: rgba(0,0,0,0.08); min-width: 60px;
}
[data-theme="dark"] .prod-bar { background: rgba(255,255,255,0.12); }
.prod-bar-fill { height: 100%; border-radius: 999px; transition: width .25s ease; }
.prod-bar-fill[data-tone="success"] { background: var(--success); }
.prod-bar-fill[data-tone="danger"]  { background: var(--heritage-red); }
.prod-bar-fill[data-tone="warn"]    { background: var(--heritage-gold); }
.prod-bar-fill[data-tone="plan"]    { background: var(--heritage-purple); }

.prod-status-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600; white-space: nowrap;
}
.prod-status-badge[data-tone="success"] { background: rgba(45,140,60,0.12);  color: var(--success-deep); }
.prod-status-badge[data-tone="danger"]  { background: rgba(204,0,0,0.10);    color: var(--heritage-red); }
.prod-status-badge[data-tone="warn"]    { background: rgba(212,168,67,0.16); color: var(--heritage-gold-dark); }
.prod-status-badge[data-tone="plan"]    { background: rgba(91,44,138,0.10);  color: var(--heritage-purple); }
[data-theme="dark"] .prod-status-badge[data-tone="success"] { background: rgba(45,140,60,0.22);  color: #6fd598; }
[data-theme="dark"] .prod-status-badge[data-tone="danger"]  { background: rgba(204,0,0,0.22);    color: #ff8a7a; }
[data-theme="dark"] .prod-status-badge[data-tone="warn"]    { background: rgba(212,168,67,0.24); color: var(--heritage-gold-light); }
[data-theme="dark"] .prod-status-badge[data-tone="plan"]    { background: rgba(91,44,138,0.26);  color: #c9a6f0; }

.prod-order-desc {
  font-weight: 500; max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- sticky table headers (long order/schedule tables) ------------------- */
.prod-table-sticky thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface, var(--warm-white));
  box-shadow: inset 0 -1px 0 var(--border, var(--border-light));
}

/* --- heatmap cell: intensity via custom property, not baked rgba() ------- */
.prod-heat-cell {
  padding: 6px 4px; text-align: center; cursor: pointer; min-width: 64px;
  background: rgba(204, 0, 0, var(--prod-heat-alpha, 0.15));
  color: var(--text, var(--ink));
}
.prod-heat-cell[data-strong="1"] { color: #fff; }

/* --- bottleneck signal card (was inline padding + border-left) ----------- */
.prod-signal-card { padding: 16px; margin-bottom: 12px; }

/* --- narrow viewports --------------------------------------------------- */
@media (max-width: 720px) {
  .prod-progress-cell { min-width: 96px; }
  .prod-order-desc { max-width: 180px; }
  .prod-run-sfg { max-width: 140px; }
  .prod-plant-pills { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   INSIGHTS REDESIGN (2026-07-31)
   Findings: severity sections → type groups → compact expandable rows.
   AI dock: persistent Ask + Brief on desktop; hidden (modal path) on mobile.

   Colour comes from the existing .prod-sev-* / .prod-accent-* tone classes and
   design-system vars — no new hex soup, and dark mode inherits automatically.
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- two-pane workspace ------------------------------------------------- */
.prod-insights-grid { display: block; }
.prod-findings-col  { min-width: 0; }   /* lets long titles ellipsise, not blow out the grid */

/* The dock only exists at desktop widths. Below the breakpoint it is removed
   from the layout entirely and the hero's Ask/Brief buttons keep opening the
   existing modals — that's the mobile contract. */
.prod-ai-dock { display: none; }

@media (min-width: 1100px) {
  .prod-insights-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 18px;
    align-items: start;
  }
  .prod-ai-dock {
    display: block;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: var(--surface, var(--card-bg, #fff));
    border: 1px solid var(--border, var(--rule, #E5D9C4));
    border-radius: var(--radius, 8px);
    padding: 14px;
  }
}

/* --- findings toolbar (severity filters + bulk expand) ------------------ */
.prod-findings-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: space-between; align-items: center;
  padding: 8px 0 12px;
  position: sticky; top: 0; z-index: 2;
  background: var(--bg, var(--page-bg, #FAF7F0));
  border-bottom: 1px solid var(--border-soft, var(--rule-soft, #EFE5D2));
  margin-bottom: 12px;
}
.prod-sev-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.prod-findings-toolbar-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.prod-sev-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  font-size: 0.78rem; font-weight: 600;
  color: var(--text, var(--ink));
  background: var(--surface-2, transparent);
  border: 1px solid var(--border, var(--rule, #E5D9C4));
  border-radius: 999px;
  cursor: pointer;
}
.prod-sev-chip:hover { border-color: var(--heritage-purple, #5B2C8A); }
.prod-sev-chip:focus-visible { outline: 2px solid var(--heritage-purple, #5B2C8A); outline-offset: 2px; }
.prod-sev-chip[aria-pressed="true"] {
  background: var(--heritage-purple, #5B2C8A); color: #fff;
  border-color: var(--heritage-purple, #5B2C8A);
}
.prod-sev-chip-count {
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem; font-weight: 700;
  min-width: 20px; text-align: center;
  padding: 1px 7px; border-radius: 999px;
  background: rgba(0,0,0,0.06);
}
.prod-sev-chip[aria-pressed="true"] .prod-sev-chip-count { background: rgba(255,255,255,0.22); }
[data-theme="dark"] .prod-sev-chip-count { background: rgba(255,255,255,0.1); }
/* Severity-tinted dot on the inactive chips so High reads as High at a glance. */
.prod-sev-chip-high   .prod-sev-chip-label::before,
.prod-sev-chip-medium .prod-sev-chip-label::before,
.prod-sev-chip-low    .prod-sev-chip-label::before {
  content: '●'; margin-right: 5px; font-size: 0.7em;
}
.prod-sev-chip-high   .prod-sev-chip-label::before { color: #CC0000; }
.prod-sev-chip-medium .prod-sev-chip-label::before { color: #D4A843; }
.prod-sev-chip-low    .prod-sev-chip-label::before { color: #5B8C5A; }
.prod-sev-chip[aria-pressed="true"] .prod-sev-chip-label::before { color: #fff; }

/* --- severity section (level 1 accordion) ------------------------------- */
.prod-sev-section {
  background: var(--surface, var(--card-bg, #fff));
  border: 1px solid var(--border, var(--rule, #E5D9C4));
  border-radius: var(--radius, 8px);
  margin-bottom: 12px;
  overflow: hidden;
}
.prod-sev-section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  /* A tinted bar so the severity band stays a distinct container even when
     open — a flat header dissolved into the rows below it. */
  background: var(--surface-2, rgba(0,0,0,0.025));
}
.prod-sev-section[open] > .prod-sev-section-head {
  border-bottom: 1px solid var(--border, var(--rule, #E5D9C4));
}
[data-theme="dark"] .prod-sev-section-head { background: rgba(255,255,255,0.04); }
.prod-sev-section-head::-webkit-details-marker { display: none; }
.prod-sev-section-head::after {
  content: '▸'; margin-left: auto; opacity: 0.5;
  transition: transform 0.15s ease;
}
.prod-sev-section[open] > .prod-sev-section-head::after { transform: rotate(90deg); }
.prod-sev-section-head:hover { background: var(--surface-2, rgba(0,0,0,0.02)); }
.prod-sev-section-head:focus-visible { outline: 2px solid var(--heritage-purple, #5B2C8A); outline-offset: -2px; }
.prod-sev-section-title { font-size: 0.9rem; }
.prod-sev-section-count {
  font-size: 0.78rem; font-variant-numeric: tabular-nums;
  padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2, rgba(0,0,0,0.05));
  color: var(--text-mute);
}
[data-theme="dark"] .prod-sev-section-count { background: rgba(255,255,255,0.08); }
.prod-sev-section-body { padding: 0 14px 12px; }

/* --- type group (level 2 accordion) ------------------------------------- */
.prod-type-group { margin-top: 10px; }
.prod-type-group:first-child { margin-top: 6px; }
/* The group header is the primary scanning unit once a severity band is open
   (16 vessel findings collapse into ONE of these), so it needs more weight than
   the rows it contains — uppercase label + tinted rail, not a hairline. */
.prod-type-group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  cursor: pointer; list-style: none;
  font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 6px;
  background: var(--surface-2, rgba(0,0,0,0.035));
  border-left: 3px solid var(--border, var(--rule, #E5D9C4));
}
[data-theme="dark"] .prod-type-group-head { background: rgba(255,255,255,0.05); }
/* Tint the group rail to its severity so an open Medium band still reads Medium. */
.prod-sev-section.prod-accent-high   .prod-type-group-head { border-left-color: #CC0000; }
.prod-sev-section.prod-accent-medium .prod-type-group-head { border-left-color: #D4A843; }
.prod-sev-section.prod-accent-low    .prod-type-group-head { border-left-color: #5B8C5A; }
.prod-type-group-head::-webkit-details-marker { display: none; }
.prod-type-group-head::after {
  content: '▸'; margin-left: auto; opacity: 0.45;
  transition: transform 0.15s ease;
}
.prod-type-group[open] > .prod-type-group-head::after { transform: rotate(90deg); }
.prod-type-group-head:hover { color: var(--heritage-purple, #5B2C8A); }
.prod-type-group-head:focus-visible { outline: 2px solid var(--heritage-purple, #5B2C8A); outline-offset: -2px; }
.prod-type-icon  { font-size: 0.95rem; }
.prod-type-label { flex: 0 1 auto; }
.prod-type-count {
  font-size: 0.74rem; font-variant-numeric: tabular-nums;
  padding: 0 7px; border-radius: 999px;
  background: var(--surface-2, rgba(0,0,0,0.05));
  color: var(--text-mute);
}
[data-theme="dark"] .prod-type-count { background: rgba(255,255,255,0.08); }
.prod-type-group-rows { padding: 6px 0 4px 10px; }

/* --- finding row (compact → expanded) ---------------------------------- */
.prod-finding-row {
  border-top: 1px dashed var(--border-soft, var(--rule-soft, #EFE5D2));
}
.prod-type-group-rows > .prod-finding-row:first-child { border-top: none; }
.prod-finding-row-head {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 4px;
  cursor: pointer; list-style: none;
  border-radius: 4px;
}
.prod-finding-row-head::-webkit-details-marker { display: none; }
.prod-finding-row-head:hover { background: var(--surface-2, rgba(0,0,0,0.02)); }
.prod-finding-row-head:focus-visible { outline: 2px solid var(--heritage-purple, #5B2C8A); outline-offset: -2px; }
.prod-finding-dot {
  flex: 0 0 auto; width: 8px; height: 8px; margin-top: 6px;
  border-radius: 50%;
}
.prod-dot-high   { background: #CC0000; }
.prod-dot-medium { background: #D4A843; }
.prod-dot-low    { background: #5B8C5A; }
.prod-finding-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.prod-finding-row-title {
  font-size: 0.85rem; font-weight: 600; line-height: 1.35;
  /* Collapsed rows stay ONE line so the list scans; full title is in the
     expanded body, so nothing is lost — only visually deferred. */
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prod-finding-row-lede {
  font-size: 0.76rem; color: var(--text-mute); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prod-finding-row[open] .prod-finding-row-title,
.prod-finding-row[open] .prod-finding-row-lede { white-space: normal; }
.prod-finding-row[open] .prod-finding-row-lede { display: none; }  /* full evidence shows below */
.prod-finding-row-count {
  flex: 0 0 auto; margin-left: auto;
  font-size: 0.72rem; font-variant-numeric: tabular-nums;
  padding: 1px 7px; border-radius: 999px;
  background: var(--surface-2, rgba(0,0,0,0.05));
  color: var(--text-mute);
}
[data-theme="dark"] .prod-finding-row-count { background: rgba(255,255,255,0.08); }
.prod-finding-row-body { padding: 2px 0 12px 17px; }
.prod-finding-table { margin-top: 8px; }
.prod-finding-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.prod-finding-action { white-space: nowrap; }

/* --- AI dock internals -------------------------------------------------- */
.prod-dock-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border-soft, var(--rule-soft, #EFE5D2));
}
.prod-dock-tabs { display: flex; gap: 4px; }
.prod-dock-tab {
  padding: 5px 12px;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-mute);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}
.prod-dock-tab:hover { color: var(--text, var(--ink)); }
.prod-dock-tab:focus-visible { outline: 2px solid var(--heritage-purple, #5B2C8A); outline-offset: 2px; }
.prod-dock-tab.is-active {
  color: var(--heritage-purple, #5B2C8A);
  background: rgba(91,44,138,0.08);
  border-color: rgba(91,44,138,0.25);
}
[data-theme="dark"] .prod-dock-tab.is-active { color: #c9a7f5; background: rgba(201,167,245,0.12); }
.prod-dock-period {
  font-size: 0.7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  color: var(--text-mute);
  background: var(--surface-2, rgba(0,0,0,0.05));
  white-space: nowrap;
}
[data-theme="dark"] .prod-dock-period { background: rgba(255,255,255,0.08); }
.prod-dock-suggest { margin-top: 12px; }
.prod-dock-history-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 14px 0 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft, var(--rule-soft, #EFE5D2));
}
.prod-dock-section-label {
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-mute);
}
.prod-dock-history { display: flex; flex-direction: column; }
.prod-dock-history .prod-ask-item:first-child { padding-top: 2px; }
.prod-dock-history .prod-ask-item:last-child  { border-bottom: none; }
.prod-ask-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.prod-answer-period {
  padding: 1px 6px; border-radius: 999px;
  background: var(--surface-2, rgba(0,0,0,0.05));
}
[data-theme="dark"] .prod-answer-period { background: rgba(255,255,255,0.08); }
.prod-ask-item-failed .prod-ask-a { color: var(--danger, #C0392B); white-space: pre-wrap; }
.prod-dock-brief-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.prod-dock-brief-md { font-size: 0.84rem; }

/* --- pinned brief on the Insights page ---------------------------------- */
.prod-brief-pinned { padding: 0; margin-top: 18px; overflow: hidden; }
.prod-brief-pinned-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; cursor: pointer; list-style: none;
}
.prod-brief-pinned-head::-webkit-details-marker { display: none; }
.prod-brief-pinned-head::after {
  content: '▸'; margin-left: auto; opacity: 0.5;
  transition: transform 0.15s ease;
}
.prod-brief-pinned[open] > .prod-brief-pinned-head::after { transform: rotate(90deg); }
.prod-brief-pinned-head:hover { background: var(--surface-2, rgba(0,0,0,0.02)); }
.prod-brief-pinned-head:focus-visible { outline: 2px solid var(--heritage-purple, #5B2C8A); outline-offset: -2px; }
.prod-brief-pinned-body { padding: 0 16px 16px; }

/* --- narrow viewports --------------------------------------------------- */
@media (max-width: 720px) {
  .prod-findings-toolbar { position: static; }   /* sticky + small screens = lost real estate */
  .prod-finding-row-body { padding-left: 8px; }
  .prod-sev-section-body { padding: 0 10px 10px; }
}
/* ============================================================
   27-agent-drawer.css
   Ask AIOP — floating button + side drawer + chat UI
   ============================================================ */

/* -------- Floating launcher button --------------------------- */
/*
 * Mobile + safe-area rules:
 *   • Anchor with env(safe-area-inset-bottom/right) so the FAB clears the
 *     iPhone home indicator and the rounded screen edge.
 *   • Touch target: 56px (>= 44px iOS HIG minimum).
 */

.agent-fab {
  position: fixed;
  right: max(24px, env(safe-area-inset-right, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 9000;
  transition: transform 160ms ease, box-shadow 160ms ease;
  /* iOS prevents tap highlight halo from showing during drag */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.agent-fab:hover { transform: translateY(-2px); box-shadow: var(--shadow-xl); }
.agent-fab:active { transform: translateY(0); }

/* Scroll-hide: JS toggles fab-hidden on scroll-down (mobile + PWA standalone) */
.agent-fab.fab-hidden {
  transform: translateY(96px);
  opacity: 0;
  pointer-events: none;
  transition: transform 240ms ease, opacity 240ms ease;
}
.agent-fab:not(.fab-hidden) {
  transition: transform 240ms ease, opacity 240ms ease;
}

.agent-fab svg { transform: scaleY(0.85); width: 26px; height: 26px; }
.agent-fab[aria-expanded="true"] { background: var(--ink-strong); }

.agent-fab-tooltip {
  position: fixed;
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  background: var(--ink-strong);
  color: #fff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  z-index: 9000;
  white-space: nowrap;
}
.agent-fab:hover + .agent-fab-tooltip { opacity: 1; }
/* Tooltip is desktop-only — fingers don't hover. */
@media (hover: none), (max-width: 640px) {
  .agent-fab-tooltip { display: none; }
}

/* -------- Scrim --------------------------------------------- */

.agent-drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.30);
  border: none;
  cursor: pointer;
  z-index: 9000;
  opacity: 0;
  transition: opacity 220ms ease;
}
.agent-drawer-scrim.open { opacity: 1; }
.agent-drawer-scrim[hidden] { display: none; }

/* -------- Drawer panel -------------------------------------- */
/*
 * Desktop:  420px right-side panel, slides in horizontally.
 * Mobile:   full-sheet bottom-up modal that respects all four
 *           safe-area insets so the Dynamic Island never sits on top of
 *           the close button and the home indicator never overlaps
 *           the input bar.
 *
 * Sizing uses 100dvh (dynamic viewport height) so the panel collapses
 * correctly when the iOS keyboard opens. 100vh on iOS Safari includes
 * the bottom URL bar and clips the input — 100dvh does not.
 */

.agent-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--warm-white);
  box-shadow: var(--shadow-xl);
  z-index: 9001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.2, 0.7, 0.3, 1);
  border-left: 1px solid var(--rule);
  /* Respect safe areas on landscape iPhones too (notched right edge). */
  padding-right: env(safe-area-inset-right, 0px);
}
.agent-drawer.open { transform: translateX(0); }
.agent-drawer[hidden] { display: none; }

/* Mobile breakpoint — covers iPhone SE (375), 14/15/16 (390), Pro Max (430),
   small Android (360). Anything narrower than 640 gets the full-sheet UX. */
@media (max-width: 640px) {
  .agent-drawer {
    width: 100vw;
    max-width: 100vw;
    border-left: none;
    /* On mobile the scrim already darkens the page; drop the heavy shadow. */
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
    /* Slide up from the bottom instead of in from the right — matches iOS
       sheet conventions and keeps the close button reachable with the thumb. */
    top: auto;
    bottom: 0;
    height: 92dvh;            /* leave a sliver at the top so users can see the scrim and tap to dismiss */
    min-height: 92dvh;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    transform: translateY(100%);
    padding-right: 0;
  }
  .agent-drawer.open { transform: translateY(0); }
}

/* Landscape phone — fall back to the side panel so the keyboard doesn't
   eat the whole bottom sheet. */
@media (max-width: 920px) and (max-height: 480px) and (orientation: landscape) {
  .agent-drawer {
    top: 0;
    bottom: auto;
    width: min(100vw, 480px);
    height: 100dvh;
    min-height: 100dvh;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-left: 1px solid var(--rule);
    transform: translateX(100%);
  }
  .agent-drawer.open { transform: translateX(0); }
}

/* -------- Header -------------------------------------------- */
/*
 * The header is the first thing under the Dynamic Island on a full-sheet
 * mobile drawer. Pad it by env(safe-area-inset-top) so the title bar and
 * close button always clear the island/notch on iPhone 14 Pro / 15 / 16.
 */

.agent-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-left, 0px)) 14px max(18px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, rgba(204, 0, 0, 0.04), transparent);
  gap: 8px;
  flex-shrink: 0;
}
/* When we're in the mobile bottom-sheet, the inset-top doesn't apply
   (sheet is anchored from the bottom) — use the standard padding instead
   plus a top grab-handle. */
@media (max-width: 640px) {
  .agent-drawer-header {
    padding: 14px 18px 14px 18px;
    position: relative;
  }
  /* Grab handle hint at the top of the sheet (iOS-native pattern). */
  .agent-drawer-header::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--ink-faint);
    opacity: 0.6;
  }
  /* Slight extra top padding so the title doesn't crowd the handle. */
  .agent-drawer-header {
    padding-top: 18px;
  }
}

.agent-drawer-title {
  display: flex;
  flex-direction: column;
}
.agent-drawer-eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--heritage-red);
  font-weight: 700;
}
.agent-drawer-h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink-strong);
}

.agent-drawer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.agent-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: background 120ms ease, color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.agent-icon-btn:hover { background: var(--eggshell-shade); color: var(--ink-strong); }
.agent-icon-btn svg { width: 16px; height: 16px; }
/* BRIDGE: "Open in Workspace" disabled state (no active conversation to promote). */
.agent-icon-btn:disabled,
.agent-icon-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.agent-icon-btn:disabled:hover,
.agent-icon-btn[disabled]:hover {
  background: transparent;
  color: var(--ink-soft);
}
/* BRIDGE: subtle Heritage-Red tint on the enabled "Open in Workspace" button
   so it reads as the promote affordance without shouting. */
#agent-open-workspace:not(:disabled):hover {
  background: var(--heritage-red-tint, rgba(204, 0, 0, 0.08));
  color: var(--heritage-red, #cc0000);
}
/* Mobile: icon buttons must hit the 44px iOS HIG minimum touch target. */
@media (max-width: 640px) {
  .agent-icon-btn { width: 44px; height: 44px; }
  .agent-icon-btn svg { width: 20px; height: 20px; }
}

/* -------- Thread list (collapsed sidebar) -------------------- */

.agent-thread-list {
  border-bottom: 1px solid var(--rule);
  max-height: 200px;
  overflow-y: auto;
  background: var(--paper);
}
.agent-thread-list[hidden] { display: none; }

.agent-thread-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 700;
}

.agent-thread-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid var(--rule-soft);
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--ink);
  gap: 8px;
}
.agent-thread-item:hover { background: var(--eggshell-shade); }
.agent-thread-item.active { background: var(--eggshell-bright); font-weight: 600; }

.agent-thread-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-thread-item-delete {
  width: 28px; height: 28px;
  border-radius: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--ink-mute);
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.agent-thread-item-delete:hover { background: rgba(192, 57, 43, 0.10); color: var(--danger); }
/* Mobile: thread items + delete buttons must be thumb-friendly. */
@media (max-width: 640px) {
  .agent-thread-item {
    padding: 14px 18px;
    font-size: 0.95rem;
    min-height: 48px;
  }
  .agent-thread-item-delete { width: 44px; height: 44px; font-size: 1.2rem; }
}

/* -------- Message stream ------------------------------------- */

.agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  /* iOS momentum scrolling — important inside a transformed parent. */
  -webkit-overflow-scrolling: touch;
  /* Prevent the entire page from rubber-banding when the drawer is open. */
  overscroll-behavior: contain;
}
@media (max-width: 640px) {
  .agent-messages {
    padding: 14px 14px;
    gap: 10px;
  }
}

.agent-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 92%;
}
.agent-msg.user { align-self: flex-end; }
.agent-msg.assistant { align-self: flex-start; }

.agent-msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  /* Break long unbroken tokens (URLs, IDs, no-whitespace strings) so the
     bubble never overflows the drawer on narrow phones. */
  overflow-wrap: anywhere;
  word-break: break-word;
}
@media (max-width: 640px) {
  .agent-msg { max-width: 94%; }
  .agent-msg-bubble { font-size: 0.95rem; }
}

.agent-msg.user .agent-msg-bubble {
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-deep));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.agent-msg.assistant .agent-msg-bubble {
  background: var(--paper);
  color: var(--ink-strong);
  border: 1px solid var(--rule);
  border-bottom-left-radius: 4px;
}

.agent-msg-bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.agent-msg-meta {
  font-size: 0.70rem;
  color: var(--ink-mute);
  padding: 0 4px;
}

/* -------- Tool indicator ------------------------------------- */

.agent-tool-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(91, 44, 138, 0.10);
  color: var(--heritage-purple);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(91, 44, 138, 0.20);
  /* Don't let long tool names overflow on narrow phones. */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .agent-tool-pill {
    padding: 6px 12px;
    font-size: 0.82rem;
  }
}
/* -------- Download card (file delivery, 2026-08-10) -----------
   Ask AIOP can now produce a REAL file (convert_attachment). The card is a
   sibling of the assistant bubble, styled to read as a deliverable rather
   than as chat text — the whole point of Slice 1 is that the user leaves
   with bytes, not a table they'd have to retype. */
.agent-download-card {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin: 2px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2, rgba(45, 140, 60, 0.06));
  border: 1px solid rgba(45, 140, 60, 0.28);
}
.agent-download-icon { font-size: 1rem; line-height: 1; color: var(--success-deep); }
.agent-download-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;              /* lets the filename ellipsize instead of pushing the button off */
  gap: 2px;
}
.agent-download-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-download-fmt {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}
.agent-download-btn {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--success-deep, #2d8c3c);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.agent-download-btn:hover { filter: brightness(1.08); text-decoration: none; }
.agent-download-btn:focus-visible { outline: 2px solid var(--heritage-purple); outline-offset: 2px; }
@media (max-width: 640px) {
  .agent-download-btn { padding: 8px 16px; font-size: 0.82rem; min-height: 44px; display: inline-flex; align-items: center; }

  /* The drawer is 100vw on a phone, so the card should use the width rather
     than hugging its content and squeezing the filename to "conv…xlsx".
     Below ~360px the button drops to its own full-width row so the name keeps
     a readable share of the line. */
  .agent-download-card { align-self: stretch; flex-wrap: wrap; row-gap: 8px; }
  .agent-download-meta { flex: 1 1 140px; }
}

@media (max-width: 360px) {
  .agent-download-btn {
    flex: 1 1 100%;
    margin-left: 0;
    justify-content: center;
  }
}

.agent-tool-pill.error { background: rgba(192, 57, 43, 0.10); color: var(--danger); border-color: rgba(192, 57, 43, 0.20); }
.agent-tool-pill.complete { background: rgba(45, 140, 60, 0.10); color: var(--success-deep); border-color: rgba(45, 140, 60, 0.20); }

.agent-tool-pill .agent-spinner {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: agent-spin 0.8s linear infinite;
}
@keyframes agent-spin { to { transform: rotate(360deg); } }

/* -------- Typing indicator (3 dots) -------------------------- */

.agent-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  background: var(--paper);
  border: 1px solid var(--rule);
}
.agent-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-mute);
  animation: agent-pulse 1.2s ease-in-out infinite;
}
.agent-typing span:nth-child(2) { animation-delay: 160ms; }
.agent-typing span:nth-child(3) { animation-delay: 320ms; }
@keyframes agent-pulse {
  0%, 80%, 100% { opacity: 0.30; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

/* -------- Empty state --------------------------------------- */

.agent-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  padding: 30px 20px;
  color: var(--ink-soft);
  gap: 10px;
}

.agent-empty-icon {
  font-size: 2.4rem;
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.agent-empty-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink-strong);
}
.agent-empty-desc {
  font-size: 0.88rem;
  max-width: 280px;
}

.agent-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}
.agent-suggestion {
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--warm-white);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ink);
  transition: all 140ms ease;
}
.agent-suggestion:hover {
  border-color: var(--heritage-red);
  background: var(--paper);
  transform: translateX(2px);
}
/* DISCOVERY CHIP (2026-08-07) — always the last starter chip, backed by
   `list_my_capabilities` (floors:'any', null-module) so it is live for every
   identity. Reads as a different KIND of action than the three task chips above
   it: dashed rule + muted ink says "meta", not "one more errand". Inherits every
   other .agent-suggestion rule, including dark mode, so this stays additive. */
.agent-suggestion-discovery {
  border-style: dashed;
  color: var(--ink-soft, var(--ink));
  background: transparent;
}
.agent-suggestion-discovery:hover {
  border-style: solid;
  color: var(--ink);
}

/* -------- Input area ---------------------------------------- */
/*
 * The input wrap sits at the bottom of the drawer. On a notched iPhone
 * the home indicator overlays the bottom 34px — push the input above it
 * using env(safe-area-inset-bottom).
 */

.agent-input-wrap {
  border-top: 1px solid var(--rule);
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)) 14px;
  background: var(--warm-white);
  flex-shrink: 0;
}
/* In landscape mobile (Pro Max etc.), keep the side insets too. */
@media (max-width: 920px) and (orientation: landscape) {
  .agent-input-wrap {
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
  }
}

.agent-input-zone {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 8px 8px 8px 12px;
  background: var(--paper);
  transition: border-color 140ms ease;
}
.agent-input-zone:focus-within { border-color: var(--heritage-red); }
.agent-input-zone.drag-over { border-color: var(--heritage-purple); background: rgba(91, 44, 138, 0.04); }

.agent-input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink-strong);
  resize: none;
  outline: none;
  min-height: 22px;
  max-height: 140px;
  line-height: 1.4;
  padding: 4px 0;
}
.agent-input::placeholder { color: var(--ink-mute); }
/* iOS auto-zooms on inputs <16px. Force 16px on mobile to prevent the
   awkward viewport zoom-and-pan when the user taps the textarea. */
@media (max-width: 640px) {
  .agent-input {
    font-size: 16px;
    min-height: 26px;
  }
}

.agent-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--heritage-red);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 140ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}
.agent-send-btn:disabled { background: var(--ink-faint); cursor: not-allowed; }
.agent-send-btn:hover:not(:disabled) { background: var(--heritage-red-dark); }
.agent-send-btn:active:not(:disabled) { transform: scale(0.95); }
.agent-send-btn svg { width: 14px; height: 14px; }
/* Mobile: send button must be a real touch target. */
@media (max-width: 640px) {
  .agent-send-btn { width: 44px; height: 44px; }
  .agent-send-btn svg { width: 18px; height: 18px; }
}

.agent-input-hint {
  font-size: 0.72rem;
  color: var(--ink-mute);
  margin-top: 6px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.agent-input-hint kbd {
  background: var(--eggshell-shade);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  font-size: 0.70rem;
  border: 1px solid var(--rule);
}

/* -------- Attach button (in composer) ----------------------- */
.agent-attach-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 140ms ease, color 140ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}
.agent-attach-btn:hover { background: rgba(204, 0, 0, 0.08); color: var(--heritage-red); }
.agent-attach-btn:active { transform: scale(0.94); }
.agent-attach-btn svg { width: 18px; height: 18px; }
@media (max-width: 640px) {
  /* Touch target ≥ 44px on mobile. */
  .agent-attach-btn { width: 44px; height: 44px; }
  .agent-attach-btn svg { width: 22px; height: 22px; }
}

/* -------- Attachment chip strip ----------------------------- */
.agent-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 2px 8px 2px;
  max-height: 120px;
  overflow-y: auto;
}
.agent-attachments[hidden] { display: none; }
.agent-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  background: var(--eggshell-shade);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 6px 4px 10px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.2;
}
.agent-attachment-chip-icon {
  flex-shrink: 0;
  font-size: 0.95rem;
  line-height: 1;
}
.agent-attachment-chip-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
  color: var(--ink-strong);
  font-weight: 500;
}
.agent-attachment-chip-size {
  flex-shrink: 0;
  color: var(--ink-mute);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
.agent-attachment-chip button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--ink-mute);
  font-size: 1.05rem;
  line-height: 1;
  padding: 0 4px;
  border-radius: 50%;
  min-width: 20px;
  min-height: 20px;
  transition: background 120ms ease, color 120ms ease;
}
.agent-attachment-chip button:hover {
  background: rgba(204, 0, 0, 0.10);
  color: var(--heritage-red);
}
@media (max-width: 640px) {
  .agent-attachment-chip-name { max-width: 56vw; }
  .agent-attachment-chip button { min-width: 28px; min-height: 28px; }
}

/* -------- Drop overlay (drag over the drawer) -------------- */
.agent-drop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(204, 0, 0, 0.06);
  backdrop-filter: blur(2px);
  border: 2px dashed var(--heritage-red);
  border-radius: var(--radius-lg, 12px);
  pointer-events: none;
  z-index: 5;
  animation: agent-drop-overlay-in 140ms ease;
}
.agent-drop-overlay.active { display: flex; }
.agent-drop-overlay-inner {
  text-align: center;
  padding: 24px 32px;
  color: var(--heritage-red);
  font-weight: 600;
  pointer-events: none;
}
.agent-drop-overlay-icon {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 8px;
}
.agent-drop-overlay-text {
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.agent-drop-overlay-sub {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink-soft);
  margin-top: 4px;
  max-width: 280px;
}
@keyframes agent-drop-overlay-in {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}
@media (max-width: 640px) {
  .agent-drop-overlay-icon { font-size: 1.8rem; }
  .agent-drop-overlay-text { font-size: 0.95rem; }
  .agent-drop-overlay-sub  { font-size: 0.74rem; max-width: 220px; }
}

/* -------- Dark mode overrides -------------------------------- */
[data-theme="dark"] .agent-drawer {
  background: var(--surface, #1E2130);
  border-left-color: rgba(255, 255, 255, 0.10);
}
[data-theme="dark"] .agent-drawer-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(204, 0, 0, 0.12), transparent);
}
[data-theme="dark"] .agent-drawer-h2 { color: #fff; }
[data-theme="dark"] .agent-icon-btn { color: #B8BEC9; }
[data-theme="dark"] .agent-icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
[data-theme="dark"] .agent-thread-list { background: rgba(0, 0, 0, 0.20); border-bottom-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .agent-thread-item { color: #D9DEE7; border-top-color: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .agent-thread-item:hover { background: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .agent-thread-item.active { background: rgba(204, 0, 0, 0.12); }
[data-theme="dark"] .agent-msg.assistant .agent-msg-bubble {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: #E5E7EB;
}
[data-theme="dark"] .agent-typing {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .agent-input-wrap {
  background: var(--surface, #1E2130);
  border-top-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .agent-input-zone {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.10);
}
[data-theme="dark"] .agent-input { color: #fff; }
[data-theme="dark"] .agent-input::placeholder { color: #8A8F99; }
[data-theme="dark"] .agent-suggestion {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.10);
  color: #D9DEE7;
}
[data-theme="dark"] .agent-suggestion:hover {
  border-color: var(--heritage-red);
  background: rgba(204, 0, 0, 0.08);
}
[data-theme="dark"] .agent-attach-btn { color: #B8BEC9; }
[data-theme="dark"] .agent-attach-btn:hover { background: rgba(204, 0, 0, 0.15); color: #fff; }
[data-theme="dark"] .agent-attachment-chip {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.10);
  color: #D9DEE7;
}
[data-theme="dark"] .agent-attachment-chip-name { color: #fff; }
[data-theme="dark"] .agent-attachment-chip-size { color: #8A8F99; }
[data-theme="dark"] .agent-attachment-chip button { color: #B8BEC9; }
[data-theme="dark"] .agent-attachment-chip button:hover {
  background: rgba(204, 0, 0, 0.20);
  color: #fff;
}
[data-theme="dark"] .agent-drop-overlay {
  background: rgba(204, 0, 0, 0.18);
  border-color: var(--heritage-red);
}
[data-theme="dark"] .agent-drop-overlay-inner { color: #fff; }
[data-theme="dark"] .agent-drop-overlay-sub { color: #B8BEC9; }

/* ════════════════════════════════════════════════════════════════
   Ask AIOP rich-text formatting (.agent-markdown) — 2026-06-17
   Assistant replies now render through the shared lib/markdown.js
   pipeline (same as Workspace chat) → full GFM. These styles make
   headings / lists / tables / blockquotes / code blocks look good
   inside the compact drawer bubble. Mirrors .ws-markdown, tuned
   smaller for the drawer. Dark-mode variants in 90-dark-mode.css.
   ════════════════════════════════════════════════════════════════ */
/* Real block-level HTML now → cancel the legacy pre-wrap (which was for
   the old <br>-joined renderer; with <p>/<li> it double-spaces). */
.agent-msg.assistant .agent-msg-bubble.agent-markdown { white-space: normal; }

.agent-markdown > *:first-child { margin-top: 0; }
.agent-markdown > *:last-child  { margin-bottom: 0; }
.agent-markdown h1, .agent-markdown h2, .agent-markdown h3,
.agent-markdown h4 {
  font-family: var(--font-serif); color: var(--ink-strong);
  line-height: 1.25; margin: 0.85em 0 0.4em; font-weight: 700;
}
.agent-markdown h1 { font-size: 1.18rem; }
.agent-markdown h2 { font-size: 1.08rem; }
.agent-markdown h3 { font-size: 1.0rem; }
.agent-markdown h4 { font-size: 0.94rem; }
.agent-markdown p  { margin: 0 0 0.6em; }
.agent-markdown ul, .agent-markdown ol { margin: 0 0 0.6em; padding-left: 1.25em; }
.agent-markdown li { margin: 0.18em 0; }
.agent-markdown li > ul, .agent-markdown li > ol { margin: 0.2em 0 0.3em; }
.agent-markdown a {
  color: var(--heritage-red); text-decoration: underline;
  text-underline-offset: 2px; word-break: break-word;
}
.agent-markdown strong { font-weight: 700; color: var(--ink-strong); }
.agent-markdown em { font-style: italic; }
.agent-markdown code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.86em; background: var(--eggshell-shade);
  padding: 1px 5px; border-radius: 4px; word-break: break-word;
}
.agent-markdown pre {
  background: #1f1b17; color: #f4ecde;
  padding: 12px 14px; border-radius: var(--radius);
  overflow-x: auto; margin: 0 0 0.7em; font-size: 0.8rem; line-height: 1.45;
}
.agent-markdown pre code {
  background: transparent; color: inherit; padding: 0; font-size: inherit;
}
.agent-markdown blockquote {
  border-left: 3px solid var(--heritage-gold); margin: 0 0 0.7em;
  padding: 2px 0 2px 12px; color: var(--ink-soft); font-style: italic;
}
.agent-markdown hr {
  border: 0; border-top: 1px solid var(--rule); margin: 0.9em 0;
}
.agent-markdown table {
  border-collapse: collapse; width: 100%; margin: 0 0 0.7em;
  font-size: 0.82rem; display: block; overflow-x: auto;
}
.agent-markdown th, .agent-markdown td {
  border: 1px solid var(--rule); padding: 6px 9px; text-align: left;
  white-space: nowrap;
}
.agent-markdown th {
  background: var(--eggshell-shade); font-weight: 600; color: var(--ink-strong);
}
.agent-markdown img { max-width: 100%; border-radius: var(--radius); }

/* -------- Background scroll lock (Bug-1) ----------------------
   When the Ask AIOP drawer is open, lock the page behind it so
   scrolling inside the drawer conversation never chains to the
   underlying page. JS (openDrawer/closeDrawer) toggles .drawer-open
   on <body> and ALSO applies an iOS position:fixed body lock (Safari
   ignores overflow:hidden on body for touch scroll) with exact
   scroll-position restore on close. This rule is the desktop +
   modern-mobile layer. */
body.drawer-open {
  overflow: hidden;
  /* Stop iOS touch-scroll of the body behind the sheet. */
  touch-action: none;
}

/* Security rows 55/56 (2026-10-12): AI save approval card (drawer + workspace). */
.agent-pw-card { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--border, #d9d9d9); border-radius: 10px; background: var(--surface, #fff); font-size: 13px; }
.agent-pw-head { font-weight: 600; font-size: 12px; opacity: .75; margin-bottom: 4px; }
.agent-pw-title { font-weight: 600; margin-bottom: 4px; }
.agent-pw-details { margin: 4px 0 6px 18px; padding: 0; }
.agent-pw-warn { color: #a8071a; font-weight: 600; margin: 4px 0; }
.agent-pw-actions { display: flex; gap: 8px; margin-top: 6px; }
.agent-pw-actions button { padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border, #d9d9d9); cursor: pointer; background: transparent; }
.agent-pw-actions .agent-pw-confirm { background: #c8102e; border-color: #c8102e; color: #fff; }
.agent-pw-actions button[disabled] { opacity: .6; cursor: default; }
.agent-pw-note { font-size: 11px; opacity: .7; margin-top: 4px; }
.agent-pw-remember { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; margin-top: 6px; cursor: pointer; }
.agent-pw-status { margin-top: 4px; }
.agent-pw-error { color: #a8071a; }
/* ============================================================
   28-formulation-intelligence.css
   Formulation Intelligence module (Alice / R&D).
   ============================================================ */

.fi-sort-btn {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  font-weight: inherit;
}
.fi-sort-btn:hover { color: var(--heritage-red, #CC0000); }

/* Mobile: stack the two-column overview into a single column */
@media (max-width: 880px) {
  #fi-content > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* What-If "modified" highlight on the new % input */
input[data-wi-sap]:focus {
  outline: 2px solid var(--purple, #5B2C8A);
  outline-offset: 1px;
}

/* AI brief markdown render — keep typography tight */
.markdown-render h2, .markdown-render h3, .markdown-render h4 { line-height: 1.25; }
.markdown-render ul { line-height: 1.5; }
.markdown-render p:first-child { margin-top: 0; }
/* ============================================================
   29-lto-tracker.css
   Foodservice LTO Tracker — toolbar, filter tabs, card grid
   ============================================================ */

.lto-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.lto-filter-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.lto-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
  font-family: inherit;
}

.lto-tab:hover {
  border-color: var(--heritage-gold);
  color: var(--ink-strong);
}

.lto-tab.is-active {
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: var(--warm-white);
  border-color: var(--heritage-red-dark);
}

.lto-tab.is-active .lto-tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: var(--warm-white);
}

.lto-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(91, 44, 138, 0.10);
  color: var(--heritage-purple-dark, #4a2374);
  font-size: 0.74rem;
  font-weight: 700;
}

.lto-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lto-search {
  min-width: 260px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.lto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.lto-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  border: 1px solid var(--rule);
}

.lto-card:hover {
  transform: translateY(-2px);
  border-color: var(--heritage-gold);
  box-shadow: 0 6px 18px rgba(204, 0, 0, 0.10);
}

.lto-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.lto-chain {
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--heritage-purple-dark, #4a2374);
}

.lto-product {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink-strong);
  margin-top: 2px;
  line-height: 1.3;
}

.lto-name {
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-style: italic;
}

.lto-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.lto-dates {
  font-size: 0.85rem;
  color: var(--ink);
  font-feature-settings: 'tnum';
}

.lto-notes {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* Status-pill colors — semantic, complement existing .badge-status-* set. */
.badge-status-active    { background: rgba(45, 140, 60, 0.12); color: var(--success-deep, #2d8c3c); border-color: rgba(45, 140, 60, 0.30); }
.badge-status-upcoming  { background: rgba(91, 44, 138, 0.10); color: var(--heritage-purple); border-color: rgba(91, 44, 138, 0.22); }
.badge-status-completed { background: rgba(90, 79, 69, 0.10); color: var(--ink-soft); border-color: rgba(90, 79, 69, 0.20); }
.badge-status-expired   { background: rgba(192, 57, 43, 0.10); color: var(--danger, #c0392b); border-color: rgba(192, 57, 43, 0.30); }

/* Mobile responsiveness */
@media (max-width: 720px) {
  .lto-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .lto-toolbar-right {
    width: 100%;
    justify-content: space-between;
  }
  .lto-search {
    flex: 1;
    min-width: 0;
  }
  .lto-grid {
    grid-template-columns: 1fr;
  }
}
/* ============================================================
   30-product-catalog.css
   Product / SKU Lookup — toolbar, channel tabs, search, card grid
   ============================================================ */

.prod-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.prod-search-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.prod-search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--ink-faint, #8a7d70);
  pointer-events: none;
}

.prod-search {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-size: 0.95rem;
}

.prod-channel-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.prod-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
  font-family: inherit;
}

.prod-tab:hover {
  border-color: var(--heritage-gold);
  color: var(--ink-strong);
}

.prod-tab.is-active {
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: var(--warm-white);
  border-color: var(--heritage-red-dark);
}

.prod-tab.is-active .prod-tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: var(--warm-white);
}

.prod-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(204, 0, 0, 0.08);
  color: var(--heritage-red);
  font-size: 0.74rem;
  font-weight: 700;
}

.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.prod-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  border: 1px solid var(--rule);
}

.prod-card:hover {
  transform: translateY(-2px);
  border-color: var(--heritage-gold);
  box-shadow: 0 6px 18px rgba(212, 168, 67, 0.18);
}

.prod-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.prod-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-strong);
  line-height: 1.3;
  word-break: break-word;
}

.prod-sku {
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-feature-settings: 'tnum';
}

.prod-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}

.prod-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.82rem;
}

.prod-meta-label {
  color: var(--ink-faint, #8a7d70);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
  font-weight: 600;
}

.prod-meta-value {
  color: var(--ink-strong);
  font-weight: 500;
  text-align: right;
}

.prod-card-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.prod-channel-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Channel picker checkboxes in the edit modal */
.prod-channel-pickers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px 12px;
}

.prod-channel-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius, 8px);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--paper);
  transition: border-color 140ms ease;
}

.prod-channel-picker:hover {
  border-color: var(--heritage-gold);
}

.prod-channel-picker input[type="checkbox"] {
  margin: 0;
  accent-color: var(--heritage-red);
}

@media (max-width: 720px) {
  .prod-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .prod-search-wrap {
    width: 100%;
  }
  .prod-grid {
    grid-template-columns: 1fr;
  }
}

/* ── W2-FIX-F6: data-origin chip ──────────────────────────────
   Replaces the hard-coded inline "Demo Data" span in the hero.
   Rendered ONLY when the API reports data_origin === 'demo'
   (table is nothing but the 15-SKU dev seed). Production holds
   333 real LKK SKUs and correctly shows no chip.
   ------------------------------------------------------------ */
.pc-origin-chip {
  font-size: 11px;
  font-weight: 600;
  background: rgba(204, 0, 0, 0.08);
  color: var(--heritage-red, #CC0000);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(204, 0, 0, 0.15);
  letter-spacing: 0.3px;
  white-space: nowrap;
}
/* ────────────────────────────────────────────────────────────
   Sales Analytics — Finance / Herman Tam module
   Heritage Red (#CC0000) for alerts/severe signals
   Heritage Gold (#D4A843) for positive trends
   ──────────────────────────────────────────────────────────── */

.sa-dropzone {
  min-height: 280px;
  flex-direction: column;
  background: rgba(204, 0, 0, 0.02);
  border: 2px dashed rgba(204, 0, 0, 0.18);
  transition: background 160ms ease, border 160ms ease;
}
.sa-dropzone.drag-over,
.sa-dropzone:hover {
  background: rgba(204, 0, 0, 0.06);
  border-color: var(--heritage-red);
}

.sa-empty-card { padding: 28px; }

.sa-info-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-mute);
  line-height: 1.7;
  font-size: 0.92rem;
}
.sa-info-list strong { color: var(--text-primary); }

.sa-info {
  background: var(--surface-soft);
  border-left: 4px solid var(--heritage-gold);
}

/* ── Dashboard layout ──────────────────────────────────────── */

.sa-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  margin: 20px;
}
@media (max-width: 1080px) {
  .sa-layout { grid-template-columns: 1fr; }
}

.sa-main { min-width: 0; }

.sa-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sa-h4 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--text-primary);
}

.sa-pill {
  display: inline-block;
  background: rgba(204, 0, 0, 0.08);
  color: var(--heritage-red);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sa-period-select {
  padding: 6px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.85rem;
  margin-right: 8px;
}

/* ── Brief verification badge (send-gate, FIX 2) ───────────── */
.sa-verify-badge {
  display: inline-block;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: default;
}
.sa-verify-ok {
  background: rgba(34, 139, 76, 0.12);
  color: #1f7a44;
  border: 1px solid rgba(34, 139, 76, 0.35);
}
.sa-verify-warn {
  background: rgba(212, 168, 67, 0.16);
  color: #9a6b00;
  border: 1px solid var(--heritage-gold, #D4A843);
}
.sa-verify-neutral {
  background: rgba(120, 120, 120, 0.10);
  color: var(--text-mute, #777);
  border: 1px solid var(--border-soft, #ddd);
}

/* ── Verification scoreboard (2026-06-28) ────────────────────
   Prominent PASS / UNVERIFIED / FAIL trust strip beneath the briefing meta.
   This is the eye-level trust signal (the small meta pill stays as the
   at-a-glance verdict). green=pass, gold=unverified, red=fail. A zero-FAIL
   cell de-emphasizes (the win state is "0 fails"). */
.sa-vscore {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}
.sa-vscore-cells {
  display: flex;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}
.sa-vscore-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  flex: 1 1 0;
  min-width: 84px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-align: center;
}
.sa-vscore-icon { font-size: 0.95rem; line-height: 1; }
.sa-vscore-n {
  font-family: var(--font-serif, 'ABC Arizona Flare', 'Playfair Display', Georgia, serif);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.sa-vscore-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sa-vscore-pass {
  background: rgba(45, 140, 60, 0.10);
  border-color: rgba(45, 140, 60, 0.32);
  color: var(--heritage-green, #2D8C3C);
}
.sa-vscore-unver {
  background: rgba(212, 168, 67, 0.13);
  border-color: rgba(212, 168, 67, 0.40);
  color: #9a6b00;
}
.sa-vscore-fail {
  background: rgba(204, 0, 0, 0.10);
  border-color: rgba(204, 0, 0, 0.32);
  color: var(--heritage-red, #CC0000);
}
/* When FAIL = 0 (the trust win), keep it calm: muted, not alarming red. */
.sa-vscore-fail.sa-vscore-zero {
  background: rgba(120, 120, 120, 0.06);
  border-color: var(--border-soft, #e2ddd0);
  color: var(--text-mute, #8a8478);
}
.sa-vscore-cov {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--text-mute, #7B7B7B);
  font-style: italic;
  white-space: nowrap;
}

/* ── Action priority chips (2026-06-28) ──────────────────────
   Small colored pill prepended to each Recommended Action card, inferred from
   the action text (the AI emits no emojis). Mirrors the PDF rank colors. */
.sa-action-pri {
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  position: relative;
  top: -1px;
}
.sa-action-pri-urgent {
  background: rgba(204, 0, 0, 0.12);
  color: var(--heritage-red, #CC0000);
  border: 1px solid rgba(204, 0, 0, 0.40);
}
.sa-action-pri-important {
  background: rgba(212, 168, 67, 0.16);
  color: #9a6b00;
  border: 1px solid var(--heritage-gold, #D4A843);
}
.sa-action-pri-opportunity {
  background: rgba(45, 140, 60, 0.12);
  color: var(--heritage-green, #2D8C3C);
  border: 1px solid rgba(45, 140, 60, 0.35);
}
/* Tint the action-card counter chip to match its priority so the card reads at
   a glance: urgent=red (default), important=gold, opportunity=green. */
.sa-actions-body ol > li.sa-action-important::before,
.sa-actions-body .sa-ol > li.sa-action-important::before {
  background: var(--heritage-gold, #D4A843);
}
.sa-actions-body ol > li.sa-action-opportunity::before,
.sa-actions-body .sa-ol > li.sa-action-opportunity::before {
  background: var(--heritage-green, #2D8C3C);
}

/* ── Keep-best notice ──────────────────────────────────────── */
/* Shown when the server kept the richer existing brief instead of */
/* overwriting it with a leaner new draft. Reuses the verify palette. */
.sa-keepbest-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(212, 168, 67, 0.10);
  border: 1px solid var(--heritage-gold, #D4A843);
  font-size: 0.82rem;
}
.sa-keepbest-text {
  color: #9a6b00;
  flex: 1 1 auto;
  min-width: 180px;
}
.sa-keepbest-replace {
  flex: 0 0 auto;
  font-size: 0.76rem;
  background: transparent;
  color: var(--heritage-red, #CC0000);
  border: 1px solid var(--heritage-red, #CC0000);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
}
.sa-keepbest-replace:hover {
  background: var(--heritage-red, #CC0000);
  color: #fff;
}

/* ── Briefing card ─────────────────────────────────────────── */

.sa-briefing {
  padding: 24px;
  background: var(--surface);
  border-left: 4px solid var(--heritage-red);
  margin-bottom: 18px;
}
.sa-briefing-empty { background: rgba(212, 168, 67, 0.05); border-left-color: var(--heritage-gold); }

.sa-briefing-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.78rem;
}

.sa-briefing-body {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-primary);
}
.sa-briefing-body h4.sa-md-h,
.sa-briefing-body h5.sa-md-h {
  font-family: var(--font-serif);
  font-style: italic;
  margin: 1.5em 0 0.4em;
  color: var(--heritage-purple, #5B2C8A);
}
/* H4 section headers — subtle purple left accent + gold bottom rule, matching
   the PDF's section banner aesthetic. */
.sa-briefing-body h4.sa-md-h {
  font-size: 1.15rem;
  padding: 0.3em 0 0.3em 0.8em;
  border-left: 4px solid var(--heritage-purple, #5B2C8A);
  border-bottom: 1px solid rgba(212, 168, 67, 0.3);
}
.sa-briefing-body h5.sa-md-h { font-size: 0.98rem; }
.sa-briefing-body ul {
  margin: 0.4em 0 0.8em;
  padding-left: 1.4em;
}
.sa-briefing-body li { margin: 0.18em 0; }
.sa-briefing-body strong { color: var(--heritage-red); }

/* ── Brief tables — match PDF aesthetic ───────────────────────
   Purple table headers, eggshell zebra stripes, hover highlight, and inline
   red/green number tinting (sa-num-neg / sa-num-pos) generated by mdToHtml(). */
.sa-briefing-body .sa-brief-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8em 0 1.2em;
  font-size: 0.88rem;
  line-height: 1.4;
}
.sa-briefing-body .sa-brief-table thead th {
  background: var(--heritage-purple, #5B2C8A);
  color: #fff;
  font-weight: 600;
  padding: 8px 12px;
  text-align: left;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.sa-briefing-body .sa-brief-table tbody td {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.sa-briefing-body .sa-brief-table tbody tr:nth-child(even) {
  background: rgba(232, 223, 201, 0.25); /* eggshell stripe */
}
.sa-briefing-body .sa-brief-table tbody tr:hover {
  background: rgba(212, 168, 67, 0.08);
}
/* Number tinting (shared by table cells + any inline tinted token) */
.sa-briefing-body .sa-num-neg,
.sa-num-neg { color: var(--heritage-red, #CC0000); font-weight: 600; }
.sa-briefing-body .sa-num-pos,
.sa-num-pos { color: var(--success); font-weight: 600; }

/* ── Inline Brief Visual Analytics (twin of the PDF charts) ─── */
.sa-brief-va {
  margin: 1.4em 0;
  padding: 1.1em 1.2em 1.3em;
  border-radius: 10px;
  background: rgba(91, 44, 138, 0.035); /* subtle purple section accent */
  border-left: 4px solid var(--heritage-purple, #5B2C8A);
}
.sa-brief-va-title {
  margin-top: 0 !important;
  color: var(--heritage-purple, #5B2C8A) !important;
}
.sa-brief-va-chart {
  margin: 0.9em 0 0;
}
.sa-brief-va-chart + .sa-brief-va-chart {
  margin-top: 1.4em;
  padding-top: 1.2em;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.sa-brief-va-label {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-secondary, #666);
  margin-bottom: 0.5em;
}
.sa-brief-va .sa-viz-chart { width: 100%; }
.sa-brief-va .sa-movers-tbl { font-size: 0.85rem; }

/* ── Upload coverage card ──────────────────────────────────── */

.sa-coverage {
  padding: 18px;
  margin-bottom: 18px;
}

.sa-coverage-grid {
  display: flex;
  gap: 18px;
  margin-bottom: 12px;
  font-size: 0.95rem;
}
.sa-coverage-grid strong {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
}

.sa-details summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-mute);
  padding: 6px 0;
}
.sa-details[open] summary {
  margin-bottom: 8px;
}

.sa-coverage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.sa-coverage-table th,
.sa-coverage-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-soft);
}
.sa-coverage-table tr.sa-row-err td { background: rgba(204, 0, 0, 0.05); }
.sa-coverage-table tr.sa-row-ok td { background: rgba(91, 140, 90, 0.04); }

/* ── ECharts visualization layer ───────────────────────────── */

.sa-viz-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sa-charts-card {
  padding: 18px;
}

.sa-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) {
  .sa-charts-row { grid-template-columns: 1fr; }
}

.sa-charts-half {
  min-width: 0;
}

.sa-viz-chart {
  width: 100%;
  min-height: 260px;
}

/* ── Signal panel ──────────────────────────────────────────── */

.sa-signals { padding: 16px; }

.sa-signal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 480px;
  overflow-y: auto;
}

.sa-signal {
  padding: 10px 12px;
  border-left: 3px solid transparent;
  margin: 6px 0;
  background: var(--surface-soft);
  border-radius: 3px;
}
.sa-sev-critical { border-left-color: var(--heritage-red); background: rgba(204, 0, 0, 0.05); }
.sa-sev-high     { border-left-color: #D4843C; background: rgba(212, 132, 60, 0.05); }
.sa-sev-medium   { border-left-color: var(--heritage-gold); }
.sa-sev-info     { border-left-color: var(--text-mute); }

.sa-signal-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.7rem;
}
.sa-signal-chip {
  font-weight: 700;
  letter-spacing: 0.04em;
}
.sa-sev-critical .sa-signal-chip { color: var(--heritage-red); }
.sa-sev-high     .sa-signal-chip { color: #B86F2F; }
.sa-sev-medium   .sa-signal-chip { color: var(--heritage-gold-dark); }

.sa-signal-type {
  color: var(--text-mute);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sa-signal-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.sa-link {
  background: transparent;
  border: none;
  color: var(--heritage-red);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 0;
}
.sa-link:hover { text-decoration: underline; }
.sa-link-warn { color: var(--text-mute); font-size: 1rem; line-height: 1; }
.sa-link-warn:hover { color: var(--heritage-red); }

/* ── Watchlist panel ──────────────────────────────────────── */

.sa-watch { padding: 16px; }

.sa-watch-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sa-watch-row {
  display: grid;
  grid-template-columns: 70px 1fr 24px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border-soft);
}
.sa-watch-status {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
}
.sa-status-watching  { background: rgba(212, 168, 67, 0.15); color: var(--heritage-gold-dark); }
.sa-status-resolved  { background: rgba(91, 140, 90, 0.15); color: #4a7649; }
.sa-status-escalated { background: rgba(204, 0, 0, 0.12); color: var(--heritage-red); }

.sa-watch-dim {
  color: var(--text-primary);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Ask panel ────────────────────────────────────────────── */

.sa-ask { padding: 16px; }

.sa-ask textarea {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
  background: var(--surface);
  color: var(--text-primary);
  margin-bottom: 8px;
}

.sa-ask-output {
  margin-top: 12px;
  max-height: 360px;
  overflow-y: auto;
}

.sa-ask-item {
  margin: 8px 0;
  padding: 10px;
  background: var(--surface-soft);
  border-radius: 4px;
  border-left: 3px solid var(--heritage-gold);
}
.sa-ask-q {
  font-size: 0.78rem;
  color: var(--text-mute);
  margin-bottom: 6px;
  font-style: italic;
}
.sa-ask-a {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-primary);
}
.sa-ask-a p { margin: 0.3em 0; }
.sa-ask-a ul { padding-left: 1.3em; margin: 0.3em 0; }

.sa-ask-loading { opacity: 0.6; }

/* ── Upload progress / results ────────────────────────────── */

.sa-upload-progress {
  padding: 12px;
  background: rgba(212, 168, 67, 0.08);
  color: var(--heritage-gold-dark);
  border-radius: 4px;
  text-align: center;
  font-size: 0.88rem;
}
.sa-upload-err {
  padding: 12px;
  background: rgba(204, 0, 0, 0.08);
  color: var(--heritage-red);
  border-radius: 4px;
  font-size: 0.85rem;
}

.sa-upload-results { padding: 18px; }

/* ── Top Movers Table ──────────────────────────────────────── */

.sa-movers-tabs {
  float: right;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.78rem;
}
.sa-tab {
  background: transparent;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-mute);
  margin-left: 4px;
}
.sa-tab.active {
  background: rgba(204, 0, 0, 0.08);
  color: var(--heritage-red);
  border-color: var(--heritage-red);
  font-weight: 600;
}

.sa-movers-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 12px;
}
.sa-movers-tbl th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border-soft);
  font-size: 0.75rem;
  color: var(--text-mute);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sa-movers-tbl td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
}
.sa-movers-tbl th.num,
.sa-movers-tbl td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.sa-movers-tbl .pos { color: #2D5F2D; }
.sa-movers-tbl .neg { color: var(--heritage-red); }
.sa-mover-name {
  font-weight: 500;
  color: var(--text-primary);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sa-trend-bar {
  height: 8px;
  background: rgba(0,0,0,0.05);
  border-radius: 2px;
  overflow: hidden;
}
.sa-trend-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 150ms ease;
}
.sa-trend-fill.up { background: #2D5F2D; }
.sa-trend-fill.down { background: var(--heritage-red); }

.sa-copy-btn {
  margin-top: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-mute);
}
.sa-copy-btn:hover {
  background: rgba(204, 0, 0, 0.06);
  color: var(--heritage-red);
}

/* ── Mobile ────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .sa-layout { margin: 12px; gap: 14px; }
  .sa-coverage-grid { flex-wrap: wrap; gap: 12px; }
  .sa-briefing { padding: 16px; }
  .sa-charts-row { grid-template-columns: 1fr; }
  .sa-viz-chart { min-height: 240px; }
  /* MOBILE POLISH 2026-06-11: horizontal scroll now lives on the wrapper
     (#sa-movers-table / #sa-brief-movers-table) via the rules below, with
     min-width on the table forcing the scroll. Keep the table a real <table>
     here so column widths stay intact while the WRAPPER scrolls. */
  .sa-movers-tbl { font-size: 0.75rem; }
}

/* ── Split-brief: Recommended Actions regen controls (2026-06-11) ───────── */
.sa-actions-section {
  /* visually delimit the actions section as the user-curated, re-rollable part.
     Eggshell panel + gold left rail, matching the PDF's Priority Actions block. */
  scroll-margin-top: 80px;
  margin-top: 1.5em;
  padding: 1.2em 1.4em;
  border-radius: 8px;
  background: rgba(255, 245, 230, 0.5); /* eggshell */
  border-left: 5px solid var(--heritage-gold, #D4A843);
}
.sa-actions-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 0;
  margin-bottom: 0.8em;
  padding-bottom: 0.5em;
  border-bottom: 2px solid var(--heritage-gold, #D4A843);
}
.sa-actions-header .sa-md-h {
  flex: 0 0 auto;
  /* inside the gold panel the heading drops its own left accent/rule */
  border-left: none;
  border-bottom: none;
  padding: 0;
}
/* Numbered action cards — each recommended action becomes a card with a red
   counter chip, mirroring the PDF's Priority Actions list.
   counter-reset lives on .sa-actions-body (the parent) — not the <ol> — so that
   if the markdown-to-HTML pass emits multiple adjacent <ol>s (AI output puts
   blank lines between numbered items), the action counter keeps incrementing
   continuously across all of them instead of resetting to 1 in each <ol>. */
.sa-actions-body {
  counter-reset: action-counter;
}
.sa-actions-body ol,
.sa-actions-body .sa-ol {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.sa-actions-body ol > li,
.sa-actions-body .sa-ol > li {
  counter-increment: action-counter;
  position: relative;
  padding: 0.8em 1em 0.8em 3.2em;
  margin-bottom: 0.6em;
  background: var(--surface, #fff);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.sa-actions-body ol > li::before,
.sa-actions-body .sa-ol > li::before {
  content: counter(action-counter);
  position: absolute;
  left: 0.6em;
  top: 0.7em;
  width: 1.6em;
  height: 1.6em;
  background: var(--heritage-red, #CC0000);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
}
/* Nested sub-bullets inside an action card stay as plain bullets. */
.sa-actions-body ol > li ul,
.sa-actions-body .sa-ol > li ul {
  list-style: disc;
  margin: 0.4em 0 0;
  padding-left: 1.2em;
}
.sa-actions-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.sa-actions-regen {
  font-size: 0.74rem;
  background: transparent;
  color: var(--heritage-red, #CC0000);
  border: 1px solid var(--heritage-red, #CC0000);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.sa-actions-regen:hover:not(:disabled) {
  background: var(--heritage-red, #CC0000);
  color: #fff;
}
.sa-actions-regen:disabled {
  opacity: 0.55;
  cursor: default;
}
.sa-actions-restore {
  font-size: 0.72rem;
  color: var(--text-mute, #7B7B7B);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  white-space: nowrap;
}
.sa-actions-restore:hover {
  color: var(--heritage-red, #CC0000);
}
/* H2-audit: Action card titles should be ink, not Heritage Red.
   The global .sa-briefing-body strong { color: red } is intentional for inline
   emphasis in the brief body, but action lead-clause titles must match the PDF
   (ink text, only the numbered chip is red). */
.sa-actions-body ol > li > strong,
.sa-actions-body .sa-ol > li > strong { color: var(--text-primary); }
.sa-actions-body {
  transition: opacity 0.15s ease;
}
.sa-actions-spinner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-mute, #7B7B7B);
  margin: 8px 0 4px;
}

/* ── Live generation-progress card (2026-06-11) ───────────────────
   Staged progress shown during brief generation / actions re-roll.
   Reuses the Heritage palette + .sa-verify-* visual language so it
   feels native to the Sales Analytics module. No new framework. */
.sa-gp-card {
  padding: 18px 20px;
  border-left: 4px solid var(--heritage-red, #CC0000);
  background: rgba(204, 0, 0, 0.03);
  border-radius: 6px;
}
.sa-gp-card-inline {
  padding: 12px 14px;
  margin-bottom: 10px;
  background: rgba(212, 168, 67, 0.06);
  border-left-color: var(--heritage-gold, #D4A843);
}
.sa-gp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.sa-gp-title {
  font-family: var(--font-serif, 'ABC Arizona Flare', 'Playfair Display', Georgia, serif);
  font-style: italic;
  font-size: 1.05rem;
  margin: 0;
  color: var(--heritage-red, #CC0000);
}
.sa-gp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.sa-gp-step {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.9rem;
  line-height: 1.35;
}
.sa-gp-icon {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  font-weight: 700;
}
.sa-gp-label { flex: 0 1 auto; }
.sa-gp-elapsed {
  color: var(--text-mute, #8a8578);
  font-variant-numeric: tabular-nums; /* steady width as seconds tick */
  white-space: nowrap;
  margin-left: 0.35rem;
}

.sa-gp-detail {
  flex: 0 1 auto;
  font-size: 0.8rem;
  color: var(--text-mute, #7B7B7B);
  font-style: italic;
}
.sa-gp-done .sa-gp-icon { color: var(--heritage-green, #2D5F2D); }
.sa-gp-done .sa-gp-label { color: var(--text, #2C2C2C); }
.sa-gp-active .sa-gp-label { color: var(--heritage-red, #CC0000); font-weight: 600; }
.sa-gp-pending { opacity: 0.5; }
.sa-gp-pending .sa-gp-icon { color: var(--text-mute, #9B9B9B); }
.sa-gp-error .sa-gp-icon { color: var(--heritage-red, #CC0000); }
.sa-gp-error .sa-gp-label { color: var(--heritage-red, #CC0000); font-weight: 600; }
.sa-gp-error .sa-gp-detail { color: var(--heritage-red, #CC0000); font-style: normal; }
.sa-gp-foot {
  margin: 12px 0 0;
  font-size: 0.78rem;
}
/* Spinner — pure CSS, Heritage red ring. */
.sa-gp-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(204, 0, 0, 0.25);
  border-top-color: var(--heritage-red, #CC0000);
  border-radius: 50%;
  animation: sa-gp-spin 0.7s linear infinite;
  vertical-align: middle;
}
.sa-gp-spinner-lg { width: 18px; height: 18px; border-width: 2.5px; }
@keyframes sa-gp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .sa-gp-spinner { animation-duration: 1.6s; }
}

/* ════════════════════════════════════════════════════════════════════════
   MOBILE POLISH PASS — 2026-06-11
   Tunes every piece of UI added today (inline brief Visual Analytics, staged
   generation progress card, verification badge tap-toggle, keep-best notice,
   split-generation action controls, dashboard panels) for touch + narrow
   viewports. Breakpoints mirror the codebase convention used in
   97-mobile-optimize.css: 720 / 480 / 380, plus (hover:none) for touch.
   This block loads LAST in 31-* so its rules win the in-file cascade.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Verification badge: tap-toggle detail popover (all widths) ──────────── */
/* The badge headline is a <button> on touch so the detail note is reachable
   without hover. The detail renders as an inline popover anchored to the badge. */
.sa-verify-wrap {
  position: relative;
  display: inline-block;
}
.sa-taptoggle-btn {
  /* reset button chrome so it looks identical to the old <span> badge */
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.sa-verify-detail {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  max-width: min(78vw, 320px);
  width: max-content;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text-primary, #2c2c2c);
  border: 1px solid var(--border-soft, #ddd);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.16);
  font-size: 0.78rem;
  line-height: 1.45;
  font-weight: 400;
  letter-spacing: normal;
  white-space: normal;
}
.sa-verify-wrap.is-open .sa-verify-detail[hidden] { display: block; } /* belt: JS owns [hidden] */

/* ── (hover: none) / touch: kill tooltip reliance, grow tap targets ──────── */
@media (hover: none), (max-width: 720px) {
  /* The verify badge becomes the primary tap target — guarantee a sane hit area. */
  .sa-taptoggle-btn {
    min-height: 32px;
    padding: 5px 12px;
  }
  /* Keep-best "Replace anyway" and the inline regen controls are destructive-ish
     operator actions — give them Apple-HIG-friendly 44px hit targets. Both carry
     `.btn.btn-sm`, which 97-mobile-optimize.css pins to min-height:36px via a
     `.btn.btn-sm` selector (specificity 0,2,0) that loads AFTER this file. To
     win the touch target WITHOUT editing the shared mobile stylesheet, these
     selectors use all three classes (0,3,0). */
  .sa-keepbest-replace.btn.btn-sm,
  .sa-actions-regen.btn.btn-sm,
  .sa-keepbest-replace,
  .sa-actions-regen {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
    display: inline-flex;
    align-items: center;
  }
  .sa-actions-restore {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
  }
  /* The keep-best <details> summary is the disclosure tap target. */
  .sa-keepbest-detail > summary {
    min-height: 36px;
    display: flex;
    align-items: center;
    cursor: pointer;
  }
}

/* ── ≤720px: large-phone / small-tablet ─────────────────────────────────── */
@media (max-width: 720px) {
  /* Brief tables scroll horizontally rather than overflowing the viewport. */
  .sa-briefing-body .sa-brief-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  /* Action cards tighten their left padding so the counter chip + text fit. */
  .sa-actions-section { padding: 1em 1em; }
  .sa-actions-body ol > li,
  .sa-actions-body .sa-ol > li {
    padding: 0.7em 0.8em 0.7em 2.8em;
  }
  /* Inline brief Visual Analytics — tighten the section padding so charts get
     more usable width, and stop the GP% heatmap from eating half the screen. */
  .sa-brief-va {
    padding: 0.9em 0.7em 1em;
    margin: 1.1em 0;
  }
  .sa-brief-va-chart + .sa-brief-va-chart {
    margin-top: 1.1em;
    padding-top: 1em;
  }
  .sa-brief-va-label { font-size: 0.74rem; }
  /* Chart heights — the JS rebuilds the heatmap grid for phones (slim left
     gutter + horizontal legend), so the inline heatmap no longer needs 460px. */
  #sa-brief-chart-heatmap { height: 360px !important; }
  #sa-brief-chart-waterfall { height: 280px !important; }
  #sa-chart-treemap { height: 300px !important; }

  /* Briefing meta row (period pill + verify badge + timestamp + export) wraps
     instead of overflowing; export button drops to its own line cleanly. */
  .sa-briefing-meta {
    flex-wrap: wrap;
    gap: 8px;
    row-gap: 8px;
  }
  .sa-briefing-meta .sa-export-pdf-btn {
    margin-left: 0 !important;
  }

  /* Keep-best notice: stack the badge / detail / replace control so nothing is
     squeezed; replace button goes full-width and thumb-friendly. */
  .sa-keepbest-notice { padding: 10px; }
  .sa-keepbest-text { min-width: 0; }

  /* Actions header: heading + controls wrap; controls take their own row and
     keep generous spacing so the destructive regen isn't fat-finger-adjacent
     to the restore link. */
  .sa-actions-header { gap: 10px; }
  .sa-actions-controls {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
    gap: 16px;
  }

  /* Tables (inline brief movers + dashboard movers) scroll inside their card
     wrapper rather than blowing out the page width. The WRAPPER div scrolls;
     the <table> keeps a min-width so columns don't crush. */
  #sa-brief-movers-table,
  #sa-movers-table {
    position: relative;
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* a thin always-on scrollbar makes the horizontal scroll discoverable */
    scrollbar-width: thin;
    scrollbar-color: rgba(204,0,0,0.4) transparent;
  }
  /* Always-visible slim scrollbar on WebKit/touch (iOS hides auto scrollbars). */
  #sa-brief-movers-table::-webkit-scrollbar,
  #sa-movers-table::-webkit-scrollbar { height: 6px; -webkit-appearance: none; }
  #sa-brief-movers-table::-webkit-scrollbar-thumb,
  #sa-movers-table::-webkit-scrollbar-thumb {
    background: rgba(204,0,0,0.4); border-radius: 3px;
  }
  /* Explicit “swipe →” caption so the cut-off columns are never silent. */
  #sa-brief-movers-table::after,
  #sa-movers-table::after {
    content: 'swipe → for more columns';
    display: block;
    padding: 4px 2px 0;
    font-size: 0.68rem;
    color: var(--text-mute, #7B7B7B);
    font-style: italic;
    position: sticky;
    left: 0;
  }
  .sa-movers-tbl { min-width: 520px; }   /* force horizontal scroll, not column crush */
  .sa-movers-tbl th,
  .sa-movers-tbl td { padding: 6px 8px; }
  .sa-mover-name { max-width: 120px; }

  /* Progress card: keep the staged step rows on a single line each, truncating
     the elapsed/detail text with an ellipsis instead of wrapping + pushing the
     layout taller on every tick. */
  .sa-gp-card { padding: 14px 14px; }
  .sa-gp-step {
    flex-wrap: nowrap;
    min-width: 0;
  }
  .sa-gp-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sa-gp-detail {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 42%;
  }
  .sa-gp-title { font-size: 0.98rem; }
}

/* ── ≤480px: iPhone portrait (390-430) ──────────────────────────────────── */
@media (max-width: 480px) {
  .sa-layout { margin: 10px; gap: 12px; }
  .sa-briefing { padding: 14px; }

  /* No element may force horizontal page scroll. */
  .sa-brief-va,
  .sa-charts-card,
  .sa-coverage,
  .sa-briefing { max-width: 100%; }
  .sa-viz-chart { min-height: 220px; }

  #sa-brief-chart-heatmap { height: 330px !important; }
  #sa-brief-chart-waterfall { height: 260px !important; }
  #sa-chart-treemap { height: 280px !important; }

  /* Verify detail popover: pin within viewport, never overflow off-screen. */
  .sa-verify-detail {
    max-width: 84vw;
    left: 0;
  }

  /* Actions controls: regen button can go full width for an easy thumb target;
     restore link stays inline beneath it. */
  .sa-actions-regen { flex: 1 1 auto; justify-content: center; }

  /* Verification scoreboard: keep the 3 cells in a row but tighten so the
     numbers stay legible; coverage caption drops to its own full-width line. */
  .sa-vscore { gap: 8px; }
  .sa-vscore-cells { gap: 6px; }
  .sa-vscore-cell { min-width: 0; padding: 8px 6px; }
  .sa-vscore-n { font-size: 1.35rem; }
  .sa-vscore-label { font-size: 0.6rem; letter-spacing: 0.05em; }
  .sa-vscore-cov { flex: 1 1 100%; white-space: normal; }
  .sa-action-pri { display: inline-flex; margin-bottom: 2px; }
}

/* ── ≤380px: iPhone SE / 360 class ──────────────────────────────────────── */
@media (max-width: 380px) {
  .sa-layout { margin: 8px; }
  .sa-briefing { padding: 12px; }
  .sa-brief-va { padding: 0.8em 0.55em 0.9em; }
  #sa-brief-chart-heatmap { height: 310px !important; }
  .sa-brief-va-label { font-size: 0.72rem; }
  .sa-movers-tbl { font-size: 0.72rem; min-width: 480px; }
  .sa-gp-step { font-size: 0.84rem; }
  .sa-gp-detail { max-width: 38%; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Pack Library (2026-07-28) — official factory-published SA packs

   The shelf that Cindy/Collin use to pull the monthly 13-workbook pack.
   Confidential finance surface: it should read as authoritative and calm,
   not as a marketing card. Heritage Red is reserved for the primary CTA and
   the residuals heading (the honesty signal), never as a background wash.
   ══════════════════════════════════════════════════════════════════════════ */

.sa-pack-card {
  padding: 18px;
  margin-bottom: 18px;
}

/* Heading row: title + muted subtitle sit on one line on desktop, wrap on phone. */
.sa-pack-h {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}
.sa-pack-sub {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* Identity row: period + status chip + provenance chip, with the period
   selector pushed to the far right. */
.sa-pack-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}
.sa-pack-ident {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.sa-pack-period {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.sa-pack-period-label { display: inline-flex; align-items: center; }

.sa-pack-title {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Metadata strip: published_at · files · size · source · checksum.
   Flex-wrap so it degrades to stacked lines instead of overflowing. */
.sa-pack-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.8rem;
  color: var(--text-primary);
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 12px;
}
.sa-pack-meta-item { white-space: nowrap; }
.sa-pack-code {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.74rem;
  background: var(--surface-sunken, rgba(0, 0, 0, 0.04));
  border-radius: 4px;
  padding: 1px 5px;
}

/* Action row. MOBILE: buttons stack full-width (see ≤720px block below) so the
   zip CTA is always a comfortable thumb target. */
.sa-pack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}
.sa-pack-btn { white-space: nowrap; }

/* Undo approve: reads as a retraction, not an action to reach for. Ghost base
   (low visual weight, never competes with Download) tinted toward the danger
   token only on hover, so an approved pack still looks approved at rest. */
.sa-pack-btn-undo { color: var(--text-mute, #6b7280); }
.sa-pack-btn-undo:hover:not(:disabled) {
  color: var(--danger, #b42318);
  border-color: var(--danger, #b42318);
}

.sa-pack-detail-err {
  font-size: 0.78rem;
  margin: 10px 0 0;
}

/* Security C8: quiet line in place of Approve/Withdraw for people who can
   read the shelf but do not sign off. Same weight as the detail note. */
.sa-pack-approver-note {
  font-size: 0.78rem;
  margin: 10px 0 0;
}

/* Residuals — the disclosure-honesty block. Gold left rule: "read this before
   you send these numbers to a customer." */
.sa-pack-residuals {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--heritage-gold, #d4a843);
  background: rgba(212, 168, 67, 0.06);
  border-radius: 0 6px 6px 0;
}
.sa-pack-residuals-h {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.sa-pack-residual-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.82rem;
  line-height: 1.5;
}
.sa-pack-residual-list li { margin-bottom: 3px; }

/* Disclosure panel — rendered markdown from the factory DISCLOSURE file. */
.sa-pack-disclosure {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface-sunken, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  max-height: 420px;
  overflow-y: auto;
}
.sa-pack-disclosure-body {
  font-size: 0.82rem;
  line-height: 1.55;
}
.sa-pack-disclosure-body h1,
.sa-pack-disclosure-body h2,
.sa-pack-disclosure-body h3 {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  margin: 12px 0 6px;
}
.sa-pack-disclosure-body p { margin: 0 0 8px; }
.sa-pack-disclosure-body ul { margin: 0 0 8px; padding-left: 18px; }

/* File manifest table. Reuses .sa-coverage-table geometry; the download column
   is right-aligned and never wraps. */
.sa-pack-files { margin-top: 14px; }
.sa-pack-table { margin-top: 4px; }
.sa-pack-fname {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.75rem;
  word-break: break-all;
}
.sa-pack-col-dl { text-align: right; white-space: nowrap; }
.sa-pack-file-dl:disabled { opacity: 0.55; cursor: default; }

/* Audit strip + confidentiality notice. */
.sa-pack-audit {
  margin: 14px 0 0;
  font-size: 0.72rem;
  line-height: 1.5;
}
.sa-pack-confidential {
  margin: 6px 0 0;
  font-size: 0.7rem;
  font-style: italic;
}

.sa-pack-skeleton { margin-top: 8px; }

/* ── Pack Library ≤720px: stack the action buttons ─────────────────────── */
@media (max-width: 720px) {
  .sa-pack-card { padding: 14px; }
  .sa-pack-top { align-items: flex-start; }
  .sa-pack-period-label,
  .sa-pack-period-label .sa-period-select { width: 100%; }
  /* Full-width stacked CTAs — the zip download is the primary thumb target. */
  .sa-pack-actions { flex-direction: column; align-items: stretch; }
  .sa-pack-btn { width: 100%; justify-content: center; }
  .sa-pack-meta { gap: 4px 14px; font-size: 0.76rem; }
  .sa-pack-meta-item { white-space: normal; }
  /* Manifest table scrolls horizontally rather than crushing the columns. */
  .sa-pack-files .sa-pack-table { min-width: 460px; }
  .sa-pack-files { overflow-x: auto; }
  .sa-pack-disclosure { max-height: 300px; }
}

@media (max-width: 380px) {
  .sa-pack-period { font-size: 1.15rem; }
  .sa-pack-files .sa-pack-table { min-width: 400px; }
}
/* ============================================================
   32-feedback-thread.css — feedback conversations P1 (2026-10-21)
   Reporter thread on Hub → My, team Conversations tab, board card
   badges, sticky "new reply" toast. Only rendered while
   FEEDBACK_CHAT_ENABLED is on. Dark mode rules at the end.
   ============================================================ */

.fbt-reporter { margin-top: 10px; }

.fbt-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--border-medium, #d8d2c4);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--text-primary, #1f1f1f);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.fbt-toggle[aria-expanded="true"] { border-color: var(--heritage-red, #CC0000); }
.fbt-toggle:focus-visible,
.fbt-row-btn:focus-visible,
.fbt-board-toggle:focus-visible { outline: 2px solid var(--heritage-gold-dark, #8B6914); outline-offset: 2px; }

.fbt-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--heritage-red, #CC0000);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.fbt-badge.is-waiting { background: var(--heritage-gold-dark, #8B6914); }

.fbt-tab-badge {
  display: inline-block;
  min-width: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--heritage-red, #CC0000);
  color: #fff;
  font-size: 0.7rem;
  line-height: 18px;
  text-align: center;
  vertical-align: middle;
}

.fbt-host { margin-top: 10px; }
.fbt { display: flex; flex-direction: column; gap: 10px; }

.fbt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
}

.fbt-msg {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-alt, #f4f1ea);
  border: 1px solid var(--border-light, #ece7dc);
  align-self: flex-start;
}
.fbt-msg.is-mine {
  align-self: flex-end;
  background: rgba(204, 0, 0, 0.06);
  border-color: rgba(204, 0, 0, 0.22);
}
.fbt-msg.is-internal {
  background: repeating-linear-gradient(135deg, rgba(212, 168, 67, 0.10) 0 8px, rgba(212, 168, 67, 0.04) 8px 16px);
  border-style: dashed;
  border-color: var(--heritage-gold-dark, #8B6914);
}

.fbt-msg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 3px;
  font-size: 0.74rem;
  color: var(--text-secondary, #5f5a50);
}
.fbt-author { font-weight: 700; color: var(--text-primary, #1f1f1f); }
.fbt-role,
.fbt-internal-chip {
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border-medium, #d8d2c4);
  font-size: 0.68rem;
}
.fbt-internal-chip { border-color: var(--heritage-gold-dark, #8B6914); color: var(--heritage-gold-dark, #8B6914); font-weight: 700; }
.fbt-time { margin-left: auto; }

.fbt-body {
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-primary, #1f1f1f);
}

.fbt-awaiting { margin: 0; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary, #5f5a50); }
.fbt-awaiting.is-team::before { content: '● '; color: var(--heritage-gold-dark, #8B6914); }
.fbt-awaiting.is-reporter::before { content: '● '; color: var(--heritage-red, #CC0000); }

.fbt-empty,
.fbt-closed,
.fbt-error,
.fbt-loading { margin: 0; font-size: 0.85rem; color: var(--text-secondary, #5f5a50); }
.fbt-error { color: var(--heritage-red, #CC0000); }

.fbt-composer { display: flex; flex-direction: column; gap: 6px; }
.fbt-composer.is-internal .fbt-input { border-style: dashed; border-color: var(--heritage-gold-dark, #8B6914); }
.fbt-label { font-size: 0.78rem; font-weight: 600; }
.fbt-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 72px;
  padding: 8px 10px;
  border: 1px solid var(--border-medium, #d8d2c4);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text-primary, #1f1f1f);
  font: inherit;
  font-size: 16px; /* no iOS zoom */
  resize: vertical;
}
.fbt-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.fbt-status { font-size: 0.78rem; color: var(--text-secondary, #5f5a50); margin-right: auto; }
.fbt-send { min-height: 36px; }
.fbt-hint { margin: 0; font-size: 0.74rem; color: var(--text-secondary, #5f5a50); }
.fbt-modes { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.82rem; }
.fbt-mode { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; cursor: pointer; }

.fbt-msg.is-new { box-shadow: 0 0 0 2px var(--heritage-red, #CC0000); }
.fbt-new-chip {
  padding: 0 6px;
  border-radius: 6px;
  background: var(--heritage-red, #CC0000);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}
.fbt-closed-hint { font-weight: 600; }

/* ── Team inbox ─────────────────────────────────────────── */
.fbt-inbox { display: flex; flex-direction: column; gap: 12px; }
.fbt-views { display: flex; flex-wrap: wrap; gap: 6px; }
.fbt-inbox-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fbt-row-item {
  border: 1px solid var(--border-light, #ece7dc);
  border-radius: 10px;
  background: var(--surface, #fff);
  padding: 4px 10px 8px;
}
.fbt-row-item.is-waiting { border-left: 4px solid var(--heritage-gold-dark, #8B6914); }
.fbt-row-btn {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--text-primary, #1f1f1f);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.fbt-row-id { font-weight: 700; }
.fbt-row-mod,
.fbt-row-who,
.fbt-row-status { font-size: 0.78rem; color: var(--text-secondary, #5f5a50); }
.fbt-row-snip {
  flex-basis: 100%;
  font-size: 0.85rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.fbt-roles { margin-top: 8px; border-top: 1px solid var(--border-light, #ece7dc); padding-top: 10px; }
.fbt-roles summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.fbt-roles-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.fbt-roles-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.85rem; }
.fbt-roles-by { font-size: 0.72rem; color: var(--text-secondary, #5f5a50); }
.fbt-roles-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.fbt-roles-form input,
.fbt-roles-form select {
  min-height: 36px;
  padding: 4px 8px;
  border: 1px solid var(--border-medium, #d8d2c4);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: var(--text-primary, #1f1f1f);
  font-size: 16px;
}
.fbt-roles-implicit { font-size: 0.82rem; margin: 6px 0; }

/* ── Board ──────────────────────────────────────────────── */
.fbt-board-host { border-top: 1px dashed var(--border-light, #ece7dc); padding-top: 8px; }
.fbb-head .fbt-badge { margin-left: 4px; }
.fbt-board-waiting { margin-left: 6px; }

/* ── Toast (sits above the implemented toast) ───────────── */
.fbt-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 9997;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface, #fff);
  color: var(--text-primary, #1f1f1f);
  border: 1px solid var(--heritage-red, #CC0000);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.fbt-toast[hidden] { display: none; }
.fbt-toast-text { font-weight: 600; font-size: 0.9rem; }
@media (hover: none), (max-width: 640px) {
  /* ≥44 px tap targets on phones (same rule as the board). */
  .fbt-toggle, .fbt .btn, .fbt-board-toggle, .fbt-row-btn, .fbt-mode,
  .fbt-toast .btn, .fbt-roles summary, .fbt-roles-form input, .fbt-roles-form select, .fbt-roles .btn,
  .fbt-view { min-height: 44px; }
  .fbt-board-toggle, .fbt .btn, .fbt-toast .btn { min-width: 44px; }
  /* 97-mobile-optimize pins .btn.btn-sm to 36 px and loads later: out-rank it. */
  .fbt .btn.btn-sm, .fbt-toast .btn.btn-sm, .fbb-actions .btn.btn-sm.fbt-board-toggle,
  .fbt-roles .btn.btn-sm { min-height: 44px; min-width: 44px; }
  .fbt-inbox .fbt-views .fbb-strip-chip.fbt-view { min-height: 44px; }
}
@media (max-width: 640px) {
  /* The agent + feedback FABs float bottom-right (~48-56 px, bottom 24-28 px).
     On phones Send goes LEFT, where nothing floats, and the composer keeps
     room below it so scrolling it into view clears the FAB stack (audit
     SHOULD-1; same clearance as .toast-container in 04-components.css). */
  .fbt-row { justify-content: flex-start; }
  .fbt-row .fbt-send { order: -1; }
  .fbt-row .fbt-status { margin-right: 0; margin-left: 4px; }
  .fbt-composer { scroll-margin-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); padding-bottom: 8px; }
  .fbt-toast { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); width: calc(100vw - 32px); }
  .fbt-msg { max-width: 96%; }
  .fbt-list { max-height: 60vh; }
}

/* ── Dark mode ──────────────────────────────────────────── */
[data-theme="dark"] .fbt-msg { background: var(--surface-alt); border-color: var(--border-light); }
[data-theme="dark"] .fbt-msg.is-mine { background: rgba(255, 107, 107, 0.10); border-color: rgba(255, 107, 107, 0.35); }
[data-theme="dark"] .fbt-msg.is-internal {
  background: repeating-linear-gradient(135deg, rgba(232, 197, 114, 0.12) 0 8px, rgba(232, 197, 114, 0.05) 8px 16px);
  border-color: var(--heritage-gold-light, #E8C572);
}
[data-theme="dark"] .fbt-internal-chip { color: var(--heritage-gold-light, #E8C572); border-color: var(--heritage-gold-light, #E8C572); }
[data-theme="dark"] .fbt-badge.is-waiting { background: #9c7a1f; }
[data-theme="dark"] .fbt-error { color: #FF6B6B; }
[data-theme="dark"] .fbt-row-item.is-waiting { border-left-color: var(--heritage-gold-light, #E8C572); }
[data-theme="dark"] .fbt-toggle,
[data-theme="dark"] .fbt-input,
[data-theme="dark"] .fbt-row-item,
[data-theme="dark"] .fbt-toast,
[data-theme="dark"] .fbt-roles-form input,
[data-theme="dark"] .fbt-roles-form select { background: var(--surface); color: var(--text-primary); border-color: var(--border-medium); }
[data-theme="dark"] .fbt-toast { border-color: #FF6B6B; }
/* ═══════════════════════════════════════════════════════════
   32 — Feedback System
   FAB, modal, inline thumbs, data quality flags, admin inbox.
   Heritage Red (#CC0000) accent, eggshell background.
   ═══════════════════════════════════════════════════════════ */

/* ── Floating Action Button ─────────────────────────────── */
.feedback-fab {
  position: fixed;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));  /* same row as agent FAB */
  right: calc(92px + env(safe-area-inset-right, 0px));  /* left of 56px agent FAB + 12px gap */
  z-index: 9001;  /* above agent-fab (9000) so hover/tooltip wins */
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.22);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.feedback-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.feedback-fab:active { transform: scale(0.96); }

/* Scroll-hide: mirrors agent-fab behavior — JS toggles fab-hidden */
.feedback-fab.fab-hidden {
  transform: translateY(96px);
  opacity: 0;
  pointer-events: none;
  transition: transform 240ms ease, opacity 240ms ease;
}
.feedback-fab-tooltip {
  position: fixed;
  right: calc(92px + env(safe-area-inset-right, 0px));
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  background: var(--ink-strong);
  color: #fff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  z-index: 9000;
  white-space: nowrap;
}
/* hover handled by JS mouseenter/mouseleave */
@media (hover: none), (max-width: 640px) {
  .feedback-fab-tooltip { display: none; }
}

/* ── Full-screen takeover slot ────────────────────────────────
   FULL-SCREEN MODULES MUST KEEP THIS FAB (2026-07-31, Kevin).
   Takeovers (.ws-root / #/workspace, .et-app / #/email-triage) hide the
   Ask-AIOP FAB because they embed / don't need in-context chat, but the
   feedback drawer is a GLOBAL escape hatch — users still have to be able to
   file a bug or idea from a full-screen module. The per-module thumbs strips
   (.ws-feedback-thumb, .feedback-module-strip) rate content; they are not a
   report path.

   With .agent-fab gone, the offset that keeps feedback LEFT of the 56px agent
   FAB (right: 92px desktop / 84px ≤700px) becomes a dead gap, so the takeover
   rules in 33-workspace.css + 13-email-triage.css move it into the primary
   bottom-right slot. This class is the shared, module-agnostic hook so any
   FUTURE full-screen shell gets correct placement by adding one class — no
   copy-pasted `display: none`.
   Guarded by tests/feedback-fab-fullscreen.test.js. */
body.fullscreen-module .feedback-fab {
  right: calc(24px + env(safe-area-inset-right, 0px));
  z-index: 9001;
}
body.fullscreen-module .feedback-fab-tooltip {
  right: calc(24px + env(safe-area-inset-right, 0px));
}
@media (max-width: 700px) {
  body.fullscreen-module .feedback-fab,
  body.fullscreen-module .feedback-fab-tooltip {
    /* Mirror the mobile .agent-fab inset convention it replaces. */
    right: max(16px, env(safe-area-inset-right, 0px));
  }
}

.feedback-fab:not(.fab-hidden) {
  transition: transform 240ms ease, opacity 240ms ease;
}

/* ── Modal Overlay ──────────────────────────────────────── */
.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: feedbackFadeIn 0.15s ease;
}
@keyframes feedbackFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.feedback-modal {
  background: var(--bg-primary, #FAF8F5);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 380px;
  max-width: 92vw;
  max-height: 80vh;
  overflow-y: auto;
}

.feedback-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
  border-bottom: 1px solid var(--border-light, #e8e4dd);
}
.feedback-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--font-serif, 'ABC Arizona Flare', 'Playfair Display', serif);
}
.feedback-modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-mute, #888);
  padding: 0 4px;
  line-height: 1;
}

.feedback-modal-body {
  padding: 16px 20px 20px;
}

.feedback-module-label {
  font-size: 0.82rem;
  color: var(--text-mute, #888);
  margin-bottom: 12px;
}

/* ── Step labels (Eliza 2026-07-14: make type choice explicit) ─ */
.feedback-step-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-mute, #888);
  margin: 0 0 8px;
}
.feedback-step-label + .feedback-type-pills,
.feedback-step-label + .feedback-textarea {
  margin-top: 0;
}

/* ── Type Pills ─────────────────────────────────────────── */
.feedback-type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.feedback-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-light, #ddd);
  background: var(--bg-secondary, #fff);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.feedback-pill:hover {
  border-color: #CC0000;
  background: rgba(204,0,0,0.06);
}
.feedback-pill.is-selected {
  border-color: #CC0000;
  background: rgba(204, 0, 0, 0.10);
  color: #8B0000;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(204, 0, 0, 0.25);
}
.feedback-pill:focus-visible {
  outline: 2px solid #CC0000;
  outline-offset: 2px;
}

/* Legacy selected-type chip (kept for older callers / admin views) */
.feedback-selected-type {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 12px;
  background: rgba(204,0,0,0.08);
  border-radius: 8px;
  font-size: 0.88rem;
}
.feedback-selected-label { flex: 1; font-weight: 600; }
.feedback-clear-type {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-mute, #888);
}

/* ── Textarea ───────────────────────────────────────────── */
.feedback-textarea {
  width: 100%;
  border: 1px solid var(--border-light, #ddd);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  background: var(--bg-secondary, #fff);
  box-sizing: border-box;
}
.feedback-textarea:focus {
  outline: none;
  border-color: #CC0000;
  box-shadow: 0 0 0 2px rgba(204,0,0,0.12);
}

/* ── 🚀 Request something new: optional detail block (2026-10-22) ──
   Rendered by feedback.js only while the capability_request pill is selected
   (replaces the retired #/request-module intake). Compact on purpose: the
   modal already scrolls, and Submit must stay reachable at 390px. */
.feedback-cap-detail {
  margin: 10px 0 2px;
  padding: 10px 12px 12px;
  border: 1px dashed var(--border-light, #ddd);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.feedback-cap-heading {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-mute, #888);
  margin-bottom: 2px;
}
.feedback-cap-label {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 2px;
}
.feedback-cap-input {
  width: 100%;
  border: 1px solid var(--border-light, #ddd);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--bg-secondary, #fff);
  color: inherit;
  box-sizing: border-box;
}
textarea.feedback-cap-input { resize: vertical; min-height: 48px; }
.feedback-cap-input:focus {
  outline: none;
  border-color: #CC0000;
  box-shadow: 0 0 0 2px rgba(204,0,0,0.12);
}
.feedback-cap-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.feedback-cap-chip {
  padding: 4px 11px;
  border-radius: 16px;
  border: 1px solid var(--border-light, #ddd);
  background: var(--bg-secondary, #fff);
  color: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.feedback-cap-chip:hover { border-color: #CC0000; }
.feedback-cap-chip.is-selected {
  border-color: #CC0000;
  background: rgba(204, 0, 0, 0.10);
  color: #8B0000;
  font-weight: 600;
}
.feedback-cap-chip:focus-visible {
  outline: 2px solid #CC0000;
  outline-offset: 2px;
}
.feedback-cap-hint {
  font-size: 0.75rem;
  color: var(--text-mute, #888);
  line-height: 1.35;
  margin-top: 2px;
}
@media (max-width: 700px) {
  .feedback-cap-input { font-size: 16px; } /* no iOS focus zoom */
  .feedback-cap-chip { min-height: 36px; }
}
[data-theme="dark"] .feedback-cap-detail { border-color: rgba(255,255,255,0.18); }
[data-theme="dark"] .feedback-cap-input,
[data-theme="dark"] .feedback-cap-chip {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.18);
}
[data-theme="dark"] .feedback-cap-chip.is-selected {
  background: rgba(255, 90, 90, 0.16);
  border-color: #ff6b6b;
  color: #ffb3b3;
}



/* ── Screenshot attach (PR2) ───────────────────────────── */
.feedback-shot-section {
  margin: 12px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feedback-shot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.feedback-shot-mobile-hint {
  font-size: 0.75rem;
  color: var(--text-mute, #888);
  line-height: 1.35;
}
.feedback-shot-mobile-hint[hidden] { display: none !important; }
.feedback-shot-upload-link.is-primary-action {
  align-self: auto;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #CC0000;
  background: rgba(204,0,0,0.06);
  text-decoration: none;
  font-weight: 700;
}
.feedback-shot-attach-btn {
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed var(--border-light, #ccc);
  background: var(--bg-secondary, #fff);
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink-strong, #222);
  transition: border-color 0.12s, background 0.12s;
}
.feedback-shot-attach-btn:hover:not(:disabled) {
  border-color: #CC0000;
  background: rgba(204,0,0,0.05);
}
.feedback-shot-attach-btn:disabled {
  opacity: 0.75;
  cursor: wait;
}
.feedback-shot-upload-link:disabled {
  opacity: 0.6;
  pointer-events: none;
}
.feedback-shot-consent {
  font-size: 0.75rem;
  color: var(--text-mute, #888);
  line-height: 1.35;
}
.feedback-shot-preview {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px;
  border: 1px solid var(--border-light, #e0dcd4);
  border-radius: 8px;
  background: var(--bg-secondary, #fff);
}
.feedback-shot-preview[hidden] { display: none !important; }
.feedback-shot-thumb {
  width: auto;
  height: 120px;
  max-width: 160px;
  object-fit: contain;
  border-radius: 4px;
  background: #f0ece6;
  border: 1px solid var(--border-light, #e8e4dd);
}
.feedback-shot-preview-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.feedback-shot-preview-note {
  font-size: 0.78rem;
  color: var(--text-mute, #666);
  line-height: 1.35;
}
.feedback-shot-remove-btn {
  align-self: flex-start;
  background: none;
  border: none;
  color: #8B0000;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.feedback-shot-remove-btn:hover { text-decoration: underline; }
.feedback-shot-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-light, #e0dcd4);
  background: rgba(204,0,0,0.04);
  color: var(--ink-strong, #222);
  font-size: 0.84rem;
  line-height: 1.35;
  min-height: 42px;
}
.feedback-shot-progress[hidden] { display: none !important; }
.feedback-shot-progress-text { flex: 1; min-width: 0; }
.feedback-shot-success {
  font-size: 0.82rem;
  color: #1f7a3a;
  font-weight: 600;
  line-height: 1.35;
}
.feedback-shot-success[hidden] { display: none !important; }
.feedback-shot-preview-meta-line {
  font-size: 0.74rem;
  color: var(--text-mute, #888);
}
.feedback-shot-preview-meta-line[hidden] { display: none !important; }
.feedback-shot-preview {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.feedback-shot-preview.is-visible {
  opacity: 1;
  transform: none;
}
.feedback-shot-error {
  font-size: 0.8rem;
  color: #8B0000;
  line-height: 1.4;
}
.feedback-shot-error[hidden] { display: none !important; }
.feedback-shot-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(204,0,0,0.18);
  border-top-color: #CC0000;
  animation: feedbackShotSpin 0.7s linear infinite;
  flex: 0 0 auto;
}
@keyframes feedbackShotSpin {
  to { transform: rotate(360deg); }
}
/* Floating toast during capture (modal is hidden so this is the only cue). */
.feedback-shot-toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(8px);
  z-index: 10050;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 360px);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.92);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.feedback-shot-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.feedback-shot-toast .feedback-shot-spinner {
  border-color: rgba(255,255,255,0.25);
  border-top-color: #fff;
}
.feedback-overlay {
  transition: opacity 160ms ease;
}
.feedback-overlay.is-capturing {
  /* keep layout, just soft-hide while toast is the status surface */
}
.feedback-shot-upload-link {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  color: #8B0000;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.feedback-shot-upload-link[hidden] { display: none !important; }

.feedback-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}
/* Submit must always render — disabled ≠ hidden (Eliza 2026-07-14). */
.feedback-actions .feedback-submit-btn {
  display: inline-flex !important;
  visibility: visible !important;
  min-width: 7.5rem;
  justify-content: center;
}
.feedback-actions .feedback-submit-btn:disabled,
.feedback-actions .feedback-submit-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.feedback-helper {
  margin-top: 8px;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--text-mute, #888);
  text-align: right;
  min-height: 1.2em;
}
.feedback-helper.is-blocked {
  color: #9a5b00;
}
.feedback-helper.is-ready {
  color: #2f6b2f;
}

/* W0-2: message character counter + soft warn near the 8000 cap */
.feedback-charcount {
  margin-top: 4px;
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--text-mute, #888);
  text-align: right;
  min-height: 1em;
}
.feedback-charcount.is-near-limit {
  color: #9a5b00;
  font-weight: 600;
}

/* ── Status Messages ────────────────────────────────────── */
.feedback-status {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}
.feedback-status-ok  { background: rgba(34,139,34,0.1); color: #228B22; }
.feedback-status-err { background: rgba(204,0,0,0.1);   color: #CC0000; }

/* ── Inline AI Thumbs ───────────────────────────────────── */
.feedback-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 0;
}
.feedback-thumb {
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.1s;
  user-select: none;
}
.feedback-thumb:hover {
  background: rgba(204,0,0,0.1);
}
.feedback-inline-input {
  border: 1px solid var(--border-light, #ddd);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.82rem;
  width: 180px;
  font-family: inherit;
}
.feedback-inline-send {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid #CC0000;
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: #fff;
  cursor: pointer;
}
.feedback-inline-thanks,
.feedback-inline-err {
  font-size: 0.82rem;
  color: var(--text-mute, #888);
  font-style: italic;
}

/* ── Data Quality Flag ──────────────────────────────────── */
.feedback-flag {
  cursor: pointer;
  font-size: 0.8rem;
  display: none;
  margin-left: 4px;
  vertical-align: middle;
}
/* Show on parent hover */
*:hover > .feedback-flag,
.feedback-flag:focus {
  display: inline;
}
.feedback-flag-sent {
  display: inline;
  opacity: 0.6;
  cursor: default;
  color: #228B22;
}

/* ═══════════════════════════════════════════════════════════
   Admin Feedback Inbox
   ═══════════════════════════════════════════════════════════ */

.feedback-admin {
  max-width: 1100px;
  margin: 0 auto;
}

/* Stats Banner */
.feedback-admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.feedback-stat-card {
  background: var(--bg-secondary, #fff);
  border: 1px solid var(--border-light, #e8e4dd);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.feedback-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #CC0000;
  font-family: var(--font-serif, 'ABC Arizona Flare', 'Playfair Display', serif);
}
.feedback-stat-label {
  font-size: 0.78rem;
  color: var(--text-mute, #888);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Filters */
.feedback-admin-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.feedback-filter-select {
  padding: 6px 12px;
  border: 1px solid var(--border-light, #ddd);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--bg-secondary, #fff);
  font-family: inherit;
}

/* Table */
.feedback-admin-table-wrap {
  overflow-x: auto;
}
.feedback-admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.feedback-admin-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border-light, #e8e4dd);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-mute, #888);
}
.feedback-admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light, #f0ebe4);
  vertical-align: top;
}
.feedback-admin-row:hover {
  background: rgba(204,0,0,0.03);
}
.feedback-msg-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ── Admin screenshot (PR3) ────────────────────────────── */
.feedback-has-shot {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.95rem;
  vertical-align: middle;
  opacity: 0.9;
}
.feedback-shot-details {
  margin: 10px 0 14px;
}
.feedback-shot-details > summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-strong, #222);
  user-select: none;
}
.feedback-shot-detail-wrap {
  margin-top: 10px;
}
.feedback-shot-full {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border-light, #e8e4dd);
  background: #f5f1ea;
  cursor: zoom-in;
}
.feedback-shot-purged {
  font-size: 0.85rem;
  color: var(--text-mute, #888);
  font-style: italic;
  padding: 8px 0;
}
.feedback-shot-purged[hidden] { display: none !important; }


/* Status badges */
.feedback-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.feedback-status-new         { background: #FFF3CD; color: #856404; }
.feedback-status-reviewed    { background: #D1ECF1; color: #0C5460; }
.feedback-status-planned     { background: #D4EDDA; color: #155724; }
.feedback-status-implemented { background: #D1E7DD; color: #0F5132; }
.feedback-status-dismissed   { background: #F2F2F2; color: #666;    }

/* Detail Panel */
.feedback-detail-panel {
  margin-top: 16px;
}
.feedback-detail-card {
  background: var(--bg-secondary, #fff);
  border: 1px solid var(--border-light, #e8e4dd);
  border-radius: 10px;
  overflow: hidden;
}
.feedback-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light, #e8e4dd);
}
.feedback-detail-header h4 { margin: 0; }
.feedback-detail-close { /* reuses .feedback-modal-close */ }

.feedback-detail-body {
  padding: 16px;
}
.feedback-detail-body p {
  margin: 4px 0;
  font-size: 0.88rem;
}
.feedback-detail-msg {
  background: var(--bg-primary, #FAF8F5);
  padding: 10px 12px;
  border-radius: 6px;
  margin: 6px 0 12px;
  font-size: 0.88rem;
  white-space: pre-wrap;
}
.feedback-context-pre {
  background: var(--bg-primary, #FAF8F5);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.feedback-detail-admin {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light, #e8e4dd);
}
.feedback-detail-admin label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-mute, #888);
}
.feedback-detail-admin .feedback-textarea {
  min-height: 40px;
}
.feedback-detail-save {
  margin-top: 8px;
}
.feedback-detail-saved {
  font-size: 0.82rem;
  color: #228B22;
  margin-left: 8px;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 700px) {
  .feedback-admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .feedback-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .feedback-modal {
    width: 100vw;
    max-width: 100vw;
    max-height: min(92dvh, 92vh);
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .feedback-modal-body {
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .feedback-shot-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .feedback-shot-attach-btn,
  .feedback-shot-upload-link.is-primary-action {
    width: 100%;
    text-align: center;
    min-height: 44px;
  }
  .feedback-shot-preview {
    flex-direction: column;
  }
  .feedback-shot-thumb {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 180px;
  }
  .feedback-shot-remove-btn,
  .feedback-shot-upload-link {
    min-height: 44px;
    padding: 8px 0;
  }
  .feedback-actions .feedback-submit-btn {
    width: 100%;
    min-height: 44px;
  }
  .feedback-fab {
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));  /* same row as mobile agent FAB */
    /* BONUS fix: position relative to the agent FAB's ACTUAL mobile position.
       Agent FAB (97-mobile-optimize.css, <=880px) is 48px wide at
       right: max(16px, env(safe-area-inset-right)). Stacking the feedback FAB
       to its left = agent-right-base(16) + agent-width(48) + gap(20) = 84px,
       PLUS the same safe-area inset the agent FAB is shifted by, so the two
       never collide on notched iPhones. (Old `76px` assumed a tighter gap and
       didn't track the agent FAB's own inset shift, causing overlap.) */
    right: calc(84px + env(safe-area-inset-right, 0px));
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }
}

/* ── Page-level Module Feedback Strip ─────────────────────────
   "Was this useful?" strip injected into modules that lack a dedicated
   AI-response surface. Subtle, right-aligned, sits below the page content.
   Reuses .feedback-inline / .feedback-thumb for the thumbs themselves. */
.feedback-module-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 18px 0 4px;
  padding: 6px 2px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}
.feedback-module-strip:hover {
  opacity: 1;
}
.feedback-module-strip .feedback-inline {
  margin-top: 0;
  padding: 0;
}
.feedback-module-strip-label {
  font-size: 0.8rem;
  color: var(--text-mute, #888);
  font-style: italic;
}

/* ── Implemented-feedback sticky toast (loop-closer, 2026-07-15) ──
   Clone of the PWA update toast pattern (25-plan.css) — sticky, dismissed
   only by the "Got it" button (no auto-dismiss). Gold/positive accent
   distinguishes it from the red update toast. z-index 9998 sits just below
   #pwa-update-bar (9999); when both are visible, JS adds .stack-above-pwa
   to lift this one clear of it. */
.feedback-notify-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  z-index: 9998;
  max-width: calc(100vw - 32px);
  background: linear-gradient(135deg, #8a6a1c, var(--heritage-gold, #D4A843));
  color: var(--warm-white, #fffdf7);
  border: 1px solid #8a6a1c;
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(138, 106, 28, 0.32);
  padding: 12px 14px;
  opacity: 0;
  transition: opacity 220ms ease, transform 260ms cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}

.feedback-notify-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Lift above the PWA update toast when both are on screen. */
.feedback-notify-toast.stack-above-pwa {
  bottom: 104px;
}

.feedback-notify-toast-body {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feedback-notify-toast-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.feedback-notify-toast-text {
  display: flex;
  flex-direction: column;
  font-size: 0.88rem;
  line-height: 1.25;
  min-width: 0;
}

.feedback-notify-toast-text strong { font-size: 0.95rem; font-weight: 700; }

.feedback-notify-toast-text span { opacity: 0.9; }

.feedback-notify-more {
  font-weight: 600;
  font-size: 0.8rem;
  opacity: 0.85;
  white-space: nowrap;
}

.feedback-notify-toast-btn {
  background: var(--warm-white, #fffdf7);
  color: #7a5c14;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 36px;
  flex-shrink: 0;
}

.feedback-notify-toast-btn:hover { background: var(--eggshell-bright, #f7f3e8); }

.feedback-notify-toast-btn:disabled { opacity: 0.7; cursor: wait; }

/* Mobile: clear the feedback FAB row (FAB sits at bottom ~18px, 42px tall
   at ≤880px — see .feedback-fab override above) so the toast never covers it. */
@media (max-width: 880px) {
  .feedback-notify-toast {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
  .feedback-notify-toast.stack-above-pwa {
    bottom: calc(156px + env(safe-area-inset-bottom, 0px));
  }
}

/* iOS PWA: lift above the home indicator (mirrors the PWA toast safe-area
   block in 25-plan.css). Mobile breakpoint above already includes the inset. */
@supports (padding: env(safe-area-inset-bottom)) {
  .feedback-notify-toast {
    bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  }
  @media (max-width: 880px) {
    .feedback-notify-toast {
      bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    }
  }
}

/* ─────────────────────────────────────────────────────────────
   Feedback Hub (Slice B, 2026-07-23) — unified #/feedback surface.
   Reuses tokens; light rules only (tabs, cards, backlog table, detail).
   ───────────────────────────────────────────────────────────── */
.fbhub { margin-top: 8px; }
.fbhub-tabbar {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border, #e6e0d8);
  margin-bottom: 18px; flex-wrap: wrap;
}
.fbhub-tab {
  appearance: none; background: none; border: none; cursor: pointer;
  padding: 10px 16px; font: inherit; font-weight: 600;
  color: var(--text-mute, #7a726a); border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
}
.fbhub-tab:hover { color: var(--text, #2a2622); background: rgba(0,0,0,.03); }
.fbhub-tab[aria-selected="true"] {
  color: var(--heritage-red, #CC0000); border-bottom-color: var(--heritage-red, #CC0000);
}
.fbhub-list { display: flex; flex-direction: column; gap: 10px; }
.fbhub-card {
  border: 1px solid var(--border, #e6e0d8); border-radius: 10px;
  padding: 12px 14px; background: var(--card-bg, #fff);
}
.fbhub-card-shipped { border-left: 3px solid #1A7A3E; }
/* Reply email (2026-11-06): the card an "Open in AIOP" link points at (#/feedback?tab=my&item=<id>). */
.fbhub-card.is-linked { outline: 2px solid var(--heritage-red, #CC0000); outline-offset: 2px; }
.fbhub-linked-note { margin: 0 0 8px; font-size: 13px; }
.fbhub-card-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.fbhub-card-mod { font-size: .82em; color: var(--text-mute, #7a726a); font-weight: 600; }
.fbhub-card-date { font-size: .8em; margin-left: auto; }
.fbhub-card-msg { font-size: .92em; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.fbhub-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.fbhub-select, .fbhub-textarea {
  font: inherit; padding: 7px 10px; border: 1px solid var(--border, #e6e0d8);
  border-radius: 8px; background: var(--card-bg, #fff); color: var(--text, #2a2622);
}
.fbhub-textarea { width: 100%; resize: vertical; }
.fbhub-table-wrap { overflow-x: auto; }
.fbhub-table { width: 100%; border-collapse: collapse; font-size: .9em; }
.fbhub-table th, .fbhub-table td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border, #efe9e2);
  vertical-align: top;
}
.fbhub-table th { font-weight: 600; color: var(--text-mute, #7a726a); white-space: nowrap; }
.fbhub-msg-cell { max-width: 380px; }
/* Reply-to column (2026-07-30, audit fix M2). The Hub backlog gained a 9th
   column of email addresses; without a width bound a long address
   (firstname.lastname@subsidiary.lkk.com) stretches the table and squeezes
   .fbhub-msg-cell above. Ellipsis keeps the row height stable, and title=
   is not needed because the full address is the link text on hover/detail. */
.fbhub-email-cell { max-width: 200px; }
.fbhub-email {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  /* --heritage-red is the real token (00-reset.css:82); --brand-red does not
     exist in this codebase and would have silently fallen back to the literal. */
  color: var(--heritage-red, #CC0000);
  text-decoration: none;
}
.fbhub-email:hover { text-decoration: underline; }
.fbhub-detail { margin-top: 16px; }
.fbhub-detail-card {
  border: 1px solid var(--border, #e6e0d8); border-radius: 12px;
  background: var(--card-bg, #fff); padding: 4px 4px 14px;
}
.fbhub-detail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border, #efe9e2);
}
.fbhub-detail-head h4 { margin: 0; font-size: 1.02em; }
.fbhub-detail-close {
  appearance: none; background: none; border: none; cursor: pointer;
  font-size: 1.5em; line-height: 1; color: var(--text-mute, #7a726a);
}
.fbhub-detail-body { padding: 12px 14px; }
.fbhub-detail-body p { margin: 4px 0; font-size: .92em; }
.fbhub-detail-msg {
  margin: 8px 0; padding: 10px 12px; border-radius: 8px;
  background: rgba(0,0,0,.03); white-space: pre-wrap; word-break: break-word;
}
.fbhub-pre {
  margin: 6px 0 0; padding: 10px 12px; border-radius: 8px;
  background: #1e1b18; color: #e8e2da; font-size: .78em; overflow-x: auto;
  white-space: pre-wrap; word-break: break-word;
}
.fbhub-detail-admin { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.fbhub-detail-admin label { font-size: .82em; font-weight: 600; color: var(--text-mute, #7a726a); }

/* ════════════════════════════════════════════════════════════════════════
   Velocity + Impact (P0, 2026-07-30) — C1 strip, C2 card, C4 ack, C5 meta.

   Appended to the EXISTING feedback stylesheet on purpose (FE-CONTRACT §10):
   no new stylesheet, no inline styles (CSP). All colour comes from the LKK
   custom properties in 00-reset.css — no hardcoded brand hex.

   Contrast note (§9): Heritage Red is used for the ONE primary numeral only,
   which renders at 1.6rem / 700 — comfortably past the 4.5:1 threshold on the
   warm surface. Every other numeral is ink/graphite. Labels and subtitles use
   --ink-mute (5.0:1 on warm-white per the token's own annotation), never a
   lighter faint tone.
   ════════════════════════════════════════════════════════════════════════ */

/* ── C1: velocity strip ─────────────────────────────────────────────── */
.fb-velocity-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 18px;
  margin: 0 0 14px;
  padding: 12px 2px;
  /* Hairline top + bottom, no card shadow (FE-CONTRACT §2). */
  border-top: 1px solid var(--rule, #E5D9C4);
  border-bottom: 1px solid var(--rule, #E5D9C4);
}

/* Fewer cells must not stretch across the full 4-column grid. */
.fb-velocity-strip.is-median-only { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fb-velocity-strip.is-count-only  { grid-template-columns: minmax(0, 1fr); }

/* Loading / empty / error variants are plain blocks, not grids — the atom
   inside owns its own layout. */
.fb-velocity-strip.is-loading,
.fb-velocity-strip.is-empty,
.fb-velocity-strip.is-error {
  display: block;
  border: 0;
  padding: 0;
}

.fb-velocity-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fb-velocity-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute, #6B6560);
}

.fb-velocity-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink-strong, #1A1410);
  overflow-wrap: anywhere;
}

/* Primary number only — the single Heritage Red accent on the strip. */
.fb-velocity-cell.is-primary .fb-velocity-value { color: var(--heritage-red, #CC0000); }

/* count_only renders a sentence, not a metric: dial the numeral weight back so
   "3 improvements shipped" doesn't read as a giant headline. */
.fb-velocity-strip.is-count-only .fb-velocity-value {
  font-size: 1.05rem;
  font-weight: 600;
}

.fb-velocity-sub {
  font-size: 0.72rem;
  color: var(--ink-mute, #6B6560);
}

/* Mobile: 4 cells → 2×2 (FE-CONTRACT §10). */
@media (max-width: 640px) {
  .fb-velocity-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
  .fb-velocity-strip.is-count-only { grid-template-columns: minmax(0, 1fr); }
  .fb-velocity-value { font-size: 1.35rem; }
}

/* ── C2: Impact card ───────────────────────────────────────────────── */
.fb-impact-card {
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 10px;
  background: var(--warm-white, #FFFDF8);
}

/* The empty state supplies its own padding/centering via the ui-empty atom. */
.fb-impact-card.is-empty { padding: 0; border: 0; background: none; }

.fb-impact-title {
  margin: 0 0 2px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute, #6B6560);
}

.fb-impact-value {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.fb-impact-number {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.05;
  color: var(--heritage-red, #CC0000);
}

.fb-impact-unit {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute, #6B6560);
}

.fb-impact-summary {
  margin: 4px 0 0;
  font-size: 0.86rem;
  color: var(--ink-soft, #4A4038);
}

.fb-impact-cta {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--heritage-red, #CC0000);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.fb-impact-cta:hover { color: var(--heritage-red-dark, #8B0000); }

@media (max-width: 640px) {
  .fb-impact-number { font-size: 1.6rem; }
}

/* ── C4: submit acknowledgement line ──────────────────────────────── */
/* A child of .feedback-status (one live region, §9), so it inherits the
   success colour and simply becomes its own line. */
.feedback-impact-ack {
  display: block;
  margin-top: 3px;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.95;
}

/* Fade only. No scale, no bounce, no confetti (FE-CONTRACT rule 3). The class
   is applied by JS only when motionAllowed(), and the media query is a second,
   independent guard for users who toggle the OS setting mid-session. */
.feedback-impact-ack.is-fading-in {
  animation: fb-impact-fade-in 200ms ease-out both;
}
@keyframes fb-impact-fade-in {
  from { opacity: 0; }
  to   { opacity: 0.95; }
}
@media (prefers-reduced-motion: reduce) {
  .feedback-impact-ack.is-fading-in { animation: none; }
}

/* ── C5: toast meta line ──────────────────────────────────────────── */
/* Scoped inside the existing toast text column so it picks up the toast's own
   colour/opacity rules rather than introducing a competing palette. */
.feedback-notify-toast-text .feedback-notify-meta {
  margin-top: 2px;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Issue Continuity (2026-07-31, M15) — suggestion strip, chain, reopen, reply
   ─────────────────────────────────────────────────────────────────────────
   THE MISS PATH IS THE CONTRACT. `.feedback-suggest-strip` carries the `hidden`
   attribute until JS fills it, and there is deliberately NO rule here that
   gives the empty host any height, margin, border or padding — so with the flag
   off, the endpoint empty, slow or erroring, the FAB modal renders with ZERO
   pixel difference from before this feature existed. Do not add a min-height,
   a skeleton, or a "checking…" state to the host.

   Every selector below is NEW (`feedback-suggest-*`, `fbhub-reply*`,
   `fbhub-chain*`, `fbhub-reopen*`, `fbhub-unlink-btn`, `fbhub-filter-check`) —
   no existing rule is modified, so nothing on any other feedback surface can
   shift. Colours reuse existing vars with literal fallbacks, same as the C4/C5
   blocks above; no new design token is introduced.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── FAB suggestion strip (M9) ─────────────────────────────────────────── */
.feedback-suggest-strip[hidden] { display: none; }

.feedback-suggest-strip {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle, #e4e0d8);
  border-left: 3px solid var(--heritage-red, #CC0000);
  border-radius: 6px;
  background: var(--surface-raised, #faf8f4);
}

.feedback-suggest-title {
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.feedback-suggest-item + .feedback-suggest-item {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle, #e4e0d8);
}

/* One line, clamped. The user wrote this text; the strip is a reminder, not a
   reader. Two lines max for the whole item keeps mobile from growing the modal. */
.feedback-suggest-msg {
  font-size: 0.8rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-suggest-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.feedback-suggest-meta {
  font-size: 0.72rem;
  opacity: 0.7;
}

.feedback-suggest-again,
.feedback-suggest-dismiss {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border-subtle, #d8d3c9);
  background: var(--surface, #fff);
}

.feedback-suggest-again { border-color: var(--heritage-red, #CC0000); }
.feedback-suggest-again[disabled] { cursor: default; opacity: 0.55; }

/* "No — new issue" is visually QUIETER than the reopen action but never hidden
   and never smaller than a tap target: it is the one-tap default escape (R1). */
.feedback-suggest-dismiss {
  margin-top: 8px;
  min-height: 28px;
  opacity: 0.85;
}

.feedback-suggest-strip.is-reopening {
  border-left-color: var(--accent-gold, #D4A843);
}

@media (max-width: 640px) {
  .feedback-suggest-strip { padding: 8px 10px; }
  .feedback-suggest-msg { white-space: normal; }
}

/* ── "Response from the team" (M10) ────────────────────────────────────── */
/* Rendered ONLY when public_reply exists. No empty state, no placeholder, and
   deliberately no "awaiting reply" styling anywhere (R4): an item with no reply
   must look exactly as it does today. */
.fbhub-reply {
  margin-top: 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent-gold, #D4A843);
  border-radius: 0 4px 4px 0;
  background: var(--surface-raised, #faf8f4);
}

.fbhub-reply-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 3px;
}

.fbhub-reply-body {
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.fbhub-reply-hint {
  font-size: 0.72rem;
  opacity: 0.7;
  margin: 2px 0 4px;
}

.fbhub-reply-tools {
  display: flex;
  gap: 8px;
  margin: 4px 0 8px;
}

/* ── Reopen badge + Hub reopen form (M10/M11) ──────────────────────────── */
/* 'important' tone, never an error/danger tone: a re-report is high-value
   signal, not something to scold a user or the team with (R3). */
.fbhub-reopen-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--accent-gold-soft, #f6ecd2);
  color: var(--text-strong, #2b2b2b);
}

.fbhub-reopen-host { margin-top: 8px; }

.fbhub-reopen-btn {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  min-height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle, #d8d3c9);
  background: var(--surface, #fff);
}

.fbhub-reopen-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.fbhub-reopen-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.fbhub-reopen-status {
  font-size: 0.75rem;
  margin-top: 4px;
  opacity: 0.85;
}

.fbhub-unlink-btn { margin-left: auto; }

.fbhub-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  white-space: nowrap;
}

/* ── Chain block (M11) ─────────────────────────────────────────────────── */
/* The artifact that replaces the manual post-mortem: #71 → #93 → #125 → #144
   in one glance, with status and date per node. */
.fbhub-detail-chain:empty { display: none; }

.fbhub-chain {
  margin: 10px 0;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle, #e4e0d8);
  border-radius: 6px;
  background: var(--surface-raised, #faf8f4);
}

.fbhub-chain-title {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.fbhub-chain-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fbhub-chain-node {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
  font-size: 0.8rem;
  border-top: 1px solid var(--border-subtle, #ece8e0);
}

.fbhub-chain-node:first-child { border-top: 0; }

.fbhub-chain-node.is-current {
  font-weight: 600;
  background: var(--accent-gold-soft, #f6ecd2);
  border-radius: 4px;
  padding-left: 6px;
  padding-right: 6px;
}

.fbhub-chain-id {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.fbhub-chain-msg {
  flex: 1 1 200px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
}

/* Cross-user privacy line: a COUNT only, never content (X14). */
.fbhub-chain-others {
  margin-top: 6px;
  font-size: 0.75rem;
  opacity: 0.7;
}

@media (max-width: 640px) {
  .fbhub-chain-msg { white-space: normal; }
  .fbhub-chain-node { align-items: flex-start; }
}

/* ── Toast reply preview (M13) ─────────────────────────────────────────── */
/* Scoped inside the existing toast text column, same as the C5 meta line, so it
   inherits the toast palette instead of introducing a competing one. */
.feedback-notify-toast-text .feedback-notify-reply,
.feedback-notify-reply {
  margin-top: 3px;
  font-size: 0.78rem;
  line-height: 1.4;
  opacity: 0.9;
}

/* ════════════════════════════════════════════════════════════════════════
   Feedback Hub — UX layout polish (2026-08-01)

   Three problems, one block:
     1. Detail lived BELOW a 50-row table. Opening #147 meant scrolling past
        every other row to read it. → master–detail split (sticky rail ≥900px,
        full-screen sheet <900px).
     2. Ticket numbers were invisible outside the detail <h4>. Ops quote them
        daily. → .fbhub-id badge in the backlog's first column, on My cards,
        on Shipped cards, and as the detail's primary heading element.
     3. An 8-column table on a 375px phone was a horizontal-scroll maze.
        → the same <table> markup re-flows into cards via data-label, so there
        is exactly ONE row template to keep correct.

   All colour comes from existing custom properties (00-reset.css). No new
   tokens, no hardcoded brand hex, no new dependencies.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Ticket number badge ─────────────────────────────────────────────────
   Visual language borrowed from .fbhub-chain-id (tabular-nums + 700) so a
   ticket number reads identically wherever it appears in the hub. */
.fbhub-id {
  display: inline-flex;
  align-items: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--heritage-red, #CC0000);
  background: rgba(204, 0, 0, 0.07);
  border: 1px solid rgba(204, 0, 0, 0.16);
}
.fbhub-id-sm { font-size: 0.76rem; padding: 1px 5px; }
.fbhub-id-md { font-size: 0.85rem; }
.fbhub-id-lg {
  font-size: 1.25rem;
  padding: 3px 10px;
}
.fbhub-id.is-copyable { cursor: pointer; }
.fbhub-id.is-copyable:hover {
  background: rgba(204, 0, 0, 0.13);
  border-color: rgba(204, 0, 0, 0.3);
}
.fbhub-id.is-copyable:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: 2px;
}
/* Copy confirmation: a colour flip, not a layout shift — the badge sits inside
   a table cell and must not resize the column when tapped. */
.fbhub-id.is-copied {
  background: rgba(26, 122, 62, 0.14);
  border-color: rgba(26, 122, 62, 0.35);
  color: #1A7A3E;
}

/* ── Master–detail split ─────────────────────────────────────────────────
   Single-column by default (mobile-first); the rail only exists at ≥900px. */
.fbhub-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.fbhub-split-list { min-width: 0; }   /* lets the table shrink instead of overflowing the grid */

@media (min-width: 900px) {
  .fbhub-split.is-detail-open {
    /* minmax(0,…) on BOTH tracks: without the 0 minimum, the table's intrinsic
       width wins and pushes the rail off-screen — the exact bug this is fixing. */
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  }
  .fbhub-split-detail {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;   /* rail scroll never chains to the page */
  }
}

/* ── Mobile: detail as a full-screen sheet ───────────────────────────────
   Fixed overlay so the operator NEVER scrolls the list to reach the detail. */
@media (max-width: 899.98px) {
  .fbhub-split-detail:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 1200;               /* above the shell, below the attachment lightbox */
    background: var(--bg, #faf7f2);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    /* AUDIT-FIX F4: opacity-only fade. The motion contract enforced by
       tests/feedback-velocity-impact-fe.test.js ("rule 3 - no casino motion")
       scans this stylesheet from the "Velocity + Impact (P0" marker to EOF, so
       every rule appended after it - including this block - is bound by the
       fade-only guarantee. A translateY slide-up violated it, and a SECOND
       @keyframes block violated the "exactly one keyframe set" assertion too.
       Reusing the existing fb-impact-fade-in keeps one fade definition for the
       whole stylesheet. 150ms stays inside the <=200ms budget.

       `opacity: 1` is declared explicitly because fb-impact-fade-in ends at
       0.95 (correct for the translucent ack toast it was written for). Without
       this, the sheet would settle at 95% and the backlog list would ghost
       through a surface that must be fully opaque. The animation does not set
       a fill-mode, so the declared value is what persists after it ends. */
    opacity: 1;
    animation: fb-impact-fade-in 150ms ease-out;
  }
  .fbhub-split-detail:not([hidden]) .fbhub-detail { margin-top: 0; }
  .fbhub-split-detail:not([hidden]) .fbhub-detail-card {
    border: 0;
    border-radius: 0;
    min-height: 100%;
    padding-top: 0;
  }
  /* Square off the sticky header to match the square sheet, and clear the
     notch/status bar so the close button is never under system chrome. */
  .fbhub-split-detail:not([hidden]) .fbhub-detail-head {
    top: 0;
    border-radius: 0;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .fbhub-split-detail:not([hidden]) { animation: none; }
}

/* Body scroll lock while the sheet is open. Only ever applied under the sheet
   breakpoint (the class is set by JS, but the rule itself is media-scoped so a
   desktop resize with a stale class can never freeze the page). */
@media (max-width: 899.98px) {
  body.fbhub-sheet-open { overflow: hidden; }
}

/* ── Selected row ────────────────────────────────────────────────────────
   Tells the operator which row the rail is showing. */
.fbhub-row.is-selected > td {
  background: rgba(204, 0, 0, 0.05);
}
.fbhub-row.is-selected > td:first-child {
  box-shadow: inset 3px 0 0 0 var(--heritage-red, #CC0000);
}

/* ── Detail panel chrome ─────────────────────────────────────────────────
   Sticky header keeps #id + close reachable on long reports. */
.fbhub-detail-head {
  position: sticky;
  /* -4px, not 0: .fbhub-detail-card has `padding: 4px 4px 14px`, so a top:0
     sticky header would leave a 4px window of card background above it and let
     body text scroll through the gap. Pulling up by the padding closes it. */
  top: -4px;
  z-index: 2;
  background: var(--card-bg, #fff);
  border-radius: 12px 12px 0 0;
  gap: 10px;
  flex-wrap: wrap;
}
.fbhub-detail-head h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  /* The <h4> is now a CONTAINER for the id badge + label, each of which sets its
     own size. Neutralising the inherited 1.02em stops it from scaling the
     .fbhub-id-lg badge to something other than the 1.25rem it declares. */
  font-size: 1rem;
}
.fbhub-detail-head h4:focus { outline: none; }
.fbhub-detail-head h4:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: 3px;
  border-radius: 4px;
}
/* The NUMBER is the headline; the word "Feedback" is supporting text. */
.fbhub-detail-title-text {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-mute, #7a726a);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fbhub-detail-head-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.fbhub-detail-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
/* ≥44px touch target (WCAG 2.5.5) — was a bare 1.5em glyph. */
.fbhub-detail-close {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.fbhub-detail-close:hover { background: rgba(0, 0, 0, 0.05); }
.fbhub-detail-close:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: 2px;
}
/* .fbhub-unlink-btn used margin-left:auto to push itself right; it now lives in
   a flex action group, so that push would fight the group. */
.fbhub-detail-head .fbhub-unlink-btn { margin-left: 0; }

/* ── Backlog table: id column + density ──────────────────────────────────── */
.fbhub-th-id, .fbhub-id-cell { width: 1%; white-space: nowrap; }
.fbhub-act-cell { width: 1%; white-space: nowrap; text-align: right; }

/* In the narrow rail-open state the table has less room, so secondary columns
   go first — the operator keeps ID, user, type, message, status, and View. */
@media (min-width: 900px) and (max-width: 1400px) {
  .fbhub-split.is-detail-open .fbhub-col-email,
  .fbhub-split.is-detail-open .fbhub-col-module { display: none; }
  .fbhub-split.is-detail-open .fbhub-msg-cell { max-width: 220px; }
}

/* ── Responsive: table → cards ───────────────────────────────────────────
   Under 880px the 8-column table becomes one card per row. The SAME markup is
   reused; data-label (set in JS) supplies the field name via ::before, so there
   is no second row template that could drift out of sync. */
@media (max-width: 880px) {
  .fbhub-table-wrap { overflow-x: visible; }
  .fbhub-table, .fbhub-table tbody, .fbhub-table tr, .fbhub-table td { display: block; width: auto; }
  .fbhub-table thead { display: none; }   /* labels move into each cell */

  .fbhub-table tr.fbhub-row {
    position: relative;
    border: 1px solid var(--border, #e6e0d8);
    border-radius: 10px;
    background: var(--card-bg, #fff);
    padding: 40px 12px 12px;     /* top room for the floating id + View */
    margin-bottom: 10px;
  }
  .fbhub-table td {
    border-bottom: 0;
    padding: 3px 0;
    display: flex;
    gap: 8px;
    align-items: baseline;
    font-size: 0.9rem;
  }
  .fbhub-table td::before {
    content: attr(data-label);
    flex: 0 0 84px;
    font-weight: 600;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-mute, #7a726a);
  }
  /* ID and the View button pin to the card's top edge: the number is the first
     thing read, the action the first thing tapped. */
  .fbhub-table td.fbhub-id-cell,
  .fbhub-table td.fbhub-act-cell {
    position: absolute;
    top: 8px;
    padding: 0;
  }
  .fbhub-table td.fbhub-id-cell { left: 12px; }
  .fbhub-table td.fbhub-act-cell { right: 12px; }
  .fbhub-table td.fbhub-id-cell::before,
  .fbhub-table td.fbhub-act-cell::before { content: none; }
  .fbhub-msg-cell, .fbhub-email-cell { max-width: none; }
  .fbhub-msg-cell { flex-direction: column; gap: 2px; }
  .fbhub-email { max-width: 100%; }

  /* Selected-row treatment must follow the card shape, not the table shape. */
  .fbhub-row.is-selected > td { background: transparent; }
  .fbhub-row.is-selected > td:first-child { box-shadow: none; }
  .fbhub-table tr.fbhub-row.is-selected {
    border-color: var(--heritage-red, #CC0000);
    box-shadow: 0 0 0 1px rgba(204, 0, 0, 0.25);
  }

  /* ≥44px touch targets for the primary actions. */
  .fbhub-view, .fbhub-table .btn-sm {
    min-height: 44px;
    padding-inline: 14px;
  }
  .fbhub-filters .fbhub-select,
  .fbhub-filters .btn { min-height: 44px; }
}

/* Small phones: labels stack above values so a long module id or email never
   forces horizontal overflow. */
@media (max-width: 480px) {
  .fbhub-table td { flex-direction: column; gap: 1px; }
  .fbhub-table td::before { flex-basis: auto; }
  .fbhub-detail-body { padding: 12px 12px 20px; }
  .fbhub-id-lg { font-size: 1.12rem; }
}

/* Guard: nothing in the hub may cause a horizontal page scroll. */
.fbhub, .fbhub-panel, .fbhub-split { max-width: 100%; min-width: 0; }
.fbhub-pre { max-width: 100%; }

/* ═══════════════════════════════════════════════════════════
   Backlog BOARD (2026-10-20, DESIGN.md §5). Only rendered when the server
   flag FEEDBACK_BOARD_ENABLED is on. Lanes by next step; one card per item;
   cause box with Confirmed / Likely / Guess labels and citation chips.
   Polish (2026-10-20 PM): one primary action + one ⋯ menu per card at every
   width; evidence folded behind one disclosure; toolbar = search + View menu
   + non-empty lane chips. Phones (≤600px): every control ≥44px tall, menus
   open in-flow full width, lane chips scroll sideways. Lanes flow through
   up to 3 newspaper columns (no row gaps). Verified with no page
   or card overflow at 360/390/430/768/1024/1280/1440/1920.
   ═══════════════════════════════════════════════════════════ */
/* --card-bg is not defined app-wide (other hub rules fall back to #fff), so
   the board defines it once: opaque cards, inputs and — critically — ⋯ menus. */
.fbb { min-width: 0; max-width: 100%; --card-bg: var(--warm-white, #FFFDF8); }
[data-theme="dark"] .fbb { --card-bg: var(--surface, #1E2130); }
.fbb-top { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; min-width: 0; }
.fbb-tools { display: flex; gap: 8px; align-items: center; min-width: 0; }
.fbb-search {
  flex: 1 1 auto; min-width: 0; max-width: 520px; height: 36px; box-sizing: border-box; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-bg); color: var(--text); font: inherit; font-size: 0.88rem;
}
.fbb-search:focus-visible { outline: 2px solid var(--heritage-red); outline-offset: 1px; }
.fbb-viewwrap { position: relative; margin-left: auto; flex: 0 0 auto; }
.fbb .fbb-view-btn { white-space: nowrap; position: relative; }
.fbb-view-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--heritage-red); margin-left: 6px; vertical-align: middle; }
.fbb-view-dot[hidden] { display: none; }
.fbb-stripwrap { min-width: 0; max-width: 100%; }
.fbb-strip { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.fbb-strip-chip {
  border: 1px solid var(--border-light); background: var(--card-bg); color: var(--text);
  border-radius: 999px; padding: 4px 12px; min-height: 30px; font-size: 0.82rem; cursor: pointer; white-space: nowrap;
}
.fbb-strip-chip b { margin-left: 4px; color: var(--heritage-red); }
.fbb-strip-chip.is-active { border-color: var(--heritage-red); box-shadow: inset 0 0 0 1px var(--heritage-red); }
.fbb-budget { font-size: 0.78rem; color: var(--text-mute); }
.fbb-budget.is-paused { color: var(--heritage-red); }

/* ⋯ menus (card actions + toolbar View). Popover on tablet/desktop, anchored
   to the trigger's right edge so it never leaves the card or the viewport. */
.fbb-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 40;
  width: max-content; min-width: 200px; max-width: min(300px, calc(100vw - 24px));
  display: flex; flex-direction: column; padding: 6px; gap: 2px;
  background: var(--card-bg); border: 1px solid var(--border-light); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.fbb-menu[hidden] { display: none; }
.fbb-menu.is-up { top: auto; bottom: calc(100% + 4px); }
/* Open card menu: fixed, placed by JS from the trigger's rect (never
   fragmented by the lane columns; flips up / clamps to the viewport). */
.fbb-menu.is-fixed { position: fixed; right: auto; bottom: auto; z-index: 1100; overflow-y: auto; overscroll-behavior: contain; }
.fbb .fbb-menu-item {
  display: block; width: 100%; text-align: left; min-height: 36px; padding: 8px 12px; margin: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 0.88rem; cursor: pointer;
  white-space: normal; overflow-wrap: anywhere;
}
.fbb .fbb-menu-item:hover, .fbb .fbb-menu-item:focus-visible { background: var(--bg-secondary); }
.fbb .fbb-menu-item.fbb-menu-sep { border-top: 1px solid var(--border-light); border-radius: 0 0 6px 6px; margin-top: 4px; padding-top: 10px; }
.fbb-view-menu { gap: 6px; padding: 10px; width: 300px; }
.fbb-view-menu .fbhub-select { width: 100%; min-width: 0; }
.fbb-legend { font-size: 0.76rem; color: var(--text-mute); border-top: 1px solid var(--border-light); padding-top: 8px; margin-top: 2px; }
.fbb-legend p { margin: 4px 0 0; line-height: 1.5; }
.fbb-legend-title { font-weight: 600; color: var(--text); font-size: 0.78rem; }

.fbb-lane { margin: 0 0 18px; min-width: 0; }
.fbb-lane-title { font-size: 0.86rem; letter-spacing: 0.04em; text-transform: uppercase; margin: 0; color: var(--ink-strong); }
.fbb-count { display: inline-block; min-width: 1.6em; text-align: center; border-radius: 999px; background: var(--ink-strong); color: #fff; font-size: 0.72rem; padding: 0 6px; margin-left: 4px; }
.fbb-lane-hint { font-size: 0.78rem; color: var(--text-mute); margin: 2px 0 8px; }
/* Lanes flow top-to-bottom through up to 3 columns of ≥440px (one column on
   narrow screens), like a newspaper: no row grid, so a short lane never leaves
   a blank gap beside a tall one. Columns read top-to-bottom, left-to-right in
   DOM order (Ready to fix → Settings → Reply ready → Needs info → …; Shipped
   sits below the columns). A long lane may continue into the next column
   between cards (the browser balances the columns); a card never splits, and a
   lane title/hint never ends a column without its first card. Continued
   fragments carry no "(cont.)" label: CSS cannot target a fragment start. */
#fbb-lanes { columns: 440px 3; column-gap: 20px; min-width: 0; }
#fbb-lanes > .ui-empty { column-span: all; }
.fbb-lane-title, .fbb-lane-hint { break-after: avoid; }
.fbb-cards { display: block; min-width: 0; }
.fbb-cards > .fbb-card { break-inside: avoid; }
.fbb-cards > .fbb-card + .fbb-card { margin-top: 12px; }

.fbb-card {
  background: var(--card-bg); border: 1px solid var(--border-light); border-radius: 10px;
  padding: 12px 14px; min-width: 0; overflow-wrap: anywhere; word-break: break-word;
}
.fbb-card.is-urgent { border-left: 4px solid var(--heritage-red); }
.fbb-head { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 0.82rem; min-width: 0; }
.fbb-id { font-weight: 700; }
.fbb-kind { border-radius: 4px; padding: 1px 6px; background: var(--ink-strong); color: #fff; font-size: 0.74rem; }
.fbb-kind-bug { background: #6b2fb3; }
.fbb-kind-how_to { background: #2a6f3e; }
.fbb-kind-feature_request { background: #5b3ea8; }
.fbb-kind-config_issue, .fbb-kind-data_issue { background: var(--heritage-red); }
.fbb-module { border-radius: 4px; padding: 1px 6px; background: var(--bg-secondary); border: 1px solid var(--border-light); font-size: 0.74rem; }
.fbb-who { color: var(--text-mute); }
.fbb-size { margin-left: auto; border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; font-weight: 600; font-size: 0.74rem; white-space: nowrap; }
.fbb-overridden { font-size: 0.72rem; color: var(--text-mute); font-style: italic; }
.fbb-urgent { color: var(--heritage-red); font-weight: 600; font-size: 0.82rem; margin: 6px 0 0; }
.fbb-said { margin: 8px 0; padding: 6px 10px; border-left: 3px solid var(--accent-gold); background: var(--bg-secondary); font-style: italic; font-size: 0.88rem; }
.fbb-said-text { display: block; }
.fbb-said.is-clamped .fbb-said-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
.fbb-said[role="button"] { cursor: pointer; }
.fbb-said[role="button"]:focus-visible { outline: 2px solid var(--heritage-red); outline-offset: 2px; }
.fbb-said small { display: block; font-style: normal; color: var(--text-mute); font-size: 0.72rem; margin-top: 2px; }
.fbb-said-toggle { display: block; font-style: normal; font-size: 0.76rem; font-weight: 600; color: var(--heritage-red); margin-top: 2px; }
.fbb-summary { font-weight: 600; font-size: 0.92rem; margin: 6px 0; }
.fbb-readstate { font-size: 0.84rem; color: var(--text-mute); margin: 6px 0; }
.fbb-readstate.fbb-paused, .fbb-readstate.fbb-failed { color: var(--heritage-red); }

.fbb-cause { border: 1px solid var(--border-light); border-radius: 8px; padding: 8px 10px; background: var(--bg-primary); margin: 8px 0; font-size: 0.85rem; min-width: 0; }
.fbb-cause-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fbb-checked { color: #2a6f3e; font-size: 0.76rem; }
.fbb-cause-text { margin: 6px 0; }
.fbb-evidence { margin: 8px 0 0; border-top: 1px dashed var(--border-light); padding-top: 4px; min-width: 0; }
.fbb-evidence > summary {
  cursor: pointer; font-size: 0.78rem; font-weight: 600; color: var(--text-mute); min-height: 28px;
  display: flex; align-items: center; gap: 6px; list-style: none;
}
.fbb-evidence > summary::-webkit-details-marker { display: none; }
.fbb-evidence > summary::before { content: '▸'; font-size: 0.7rem; }
.fbb-evidence[open] > summary::before { content: '▾'; }
.fbb-claim { margin: 6px 0; }
.fbb .fbb-cites { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0; max-width: 100%; }
.fbb .fbb-cite {
  margin: 0; min-height: 26px; min-width: 0; line-height: 1.5; display: inline-block; vertical-align: middle;
  font-family: ui-monospace, Menlo, monospace; font-size: 0.72rem; border: 1px solid var(--border);
  background: var(--bg-secondary); color: var(--text); border-radius: 4px; padding: 0 5px; cursor: pointer;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fbb-quote { font-size: 0.78rem; color: var(--text-mute); background: var(--bg-secondary); border-radius: 4px; padding: 4px 6px; margin-top: 4px; }
.fbb-label { display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; border-radius: 4px; padding: 0 5px; }
.fbb-label-confirmed { background: #dff3e4; color: #1d5c31; }
.fbb-label-likely { background: #fbf0cf; color: #6d5410; }
.fbb-label-guess { background: #fde2e2; color: #8a1c1c; }
.fbb-label-reported { background: var(--bg-secondary); color: var(--text-mute); }
.fbb-herring { color: var(--text-mute); margin: 6px 0 0; }
.fbb-datafix { color: var(--heritage-red); margin: 6px 0 0; }
.fbb-dropped { color: var(--text-mute); font-size: 0.76rem; margin: 4px 0 0; }
.fbb-extra { border: 1px dashed var(--accent-gold); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 0.85rem; }
.fbb-extra p { margin: 4px 0 0; }
.fbb-extra-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-mute); }
.fbb-extra ol { margin: 4px 0 0 18px; padding: 0; }
.fbb-codeline, .fbb-metaline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.76rem; margin-top: 6px; min-width: 0; }
.fbb-k { font-weight: 600; }
.fbb-code { font-size: 0.72rem; background: #ede7f6; border-radius: 4px; padding: 0 5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbb-stale { color: #a35a00; }
.fbb-cost { margin-left: auto; color: var(--text-mute); }
.fbb-related { color: var(--text-mute); }
.fbb-fixedline { color: var(--success, #2e7d32); }
.fbb-select { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; cursor: pointer; accent-color: var(--accent, #c8102e); }
.fbb-auto { font-size: 0.7rem; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--info-bg, #e8f0fe); color: var(--info, #1a56db); }
.fbb-linkpr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 2px; font-size: 0.78rem; }
.fbb-linkpr-num { width: 6.5em; box-sizing: border-box; border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 4px 6px; background: var(--card-bg); color: var(--text); font: inherit; }
.fbb-linkpr-cov { border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 4px 6px; background: var(--card-bg); color: var(--text); font: inherit; }
.fbb-prlink { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border-light); }
.fbb-prlink-done { color: var(--success, #2e7d32); }
.fbb-prlinks { display: flex; flex-wrap: wrap; gap: 6px; }
.fbb-prlist { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; }
.fbb-prlist li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.fbb-repeat { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; font-size: 0.8rem; color: var(--text-mute); }
.fbb-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; margin: 6px 0; border: 1px solid var(--border-light); border-radius: var(--radius-sm); background: var(--card-bg); position: sticky; top: 0; z-index: 3; }
.fbb-bulk[hidden] { display: none; }
.fbb-bulk-n { font-weight: 600; font-size: 0.82rem; margin-right: 4px; }
.fbb-toppanel { margin: 6px 0; padding: 8px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); background: var(--card-bg); }
.fbb-tokens, .fbb-similar { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; }
.fbb-tokens li, .fbb-similar li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }

/* One primary action + ⋯ at every width. */
.fbb-actions { position: relative; display: flex; gap: 8px; margin-top: 10px; align-items: center; justify-content: space-between; min-width: 0; }
.fbb .btn.fbb-primary { background: var(--heritage-red); color: #fff; border-color: var(--heritage-red); min-width: 0; max-width: calc(100% - 52px); white-space: normal; text-align: center; }
.fbb .btn.fbb-menu-btn { min-width: 36px; padding-left: 10px; padding-right: 10px; font-size: 1rem; line-height: 1; }
.fbb .fbb-actions .fbb-menu-btn[aria-expanded="true"], .fbb .fbb-view-btn[aria-expanded="true"] { border-color: var(--heritage-red); }
.fbb-panel { margin-top: 8px; border-top: 1px solid var(--border-light); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fbb-panel[hidden] { display: none; }
.fbb-panel-label { font-size: 0.76rem; font-weight: 600; }
.fbb-reply, .fbb-dup, .fbb-move-module, .fbb-ship-ref, .fbb-ship-title { width: 100%; box-sizing: border-box; border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 6px 8px; background: var(--card-bg); color: var(--text); font: inherit; }
.fbb-panel .fbhub-select { width: 100%; min-width: 0; }
.fbb-hint { font-size: 0.74rem; color: var(--text-mute); margin: 0; }
.fbb-panel-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.fbb-checklist { margin: 0; padding-left: 4px; list-style: none; font-size: 0.84rem; }
.fbb-checklist label { display: flex; gap: 8px; align-items: flex-start; }

.fbb-shipped { margin-top: 12px; }
.fbb-shipped > summary { cursor: pointer; font-weight: 600; font-size: 0.86rem; text-transform: uppercase; letter-spacing: 0.04em; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.fbb .fbb-closed-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; text-align: left; margin: 0;
  padding: 8px 4px; border: 0; border-bottom: 1px solid var(--border-light); background: transparent; color: var(--text);
  font: inherit; font-size: 0.84rem; min-width: 0; cursor: pointer;
}
.fbb .fbb-closed-row:hover, .fbb .fbb-closed-row:focus-visible { background: var(--bg-secondary); }
.fbb-closed-msg { flex: 1 1 220px; min-width: 0; color: var(--text-mute); }

/* Tablet and below: lane chips on one line, scrolling sideways on purpose. */
@media (max-width: 899.98px) {
  .fbb-strip { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; padding-bottom: 4px; }
  .fbb-strip-chip { flex: 0 0 auto; }
}

/* Phones: ≥44px targets everywhere, menus in-flow and full width. */
@media (max-width: 600px) {
  .fbb-card { padding: 12px; }
  .fbb-search { height: 44px; max-width: none; font-size: 16px; }
  .fbb .btn.fbb-view-btn, .fbb .btn.fbb-primary, .fbb .btn.fbb-menu-btn,
  .fbb .fbb-panel .btn, .fbb .fbb-strip-chip { min-height: 44px; }
  .fbb .fbb-actions .btn.fbb-menu-btn { width: 44px; min-width: 44px; flex: 0 0 44px; }
  .fbb .btn.fbb-primary { flex: 0 1 auto; min-width: 128px; padding-left: 18px; padding-right: 18px; }
  .fbb-actions { flex-wrap: wrap; }
  .fbb-actions > .fbb-menu {
    position: static; order: 3; flex: 1 1 100%; width: auto; min-width: 0; max-width: none; box-shadow: none; margin-top: 2px;
  }
  .fbb .fbb-menu-item { min-height: 44px; display: flex; align-items: center; }
  .fbb-view-menu { position: absolute; width: min(300px, calc(100vw - 32px)); }
  .fbb-view-menu .fbhub-select { min-height: 44px; }
  .fbb-evidence > summary, .fbb-shipped > summary { min-height: 44px; }
  .fbb .fbb-cite { min-height: 44px; display: inline-flex; align-items: center; padding: 0 10px; }
  .fbb .fbb-closed-row { min-height: 44px; }
  .fbb-reply, .fbb-dup, .fbb-move-module, .fbb-ship-ref, .fbb-ship-title, .fbb-panel .fbhub-select { min-height: 44px; font-size: 16px; }
  .fbb-select { width: 44px; height: 44px; }
  .fbb-linkpr-num, .fbb-linkpr-cov { min-height: 44px; font-size: 16px; }
  .fbb-prlist .btn { min-height: 44px; }
  .fbb-bulk .btn, .fbb-repeat .btn, .fbb-toppanel .btn, .fbb-similar .btn, .fbb-tokens .btn { min-height: 44px; }
  .fbb-checklist label { min-height: 44px; align-items: center; }
  .fbb-checklist input { width: 22px; height: 22px; }
  .fbb-cost { margin-left: 0; }
  .fbb-size { margin-left: 0; }
}

/* Feedback fix-kit (2026-10-21): error id line in the form opened by
   "Report this"; read-only packet box when the clipboard is blocked. */
.feedback-error-ref { font-size: 0.85rem; color: var(--ink-mute); margin-top: 4px; }
.fbb-packet { width: 100%; box-sizing: border-box; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }


/* ── Feedback > Backlog admin summary (2026-10-24) ─────────────────────────
   Replaces Administration > Feedback. Stats strip, by-type / by-status bars,
   collapsible module ratings. Admin only (feedback-admin-summary.js). Static:
   no motion. Sits outside #fbhub-panel so the board view keeps it. */
.fbhub-admin-summary { margin: 0 0 14px; }
.fbsum {
  border: 1px solid var(--rule, #e6e0d8); border-radius: 10px;
  background: var(--card-bg, #fff); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.fbsum-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.fbsum-stat { min-width: 0; }
.fbsum-stat-val { font-size: 1.35rem; font-weight: 700; line-height: 1.15; color: var(--ink-strong, #2a2622); font-variant-numeric: tabular-nums; }
.fbsum-stat-label { font-size: .82rem; font-weight: 600; color: var(--ink, #2a2622); }
.fbsum-stat-sub { font-size: .75rem; color: var(--text-mute, #6B6560); }
.fbsum-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fbsum-col { min-width: 0; }
.fbsum-h { font-size: .82rem; font-weight: 700; margin: 0 0 6px; color: var(--ink-strong, #2a2622); text-transform: uppercase; letter-spacing: .03em; }
.fbsum-bar { display: grid; grid-template-columns: minmax(84px, 9em) 1fr auto; align-items: center; gap: 8px; font-size: .82rem; padding: 2px 0; }
.fbsum-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbsum-bar-val { font-variant-numeric: tabular-nums; color: var(--text-mute, #6B6560); min-width: 2.5em; text-align: right; }
.fbsum-bar-track { display: block; height: 6px; border-radius: 3px; background: var(--rule-soft, #efe9e1); overflow: hidden; }
.fbsum-bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--heritage-gold, #D4A843); }
.fbsum-bar[data-tone="bug"] .fbsum-bar-fill { background: var(--heritage-red, #CC0000); }
.fbsum-bar[data-tone="suggestion"] .fbsum-bar-fill { background: var(--heritage-purple, #5B2C8A); }
.fbsum-bar[data-tone="good"] .fbsum-bar-fill { background: var(--success-deep, #1F6B2B); }
.fbsum-bar[data-tone="mute"] .fbsum-bar-fill { background: var(--ink-mute, #6B6560); }
.fbsum-note { margin: 0; font-size: .85rem; color: var(--text-mute, #6B6560); }
.fbsum-ratings-card { border-top: 1px solid var(--rule, #e6e0d8); padding-top: 8px; }
.fbsum-ratings-card > summary {
  cursor: pointer; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
  min-height: 32px; list-style-position: inside;
}
.fbsum-ratings-card > summary .fbsum-h { margin: 0; display: inline; }
.fbsum-count { font-size: .78rem; font-weight: 700; padding: 0 7px; border-radius: 9px; background: var(--rule-soft, #efe9e1); }
.fbsum-hint { font-size: .78rem; color: var(--text-mute, #6B6560); }
.fbsum-ratings-card[open] > summary { margin-bottom: 8px; }
.fbsum-ratings-wrap { overflow-x: auto; }
.fbsum-ratings { width: 100%; border-collapse: collapse; font-size: .86rem; }
.fbsum-ratings th { text-align: left; font-size: .76rem; color: var(--text-mute, #6B6560); font-weight: 600; padding: 4px 8px; border-bottom: 1px solid var(--rule, #e6e0d8); }
.fbsum-ratings td { padding: 6px 8px; border-bottom: 1px solid var(--rule-soft, #efe9e1); vertical-align: middle; }
.fbsum-pct { display: inline-block; min-width: 3em; font-weight: 700; font-variant-numeric: tabular-nums; }
.fbsum-pct[data-tone="good"] { color: var(--success-deep, #1F6B2B); }
.fbsum-pct[data-tone="mid"] { color: var(--heritage-gold-dark, #8B6914); }
.fbsum-pct[data-tone="low"] { color: var(--heritage-red, #CC0000); }
.fbsum-rating-track { display: inline-block; width: 120px; vertical-align: middle; margin-left: 6px; }
.fbsum-bar-fill[data-tone="good"] { background: var(--success-deep, #1F6B2B); }
.fbsum-bar-fill[data-tone="mid"] { background: var(--heritage-gold, #D4A843); }
.fbsum-bar-fill[data-tone="low"] { background: var(--heritage-red, #CC0000); }
.fbsum-votes { white-space: nowrap; color: var(--text-mute, #6B6560); font-variant-numeric: tabular-nums; }
.fbsum-error { border-left: 3px solid var(--heritage-red, #CC0000); }
[data-theme="dark"] .fbsum { background: var(--surface, #1E2130); border-color: var(--border-light, rgba(255,255,255,.12)); }
[data-theme="dark"] .fbsum-stat-val, [data-theme="dark"] .fbsum-h, [data-theme="dark"] .fbsum-stat-label { color: var(--text-primary, #E8E6E3); }
[data-theme="dark"] .fbsum-pct[data-tone="good"] { color: #6FCF97; }
[data-theme="dark"] .fbsum-pct[data-tone="mid"] { color: #E8C46A; }
[data-theme="dark"] .fbsum-pct[data-tone="low"] { color: #FF8A8A; }
@media (max-width: 700px) {
  .fbsum { padding: 10px 12px; }
  .fbsum-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fbsum-split { grid-template-columns: 1fr; }
  .fbsum-ratings-card > summary { min-height: 44px; align-items: center; }
  .fbsum-rating-track { display: none; }
  .fbsum-ratings thead { display: none; }
  .fbsum-ratings tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 6px 0; border-bottom: 1px solid var(--rule-soft, #efe9e1); }
  .fbsum-ratings td { border: 0; padding: 0; }
  .fbsum-ratings td:first-child { grid-column: 1 / -1; }
}

/* ── One-tap answer ratings (AI_ANSWER_RATING, 2026-11-13) ─────────────
   Workspace (.ws-feedback) and Ask AIOP (.feedback-inline) share these.
   .ai-rating is only added by public/js/ui/ai-answer-rating.js while the
   switch is on, so nothing here applies when it is off. */
.ai-rating { flex-wrap: wrap; }
.ai-rating .ws-feedback-thumb.ai-rating-on,
.ai-rating .feedback-thumb.ai-rating-on {
  opacity: 1;
  background: rgba(204, 0, 0, 0.1);
  box-shadow: inset 0 0 0 1px rgba(204, 0, 0, 0.35);
}
.ai-rating[data-ai-rating="up"] .ws-feedback-thumb:not(.ai-rating-on),
.ai-rating[data-ai-rating="down"] .ws-feedback-thumb:not(.ai-rating-on),
.ai-rating[data-ai-rating="up"] .feedback-thumb:not(.ai-rating-on),
.ai-rating[data-ai-rating="down"] .feedback-thumb:not(.ai-rating-on) { opacity: .45; }
.ai-rating .feedback-thumb:focus-visible,
.ai-rating .ws-feedback-thumb:focus-visible { outline: 2px solid var(--heritage-red, #CC0000); outline-offset: 1px; }
.ai-rating-comment {
  flex-basis: 100%;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.ai-rating-comment-input {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 420px;
  border: 1px solid var(--border-light, #ddd);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.82rem;
  font-family: inherit;
  background: var(--surface, #fff);
  color: inherit;
}
.ai-rating-saved,
.ai-rating-thanks {
  font-size: 0.78rem;
  color: var(--text-mute, #888);
}
@media (max-width: 640px) {
  .ai-rating-comment-input { flex-basis: 100%; max-width: none; }
}
/* ===================================================================
   33-workspace.css — LKK AI Workspace (full-screen chat + artifacts)
   Heritage Red #CC0000 · Gold #D4A843 · Playfair Display + Source Sans Pro
   Claude/ChatGPT-grade full-screen surface. Reuses design-system tokens
   from 00-reset.css ( --heritage-*, --ink-*, --eggshell-*, --radius-* ).
   =================================================================== */

/* The workspace takes over the full viewport below the app shell header.
   It is a fixed 3-column grid: rail | chat | (resizer + artifacts). */
.ws-root {
  --ws-rail-w: 264px;
  --ws-split: 0.44;                /* chat fraction when artifacts open — give the
                                     artifact pane the larger half (56%) so charts,
                                     wide tables + code have real room to breathe */
  /* SHARED HEADER BAND (2026-07-28, Kevin: "header bars intersect") ─────────
     The chat topbar (.ws-topbar, column 2) and the artifacts header
     (.artifacts-header in 34-artifacts.css, column 4) sit on the SAME
     horizontal band starting at y=0, in different grid columns. They used to
     compute to ~57px and ~47px respectively, so their bottom rules landed on
     two different Y coordinates and the two chrome strips read as overlapping
     planes instead of one continuous band — that is the "intersecting headers"
     bug. Both bars now derive their height from this ONE token, so the rules
     join into a single unbroken line across the split. Change it here or
     nowhere. Mobile re-declares its own value in the ≤900px block. */
  --ws-head-h: 57px;
  /* Resizer track width. Referenced by the grid template AND by the JS ratio
     math (which measures the live element), so the two can never disagree. */
  --ws-resizer-w: 6px;
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: var(--ws-rail-w) 1fr;
  grid-template-rows: 100%;
  height: 100vh;
  height: 100dvh;
  background:
    radial-gradient(ellipse at top left, rgba(212,168,67,0.05), transparent 55%),
    var(--eggshell-bright);
  z-index: 50;                     /* above the SPA shell, below toasts/drawer */
  overflow: hidden;
  font-family: var(--font-sans);
}
.ws-root.artifacts-open {
  /* chat : resizer : artifacts — left rail stays fixed.
     minmax floors the artifact pane at 420px so it never collapses too narrow
     to render a chart/table cleanly (the chat column yields first). */
  grid-template-columns:
    var(--ws-rail-w)
    minmax(0, calc((100% - var(--ws-rail-w) - var(--ws-resizer-w)) * var(--ws-split)))
    var(--ws-resizer-w)
    minmax(420px, 1fr);
}
.ws-root.rail-collapsed { --ws-rail-w: 0px; }

/* ---------------- Left rail: conversations ------------------------- */
.ws-rail {
  grid-row: 1;
  background: linear-gradient(180deg, var(--warm-white), var(--paper));
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
  transition: width .18s ease;
}
.rail-collapsed .ws-rail { display: none; }

/* RAIL-COLLAPSE FIX (2026-07-06, Oscar/Shawn China report): the rule above
   removes the rail from the grid FLOW entirely (display:none ≠ a 0px item).
   Without explicit column pins, grid auto-placement then slid .ws-main into
   column 1 — the very track `.ws-root.rail-collapsed` just shrank to 0px — so
   the chat rendered 0px wide (CJK text, which may break between any two
   characters, stacked one character per line down a sliver on the left) while
   the empty 1fr track read as a blank white page. Clicking the toggle again
   returned the rail to flow and "fixed" it. Pin every pane to its column so
   hiding the rail can never re-flow its siblings. Desktop-only: the ≤900px
   drawer model uses a single 1fr column with the rail position:fixed (out of
   flow); a column-2 pin there would fabricate a phantom implicit track. */
@media (min-width: 901px) {
  .ws-rail  { grid-column: 1; }
  .ws-main  { grid-column: 2; }
  .ws-root.artifacts-open .ws-resizer        { grid-column: 3; }
  .ws-root.artifacts-open .ws-artifacts-pane { grid-column: 4; }
}

.ws-convos { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ws-convos-head { padding: 14px 14px 8px; }
.ws-new-chat {
  width: 100%;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 14px;
  background: var(--heritage-red);
  color: #fff;
  border: none; border-radius: var(--radius);
  font-family: var(--font-sans); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background .15s ease, transform .05s ease;
  box-shadow: var(--shadow-sm);
}
.ws-new-chat:hover { background: var(--heritage-red-deep); }
.ws-new-chat:active { transform: translateY(1px); }
.ws-new-chat svg { stroke: #fff; }

.ws-convos-search {
  position: relative; margin: 4px 12px 10px;
  display: flex; align-items: center;
}
.ws-convos-search svg { position: absolute; left: 10px; stroke: var(--ink-faint); pointer-events: none; }
.ws-convos-search input {
  width: 100%; padding: 8px 10px 8px 30px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--warm-white); color: var(--ink);
  font-family: var(--font-sans); font-size: 13px;
}
.ws-convos-search input:focus { outline: none; border-color: var(--heritage-gold); box-shadow: 0 0 0 3px var(--rule-gold); }

.ws-convos-list { flex: 1 1 auto; overflow-y: auto; padding: 0 8px 16px; }
.ws-convos-empty { padding: 16px 12px; color: var(--ink-mute); font-size: 13px; text-align: center; }

.ws-convo-item {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 10px; margin: 2px 0;
  border-radius: var(--radius); cursor: pointer;
  color: var(--ink-soft); font-size: 13.5px;
  transition: background .12s ease;
}
.ws-convo-item:hover { background: var(--eggshell-shade); }
.ws-convo-item.active { background: var(--eggshell-deep); color: var(--ink-strong); font-weight: 600; }
/* QA-GAP #4 (2026-06-06): title + relative-time meta stack so near-duplicate
   titles are distinguishable in the rail. The main column flexes; the title
   ellipsizes on one line and the meta sits beneath it in muted small text. */
.ws-convo-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ws-convo-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-convo-meta { font-size: 11px; color: var(--ink-faint); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-convo-item.active .ws-convo-meta { color: var(--ink-mute); }
/* B3: body-match snippet under the title when the rail search hit MESSAGE text
   rather than the title. Clamped to one line so row height stays uniform. */
.ws-convo-snippet {
  font-size: 11.5px; color: var(--ink-mute); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-convo-item.active .ws-convo-snippet { color: var(--ink-soft); }
.ws-convo-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s ease; }
.ws-convo-item:hover .ws-convo-actions,
.ws-convo-item:focus-within .ws-convo-actions { opacity: 1; }
.ws-convo-btn {
  display: grid; place-items: center;
  width: 24px; height: 24px; padding: 0;
  background: transparent; border: none; border-radius: 5px;
  color: var(--ink-mute); cursor: pointer;
}
.ws-convo-btn:hover { background: rgba(204,0,0,0.08); color: var(--heritage-red); }
.ws-convo-rename-input {
  flex: 1 1 auto; min-width: 0;
  padding: 4px 6px; border: 1px solid var(--heritage-gold); border-radius: 5px;
  font-family: var(--font-sans); font-size: 13.5px; color: var(--ink-strong);
  background: var(--warm-white);
}
.ws-convo-rename-input:focus { outline: none; box-shadow: 0 0 0 3px var(--rule-gold); }

/* ---------------- Center: chat ------------------------------------- */
.ws-main {
  grid-row: 1;
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background: transparent;
}
/* Topbar: aligned to the AIOP shell .topbar (03-shell.css) so the workspace
   reads native — same glass blur(12px), same eggshell tint, same solid --rule
   bottom border (was blur(8px)/0.7/--rule-soft, which looked lighter/bolted-on). */
.ws-topbar {
  display: flex; align-items: center; gap: 12px;
  /* HEADER BAND (2026-07-28): height comes from --ws-head-h, NOT from vertical
     padding, so this bar and .artifacts-header are pixel-identical and their
     1px bottom rules form one continuous line across the split. box-sizing is
     explicit because the border participates in the fixed height. */
  box-sizing: border-box;
  height: var(--ws-head-h);
  min-height: var(--ws-head-h);
  flex: 0 0 auto;
  padding: 0 18px;
  border-bottom: 1px solid var(--rule);
  background: rgba(255,253,248,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.ws-rail-toggle {
  display: grid; place-items: center; width: 32px; height: 32px;
  background: transparent; border: none; border-radius: 6px;
  color: var(--ink-soft); cursor: pointer;
}
.ws-rail-toggle:hover { background: var(--eggshell-shade); }

/* Exit / Back control — the only way out of the full-screen takeover.
   Mirrors AIOP secondary-button conventions (token-based) so it reads native.
   Desktop: pill with "Back" label. Mobile: ≥44px square chevron (label hidden). */
.ws-exit-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px 0 9px;
  background: var(--warm-white);
  border: 1px solid var(--rule); border-radius: 999px;
  color: var(--ink-soft); cursor: pointer;
  font-family: var(--font-sans); font-size: 13px; font-weight: 600;
  transition: border-color .14s ease, color .14s ease, background .14s ease;
}
.ws-exit-btn:hover { border-color: var(--heritage-gold); color: var(--ink-strong); background: var(--eggshell-shade); }
.ws-exit-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold); }
.ws-exit-btn svg { stroke: currentColor; flex: 0 0 auto; }
.ws-exit-label { line-height: 1; }
/* Title: match the shell .topbar-title weight/tracking (was 600 / no tracking). */
.ws-topbar-title {
  font-family: var(--font-serif); font-style: italic;
  font-size: 18px; color: var(--ink-strong); font-weight: 700;
  letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 9px;
}
.ws-brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--heritage-red);
  box-shadow: 0 0 0 3px rgba(204,0,0,0.14);
}
/* MOBILE POLISH (2026-07-08): full brand title on desktop, short "Workspace"
   on phones (≤640px). Same pattern as the gov-label full/short swap. */
.ws-brand-short { display: none; }
.ws-topbar-spacer { flex: 1 1 auto; }
.ws-gov-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(45,140,60,0.10); color: var(--success-deep);
  font-size: 12px; font-weight: 600;
  border: 1px solid rgba(45,140,60,0.22);
}
.ws-gov-badge svg { stroke: var(--success-deep); }
/* QA-GAP #2 (2026-06-06): swap full ↔ short governance label by breakpoint so
   the topbar never wraps on a phone. Desktop shows the full reassuring label;
   mobile (≤640px) shows the compact "Governed" pill. Default (desktop): full
   visible, short hidden — the @media block below inverts this for phones. */
.ws-gov-label-short { display: none; }
.ws-gov-label-full { display: inline; }

/* ── FLOOR BADGE (Floor-Aware Train E, 2026-07-25) ─────────────────────────
   Which FLOOR (platform tenant) am I typing into? Rendered only for a
   multi-floor user (floor-ui.js floorBadgeHtml), because a single-floor pilot
   user has no other room to confuse this with. Accent comes from the server's
   workspace record via the --ws-floor-accent custom property, so a future BU
   floor is styled correctly with no CSS change (same data-driven promise as
   the picker). Deliberately quieter than the governance pill: it is a signpost,
   not a claim about safety. */
.ws-floor-badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 10px; padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--ws-floor-accent, #D4A843) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ws-floor-accent, #D4A843) 34%, transparent);
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--text-secondary, #5a5a5a);
  white-space: nowrap; max-width: 190px;
}
.ws-floor-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto;
  background: var(--ws-floor-accent, #D4A843);
}
.ws-floor-name { overflow: hidden; text-overflow: ellipsis; }

/* ── CROSS-FLOOR SWITCH CARD (Train E) ────────────────────────────────────
   Server 409 THREAD_FLOOR_MISMATCH: the user owns this thread and may open its
   floor — they are standing in the wrong room. Rendered in the thread pane (not
   a toast) because it carries a navigation CHOICE with a consequence. */
.ws-floor-mismatch {
  max-width: 560px; margin: 48px auto; padding: 24px 26px;
  border: 1px solid var(--border, #e3e0da); border-radius: 14px;
  background: var(--surface, #fff); text-align: center;
}
.ws-floor-mismatch-title {
  margin: 0 0 8px; font-size: 17px; font-weight: 700;
  color: var(--text-primary, #1a1a1a);
}
.ws-floor-mismatch-body {
  margin: 0 0 18px; font-size: 14px; line-height: 1.55;
  color: var(--text-secondary, #5a5a5a);
}
.ws-floor-mismatch-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

.ws-thread {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 0;
}

/* Greeting / empty state — centered Claude-style */
.ws-greeting {
  margin: auto;
  max-width: 720px; width: 100%;
  padding: 48px 24px;
  text-align: center;
}
.ws-greeting-mark {
  display: inline-grid; place-items: center;
  width: 72px; height: 72px; margin-bottom: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(204,0,0,0.10), rgba(212,168,67,0.16));
}
.ws-greeting-mark svg { stroke: var(--heritage-red); }
.ws-greeting-title {
  font-family: var(--font-serif); font-size: 32px; line-height: 1.15;
  color: var(--ink-strong); margin: 0 0 8px;
}
.ws-greeting-sub { color: var(--ink-mute); font-size: 16px; margin: 0 0 28px; }
.ws-chips {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  max-width: 620px; margin: 0 auto; text-align: left;
}
.ws-chip {
  padding: 14px 16px;
  background: var(--warm-white);
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  color: var(--ink-soft); font-size: 14px; line-height: 1.35;
  cursor: pointer; transition: all .14s ease;
  box-shadow: var(--shadow-sm);
}
.ws-chip:hover {
  border-color: var(--heritage-gold); color: var(--ink-strong);
  transform: translateY(-1px); box-shadow: var(--shadow);
}
@media (max-width: 720px) { .ws-chips { grid-template-columns: 1fr; } }

/* Message list */
.ws-messages {
  width: 100%; max-width: 820px; margin: 0 auto;
  padding: 24px 24px 40px;
  display: flex; flex-direction: column; gap: 22px;
}
.ws-msg { display: flex; gap: 14px; align-items: flex-start; }
.ws-msg.user { flex-direction: row-reverse; }
.ws-avatar {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.ws-avatar-ai { background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark)); color: #fff; }
.ws-avatar-ai svg { stroke: #fff; }
.ws-avatar-user { background: var(--eggshell-deep); color: var(--ink-strong); }
.ws-msg-body { min-width: 0; max-width: calc(100% - 46px); display: flex; flex-direction: column; gap: 6px; }
.ws-msg.user .ws-msg-body { align-items: flex-end; }
.ws-msg-bubble {
  padding: 12px 16px; border-radius: 14px;
  font-size: 15px; line-height: 1.6; color: var(--ink);
  word-wrap: break-word; overflow-wrap: anywhere;
}
.ws-msg.user .ws-msg-bubble {
  background: var(--heritage-red); color: #fff;
  border-bottom-right-radius: 4px;
}
.ws-msg.assistant .ws-msg-bubble {
  background: var(--warm-white); border: 1px solid var(--rule-soft);
  border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm);
}

/* Markdown content inside assistant bubbles */
.ws-markdown > *:first-child { margin-top: 0; }
.ws-markdown > *:last-child { margin-bottom: 0; }
.ws-markdown h1, .ws-markdown h2, .ws-markdown h3 { font-family: var(--font-serif); color: var(--ink-strong); line-height: 1.25; margin: 1em 0 .5em; }
.ws-markdown h1 { font-size: 22px; } .ws-markdown h2 { font-size: 19px; } .ws-markdown h3 { font-size: 16.5px; }
.ws-markdown p { margin: 0 0 .7em; }
.ws-markdown ul, .ws-markdown ol { margin: 0 0 .7em; padding-left: 1.3em; }
.ws-markdown li { margin: .2em 0; }
.ws-markdown a { color: var(--heritage-red); text-decoration: underline; text-underline-offset: 2px; }
.ws-markdown code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.88em; background: var(--eggshell-shade);
  padding: 1.5px 5px; border-radius: 4px; color: var(--heritage-red-dark);
}
.ws-markdown pre {
  background: #1f1b17; color: #f4ecde;
  padding: 14px 16px; border-radius: var(--radius);
  overflow-x: auto; margin: 0 0 .8em;
}
.ws-markdown pre code { background: transparent; color: inherit; padding: 0; font-size: 13px; }
.ws-markdown blockquote {
  border-left: 3px solid var(--heritage-gold); margin: 0 0 .8em;
  padding: 2px 0 2px 14px; color: var(--ink-soft); font-style: italic;
}
.ws-markdown table {
  border-collapse: collapse; width: 100%; margin: 0 0 .8em; font-size: 13.5px;
}
.ws-markdown th, .ws-markdown td { border: 1px solid var(--rule); padding: 7px 10px; text-align: left; }
.ws-markdown th { background: var(--eggshell-shade); font-weight: 600; color: var(--ink-strong); }
/* POLISH (2026-07-08): zebra rows for scan-ability + a horizontal scroll
   track so a wide table scrolls inside the bubble instead of blowing it out
   (same pattern as the artifact panel's markdown tables). */
.ws-markdown tbody tr:nth-child(even) { background: rgba(212,168,67,.05); }
.ws-markdown table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ws-markdown table::-webkit-scrollbar { height: 8px; }
.ws-markdown table::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 8px; }
.ws-markdown img { max-width: 100%; border-radius: var(--radius); }

/* Streaming caret */
.ws-caret {
  display: inline-block; width: 7px; height: 1.05em; vertical-align: text-bottom;
  background: var(--heritage-red); margin-left: 2px; border-radius: 1px;
  animation: ws-blink 1s steps(2) infinite;
}
@keyframes ws-blink { 50% { opacity: 0; } }

/* Tool pills */
.ws-tool-pill {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  padding: 6px 12px; border-radius: 999px;
  background: var(--eggshell-shade); border: 1px solid var(--rule);
  color: var(--ink-soft); font-size: 12.5px; font-weight: 500;
}
.ws-tool-pill.complete { background: rgba(45,140,60,0.08); border-color: rgba(45,140,60,0.22); color: var(--success-deep); }
.ws-tool-pill.error { background: rgba(192,57,43,0.08); border-color: rgba(192,57,43,0.24); color: var(--danger); }
/* A6: the tool SUCCEEDED and found nothing. Deliberately neutral/muted — not
   green (that reads "data returned") and not red (nothing failed). A dashed
   border carries "empty" without importing alarm. */
.ws-tool-pill.empty {
  background: transparent; border-style: dashed; border-color: var(--rule);
  color: var(--ink-mute); font-weight: 400;
}
/* ── TOOL STACKING (2026-08-07) ──────────────────────────────────────────
   A run of same-name calls collapses into ONE pill carrying "×N". Kevin, on a
   research turn that painted eleven identical rows: "is there any way to stack
   them instead of list them?"

   The count is a subtle inline chip, not a loud badge — it modifies the tool
   name, it is not a status of its own. It inherits `currentColor` so it reads
   green inside a complete pill and red inside an error pill without needing a
   variant per state. */
.ws-tool-count {
  display: inline-block;
  padding: 0 5px; margin-left: 2px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: .92em; font-weight: 600; font-variant-numeric: tabular-nums;
  opacity: .85;
}
/* The one thing stacking must not do is hide a failure. When a mostly-green
   group contains errors, the ✕N chip is forced to danger red REGARDLESS of the
   pill's own colour, so it never blends into the success styling around it. */
.ws-tool-count.err {
  background: rgba(192,57,43,0.12);
  color: var(--danger);
  opacity: 1;
}
/* AUDIT F1: same guarantee for A6's zero-result state. A mixed "got data +
   found nothing" group must not read as an unqualified green ✓ — the ∅N chip
   stays muted (this is not a failure) but is always legible. */
.ws-tool-count.empty {
  background: color-mix(in srgb, var(--ink-mute) 14%, transparent);
  color: var(--ink-mute);
  opacity: 1;
}
.ws-tool-pill.stacked { cursor: default; }

.ws-spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--rule); border-top-color: var(--heritage-red);
  animation: ws-spin .7s linear infinite;
}
@keyframes ws-spin { to { transform: rotate(360deg); } }

/* Typing dots */
.ws-typing { display: inline-flex; gap: 4px; padding: 12px 16px; align-self: flex-start; }
.ws-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); animation: ws-bounce 1.2s infinite; }
.ws-typing span:nth-child(2) { animation-delay: .15s; }
.ws-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ws-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Feedback thumbs */
.ws-feedback { display: flex; gap: 4px; padding: 0 4px; }
.ws-feedback-thumb { background: transparent; border: none; cursor: pointer; font-size: 14px; opacity: .5; padding: 2px 4px; border-radius: 5px; transition: opacity .12s, background .12s; }
.ws-feedback-thumb:hover { opacity: 1; background: var(--eggshell-shade); }
.ws-feedback-thumb-active { opacity: 1; }
.ws-feedback-thumb-sent { cursor: default; opacity: .35; pointer-events: none; }

/* ── Message actions: copy + regenerate (2026-07-06) ────────────────
   Hover-reveal so the thread stays clean; sit in the same .ws-feedback row
   as the thumbs, top-aligned under the assistant bubble. */
.ws-msg-action {
  background: transparent; border: none; cursor: pointer; font-size: 13px;
  padding: 2px 5px; border-radius: 5px; position: relative;
  opacity: 0; transition: opacity .18s ease, background .18s ease;
}
.ws-msg:hover .ws-msg-action,
.ws-msg-action:focus-visible,
.ws-msg-copy.copied { opacity: 1; }
.ws-msg-action:hover { background: var(--eggshell-shade); }
/* Touch devices have no hover — keep the actions faintly visible. */
@media (hover: none) {
  .ws-msg-action { opacity: .5; }
}

/* ── Edit user message (frontier parity 2026-07-08) ──────────────────
   Hover-reveal ✏️ under the user's own bubbles; right-aligned to match the
   user message alignment. Reuses .ws-msg-action reveal behavior. */
.ws-user-actions { justify-content: flex-end; }

/* ── Export conversation (topbar, 2026-07-08) ─────────────────────── */
.ws-export-trigger {
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  padding: 4px 8px; border-radius: var(--radius-sm, 6px);
  /* 2026-08-07: --ink-600 is defined nowhere on the platform, so this always
     fell through to #555 and could not follow the dark-mode remap. Same class
     of bug as the 37 dead tokens fixed in 40-workspace-research.css. */
  color: var(--ink-soft, #4A4038); transition: background 0.12s;
  display: inline-flex; align-items: center;
}
.ws-export-trigger:hover { background: rgba(0, 0, 0, 0.06); }

/* ── Task-list checkboxes (GFM, 2026-07-08) ────────────────────────
   marked emits <li><input type=checkbox disabled [checked]> …</li>; DOMPurify
   now allows the (forced-disabled) checkbox through. Style it as a static
   check-mark, not a form control. */
/* Custom-drawn box (browser defaults look like a form, not a document):
   Heritage Red fill + inline SVG check when done; completed items read as
   done — muted + struck through. (Polished 2026-07-08.) */
.ws-markdown li:has(> input[type="checkbox"]) { list-style: none; margin-left: -1.2em; }
.ws-markdown input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 15px; height: 15px; margin-right: 7px; vertical-align: -2.5px;
  border: 1.5px solid var(--ink-faint);
  border-radius: 4px;
  background: var(--warm-white);
  pointer-events: none;
  transition: background .18s ease, border-color .18s ease;
}
.ws-markdown input[type="checkbox"]:checked {
  border-color: var(--heritage-red);
  background: var(--heritage-red) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.5l2.5 2.5 4.5-5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px 10px no-repeat;
}
.ws-markdown li:has(> input[type="checkbox"]:checked) {
  color: var(--ink-mute);
  text-decoration: line-through;
  text-decoration-color: var(--ink-faint);
  text-decoration-thickness: 1px;
}
/* "Copied" tooltip flash above the copy icon (data-tip carries the i18n text). */
.ws-msg-copy.copied::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink-strong); color: var(--warm-white);
  font-size: 11px; font-weight: 600; line-height: 1;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; z-index: 5; box-shadow: var(--shadow-sm);
}

/* STOP: "(stopped)" note under a partial response the user cut short. */
.ws-msg-stopped { font-size: 12px; font-style: italic; color: var(--ink-mute); padding: 0 4px; }
/* A4: turn-level honesty notes. Budget = the answer was time-capped; verify =
   the deterministic numeric verifier ran (and possibly corrected a total). */
.ws-msg-budget {
  font-size: 12px; color: var(--ink-soft); padding: 4px 8px; margin-top: 4px;
  background: rgba(212,168,67,0.10); border-left: 2px solid var(--gold, #D4A843);
  border-radius: 3px;
}
.ws-msg-verify {
  font-size: 12px; color: var(--success-deep); padding: 2px 4px; margin-top: 4px;
}
.ws-msg-verify.corrected { font-weight: 600; }
.ws-msg-verify.skipped { color: var(--ink-mute); }
.ws-msg-verify.uncorrected { color: var(--warning); font-weight: 600; }
/* A3: persistent tool provenance under a committed answer. Collapsed by
   default so it never competes with the answer itself. */
.ws-tools-used { margin-top: 8px; font-size: 12px; }
.ws-tools-used > summary {
  cursor: pointer; color: var(--ink-mute); list-style: none;
  padding: 2px 0; user-select: none;
}
.ws-tools-used > summary::-webkit-details-marker { display: none; }
.ws-tools-used > summary:hover { color: var(--ink-soft); }
.ws-tools-used-list {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0 2px;
}
.ws-tools-used-list .ws-tool-pill { padding: 4px 10px; font-size: 11.5px; }
/* TOOL STACKING: even collapsed, a turn that used many DISTINCT tools can run
   long. Cap the expanded chip list and let it scroll rather than pushing the
   answer off-screen — the provenance is supporting evidence, not the content. */
.ws-tools-used-list { max-height: 132px; overflow-y: auto; }

/* A5: capability caveat pinned INSIDE the assistant bubble (web search capped /
   unavailable). Neutral-informational, never alarming — the answer is valid,
   it just has a known blind spot the reader must carry. */
.ws-msg-notice {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 12px; line-height: 1.45; color: var(--ink-soft);
  padding: 6px 9px; margin-top: 8px;
  background: var(--eggshell-shade); border-left: 2px solid var(--ink-faint);
  border-radius: 3px;
}

/* A1: durable, retryable failure block in the transcript (replaces the toast).
   Constrained width so it reads as a message-level event, not a page banner. */
.ws-turn-error { align-self: stretch; max-width: 760px; margin: 4px 0 8px; }
.ws-turn-error .ui-error { margin: 0; }
.ws-turn-error .ui-error-desc {
  /* Server/network detail can be long or unwrapped (stack-ish). Keep it
     readable and prevent it blowing out the transcript width. */
  word-break: break-word; font-size: 12px; max-height: 6.5em; overflow: auto;
}
.ws-turn-error .ui-error-action { display: flex; gap: 8px; flex-wrap: wrap; }

/* EDIT polish (2026-07-08): subtle "edited" tag under a user message that was
   re-sent from an edit session. Right-aligned to match the user bubble. */
.ws-msg-edited { font-size: 11px; font-style: italic; color: var(--ink-faint); padding: 0 4px; }
.ws-msg.user .ws-msg-edited { text-align: right; }

/* REGENERATE: superseded response — dimmed, dashed border, labeled. */
.ws-msg.previous { opacity: .55; }
.ws-msg.previous .ws-msg-bubble { border-style: dashed; box-shadow: none; }
.ws-msg-prev-label {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-faint); padding: 0 4px;
}

/* Artifact chips inside assistant bubbles */
.ws-artifact-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ws-artifact-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  background: var(--paper); border: 1px solid var(--rule);
  cursor: pointer; transition: all .14s ease; font-size: 13px; color: var(--ink-soft);
}
.ws-artifact-chip:hover { border-color: var(--heritage-gold); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.ws-artifact-chip-icon { font-size: 15px; }
.ws-artifact-chip-title { font-weight: 600; color: var(--ink-strong); }
.ws-artifact-chip-open { color: var(--heritage-red); font-weight: 600; }

/* Composer */
.ws-composer-wrap { padding: 12px 24px 18px; position: relative; }   /* relative: anchors .ws-catchup */
.ws-composer {
  max-width: 820px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 10px;
  padding: 10px 10px 10px 16px;
  background: var(--warm-white);
  border: 1px solid var(--rule); border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  transition: border-color .14s ease, box-shadow .14s ease;
}
.ws-composer:focus-within { border-color: var(--heritage-gold); box-shadow: var(--shadow), 0 0 0 3px var(--rule-gold); }
.ws-input {
  flex: 1 1 auto; resize: none; border: none; background: transparent;
  font-family: var(--font-sans); font-size: 15px; line-height: 1.5;
  color: var(--ink); max-height: 200px; padding: 6px 0;
}
.ws-input:focus { outline: none; }
/* Model selector (wired 2026-07-06) — minimal Claude-style picker in the
   composer row, left of the send button. Subtle ghost trigger + popup listbox.
   Slot stays hidden until the catalog loads with ≥2 options. */
.ws-model-slot { flex: 0 0 auto; display: flex; align-items: center; position: relative; align-self: flex-end; }
.ws-model-slot[hidden] { display: none; }
.ws-model-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 9px; margin-bottom: 3px;
  background: transparent; border: none; border-radius: 8px; cursor: pointer;
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  color: var(--ink-mute); white-space: nowrap;
  transition: background .14s ease, color .14s ease;
}
.ws-model-btn svg { stroke: currentColor; opacity: .7; }
.ws-model-btn:hover { background: var(--eggshell-shade); color: var(--ink); }
.ws-model-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold); }
.ws-model-menu {
  position: absolute; bottom: calc(100% + 10px); right: 0; z-index: 40;
  min-width: 236px; max-width: 300px; padding: 5px;
  background: var(--eggshell-bright, #fff); border: 1px solid var(--eggshell-deep);
  border-radius: 12px; box-shadow: var(--shadow), 0 10px 28px rgba(0,0,0,.10);
}
.ws-model-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; background: transparent; border: none; border-radius: 8px;
  cursor: pointer; text-align: left; font-family: var(--font-sans);
  transition: background .12s ease;
}
.ws-model-opt:hover { background: var(--eggshell-shade); }
.ws-model-opt.active { background: var(--eggshell-deep); }
.ws-model-opt-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ws-model-opt-name {
  font-size: 13px; font-weight: 600; color: var(--ink-strong);
  display: flex; align-items: center; gap: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-model-opt-desc {
  font-size: 11.5px; color: var(--ink-mute); line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-model-default-tag {
  flex: 0 0 auto; font-size: 9.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--heritage-gold);
  border: 1px solid var(--rule-gold); border-radius: 999px; padding: 1px 6px;
}
.ws-model-opt-check { flex: 0 0 auto; stroke: var(--heritage-red); }

.ws-send {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--heritage-red); color: #fff; border: none; cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
}
.ws-send svg { stroke: #fff; }
.ws-send:hover:not(:disabled) { background: var(--heritage-red-deep); }
.ws-send:disabled { background: var(--eggshell-deep); cursor: not-allowed; opacity: .8; }
.ws-send:disabled svg { stroke: var(--ink-faint); }
/* STOP BUTTON: streaming mode — same slot, Heritage Red with a soft pulse so
   it reads as an active control. The ■ icon uses fill (not stroke). */
.ws-send.ws-send-stop { background: var(--heritage-red); cursor: pointer; animation: ws-stop-pulse 1.6s ease-in-out infinite; }
.ws-send.ws-send-stop svg { fill: #fff; stroke: none; }
.ws-send.ws-send-stop:hover { background: var(--heritage-red-deep); }
@keyframes ws-stop-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(204, 0, 0, .35); }
  50%      { box-shadow: 0 0 0 6px rgba(204, 0, 0, 0); }
}
.ws-composer-hint { max-width: 820px; margin: 8px auto 0; text-align: center; font-size: 11.5px; color: var(--ink-faint); }
/* QA-GAP #3 (2026-06-06): composer length hint. Subtle remaining-count note as
   the user nears the 4000-char cap; turns Heritage Red once the cap is hit so
   the maxlength truncation reads as intentional, not a silent drop. */
.ws-len-hint { max-width: 820px; margin: 6px auto 0; text-align: center; font-size: 11.5px; color: var(--ink-mute); }
.ws-len-hint[hidden] { display: none; }
.ws-len-hint.over { color: var(--heritage-red); font-weight: 600; }

/* Attach button (📎) — left of the textarea, mirrors .ws-send sizing but ghost-styled. */
.ws-attach {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; align-self: flex-end;
  background: transparent; color: var(--ink-mute);
  border: none; cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.ws-attach svg { stroke: currentColor; }
.ws-attach:hover { background: var(--eggshell-shade); color: var(--heritage-red); }
.ws-attach:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold); }

/* Web-search toggle (🌐) — mirrors .ws-attach; .on = active (search enabled). */
.ws-websearch {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; align-self: flex-end;
  background: transparent; color: var(--ink-mute);
  border: none; cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.ws-websearch svg { stroke: currentColor; }
.ws-websearch:hover { background: var(--eggshell-shade); color: var(--heritage-red); }
.ws-websearch:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold); }
.ws-websearch.on {
  background: color-mix(in srgb, var(--heritage-red) 12%, transparent);
  color: var(--heritage-red);
}
.ws-websearch.on:hover { background: color-mix(in srgb, var(--heritage-red) 18%, transparent); }
/* WEB SEARCH × MODEL (2026-07-06): non-Claude model selected → toggle greys out
   (disabled, not hidden) so users know the feature exists. Tooltip explains. */
.ws-websearch:disabled,
.ws-websearch.unavailable {
  color: color-mix(in srgb, var(--ink-mute) 45%, transparent);
  background: transparent;
  cursor: not-allowed;
  opacity: .55;
}
.ws-websearch:disabled:hover,
.ws-websearch.unavailable:hover { background: transparent; color: color-mix(in srgb, var(--ink-mute) 45%, transparent); }

/* Web-search result UI: "searched the web" indicator + numbered Sources list,
   rendered under an assistant message that used live search. */
.ws-search-meta { margin-top: 10px; }
.ws-search-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-mute);
  padding: 3px 8px; border-radius: 999px;
  background: var(--eggshell-shade);
}
.ws-search-globe { font-size: 12px; line-height: 1; }
.ws-sources { margin-top: 8px; }
.ws-sources-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-mute); font-weight: 600; margin-bottom: 4px;
}
.ws-sources-list { margin: 0; padding-left: 18px; }
.ws-sources-list li { font-size: 13px; line-height: 1.5; margin: 2px 0; }
.ws-sources-list a { color: var(--heritage-red); text-decoration: none; word-break: break-word; }
.ws-sources-list a:hover { text-decoration: underline; }
/* OWNED WEB SEARCH (P1/P2, 2026-08-07) — richer citation fields.
   Only rendered when AIOP owned the retrieval; an Anthropic-backed citation has
   neither element, so these rules are inert on the default backend. */
.ws-sources-list .ws-source-meta {
  display: inline; margin-left: 6px; font-size: 11px;
  color: var(--text-muted, #6b7280); white-space: nowrap;
}
/* A quote is EVIDENCE, so it reads as a quotation rather than as body copy —
   and only ever appears for confidence 'quoted'/'extracted' (see chat.js §3.1).
   The left rule is the visual promise that this text is verbatim from the page. */
.ws-sources-list .ws-source-quote {
  margin: 4px 0 6px; padding: 4px 0 4px 10px;
  border-left: 2px solid var(--gold, #d4a843);
  font-size: 12px; line-height: 1.5; font-style: italic;
  color: var(--text-secondary, #4b5563);
  /* Long unbroken URLs/CJK strings in a quote must not blow out the bubble. */
  overflow-wrap: anywhere;
}

/* MODEL HONESTY (A2/B5/B9, 2026-08-07): rendered ONLY when the model that
   actually served a deliverable differs from the one the picker showed — a
   cross-provider fallback, a capability downgrade, or a thread pinned to a
   model no longer in the catalog. A clean run renders nothing at all.
   Gold (advisory), not red (error): the work succeeded, the attribution just
   is not what the user chose. */
.ws-model-route {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 10px; padding: 8px 10px;
  border: 1px solid var(--rule-gold);
  border-radius: 8px;
  background: color-mix(in srgb, var(--rule-gold) 12%, transparent);
}
.ws-model-route-icon { font-size: 12px; line-height: 1.5; color: var(--gold, #D4A843); flex: none; }
.ws-model-route-body { min-width: 0; }
.ws-model-route-line { font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.ws-model-route-line + .ws-model-route-line { margin-top: 3px; }
/* Standalone notice row (thread opened on an unavailable model) — no avatar,
   no bubble chrome; the banner IS the message. */
.ws-msg.assistant.notice { display: block; padding: 0; margin: 8px 0; }
.ws-msg.assistant.notice .ws-model-route { margin-top: 0; }
/* Picker button warns when the label had to be substituted (B9). */
.ws-model-btn.substituted { color: var(--ink); }
.ws-model-btn-warn { font-size: 11px; line-height: 1; color: var(--gold, #D4A843); }

/* Queued-attachment strip — chips above the input row inside the composer card. */
.ws-attachments {
  max-width: 820px; margin: 0 auto 8px;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.ws-attachments[hidden] { display: none; }
.ws-attachment-chip {
  display: inline-flex; align-items: center; gap: 7px;
  max-width: 260px;
  padding: 6px 8px 6px 10px;
  background: var(--warm-white);
  border: 1px solid var(--rule); border-radius: 10px;
  font-size: 12.5px; color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}
.ws-attachment-chip-icon { font-size: 14px; flex: 0 0 auto; }
.ws-attachment-chip-name {
  font-weight: 600; color: var(--ink-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.ws-attachment-chip-size { color: var(--ink-faint); flex: 0 0 auto; }
.ws-attachment-chip-remove {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 18px; height: 18px; margin-left: 2px;
  background: transparent; border: none; border-radius: 50%;
  color: var(--ink-mute); font-size: 15px; line-height: 1; cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.ws-attachment-chip-remove:hover { background: rgba(204,0,0,0.10); color: var(--heritage-red); }

/* Drag-drop overlay — covers the chat region while files are dragged over it. */
.ws-main { position: relative; }   /* anchor the absolute overlay to the chat column */
.ws-drop-overlay {
  position: absolute; inset: 0; z-index: 30;
  display: none; align-items: center; justify-content: center;
  background: rgba(255,253,248,0.86);
  backdrop-filter: blur(3px);
  pointer-events: none;
}
.ws-drop-overlay.active { display: flex; animation: ws-drop-in .18s ease; }
@keyframes ws-drop-in { from { opacity: 0; } to { opacity: 1; } }
.ws-drop-overlay-inner {
  text-align: center;
  padding: 32px 40px;
  border: 2px dashed var(--heritage-gold); border-radius: var(--radius-lg);
  background: var(--warm-white); box-shadow: var(--shadow-lg);
}
.ws-drop-overlay-icon { font-size: 34px; color: var(--heritage-red); }
.ws-drop-overlay-text {
  font-family: var(--font-serif); font-size: 20px; color: var(--ink-strong);
  margin-top: 6px;
}
.ws-drop-overlay-sub { font-size: 12.5px; color: var(--ink-mute); margin-top: 6px; }

/* ---------------- Resizer + Artifacts pane ------------------------- */
/* DRAG-RESIZE (rebuilt 2026-07-28) ──────────────────────────────────
   ONE handle drives BOTH columns — --ws-split sizes the chat track and the
   artifacts track is minmax(420px, 1fr), so dragging this widens one and
   narrows the other. There is deliberately NO second resizer: the chat column
   being "drag-resizable" is this same handle. (Kevin 2026-07-28 asked for both
   sides; both sides already move — what was missing was the AFFORDANCE.)

   The visual line stays a crisp 6px, but ::before extends the POINTER target
   ±4px either side (14px effective) so it is actually grabbable, and ::after
   paints a gold grip bar so it reads as a handle rather than a border. */
.ws-resizer {
  grid-row: 1;
  position: relative;
  cursor: col-resize;
  /* AT REST the handle should read as a QUIET seam, not a bright stripe. It was
     `--rule-soft`, which in dark mode remaps to --border-light (#2D3044) —
     LIGHTER than the two panels it separates (~#191C25), so the divider glowed
     as a bright vertical bar right through the header band and re-created the
     "two colliding planes" impression the band fix just removed. A low-alpha ink
     wash tracks the theme automatically: it darkens a light surface and barely
     lifts a dark one, in both cases reading as a seam rather than a feature.
     The gold hover/drag state below is where the handle becomes prominent —
     that is the affordance, and it should only appear on intent.
     The flat --rule-soft declaration first is the fallback for any engine
     without color-mix(); Chromium 144+ (our baseline) takes the second. */
  background: var(--rule-soft);
  background: color-mix(in srgb, var(--ink-faint) 22%, transparent);
  transition: background .12s ease;
  /* Never let the 6px track be squeezed away or grow. */
  min-width: var(--ws-resizer-w);
  /* The handle must stay hit-testable above the panes it separates (the
     artifacts pane paints a border-left right against it). */
  z-index: 2;
  /* No text selection / no native touch panning while dragging the handle. */
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
/* CARRY THE HEADER RULE ACROSS THE HANDLE (2026-07-28) ───────────────────
   With both bars now the same height, the 1px header rule ran to the edge of
   each column but STOPPED for the 6px resizer track, leaving a small gap in
   what should read as one continuous line across the whole band. Painting the
   same 1px rule on the handle at exactly --ws-head-h closes it, so the band
   reads as unbroken while the handle stays independently draggable. Only while
   artifacts are open (the handle is display:none otherwise). */
.ws-root.artifacts-open .ws-resizer {
  /* A 1px solid slab of --rule, sized to 100%x1px and positioned so it lands
     exactly on the header rule's row. The base `background` (the quiet seam
     wash) still paints underneath as background-color. */
  background-image: linear-gradient(var(--rule), var(--rule));
  background-repeat: no-repeat;
  background-size: 100% 1px;
  background-position: 0 calc(var(--ws-head-h) - 1px);
}
/* Hover/drag paints gold over the whole track — drop the rule carry so the
   affordance is a single clean gold bar, not a bar with a seam in it. */
.ws-resizer:hover, .ws-resizer:focus-visible,
.ws-root.ws-resizing .ws-resizer { background-image: none; }

/* Widened invisible hit area — does NOT change the rendered 6px line. */
.ws-resizer::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -4px; right: -4px;
}
/* Grip bar: hidden at rest, gold on hover/focus/drag. The affordance that was
   missing — previously the handle was an invisible 6px mystery strip. */
.ws-resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 28px;
  transform: translate(-50%, -50%);
  border-radius: 2px;
  background: var(--ink-faint);
  opacity: 0;
  transition: opacity .14s ease, height .14s ease, background .14s ease;
}
.ws-resizer:hover,
.ws-resizer:focus-visible,
.ws-root.ws-resizing .ws-resizer { background: var(--heritage-gold); outline: none; }
.ws-resizer:hover::after,
.ws-resizer:focus-visible::after,
.ws-root.ws-resizing .ws-resizer::after {
  opacity: 1;
  height: 42px;
  background: var(--warm-white);
}
.ws-resizer:focus-visible { box-shadow: 0 0 0 3px var(--rule-gold); }

/* WHILE DRAGGING (class set by wireResizer on .ws-root) ──────────────────
   Applied to the ROOT rather than document.body so teardown is a single class
   removal and we never clobber a pre-existing inline body cursor/user-select. */
.ws-root.ws-resizing { cursor: col-resize; user-select: none; -webkit-user-select: none; }
/* CRITICAL: an artifact's sandboxed <iframe> swallows pointer events, which
   killed the drag the moment the cursor crossed into the artifact pane. Pointer
   capture in JS is the primary fix; this is belt-and-braces (and also stops a
   chart tooltip firing mid-drag). Only while dragging. */
.ws-root.ws-resizing .ws-artifacts-pane iframe,
.ws-root.ws-resizing .ws-artifacts-pane .artifact-render,
.ws-root.ws-resizing .ws-thread { pointer-events: none; }
/* Suppress the pane's slide-in animation during a drag — it must not re-run. */
.ws-root.ws-resizing .ws-artifacts-pane { animation: none; }

.ws-artifacts-pane {
  grid-row: 1;
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--warm-white);
  /* NOTE: no border-left here on desktop — the nested .artifacts-panel already
     paints one (34-artifacts.css). Two nested 1px rules rendered a 2px seam
     with a sliver of warm-white between them, which read as the artifacts
     chrome cutting into the divider. The pane keeps the border ONLY in the
     fallback/mobile cases handled below. */
  animation: ws-slide-in .22s ease;
}
/* Fallback chrome (Agent B absent) has no .artifacts-panel, so the pane must
   carry the rule itself. :not(:has()) keeps the healthy path single-bordered.
   Chromium 144+ baseline — :has() is already relied on elsewhere in this file.
   DESKTOP-SCOPED on purpose: :has() specificity resolves to its most specific
   argument, so an unscoped rule here would OUTRANK the ≤900px
   `.ws-root.artifacts-open .ws-artifacts-pane { border-left: none }` overlay
   rule and paint a stray 1px seam down the left of the mobile full-screen
   artifact overlay. Keeping it inside min-width:901px makes that impossible. */
@media (min-width: 901px) {
  .ws-artifacts-pane:not(:has(> .ws-artifacts-body > .artifacts-panel)) {
    border-left: 1px solid var(--rule);
  }
}
@keyframes ws-slide-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
/* Fallback header — held to the SAME shared band as .ws-topbar and
   .artifacts-header so the fallback path cannot reintroduce the intersect. */
.ws-artifacts-head {
  box-sizing: border-box;
  height: var(--ws-head-h);
  min-height: var(--ws-head-h);
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.ws-artifacts-tabs { flex: 1 1 auto; display: flex; gap: 6px; overflow-x: auto; }
.ws-artifact-tab {
  padding: 6px 12px; border-radius: 8px 8px 0 0;
  background: transparent; border: 1px solid transparent; border-bottom: none;
  color: var(--ink-mute); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.ws-artifact-tab.active { background: var(--warm-white); border-color: var(--rule); color: var(--ink-strong); font-weight: 600; }
.ws-artifacts-close {
  flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px;
  background: transparent; border: none; border-radius: 6px; color: var(--ink-mute); cursor: pointer;
}
.ws-artifacts-close:hover { background: var(--eggshell-shade); color: var(--heritage-red); }
/* Host for Agent B's ArtifactsPanel. The panel owns its OWN header/body/padding
   + border, so this wrapper must be flush (no padding) and a flex column so the
   inner .artifacts-panel can fill the full height (kills the dead-space gap +
   the 16px inset that made charts/tables feel cramped against the edge).
   The fallback renderer (.ws-artifacts-head/-view) re-adds its own padding. */
.ws-artifacts-body { flex: 1 1 auto; display: flex; flex-direction: column; overflow: hidden; padding: 0; min-height: 0; min-width: 0; }
.ws-artifacts-body > .artifacts-panel { flex: 1 1 auto; min-height: 0; }
/* Fallback-only chrome (Agent B absent): header pins, view scrolls + padded. */
.ws-artifacts-body > .ws-artifact-view { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px; }
.ws-artifacts-body > .ws-artifacts-head { flex: 0 0 auto; }
.ws-artifacts-empty { color: var(--ink-mute); font-size: 13px; text-align: center; padding: 40px 16px; }

/* Built-in fallback artifact view (used only if Agent B renderer absent) */
.ws-artifact-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ws-artifact-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-mute); font-weight: 600; }
.ws-artifact-tool-spacer { flex: 1 1 auto; }
.ws-artifact-action {
  padding: 5px 12px; border-radius: 6px; border: 1px solid var(--rule);
  background: var(--warm-white); color: var(--ink-soft); font-size: 12.5px; cursor: pointer;
}
.ws-artifact-action:hover { border-color: var(--heritage-gold); color: var(--ink-strong); }
.ws-artifact-notice { font-size: 12.5px; color: var(--warning); margin-bottom: 8px; }
.ws-artifact-code { background: #1f1b17; color: #f4ecde; padding: 14px; border-radius: var(--radius); overflow: auto; font-size: 12.5px; }
.ws-artifact-code code { font-family: ui-monospace, Menlo, Consolas, monospace; }


/* ---- Ask-AIOP FAB collides with the workspace takeover -------------
   The app's floating Ask-AIOP (.agent-fab) sits at z-index 9000, above
   the workspace (z-index 50), and overlaps the composer + footer on
   mobile. The workspace ALREADY embeds Ask AIOP chat, so a second
   floating chat entry point is redundant — keep .agent-fab hidden.
   (:has supported in the app's Chromium 144+ baseline.)

   FEEDBACK FAB IS DELIBERATELY *NOT* HIDDEN (2026-07-31, Kevin).
   Regression history: this block used to hide .feedback-fab too, which
   left users with NO way to file a bug/idea from a full-screen module —
   per-message 👍/👎 thumbs are AI-response rating, not the feedback
   drawer. Feedback is a global escape hatch and must survive every
   takeover. If you re-add `.feedback-fab` here, tests/feedback-fab-
   fullscreen.test.js will fail. Reposition it instead (see below). */
body:has(.ws-root) .agent-fab,
body:has(.ws-root) .agent-fab-tooltip,
body.ws-open .agent-fab,
body.ws-open .agent-fab-tooltip {
  display: none !important;
}

/* Ask-AIOP is hidden on the takeover, so the feedback FAB takes over the
   primary bottom-right slot (its default `right: 92px` only exists to sit
   LEFT of the 56px agent FAB). Keeps "bottom right" literally true.

   ── FAB vs COMPOSER OVERLAP (2026-08-03, Kevin) ────────────────────────
   KEVIN (verbatim): "Feedback FAB on AI Workspace placement needs work —
   overlaps the chat bar field and send button."

   The previous comment here claimed `right: 24px` "clears the centered,
   max-width:820px composer". That was only ever true on WIDE desktops. The
   composer is `max-width: 820px; margin: 0 auto` inside the CHAT COLUMN, not
   the viewport, so as the column narrows (small laptop, rail open, artifacts
   split, any phone) the composer stops being centered-with-slack and reaches
   the full column width — straight under a FAB parked at bottom-right.

   Measured overlap BEFORE this fix (harness: scratch/aiop-ws-feedback-fab-
   20260803/measure.js, real main.css + the index.js composer markup) — the
   FAB covered the SEND BUTTON, not just the card:
     1440px  send∩0px²      (the only widths the old comment described)
     1280px  send∩0px²
     1150px  send∩588px²   composer∩1248px²
     1024px  send∩777px²   composer∩1536px²   ← worst desktop
      900px  send∩644px²   composer∩1184px²
      640px  send∩574px²   composer∩882px²
      390px  send∩656px²   composer∩966px²    ← phone
   A 38-44px send button losing ~600-780px² to a FAB at z-index 9001 means the
   FAB literally eats the tap. Horizontal dodging cannot fix this: at ≤900px
   the composer owns the full width, so there is no free right gutter left.

   FIX = lift the FAB ABOVE the composer's control row instead.
   Why a STATIC offset is provably safe: `.ws-composer` is `align-items:
   flex-end`, so send / attach / model are BOTTOM-anchored. Growing the
   textarea (to its 200px max) extends the card UPWARD only — the distance
   from the viewport bottom to the send button's TOP edge does NOT depend on
   how much the user has typed (verified rows=1/2/4/8/12 at every breakpoint;
   measure-grow.js). It depends only on which OPTIONAL ROWS are present:

     rows below the control row      send TOP from viewport bottom
     ────────────────────────────  ─────────────────────────────
     .ws-composer-hint only          desktop 93px · ≤900px 90px
     + .ws-len-hint visible          desktop 117px · ≤900px 114px   ← WORST

   .ws-len-hint is the trap: it is `hidden` until the user nears the 4000-char
   cap, then un-hides and pushes the whole control row UP by ~24px. An offset
   tuned against the quiet state re-collides with SEND exactly when the user is
   mid-long-message (measured: send∩393px² at 1024px). .ws-attachments does NOT
   move send (it stacks ABOVE the control row inside the card).

   So --ws-fab-clear is sized for the WORST case (len-hint visible), not the
   common one, and is composed from the same values that build that stack:
     .ws-composer-wrap bottom pad 18px + .ws-composer pad 10px
     + .ws-send 38px + .ws-len-hint row ~24px + 12px visual gap = 102px
   The FAB's own `bottom` adds the base 28px inset on top, so its box clears
   the control row in EVERY composer state (quiet, len-hint, attachments,
   grown textarea). Tooltip tracks it via the same token.
   Guarded by tests/feedback-fab-placement.test.js (source contract) +
   measure-grown-overlap.js (40 geometry states). Do NOT "simplify" this back
   to a bare bottom-right FAB, and do NOT drop the len-hint allowance. */
body:has(.ws-root),
body.ws-open {
  /* 18px wrap pad + 10px composer pad + 38px send + 24px len-hint + 12px gap */
  --ws-fab-clear: 102px;
}
body:has(.ws-root) .feedback-fab,
body.ws-open .feedback-fab {
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(28px + var(--ws-fab-clear) + env(safe-area-inset-bottom, 0px));
  z-index: 9001;                   /* above .ws-root (50) + rail drawer (60) */
}
body:has(.ws-root) .feedback-fab-tooltip,
body.ws-open .feedback-fab-tooltip {
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(90px + var(--ws-fab-clear) + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 700px) {
  /* Mirror the mobile .agent-fab inset convention it replaces. */
  body:has(.ws-root) .feedback-fab,
  body.ws-open .feedback-fab {
    right: max(16px, env(safe-area-inset-right, 0px));
  }
  body:has(.ws-root) .feedback-fab-tooltip,
  body.ws-open .feedback-fab-tooltip {
    right: max(16px, env(safe-area-inset-right, 0px));
  }
}
/* ≤700px the send button grows to the 44px Apple HIG target while the wrap pad
   tightens to max(14px, 12px+safe-area) and the composer pad drops to 8px — the
   two changes nearly cancel (measured send top 114px vs desktop 117px), so the
   same clearance holds. Declared explicitly rather than inherited so the mobile
   arithmetic is auditable on its own terms, and so retuning the mobile composer
   doesn't silently ride on a desktop constant:
     14px wrap + 8px composer pad + 44px send + 24px len-hint + 12px gap = 102px
   The FAB's own env(safe-area-inset-bottom) still handles the home indicator.
   NOTE: intentionally 700px, NOT 900px — a `(max-width: 900px)` block opened
   HERE would become the FIRST match for mediaBlock() in
   tests/workspace-mobile-polish.test.js and shadow the real RESPONSIVE block
   below (9 unrelated mobile tests fail). See the note under this block. */
@media (max-width: 700px) {
  body:has(.ws-root),
  body.ws-open {
    /* 14px wrap pad + 8px composer pad + 44px send + 24px len-hint + 12px gap */
    --ws-fab-clear: 102px;
  }
}
/* NOTE: the ≤900px rail-open exception for this FAB lives at the END of this
   file, NOT here. tests/workspace-mobile-polish.test.js resolves the mobile
   contract via mediaBlock(css, '(max-width: 900px)'), which takes the FIRST
   matching @media block — opening one above the RESPONSIVE section below
   hijacks that lookup and fails 9 unrelated mobile tests. */

/* ===================================================================
   RESPONSIVE — phones + tablets
   Conventions matched from 97-mobile-optimize.css / 03-shell.css:
   breakpoints 900/640/480/380, env(safe-area-inset-*), 100dvh,
   16px inputs (no iOS zoom), 44px tap targets, (hover:none) touch.
   Desktop layout is untouched — everything below lives in @media.
   =================================================================== */

/* Mobile scrim behind the off-canvas rail drawer. Desktop: never shown. */
.ws-scrim { display: none; }

/* Mobile Chat|Artifact view toggle in the topbar. Desktop: never shown. */
.ws-view-toggle { display: none; }

/* ---- Tablet + phone: ≤900px (rail becomes an off-canvas drawer) ---- */
@media (max-width: 900px) {
  /* Single column; chat fills the viewport. Rail + artifacts overlay it. */
  .ws-root,
  .ws-root.artifacts-open {
    grid-template-columns: 1fr;
  }

  /* Left rail → off-canvas drawer sliding in from the left, with a scrim.
     Hidden (translated off-screen) until `.rail-open`. */
  .ws-root .ws-rail {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(86vw, 320px);
    z-index: 60;
    display: flex;                      /* override desktop display:none-on-collapse */
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
    /* Respect the notch on the drawer's own top padding. */
    padding-top: env(safe-area-inset-top, 0px);
    will-change: transform;
  }
  .ws-root.rail-open .ws-rail { transform: translateX(0); }
  /* rail-collapsed is a desktop-only concept; on mobile the drawer model wins. */
  .ws-root.rail-collapsed .ws-rail { display: flex; }

  /* Scrim — covers the chat while the drawer is open; tap to dismiss. */
  .ws-scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(26,22,18,0.62);
    z-index: 55;
    animation: ws-scrim-in .18s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .ws-scrim[hidden] { display: none; }

  /* Topbar: respect the notch; keep the hamburger a comfortable tap target.
     MOBILE GUARD (2026-07-28): the desktop shared-band token gives .ws-topbar a
     FIXED height. On mobile the bar must grow by env(safe-area-inset-top) for
     the notch and by the 44px tap targets inside it, so the fixed height is
     released back to auto here. The ≤900px pane is a fixed overlay offset by
     --ws-topbar-h (measured live in JS), NOT by --ws-head-h, so the two
     systems stay independent and the drawer model is unchanged. */
  .ws-topbar {
    height: auto;
    min-height: 0;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
    gap: 8px;
    /* EXPLICIT (2026-07-28): nowrap was already the flex default, but it is
       load-bearing here — a wrapped topbar would put the Chat|Artifact toggle on
       a second row while --ws-topbar-h (measured in JS) had already positioned
       the overlay against the one-row height, covering the toggle. Declaring it
       makes the squeeze order a decision instead of an accident. */
    flex-wrap: nowrap;
  }
  /* TOUCH TARGET FLOORS (2026-07-28) ──────────────────────────────────
     Every one of these is a flex CHILD, and flex items default to
     `flex-shrink: 1` — so a declared `width` is only a STARTING size, not a
     floor. Measured 2026-07-28 with an artifact open (which adds the ~129px
     Chat|Artifact toggle to the bar): .ws-rail-toggle shrank to 31.1px @375 and
     33.8px @390, i.e. the only affordance that opens the conversation drawer
     dropped ~25% under Apple's 44px HIG minimum exactly when the bar got busy.
     `flex: 0 0 auto` makes the declared size real; the title yields instead. */
  .ws-rail-toggle {
    width: 44px; height: 44px;
    flex: 0 0 auto;
  }
  .ws-exit-btn,
  .ws-export-trigger,
  .ws-research-trigger,
  .ws-gov-badge,
  .ws-view-toggle { flex: 0 0 auto; }
  /* The title is the ONE element that should absorb the squeeze. min-width:0 lets
     it actually shrink below its content size (a flex item's automatic minimum
     size is otherwise min-content, which is what forced the controls to shrink
     instead), and the ellipsis keeps the truncation legible rather than clipped. */
  .ws-topbar-title {
    font-size: 16px;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
  }
  .ws-brand-full,
  .ws-brand-short { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Exit: collapse to a 44×44 chevron-only tap target (Apple HIG). Topbar
     padding-top already carries env(safe-area-inset-top). */
  .ws-exit-btn {
    min-width: 44px; height: 44px; padding: 0; justify-content: center;
    border-radius: 12px;
  }
  .ws-exit-label { display: none; }
  /* The governance badge text is long; shrink it so the topbar never wraps. */
  .ws-gov-badge { padding: 5px 9px; font-size: 11px; }
  /* QA-GAP #2: on phones use the compact "Governed" label instead of the full
     "Private & governed" string, which wrapped to two lines at 390px. */
  .ws-gov-label-full { display: none; }
  .ws-gov-label-short { display: inline; }

  /* Artifacts pane → full-screen overlay (not a squished split). The shell
     stacks rail|chat(1fr)|resizer|artifacts in one grid column; force the
     artifacts pane to cover the chat as a fixed overlay instead. */
  .ws-resizer { display: none !important; }
  .ws-root.artifacts-open .ws-artifacts-pane {
    position: fixed;
    /* Start BELOW the topbar so the Chat|Artifact toggle + brand bar stay
       reachable (don't bury the only way back to chat under the overlay). */
    top: var(--ws-topbar-h, 56px);
    left: 0; right: 0; bottom: 0;
    z-index: 40;                        /* above chat, below rail drawer + scrim */
    border-left: none;
    /* Slide UP into place (the desktop translateX slide-in reads wrong for a
       full-screen mobile overlay). Overrides the .ws-artifacts-pane animation. */
    animation: ws-art-slide-up .24s cubic-bezier(.32,.72,0,1);
    box-shadow: 0 -8px 24px rgba(26,22,18,0.10);
  }
  /* Overlay body: momentum scroll + home-indicator clearance so the last row
     of a chart/table/code clears the gesture bar.
     FLOOR (2026-07-28): a bare env() resolves to 0px on every device that does
     not report an inset — non-notched Android, iPad, narrow desktop Safari, and
     any PWA where the inset is withheld. Measured 0px in Chromium. The last row
     of a table then sits flush against the viewport edge with nothing under it.
     max() gives a real base gap and still grows for the home indicator, which is
     the same pattern .ws-composer-wrap already uses — the artifact body simply
     never got parity. */
  .ws-root.artifacts-open .ws-artifacts-pane .artifacts-body {
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
  /* Lift the topbar above the artifact overlay + pin it while artifacts are open
     so the toggle is always tappable. */
  .ws-root.artifacts-open .ws-topbar {
    position: relative;
    z-index: 42;
  }

  /* Single-view switching on mobile: chat OR artifact, never both.
     Default = chat visible, artifact hidden until `.show-artifact`. */
  .ws-root.artifacts-open.show-artifact .ws-artifacts-pane { display: flex; }
  .ws-root.artifacts-open:not(.show-artifact) .ws-artifacts-pane { display: none; }
  /* Chat (.ws-main) always stays mounted; it's simply behind the overlay.
     We do NOT display:none it (that broke focus/scroll); the overlay covers it. */

  /* Show the Chat|Artifact toggle when an artifact is open (JS un-hides it). */
  .ws-root.artifacts-open .ws-view-toggle:not([hidden]) {
    display: inline-flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;            /* the two tabs sit side-by-side, never stack */
    gap: 2px;
    background: var(--eggshell-shade);
    border: 1px solid var(--rule);
    border-radius: 999px;
    padding: 2px;
    white-space: nowrap;
  }
  /* When the toggle is showing (artifact open on mobile), the gov badge would
     crowd the topbar and force the toggle to wrap/stack — hide it to reclaim
     width. The privacy posture is still communicated on the chat view. */
  .ws-root.artifacts-open .ws-gov-badge { display: none; }
  .ws-view-tab {
    appearance: none; border: none; background: transparent;
    font-family: var(--font-sans); font-size: 12.5px; font-weight: 600;
    color: var(--ink-mute); padding: 6px 14px; border-radius: 999px;
    /* 40px + the wrapper's 2px padding top/bottom = a 44px tap target for the
       single most important mobile control in the workspace (the only way back
       to the conversation while an artifact is open). Was 34px. */
    cursor: pointer; min-height: 40px; white-space: nowrap; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
  }
  .ws-view-tab.active { background: var(--warm-white); color: var(--ink-strong); box-shadow: var(--shadow-sm); }

  /* Composer: pin comfortably above the home indicator; bigger send target. */
  .ws-composer-wrap {
    /* max() guarantees a comfortable base gap even when the safe-area inset is 0
       (non-notched devices / browser chrome) so the hint never sits flush. */
    padding: 10px 14px max(14px, calc(12px + env(safe-area-inset-bottom, 0px)));
  }
  .ws-composer { padding: 8px 8px 8px 10px; gap: 6px; }
  /* 16px input prevents iOS focus auto-zoom (the workspace set 15px). */
  .ws-input { font-size: 16px; }
  .ws-send { width: 44px; height: 44px; }     /* Apple HIG tap target */
  .ws-attach { width: 44px; height: 44px; }   /* Apple HIG tap target */
  .ws-composer-hint { font-size: 11px; }

  /* Message column uses full width on narrow screens. */
  .ws-messages { padding: 18px 16px 32px; gap: 18px; }
  .ws-greeting { padding: 36px 18px; }

  /* Touch: reveal conversation rename/delete actions (no hover on touch). */
  .ws-convo-actions { opacity: 1; }
  .ws-convo-btn { width: 34px; height: 34px; }   /* fat-finger friendly */
}

/* Slide the scrim in. */
@keyframes ws-scrim-in { from { opacity: 0; } to { opacity: 1; } }
/* Mobile artifact overlay: slide up from the bottom. */
@keyframes ws-art-slide-up { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- Phone: ≤640px (tighten chrome + greeting) -------------------- */
@media (max-width: 640px) {
  /* MOBILE POLISH (2026-07-08): single-line compact topbar. At 390px the full
     "LKK AI Workspace" title wrapped to two lines while 4 buttons + the badge
     fought for space. Swap to the short brand, icon-only gov badge, tighter
     gaps/padding, slimmer export/research triggers. */
  .ws-topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .ws-topbar-title { white-space: nowrap; min-width: 0; }
  .ws-brand-full { display: none; }
  .ws-brand-short { display: inline; }
  .ws-export-trigger { padding: 4px; font-size: 1rem; }
  /* (.ws-research-trigger's matching override lives in 40-workspace-research.css
     — that file loads after this one, so the override must live there.) */
  /* Icon-only shield: hide BOTH text labels (the 900px block shows the short
     one). Accessible name lives on the badge's aria-label; tooltip intact. */
  .ws-gov-badge { padding: 6px 7px; gap: 0; }
  .ws-gov-label-short { display: none; }
  /* TRAIN E: floor badge goes dot-only ≤640px. The DOT survives (the accent is
     the fastest floor tell) while the name yields the width — rather than
     hiding the badge outright, which would remove the one signal a dual-floor
     user needs most on a phone, where the switcher chip is also collapsed. */
  .ws-floor-badge { margin-left: 6px; padding: 4px 6px; gap: 0; }
  .ws-floor-name { display: none; }

  /* MOBILE POLISH (2026-07-08): compact composer — tighter chrome so the row
     stays single-line. JS also swaps in a short placeholder ≤640px; the
     ellipsis rule is belt-and-braces so no placeholder ever wraps/stacks. */
  .ws-composer-wrap { padding-left: 10px; padding-right: 10px; }
  .ws-composer { padding: 6px 6px 6px 10px; gap: 4px; }
  .ws-input::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ws-model-btn { padding: 0 6px; font-size: 11px; gap: 4px; }
  .ws-model-btn-label {
    max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  .ws-greeting-mark { width: 60px; height: 60px; margin-bottom: 14px; }
  .ws-greeting-title { font-size: 26px; }
  .ws-greeting-sub { font-size: 15px; margin-bottom: 22px; }
  /* Chips already single-column ≤720px; tighten padding for thumbs. */
  .ws-chip { padding: 13px 14px; min-height: 44px; }

  .ws-msg { gap: 10px; }
  .ws-avatar { width: 28px; height: 28px; }
  .ws-msg-body { max-width: calc(100% - 38px); }
  .ws-msg-bubble { font-size: 14.5px; padding: 11px 14px; }

  /* Artifact overlay body: stay flush (the panel owns its own padding); only
     the fallback view needs the inset. Momentum scroll on the host. */
  .ws-artifacts-body { padding: 0; -webkit-overflow-scrolling: touch; }
  .ws-artifacts-body > .ws-artifact-view { padding: 12px; }
}

/* ---- Small phone: ≤380px (iPhone SE / mini) ----------------------- */
@media (max-width: 380px) {
  .ws-topbar-title { font-size: 15px; }
  .ws-gov-badge { display: none; }            /* reclaim width on the smallest phones */
  .ws-floor-badge { display: none; }          /* ditto — switcher in the shell still names the floor */
  .ws-greeting-title { font-size: 23px; }
  .ws-messages { padding: 14px 12px 28px; }
  .ws-rail { width: min(90vw, 300px); }
}

/* ---- PWA standalone: extra home-indicator clearance --------------- */
@media (display-mode: standalone) {
  .ws-composer-wrap { padding-bottom: max(14px, env(safe-area-inset-bottom, 14px)); }
}

/* ---- Touch devices: kill hover-only affordances ------------------- */
@media (hover: none) and (pointer: coarse) {
  .ws-convo-actions { opacity: 1; }            /* rename/delete always tappable */
  .ws-chip:hover { transform: none; }          /* no sticky hover lift on tap */
  .ws-artifact-chip:hover { transform: none; }
  /* Message actions (copy/regenerate/thumbs) + Send/Stop: ≥44px tap targets. */
  .ws-msg-action,
  .ws-feedback-thumb { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; font-size: 16px; }
  .ws-send { width: 44px; height: 44px; }
}

/* ---- Landscape phones: short viewport — trim vertical greeting ----- */
@media (max-height: 500px) and (orientation: landscape) {
  .ws-greeting { padding: 18px 18px; }
  .ws-greeting-mark { width: 44px; height: 44px; margin-bottom: 8px; }
  .ws-greeting-title { font-size: 20px; margin-bottom: 4px; }
  .ws-greeting-sub { margin-bottom: 14px; }
  .ws-chips { grid-template-columns: repeat(2, 1fr); }   /* use the width */
}

/* ──────────────────────────────────────────────────────────────────
   BRIDGE — "Open in Workspace" carry-over from the Ask-AIOP drawer.
   Carried turns render dimmed (read-only context); a labeled divider
   marks where the fresh workspace session begins.
   ────────────────────────────────────────────────────────────────── */
.ws-msg.carried { opacity: 0.72; }
.ws-msg.carried .ws-msg-bubble { box-shadow: none; }
.ws-carry-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 2px 6px;
  user-select: none;
}
.ws-carry-divider-line {
  flex: 1;
  height: 1px;
  background: var(--eggshell-deep, rgba(0,0,0,0.10));
}
.ws-carry-divider-label {
  flex: 0 0 auto;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ── Long-chat summary notice (budget-longchat-1019) ──────────────────
   Top of a long thread whose older turns are summarized for the model.
   The full transcript still renders below; this only explains the cost/speed
   behaviour and offers a fresh chat seeded with the summary. */
.ws-summary-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 6px 2px 14px;
  padding: 10px 12px;
  border: 1px solid var(--eggshell-deep, rgba(0,0,0,0.10));
  border-radius: 10px;
  background: var(--eggshell, rgba(0,0,0,0.02));
  font-size: 13px;
  color: var(--ink-soft);
}
.ws-summary-icon { flex: 0 0 auto; line-height: 1.4; }
.ws-summary-body { flex: 1 1 auto; min-width: 0; }
.ws-summary-details { margin-top: 6px; }
.ws-summary-details > summary { cursor: pointer; font-size: 12px; }
.ws-summary-text {
  margin-top: 6px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.45;
}
.ws-summary-newchat { flex: 0 0 auto; white-space: nowrap; }
/* Ask AIOP drawer variant (audit F2): the drawer is narrow, so the button
   wraps under the text instead of squeezing it; never shrinks in the
   column-flex message list. */
.agent-summary-banner { flex-wrap: wrap; flex: 0 0 auto; margin: 0 0 4px; }
.agent-summary-banner .ws-summary-newchat { margin-left: 26px; }

/* ── Scroll anchoring: "↓ Catch up" pill (2026-07-06) ─────────────────
   Floats centered above the composer. Hidden (faded + slid down, no pointer
   events) while the chat is pinned to the bottom; chat.js adds .show when the
   user scrolls up during/after generation. */
.ws-catchup {
  position: absolute;
  top: -46px;
  left: 50%;
  z-index: 5;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  color: var(--ink-soft);
  font-size: 13px; font-weight: 600; line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(8px);
  transition: opacity .18s ease, transform .18s ease, border-color .14s ease, color .14s ease;
}
.ws-catchup.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.ws-catchup:hover { border-color: var(--heritage-red); color: var(--ink-strong); }
.ws-catchup-arrow { color: var(--heritage-red); font-weight: 700; }

/* ── Collapsible code blocks (2026-07-06) ─────────────────────────────
   Assistant code fences render inside .ws-code: a header row (language +
   line count toggle, copy button) over a collapsible body. Long blocks
   (>5 lines) start collapsed so non-technical users aren't hit with a wall
   of code. Light theme to match the self-hosted highlight-github.min.css. */
.ws-markdown .ws-code {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin: 0 0 .8em;
  overflow: hidden;
  background: var(--warm-white);
}
.ws-code-header {
  display: flex; align-items: center;
  background: var(--eggshell-shade);
}
.ws-code.expanded .ws-code-header { border-bottom: 1px solid var(--rule-soft); }
.ws-code-toggle {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: none; border: none;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1;
  color: var(--ink-soft);
  cursor: pointer; text-align: left;
}
.ws-code-toggle:hover { color: var(--ink-strong); }
.ws-code-chevron {
  font-size: 9px; color: var(--heritage-red);
  transition: transform .15s ease;
}
.ws-code.expanded .ws-code-chevron { transform: rotate(90deg); }
.ws-code-lang { font-weight: 700; text-transform: capitalize; }
.ws-code-lines { color: var(--ink-faint); }
.ws-code-copy {
  flex: 0 0 auto;
  position: relative;
  padding: 6px 12px;
  background: none; border: none;
  font-size: 13px; line-height: 1;
  cursor: pointer; opacity: .65;
  transition: opacity .14s ease;
}
.ws-code-copy:hover { opacity: 1; }
.ws-code-copy.copied::after {
  content: attr(data-tip);
  position: absolute; right: 0; top: -22px;
  padding: 3px 8px; border-radius: 6px;
  background: var(--ink-strong); color: #fff;
  font-size: 11px; white-space: nowrap;
}
.ws-code-body { display: none; }
.ws-code.expanded .ws-code-body { display: block; }
/* Override the dark .ws-markdown pre theme inside the collapsible wrapper —
   highlight-github.min.css is a light theme. */
.ws-markdown .ws-code pre {
  margin: 0; border-radius: 0;
  background: #faf8f3; color: var(--ink);
  padding: 12px 14px;
}
.ws-markdown .ws-code pre code { color: inherit; }

/* ══════════════════════════════════════════════════════════════════
   FRONTIER POLISH (2026-07-08) — edit banner, image thumbs, shortcuts
   panel, reduced-motion. Timing system: .18s standard micro-interaction,
   .3s overlay entrances.
   ══════════════════════════════════════════════════════════════════ */

/* ── Editing banner: shown above the composer during an edit session ── */
.ws-editing-banner {
  max-width: 820px; margin: 0 auto 8px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--rule-gold);
  border-radius: 10px;
  background: color-mix(in srgb, var(--heritage-gold) 10%, var(--warm-white));
  font-size: 12.5px; color: var(--ink-soft);
  animation: ws-fade-up .18s ease;
}
.ws-editing-banner[hidden] { display: none; }
.ws-editing-banner-icon { font-size: 13px; line-height: 1; }
.ws-editing-banner-label { font-weight: 600; color: var(--ink-strong); }
.ws-editing-banner-hint { color: var(--ink-faint); }
.ws-editing-banner-cancel {
  margin-left: auto;
  background: none; border: none; padding: 2px 8px; border-radius: 6px;
  font-family: var(--font-sans); font-size: 12px; font-weight: 600;
  color: var(--heritage-red); cursor: pointer;
  transition: background .18s ease;
}
.ws-editing-banner-cancel:hover { background: rgba(204,0,0,0.08); }
/* Gold ring on the composer while editing — reads as a distinct mode. */
.ws-composer.ws-editing { border-color: var(--heritage-gold); box-shadow: var(--shadow), 0 0 0 3px var(--rule-gold); }
@keyframes ws-fade-up { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ── Queued image attachments: real thumbnail instead of a generic icon ── */
.ws-attachment-thumb {
  flex: 0 0 auto; width: 28px; height: 28px;
  border-radius: 6px; object-fit: cover;
  border: 1px solid var(--rule);
  background: var(--eggshell-shade);
}

/* ── Keyboard shortcuts panel (? key / composer-hint link) ─────────── */
.ws-shortcuts-overlay {
  position: fixed; inset: 0; z-index: 1300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(26,22,18,0.45);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  animation: ws-drop-in .3s ease;
}
.ws-shortcuts-overlay[hidden] { display: none; }
.ws-shortcuts-card {
  width: min(92vw, 400px);
  padding: 18px 20px 14px;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: ws-pop-in .3s cubic-bezier(.32,.72,0,1);
}
@keyframes ws-pop-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.ws-shortcuts-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ws-shortcuts-title {
  flex: 1 1 auto; margin: 0;
  font-family: var(--font-serif); font-size: 17px; font-weight: 700;
  color: var(--ink-strong);
}
.ws-shortcuts-close {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0;
  background: transparent; border: none; border-radius: 8px;
  font-size: 20px; line-height: 1; color: var(--ink-mute); cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.ws-shortcuts-close:hover { background: var(--eggshell-shade); color: var(--heritage-red); }
.ws-shortcuts-close:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold); }
.ws-shortcut-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--rule-soft);
}
.ws-shortcut-row:first-child { border-top: none; }
.ws-shortcut-label { flex: 1 1 auto; font-size: 13.5px; color: var(--ink-soft); }
.ws-shortcut-keys { display: flex; gap: 4px; flex: 0 0 auto; }
.ws-shortcut-keys kbd {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  font-family: var(--font-sans); font-size: 11.5px; font-weight: 600;
  color: var(--ink-strong);
  background: var(--eggshell-shade);
  border: 1px solid var(--rule); border-bottom-width: 2px;
  border-radius: 5px;
}

/* Discoverability link inside the composer hint. Desktop-only. */
.ws-shortcut-hint {
  background: none; border: none; padding: 0; margin-left: 8px;
  font: inherit; color: var(--ink-faint); cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 2px;
  transition: color .18s ease;
}
.ws-shortcut-hint:hover { color: var(--ink-soft); }
/* No hardware keyboard → no shortcuts UI (phones/tablets/touch). */
@media (max-width: 900px), (hover: none) {
  .ws-shortcut-hint, .ws-shortcuts-overlay { display: none !important; }
}

/* ── Reduced motion: the workspace previously had NO coverage ─────────
   Kill decorative movement wholesale; keep the two "work is happening"
   indicators alive (they carry meaning) in a calmer form. */
@media (prefers-reduced-motion: reduce) {
  .ws-root *, .ws-root *::before, .ws-root *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .ws-spinner { animation: ws-spin 1.4s linear infinite !important; }
  .ws-typing span { animation: none !important; opacity: .6; transform: none; }
  .ws-caret { animation: none !important; opacity: .7; }
  .ws-send.ws-send-stop { animation: none !important; }
  .ws-catchup { transform: translateX(-50%) !important; }
}


/* ── Toast readability inside workspace ──────────────────────── */
/* Toasts render in the body-level #toast-container portal, NOT inside
   the workspace DOM, so `.ws-container ~ .toast-container` (the earlier
   attempt) could never match — `.ws-container` doesn't exist (root class
   is `.ws-root`) and #toast-container is a sibling of #app, not of the
   workspace root. Key off `body.ws-open` instead: renderWorkspace adds
   it on enter, cleanup() removes it on exit, so these rules cover every
   toast shown while the workspace takeover is active. Only bg/text/
   shadow are set so the design-system variant left borders (.success
   green, .error red, .info purple, .warn gold) still show. */
body.ws-open .toast-container .toast {
  background: var(--warm-white, #ffffff);
  color: var(--ink, #1a1a1a);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
[data-theme="dark"] body.ws-open .toast-container .toast {
  background: var(--bg-secondary, #2a2d3a);
  color: var(--text-primary, #e8e8ec);
  border-color: var(--border-light, #3a3d4a);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* ═══════════════════════════════════════════════════════════════════
   NATIVE ARTIFACT DISPLAY 2026-07-20 — in-panel renderers for the
   Layer-B native kinds (spreadsheet / presentation / document) + the
   Create Sheet·Deck·Doc generate entry points. Brand: eggshell paper,
   Heritage Red #CC0000, Gold #D4A843, Playfair titles.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Create chips (greeting screen) ─────────────────────────────── */
.ws-create-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.ws-create-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-mute, #6B6560);
}
.ws-create-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13.5px;
  padding: 8px 14px;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 999px;
  background: var(--warm-white, #FFFDF8);
  color: var(--ink-strong, #1A1410);
  cursor: pointer;
  transition: border-color .14s ease, color .14s ease, box-shadow .14s ease;
}
.ws-create-chip:hover { border-color: var(--heritage-red, #CC0000); color: var(--heritage-red, #CC0000); }
.ws-create-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold, rgba(212,168,67,.35)); }

/* ── Generate modal ─────────────────────────────────────────────── */
.ws-generate-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(26, 20, 16, .42);
}
.ws-generate-overlay[hidden] { display: none; }
.ws-generate-card {
  width: min(480px, 100%);
  background: var(--warm-white, #FFFDF8);
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 18px 60px rgba(26,22,18,.24);
}
.ws-generate-title {
  margin: 0 0 2px;
  font-family: "ABC Arizona Flare", "Playfair Display", Georgia, serif;
  font-size: 20px;
  color: var(--ink-strong, #1A1410);
}
.ws-generate-sub { margin: 0 0 12px; font-size: 13.5px; color: var(--ink-mute, #6B6560); }
.ws-generate-input {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 72px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 8px;
  background: var(--paper, #FBF6EC);
  color: var(--ink-strong, #1A1410);
}
.ws-generate-input:focus-visible {
  outline: none;
  border-color: var(--heritage-red, #CC0000);
  box-shadow: 0 0 0 3px var(--rule-gold, rgba(212,168,67,.30));
}
.ws-generate-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.ws-generate-cancel, .ws-generate-go {
  font: inherit;
  font-size: 13.5px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--rule, #E5D9C4);
  background: var(--warm-white, #FFFDF8);
  color: var(--ink-soft, #4A4540);
}
.ws-generate-go {
  background: var(--heritage-red, #CC0000);
  border-color: var(--heritage-red, #CC0000);
  color: #fff;
  font-weight: 600;
}
.ws-generate-go:hover { background: var(--heritage-red-dark, #A30000); }
.ws-generate-go:disabled { opacity: .6; cursor: wait; }
.ws-generate-status { margin-top: 10px; font-size: 12.5px; min-height: 1em; color: var(--ink-mute, #6B6560); }
.ws-generate-status.is-error { color: var(--heritage-red, #CC0000); }

/* ── Spreadsheet renderer ───────────────────────────────────────── */
.artifact-kind-spreadsheet { display: flex; flex-direction: column; min-height: 0; }
.art-sheet-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--rule, #E5D9C4);
}
.art-sheet-tabs::-webkit-scrollbar { display: none; }
.art-sheet-tab {
  font: inherit;
  font-size: 12.5px;
  padding: 6px 12px;
  border: 1px solid var(--rule, #E5D9C4);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: var(--paper, #FBF6EC);
  color: var(--ink-mute, #6B6560);
  cursor: pointer;
  white-space: nowrap;
}
.art-sheet-tab.is-active {
  background: var(--warm-white, #FFFDF8);
  color: var(--heritage-red, #CC0000);
  font-weight: 600;
  border-bottom: 2px solid var(--heritage-gold, #D4A843);
  margin-bottom: -1px;
}
.art-sheet-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px 4px; }
.art-sheet-table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.art-sheet-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--heritage-red, #CC0000);
  font-weight: 700;
  border-bottom: 2px solid var(--heritage-gold, #D4A843);
  background: var(--paper, #FBF6EC);
  white-space: nowrap;
}
.art-sheet-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--rule, #E5D9C4);
  color: var(--ink-strong, #1A1410);
  white-space: nowrap;
}
.art-sheet-table tbody tr:nth-child(even) { background: rgba(212,168,67,.05); }
.art-sheet-cap, .art-sheet-empty {
  padding: 10px 16px 16px;
  font-size: 12.5px;
  color: var(--ink-mute, #6B6560);
}

/* ── Presentation renderer ──────────────────────────────────────── */
.artifact-kind-presentation { height: 100%; }
.art-deck { display: flex; flex-direction: column; height: 100%; outline: none; }
.art-deck:focus-visible { box-shadow: inset 0 0 0 3px var(--rule-gold, rgba(212,168,67,.35)); }
.art-slide-stage {
  flex: 1 1 auto;
  min-height: 280px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 18px;
  background: var(--paper, #FBF6EC);
  overflow: auto;
}
.art-slide {
  width: 100%;
  max-width: 760px;
  background: var(--eggshell, #FFF5E6);
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(26,22,18,.08);
  padding: 28px 32px;
  overflow: auto;
  transition: opacity .18s ease;
}
.art-slide-title, .art-slide-cover-title, .art-slide-section-title {
  font-family: "ABC Arizona Flare", "Playfair Display", Georgia, serif;
  color: var(--ink-strong, #1A1410);
  margin: 0 0 10px;
}
.art-slide-title { font-size: 20px; border-bottom: 2px solid var(--heritage-gold, #D4A843); padding-bottom: 8px; }
.art-slide-cover { display: flex; flex-direction: column; justify-content: center; text-align: center; }
.art-slide-rule { width: 64px; height: 3px; margin: 0 auto 18px; background: var(--heritage-gold, #D4A843); border-radius: 2px; }
.art-slide-cover-title { font-size: 28px; }
.art-slide-cover-sub { font-size: 15px; color: var(--ink-mute, #6B6560); margin: 6px 0 0; }
.art-slide-section { display: flex; flex-direction: column; justify-content: center; }
.art-slide-section-title {
  font-size: 24px;
  color: var(--heritage-red, #CC0000);
  border-left: 4px solid var(--heritage-gold, #D4A843);
  padding-left: 14px;
}
.art-slide-sub { font-size: 13.5px; color: var(--ink-mute, #6B6560); margin: 0 0 10px; }
.art-slide-bullets { margin: 8px 0 0; padding-left: 22px; font-size: 14.5px; line-height: 1.7; color: var(--ink-strong, #1A1410); }
.art-slide-bullets li::marker { color: var(--heritage-red, #CC0000); }
.art-slide-table { font-size: 12.5px; }
.art-deck-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 12px;
  border-top: 1px solid var(--rule, #E5D9C4);
  background: var(--warm-white, #FFFDF8);
}
.art-deck-prev, .art-deck-next { min-width: 36px; justify-content: center; font-size: 16px; line-height: 1; }
.art-deck-prev:disabled, .art-deck-next:disabled { opacity: .35; cursor: default; }
.art-deck-counter { font-size: 12.5px; color: var(--ink-mute, #6B6560); min-width: 90px; text-align: center; }
.art-deck-thumbs {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--warm-white, #FFFDF8);
  border-top: 1px solid var(--rule, #E5D9C4);
}
.art-deck-thumb {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 150px;
  font: inherit;
  font-size: 11.5px;
  padding: 5px 9px;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 7px;
  background: var(--paper, #FBF6EC);
  color: var(--ink-mute, #6B6560);
  cursor: pointer;
}
.art-deck-thumb.is-active { border-color: var(--heritage-red, #CC0000); color: var(--heritage-red, #CC0000); font-weight: 600; }
.art-deck-thumb-n { font-weight: 700; }
.art-deck-thumb-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Honest chart preview (slide layout: chart) */
.art-chart-preview { margin-top: 10px; }
.art-chart-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--heritage-red, #CC0000);
  background: rgba(204,0,0,.07);
  border-radius: 5px;
  padding: 3px 8px;
  margin-bottom: 10px;
}
.art-chart-series { font-size: 12.5px; color: var(--ink-mute, #6B6560); margin-bottom: 6px; }
.art-chart-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 12.5px; }
.art-chart-cat { flex: 0 0 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft, #4A4540); }
.art-chart-track { flex: 1 1 auto; height: 14px; background: rgba(212,168,67,.14); border-radius: 4px; overflow: hidden; }
.art-chart-bar { display: block; height: 100%; background: linear-gradient(90deg, var(--heritage-red, #CC0000), #E04435); border-radius: 4px; }
.art-chart-val { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--ink-strong, #1A1410); }
.art-chart-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.art-chart-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 8px;
  background: var(--warm-white, #FFFDF8);
  font-size: 12.5px;
}

/* ── Document renderer ──────────────────────────────────────────── */
.artifact-kind-document { overflow: auto; }
.art-doc { max-width: 720px; margin: 0 auto; padding: 28px 24px 48px; }
.art-doc-head { border-bottom: 3px solid var(--heritage-gold, #D4A843); padding-bottom: 14px; margin-bottom: 20px; }
.art-doc-title {
  font-family: "ABC Arizona Flare", "Playfair Display", Georgia, serif;
  font-size: 26px;
  color: var(--ink-strong, #1A1410);
  margin: 0;
}
.art-doc-subtitle { font-size: 14px; color: var(--ink-mute, #6B6560); margin: 6px 0 0; }
.art-doc-section { padding: 14px 0 18px; border-bottom: 1px solid var(--rule-gold, rgba(212,168,67,.4)); }
.art-doc-section:last-child { border-bottom: none; }
.art-doc-section h2 {
  font-family: "ABC Arizona Flare", "Playfair Display", Georgia, serif;
  font-size: 18px;
  color: var(--heritage-red, #CC0000);
  margin: 0 0 8px;
}
.art-doc-section p { font-size: 14px; line-height: 1.7; color: var(--ink-strong, #1A1410); margin: 0 0 10px; }
.art-doc-section ul { margin: 0 0 10px; padding-left: 22px; font-size: 14px; line-height: 1.7; }
.art-doc-section li::marker { color: var(--heritage-gold, #D4A843); }
.art-doc-section .art-sheet-scroll { padding: 4px 0 8px; }

/* ── Export menu: recommended (primary) format emphasis ─────────── */
.art-export-item.is-primary { font-weight: 700; color: var(--heritage-red, #CC0000); }

/* ── Mobile (≤640px) ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .art-slide-stage { padding: 10px; }
  .art-slide { padding: 18px 16px; }
  .art-slide-cover-title { font-size: 22px; }
  .art-deck-prev, .art-deck-next { min-width: 44px; min-height: 44px; }
  .art-deck-controls { position: sticky; bottom: 0; }
  .art-sheet-scroll { padding: 10px 10px 4px; }
  .art-doc { padding: 20px 14px 40px; }
  .art-chart-cat { flex-basis: 72px; }
  .ws-create-chip { min-height: 44px; }
}

/* Reduced motion: no slide fade. */
@media (prefers-reduced-motion: reduce) {
  .art-slide { transition: none !important; }
}

/* ══════════════════════════════════════════════════════════════════
   CODE EXECUTION OUTPUT (2026-08-07 · polish-a11y B4)

   code-exec.js has shipped 16 distinct class names since the exec wave
   with ZERO stylesheet backing — every result panel rendered as raw
   unstyled markup (native <table> borders, browser-default <pre>, a
   naked ✓/✕ glyph). This block is the missing sheet.

   Two mount contexts, both handled below:
     · chat        — appended inside .ws-code, under the code body
                     (code-exec.js workspace path; wrap.querySelector(':scope > .ws-exec-output')`)
     · artifacts   — appended into .artifacts-body (artifacts.js:419)
   Panel carries role="region" + aria-label (code-exec.js:275-276), so it
   is a landmark; the visual treatment needs to read as a distinct,
   subordinate result surface rather than more code.
   ══════════════════════════════════════════════════════════════════ */

.ws-exec-output {
  border-top: 1px solid var(--rule);
  background: var(--eggshell-bright);
  font-size: 12px;
  /* The panel is a sibling of the code body inside .ws-code, which has
     overflow:hidden + a radius — no radius needed here, the parent clips. */
}
/* In the artifacts pane there is no clipping wrapper, so give it its own
   box. :not() keeps the chat variant flat. */
.artifacts-body > .ws-exec-output {
  margin-top: 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Status header ────────────────────────────────────────────────── */
.ws-exec-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--eggshell-shade);
  border-bottom: 1px solid var(--rule-soft);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1;
  color: var(--ink-soft);
}
.ws-exec-badge {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--success, #2E7D32); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
}
/* Error/timeout: the badge is the only colour signal, so it must not rely
   on the glyph alone (✓ vs ✕ is a 1-character difference at 10px). */
.ws-exec-output.is-error .ws-exec-badge { background: var(--danger, #C0392B); }
.ws-exec-output.is-error .ws-exec-head {
  color: var(--danger, #C0392B);
  background: color-mix(in srgb, var(--danger, #C0392B) 8%, var(--eggshell-shade));
}

/* ── Text output / result / error ─────────────────────────────────── */
.ws-exec-text {
  margin: 0;
  padding: 10px 12px;
  background: transparent;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;      /* long lines wrap rather than clip */
  word-break: break-word;
  overflow-x: auto;
  /* Long-running scripts can emit hundreds of lines (capped at
     MAX_OUTPUT_LINES in code-exec.js) — cap the visual height too so one
     result can't push the composer off screen. */
  max-height: 320px;
  overflow-y: auto;
}
.ws-exec-text + .ws-exec-text { border-top: 1px dashed var(--rule-soft); }
/* The returned value, distinguished from stdout by a leading "→". */
.ws-exec-result { color: var(--ink-strong); font-weight: 500; }
.ws-exec-err    { color: var(--danger, #C0392B); }
.ws-exec-empty  { color: var(--ink-mute); font-style: italic; }

/* ── Tabular result ───────────────────────────────────────────────── */
.ws-exec-table-wrap {
  max-height: 340px;
  overflow: auto;
  /* Contain the scroll so a wide table never widens the chat column. */
  max-width: 100%;
}
.ws-exec-table {
  border-collapse: collapse;
  width: 100%;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11.5px;
}
.ws-exec-table th,
.ws-exec-table td {
  padding: 5px 10px;
  text-align: left;
  border-bottom: 1px solid var(--rule-soft);
  white-space: nowrap;
  color: var(--ink);
}
.ws-exec-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--eggshell-shade);
  color: var(--ink-strong);
  font-weight: 700;
  border-bottom: 1px solid var(--rule);
}
.ws-exec-table tbody tr:last-child td { border-bottom: none; }
.ws-exec-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--ink-faint) 5%, transparent); }
/* Row-count truncation notice (>200 rows). */
.ws-exec-more {
  padding: 6px 12px;
  border-top: 1px solid var(--rule-soft);
  background: var(--eggshell-shade);
  color: var(--ink-mute);
  font-size: 11px; font-style: italic;
}

/* ── Chart result (echarts, parent-side) ──────────────────────────── */
.ws-exec-chart {
  width: 100%;
  height: 280px;
  padding: 8px 12px 12px;
}

/* ── Generated file downloads ─────────────────────────────────────── */
.ws-exec-files {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--rule-soft);
}
.ws-exec-files-label {
  color: var(--ink-mute);
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
}
.ws-exec-file {
  /* 32px tall + generous padding: these are real download targets and the
     mobile floor for the workspace is 44px on primary controls; these are
     secondary/inline so 32 is the accepted compromise used by chips. */
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--warm-white);
  color: var(--ink-soft);
  font-size: 11.5px; font-family: inherit;
  cursor: pointer;
  transition: border-color .14s ease, color .14s ease, background .14s ease;
}
.ws-exec-file:hover:not(:disabled) {
  border-color: var(--heritage-red);
  color: var(--heritage-red);
  background: var(--eggshell-bright);
}
.ws-exec-file:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold); }
.ws-exec-file:disabled { opacity: .5; cursor: default; }

/* ── Run button in the code header ────────────────────────────────── */
/* Sibling of .ws-code-copy, inserted before it (code-exec.js:328). */
.ws-code-run {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; margin-right: 2px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--warm-white);
  color: var(--ink-soft);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px; line-height: 1;
  cursor: pointer;
  transition: border-color .14s ease, color .14s ease, background .14s ease;
}
.ws-code-run:hover:not(:disabled) {
  border-color: var(--heritage-red);
  color: var(--heritage-red);
}
.ws-code-run:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold); }
.ws-code-run:disabled { cursor: default; opacity: .7; }
.ws-code-run.is-running { color: var(--ink-mute); }
/* The label hides on narrow screens; the ▶/spinner still communicates. */
@media (max-width: 640px) {
  .ws-code-run-label { display: none; }
}

/* Dark mode: 90-dark-mode.css remaps the warm tokens scoped to .ws-root,
   and every colour above is token-driven, so the panel converts for free.
   The two literal-ish fallbacks (--success/--danger) are defined globally
   and stay legible on the dark surface. Only the zebra stripe needs a
   nudge — --ink-faint goes light in dark mode, so 5% of it reads as a
   too-bright band. */
[data-theme="dark"] .ws-exec-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--ink-faint) 10%, transparent);
}

/* Own Astra allowance. Shared by Workspace and the Ask AIOP composer. */
.astra-usage {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary, #64646c);
  padding: 6px 4px;
  overflow-wrap: anywhere;
  min-width: 0;
}
.astra-usage-summary { font-weight: 600; color: var(--text-primary, #222); }
.astra-usage-meta { font-size: 11px; }
.astra-usage-warning { color: var(--warning-text, #946000); margin-top: 4px; }
.astra-usage-action {
  font: inherit;
  color: var(--text-primary, #222);
  background: var(--bg-secondary, #f6f6f6);
  border: 1px solid var(--border-color, #d8d8dc);
  border-radius: 8px;
  padding: 8px 12px;
  min-height: 44px;
  cursor: pointer;
  margin-top: 4px;
  max-width: 100%;
  white-space: normal;
}
.astra-usage-action:focus-visible, .astra-draft-recovery summary:focus-visible {
  outline: 2px solid var(--accent, #b31924);
  outline-offset: 2px;
}
.astra-draft-recovery {
  font-size: 12px;
  padding: 4px;
  border: 1px solid var(--border-color, #d8d8dc);
  border-radius: 8px;
  margin-top: 4px;
}
.astra-draft-recovery summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.astra-draft-recovery pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 120px; overflow-y: auto; font: inherit; }
#agent-astra-usage { flex-shrink: 0; }

[data-theme="dark"] .astra-usage-warning { color: #fcd34d; }

/* ---- Feedback FAB: rail-drawer exception (2026-07-31) --------------
   Deliberately at END OF FILE. The ≤900px off-canvas rail drawer (z-index 60)
   plus its full-viewport scrim owns the screen, so the feedback FAB stands
   down while it's open — one of the few sanctioned hides (see the
   ALLOWED_HIDE list in tests/feedback-fab-fullscreen.test.js).

   Do NOT relocate this next to the other .feedback-fab takeover rules above:
   tests/workspace-mobile-polish.test.js resolves the mobile contract with
   mediaBlock(css, '(max-width: 900px)'), which returns the FIRST matching
   @media block. An earlier 900px block shadows the real RESPONSIVE one and
   fails 9 unrelated mobile touch-target tests. */
@media (max-width: 900px) {
  body:has(.ws-root.rail-open) .feedback-fab,
  body:has(.ws-root.rail-open) .feedback-fab-tooltip {
    display: none !important;
  }
}

/* Same-thread source/task continuity: bounded, readable on tablet and desktop. */
.ws-task-state { margin: 12px 0; padding: 12px 16px; border: 1px solid var(--border-color, #ddd); border-radius: 12px; overflow-wrap: anywhere; }
.ws-task-state summary { cursor: pointer; font-weight: 600; }
.ws-task-state details + details { margin-top: 10px; }
.ws-task-create { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
#ws-generate-files label { display: block; overflow-wrap: anywhere; margin: 6px 0; }
/* 34-artifacts.css — Artifacts engine split-pane + renderers.
 * Brand: Heritage Red #CC0000, Gold #D4A843. Self-hosted highlight theme is in
 * /vendor/highlight-github.min.css (loaded by index.html). Artifact iframe gets
 * its OWN reset injected inside srcdoc — parent styles never bleed in. */

.artifacts-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: var(--warm-white, #FFFDF8);
  /* This is the ONE left rule on desktop. 33-workspace.css deliberately does
     NOT also put a border-left on the outer .ws-artifacts-pane when this panel
     is present — nested 1px rules rendered a 2px seam with a warm-white sliver
     between them, which read as the artifacts chrome cutting into the divider
     (2026-07-28). Do not re-add it there. */
  border-left: 1px solid var(--rule, #E5D9C4);
}

/* SHARED HEADER BAND (2026-07-28, Kevin: "header bars intersect") ───────────
   This header sits in grid column 4; the chat topbar (.ws-topbar) sits in
   column 2. Both start at y=0. They used to compute to ~47px and ~57px, so
   their 1px bottom rules landed on two different Y coordinates and the two
   chrome strips read as colliding planes across the split.

   Height now comes from --ws-head-h (declared once on .ws-root in
   33-workspace.css) instead of vertical padding, so the two bars are
   pixel-identical and their bottom rules form ONE continuous line. The fallback
   value keeps this correct if the panel is ever mounted outside .ws-root.
   The ≤900px block at the bottom of this file releases the fixed height for
   the mobile overlay (44px tap targets + notch). */
.artifacts-header {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--ws-head-h, 57px);
  min-height: var(--ws-head-h, 57px);
  padding: 0 10px 0 12px;
  border-bottom: 1px solid var(--rule, #E5D9C4);
  /* TONE MATCH (2026-07-28) ──────────────────────────────────────
     Aligning the two bars' HEIGHTS removed the geometric collision, but a
     measurable tonal step remained across the divider: the chat topbar renders
     ~rgb(255,251,245) (translucent warm-white over the eggshell gradient +
     blur) while this bar was flat --paper ~rgb(251,246,236). Sampled from a 2x
     screenshot, that is a 4-9/255 delta — small, but it is exactly the cue that
     makes one continuous band read as "two different surfaces meeting", which
     is the other half of what Kevin reported.

     Matching the topbar's recipe (same translucent fill + same blur) makes the
     whole band ONE surface. Kept as its own declaration rather than a shared
     token because the two bars sit on different parents: --warm-white here
     resolves through .ws-root's dark-mode remap, so this stays correct in both
     themes (verified: both bars land on identical computed colours in light AND
     dark). The --paper fallback is retained for a panel mounted outside
     .ws-root, where there is no topbar to match. */
  background: rgba(255, 253, 248, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex: 0 0 auto;
  flex-wrap: nowrap;            /* header NEVER wraps — tabs scroll, actions pin */
  /* The tab strip scrolls horizontally inside a fixed-height bar; without this
     a long tab label could push the actions group out of the pane. */
  overflow: hidden;
}

/* NOTE specificity: 95-polish-v3.css sets a GLOBAL `[role="tablist"]{flex-wrap:wrap}`
   that loads AFTER this file and would otherwise win (equal specificity, later
   source order). We scope with `.artifacts-header .artifacts-tabs` (higher
   specificity) so the artifact tab strip stays a single horizontal-scroll row
   instead of wrapping the tabs onto a 2nd line. */
.artifacts-header .artifacts-tabs {
  display: flex;
  flex-wrap: nowrap;            /* beat [role="tablist"]{flex-wrap:wrap} */
  align-items: center;
  gap: 4px;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  /* DESKTOP ZERO-WIDTH FLOOR (2026-07-28, audit sweep) ──────────────────────
     `min-width: 0` (kept below) is what lets this strip shrink instead of pushing
     the actions row onto a 2nd line — correct, and load-bearing. But with NO
     floor it also makes collapsing to exactly 0px a legal outcome, and that is
     not hypothetical on desktop either:

       measured on base 339c96a, 1440px viewport, split dragged to the 0.74 max
       clamp, editable artifact (7 action buttons):
         strip clientWidth = 0     header overflow = 9px

     i.e. the same invisible-tabs defect found on phones, reachable on a laptop by
     dragging the resizer right. The mobile block sets its own 96px floor; this is
     the desktop half of the same guard. 120px keeps a readable tab while still
     yielding to the action row first, so the 2026-07-28 narrow-split behaviour
     (tabs shrink, actions keep their size) is preserved — it simply stops at a
     floor instead of at zero. */
  flex: 1 1 120px;
  min-width: 120px;
                                /* min-width:0 was CRITICAL to let this item
                                   shrink so the actions group never gets pushed
                                   to a 2nd row; the floor above keeps that
                                   property while forbidding a 0px collapse. */
  scrollbar-width: none;        /* clean — no chrome scrollbar under the tabs */
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  row-gap: 0;                   /* override the global tablist row-gap */
  /* POLISH (2026-07-28): when the strip overflows, the last tab used to clip
     mid-glyph with no signal that more tabs existed. Fade the right edge so the
     overflow reads as "scroll me" instead of "broken layout". The mask is a
     no-op when the content fits (nothing to fade). */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent 100%);
          mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent 100%);
}
.artifacts-header .artifacts-tabs::-webkit-scrollbar { height: 0; display: none; }

.art-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  font: inherit;
  font-size: 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-mute, #6B6560);
  cursor: pointer;
  white-space: nowrap;
  /* RELATIVE CAP (2026-07-28, audit sweep) ───────────────────────────────
     Was a flat `200px`. A tab wider than the strip that is supposed to scroll it
     can never be brought fully into view — scrollIntoView() has no valid resting
     position, so the tab stays permanently part-clipped. That is a phone bug
     first (the mobile strip is ~96-150px), but it is NOT phone-only: the desktop
     split is user-draggable down to a 420px artifact pane, at which point the
     strip is narrower than 200px too. Clamping against 100% of the strip fixes
     the whole family at the base rule, which is why the mobile and
     narrow-desktop overrides can then simply carry a tighter arm. */
  max-width: min(200px, 100%);
  flex: 0 0 auto;               /* tabs keep their size; the strip scrolls */
  scroll-snap-align: start;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.art-tab:hover { background: rgba(204,0,0,.06); color: var(--ink-strong, #1A1410); }
.art-tab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold, rgba(212,168,67,.35)); }
.art-tab.is-active {
  background: var(--warm-white, #FFFDF8);
  border-color: var(--rule, #E5D9C4);
  color: var(--ink-strong, #1A1410);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
/* Gold underline accent on the active tab — reads as a real selected state.
   POLISH (2026-07-28): the tab is now vertically centred inside a fixed-height
   header, so `bottom:-1px` floated the accent in mid-air instead of sitting on
   the header's bottom rule. Anchor it to the tab's own bottom edge and give the
   tab a matching height so the accent lands ON the rule and reads as a real
   selected tab connected to the content below. */
.art-tab.is-active::after {
  content: "";
  position: absolute;
  left: 9px; right: 9px; bottom: 0; height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--heritage-gold, #D4A843);
}
.art-tab { position: relative; }
.art-tab-label { overflow: hidden; text-overflow: ellipsis; }
.art-tab-icon { font-size: 13px; line-height: 1; flex: 0 0 auto; }

/* The actions group holds seven controls (Run/Edit/Export/Copy/Download/
   Fullscreen/Close) pinned to the right; the tab strip yields FIRST. That part is
   unchanged and intentional.

   WHAT CHANGED (2026-07-28, audit sweep): it used to be `flex: 0 0 auto`, i.e.
   absolutely immovable. Combined with the strip's `min-width: 0`, the strip was
   the only thing that could give — all the way to 0px. Measured on base 339c96a
   at 1440px, split at the 0.74 max clamp, editable artifact (7 buttons):
   strip clientWidth 0, header overflow 9px. The tabs were invisible and the close
   button was clipped.

   `flex: 0 1 auto` + `min-width: 0` + `overflow-x: auto` makes the group the
   SECOND thing to yield, after the strip has hit its floor — and it yields by
   SCROLLING, never by clipping. Individual buttons still keep their exact size
   (`.art-btn { flex: 0 0 auto }`), so nothing squashes and no tap target shrinks;
   the row just becomes scrollable in the extreme case. `flex-wrap: nowrap` still
   forbids a 2nd row, which would break the shared header band. */
.artifacts-actions {
  display: flex; align-items: center; gap: 4px;
  flex: 0 1 auto; min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
}
.artifacts-actions::-webkit-scrollbar { height: 0; display: none; }
.artifacts-actions > * { flex: 0 0 auto; }
.art-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit;
  font-size: 13px;
  padding: 6px 11px;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 8px;
  background: var(--warm-white, #FFFDF8);
  color: var(--ink-soft, #4A4540);
  cursor: pointer;
  transition: border-color .14s ease, color .14s ease, background .14s ease;
}
.art-btn[hidden] { display: none !important; }
.art-btn:hover { border-color: var(--heritage-red, #CC0000); color: var(--heritage-red, #CC0000); background: var(--warm-white, #FFFDF8); }
.art-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold, rgba(212,168,67,.35)); }
.art-btn:active { transform: translateY(1px); }
.art-close {
  border: 1px solid transparent;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border-radius: 8px;
  color: var(--ink-mute, #6B6560);
  margin-left: 2px;
}
.art-close:hover { color: var(--heritage-red, #CC0000); background: rgba(204,0,0,.07); border-color: transparent; }

/* PHASE 1 EXPORT: Export dropdown (Excel / PDF download). Brand palette, no
   em dashes in copy. The menu anchors to its wrap so it floats over the body. */
.art-export-wrap { position: relative; display: inline-flex; }
.art-export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 210px;
  padding: 6px;
  background: var(--warm-white, #FFFDF8);
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(91, 44, 138, .14);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.art-export-menu[hidden] { display: none; }
.art-export-item {
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 8px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft, #4A4540);
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.art-export-item:hover { background: rgba(204,0,0,.07); color: var(--heritage-red, #CC0000); }
.art-export-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rule-gold, rgba(212,168,67,.35)); }
.art-export-item[hidden] { display: none; }

.artifacts-body {
  flex: 1 1 auto;
  min-height: 0;                /* lets the flex child actually scroll */
  overflow: auto;
  /* POLISH (2026-07-28): scrolling to the end of an artifact used to chain the
     scroll into the chat thread behind the pane, which silently scrolled the
     conversation away while the user was reading a chart. Contain it. */
  overscroll-behavior: contain;
  padding: 0;
  position: relative;
  background: var(--warm-white, #FFFDF8);
}

.artifact-render { width: 100%; height: 100%; min-width: 0; }

/* HTML artifact iframe — fills the pane, isolated origin. */
.artifact-iframe {
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: 0;
  background: var(--warm-white, #FFFDF8);
  display: block;
}
.artifact-kind-html { height: 100%; }

/* Markdown / svg renders get comfortable padding. */
.artifact-markdown,
.artifact-svg,
.artifact-chart-wrap { padding: 16px 20px; }

.artifact-code {
  margin: 0;
  padding: 16px 20px;
  overflow-x: auto;             /* long lines scroll, never clip the panel */
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  background: var(--paper, #FBF6EC);
  /* keep code on a single horizontal track so it scrolls instead of wrapping */
  white-space: pre;
  tab-size: 2;
}
/* thin, branded scrollbar on the code track (desktop) */
.artifact-code::-webkit-scrollbar { height: 8px; }
.artifact-code::-webkit-scrollbar-thumb { background: var(--rule, #E5D9C4); border-radius: 8px; }
.artifact-code::-webkit-scrollbar-thumb:hover { background: var(--ink-faint, #B8AFA2); }

.artifact-svg svg { max-width: 100%; height: auto; }
.artifact-chart { padding: 12px; }

.artifact-loading, .artifact-error {
  padding: 20px;
  font-size: 14px;
  color: var(--ink-mute, #6B6560);
}
.artifact-error { color: var(--heritage-red, #CC0000); }

/* Empty state — shown if the panel chrome is up with no active artifact.
   POLISH (2026-07-28): `min-height: 60%` resolves against the scroll container
   and collapsed to a top-hugging block in a short pane, so the empty state
   floated awkwardly under the header instead of centring. Fill the body and
   centre for real. */
.artifacts-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
  min-height: 100%;
  box-sizing: border-box;
  padding: 48px 24px; text-align: center;
  color: var(--ink-mute, #6B6560);
}
.artifacts-empty-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, rgba(204,0,0,.08), rgba(212,168,67,.14));
  margin-bottom: 4px;
}
.artifacts-empty-title { font-family: "ABC Arizona Flare", "Playfair Display", Georgia, serif; font-size: 16px; color: var(--ink-strong, #1A1410); }
.artifacts-empty-sub { font-size: 13px; max-width: 240px; line-height: 1.45; }

/* Markdown body inside an artifact (tables, headings, code). */
.artifact-markdown.markdown-body { font-size: 14px; line-height: 1.6; color: var(--ink-strong, #1A1410); }
.artifact-markdown.markdown-body h1,
.artifact-markdown.markdown-body h2,
.artifact-markdown.markdown-body h3 { font-family: "ABC Arizona Flare", "Playfair Display", Georgia, serif; }
/* Tables: scroll horizontally inside their own track so a wide table never
   clips or stretches the panel. `display:block` on the table turns it into the
   scroller; this applies on desktop too (the panel is narrow). */
.artifact-markdown.markdown-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin: 12px 0;
  white-space: nowrap;
}
.artifact-markdown.markdown-body th,
.artifact-markdown.markdown-body td { border: 1px solid var(--rule, #E5D9C4); padding: 7px 11px; text-align: left; }
.artifact-markdown.markdown-body th { background: var(--paper, #FBF6EC); font-weight: 600; }
.artifact-markdown.markdown-body tbody tr:nth-child(even) { background: rgba(212,168,67,.045); }  /* zebra for scan-ability */
.artifact-markdown.markdown-body table::-webkit-scrollbar { height: 8px; }
.artifact-markdown.markdown-body table::-webkit-scrollbar-thumb { background: var(--rule, #E5D9C4); border-radius: 8px; }
.artifact-markdown.markdown-body pre { background: var(--paper, #FBF6EC); padding: 12px; border-radius: 8px; overflow: auto; }
.artifact-markdown.markdown-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* Copy toast. Anchored to the shared header band (2026-07-28) — the old
   hard-coded `top: 50px` was tuned to the pre-unification 46px header and now
   drifts whenever --ws-head-h changes. */
.art-toast {
  position: absolute;
  top: calc(var(--ws-head-h, 57px) + 8px);
  right: 16px;
  background: var(--ink-strong, #1A1410);
  color: var(--warm-white, #FFFDF8);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 7px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s;
  pointer-events: none;
  z-index: 5;
}
.art-toast.is-visible { opacity: .95; transform: translateY(0); }

/* Panel hidden state (controlled by ArtifactsPanel.show/hide). */
.is-hidden { display: none !important; }

/* Artifact chip inside a chat bubble (Claude-style "Open artifact"). */
.artifact-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 10px;
  background: var(--paper, #FBF6EC);
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-strong, #1A1410);
}
.artifact-chip:hover { border-color: var(--heritage-red, #CC0000); }
.artifact-chip .chip-icon { font-size: 16px; }
.artifact-chip .chip-cta { color: var(--ink-mute, #6B6560); margin-left: auto; }

/* ===================================================================
   MOBILE — artifact overlay renderers (phones + tablets)
   The pane is a full-screen overlay ≤900px (positioned by 33-workspace.css).
   Here we make every renderer fit the viewport: no horizontal layout break.
   =================================================================== */
@media (max-width: 900px) {
  /* Header: full 44px tap targets (Apple HIG). Notch handled by the pane.
     MOBILE GUARD (2026-07-28): release the desktop shared-band fixed height —
     the mobile bar must grow to fit 44px tap targets. height:auto + a 52px floor
     restores the pre-existing mobile sizing exactly. */
  .artifacts-header { height: auto; padding: 7px 10px; gap: 6px; min-height: 52px; }

  /* ═══ TAB-STRIP WIDTH BUDGET (2026-07-28) ══════════════════════════════════
     THE BUG: on a phone the tab strip measured **0px wide** while its scrollWidth
     was 442px — three real tabs (160/114/160px) existed, were scrollable, and were
     completely invisible. Multi-artifact switching was unreachable on every phone.

     WHY: `.artifacts-tabs { flex: 1 1 auto; min-width: 0 }` (a deliberate desktop
     choice, so the actions row can never be pushed to a 2nd line) meets
     `.artifacts-actions { flex: 0 0 auto }` — and on mobile the actions were given
     44px tap targets without any width budget to pay for them. Six
     non-shrinkable buttons measured 368.3px of a 389px header at 390px:

         ▶ Run 60.5 · Export ▾ 70.1 · Copy 53.7 · Download 81.4 · ⛶ 36.6 · × 44

     `min-width: 0` then makes collapsing to zero the LEGAL outcome. The header
     also overflowed by 5px, and since it is `overflow: hidden`, the right edge of
     the × close button was clipped rather than scrolled.

     THE FIX — three independent guards, because any one alone is defeatable:
       1. Floor the tabs so zero is no longer reachable at all.
       2. Let the ACTIONS group yield (it was the immovable object) and scroll.
       3. Reclaim real width by dropping button LABELS to icons ≤640px (below),
          which keeps every action — no feature is removed from mobile.
     ═════════════════════════════════════════════════════════════════════════ */
  .artifacts-header .artifacts-tabs {
    height: auto;
    /* GUARD 1: a hard floor. Even if the action row somehow grows again, the
       strip cannot be squeezed below a width that shows a real tab, and it
       scrolls (overflow-x:auto from the base rule) to reach the rest. This is
       what makes the failure mode "scroll to see tab 3" instead of "tab 3 does
       not exist". */
    min-width: 96px;
    flex: 1 1 96px;
  }
  /* GUARD 2: the actions group must yield on mobile. On desktop `flex: 0 0 auto`
     is correct (there is room for everything and the tabs should absorb the
     squeeze); on a 390px phone it is exactly what starved the tabs. Allowing it
     to shrink and scroll means BOTH groups stay reachable at any width. */
  .artifacts-actions {
    flex: 0 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .artifacts-actions::-webkit-scrollbar { height: 0; display: none; }

  .art-btn { padding: 0 12px; min-height: 44px; font-size: 13px; flex: 0 0 auto; }
  .art-close { width: 44px; height: 44px; min-width: 44px; font-size: 24px; }
  /* A TAB MUST NEVER BE WIDER THAN ITS OWN STRIP (2026-07-28).
     The old `max-width: 160px` was an absolute cap chosen for a desktop-width
     strip. On a phone the strip is ~100-150px, so a 160px tab exceeded its
     scroll container and scrollIntoView() could not bring ANY tab fully into
     view — every tab stayed permanently part-clipped no matter how the user
     scrolled (measured `insideStrip: false` for all three at 390px, both at
     160px and at a flat 128px).

     `min()` against 100% makes the cap RELATIVE to the strip: the tab shrinks
     with its container instead of overflowing it, so there is always a scroll
     position where the active tab is wholly visible. The 128px arm keeps a tab
     from stretching absurdly wide on a tablet-sized strip. The label ellipsizes
     (`.art-tab-label` overflow:hidden) rather than clipping mid-glyph. */
  .art-tab { padding: 8px 12px; min-height: 40px; max-width: min(128px, 100%); }

  /* FULLSCREEN IS A LIE ≤900px — hide the control (2026-07-28).
     `.ws-artifacts-pane.art-fullscreen` is specificity (0,2,0). The mobile
     overlay rule `.ws-root.artifacts-open .ws-artifacts-pane` in 33-workspace.css
     is (0,3,0) and therefore WINS: position/inset/z-index never applied.
     Measured with the class present at 390×844 — pane box unchanged (top 65,
     h 779). The pane is ALREADY the full viewport below the topbar, so maximising
     is a no-op by construction, not a missing feature.
     Rather than bump specificity to "win" a fight that has no prize, remove the
     dishonest affordance: the button flipped ⛶→✕, set aria-pressed=true, and
     flashed "Esc to exit" on a device with no Esc key. artifacts.js's
     toggleFullscreen() is guarded to match, so hiding this is belt-and-braces and
     not the sole defence. */
  .art-fullscreen-btn { display: none; }

  /* Code + markdown padding tightened for narrow screens. */
  .artifact-markdown,
  .artifact-svg,
  .artifact-chart-wrap { padding: 14px 14px; }
  .artifact-code { padding: 14px 14px; font-size: 12.5px; }

  /* HTML iframe + charts + svg: fit the viewport width. */
  .artifact-iframe { width: 100%; min-height: 60vh; }
  .artifact-svg svg { max-width: 100%; height: auto; }
  /* echarts sets explicit px width/height on its root + canvas; cap the wrapper
     so it can't exceed the viewport, and let the resize path shrink it. */
  .artifact-chart { max-width: 100%; }
  /* Mermaid diagrams render as <svg>; scale down to fit. */
  .artifact-markdown.markdown-body svg,
  .artifact-render svg { max-width: 100%; height: auto; }
}

/* NARROW DESKTOP SPLIT (2026-07-28) ─────────────────────────────────
   Seven action buttons in a 420px-floor pane crushed the tab strip to ~0 width
   — the tabs existed but were unreadable. Compact the action row on smaller
   laptops (and whenever the user drags the split narrow) so tabs keep real
   room. Desktop-only band: the ≤900px block above owns phone sizing. */
@media (min-width: 901px) and (max-width: 1180px) {
  .artifacts-header { gap: 6px; padding: 0 8px 0 10px; }
  .artifacts-actions { gap: 2px; }
  /* Pair the desktop tab floor with a yielding action row (2026-07-28 audit).
     A floor alone converts "tabs collapse to 0" into "header overflows and clips
     the close button" — trading one defect for another. Letting the group shrink
     and SCROLL means both stay reachable. Buttons keep their own size
     (`.art-btn{flex:0 0 auto}`), so nothing squashes; the group just scrolls. */
  .artifacts-actions { flex: 0 1 auto; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .artifacts-actions::-webkit-scrollbar { height: 0; display: none; }
  .art-btn { padding: 6px 8px; font-size: 12.5px; }
  /* Relative for the same reason as the base rule: this band exists precisely
     BECAUSE the strip is being squeezed here, so a flat cap is most likely to
     exceed the container exactly in this range. */
  .art-tab { padding: 6px 9px; max-width: min(150px, 100%); }
}

/* Touch: kill hover-only affordance on artifact chips. */
@media (hover: none) and (pointer: coarse) {
  .artifact-chip:hover { border-color: var(--rule, #E5D9C4); }
}

/* Phone (≤640px): the iframe + its container must be full-width with NO
   horizontal overflow of the panel. The srcdoc now injects a viewport meta +
   responsive base CSS (artifacts-sandbox.js), so brand-template + fixed-width
   artifacts reflow to the viewport instead of forcing a pinch-zoom. */
@media (max-width: 640px) {
  .artifacts-body { overflow-x: hidden; }
  .artifact-render { width: 100%; max-width: 100%; }
  .artifact-iframe { width: 100%; max-width: 100%; min-height: 60vh; }

  /* ═══ GUARD 3: ICON-ONLY ACTIONS — reclaim real width for the tabs ══════════
     Copy (53.7px) + Download (81.4px) + Export ▾ (70.1px) = 205px of the 389px
     header spent on English words, on the one screen size that cannot afford it.
     Collapsing them to glyphs frees ~120px — which is what actually gives the
     tab strip a usable measure instead of just a 96px floor.

     NO FUNCTION IS REMOVED. Every button stays present, tappable and 44px; only
     its text label is replaced by an icon. This is the opposite of the tempting
     "just hide Copy and Download on mobile" fix, which would have silently taken
     source-copy and source-download away from every phone user.

     ACCESSIBILITY — why this is safe:
       - font-size: 0 hides the label VISUALLY but the text node stays in the DOM.
       - Each of these buttons carries an explicit aria-label (added in
         artifacts.js 2026-07-28: copySource / downloadSource / exportTooltip), so
         the accessible name is a full sentence and does NOT depend on the glyph.
       - The ::before glyph is aria-hidden by construction (CSS generated content
         is not exposed as a text alternative when an aria-label is present).
       - i18n-safe: no new strings, and no locale can widen a glyph.
     ═════════════════════════════════════════════════════════════════════ */
  .artifacts-actions .art-copy-btn,
  .artifacts-actions .art-download-btn,
  .artifacts-actions .art-export-btn {
    font-size: 0;               /* hide the label text, keep it for a11y/DOM */
    gap: 0;
    padding: 0;
    width: 44px;
    min-width: 44px;
    justify-content: center;
  }
  .artifacts-actions .art-copy-btn::before,
  .artifacts-actions .art-download-btn::before,
  .artifacts-actions .art-export-btn::before {
    font-size: 17px;
    line-height: 1;
  }
  .artifacts-actions .art-copy-btn::before     { content: "\29C9"; }   /* ⧉ two joined squares = copy */
  .artifacts-actions .art-download-btn::before { content: "\2913"; }   /* ⤓ down arrow to bar = save */
  .artifacts-actions .art-export-btn::before   { content: "\21EA"; }   /* ⇪ up arrow from bar = export */

  /* The Run button keeps its label — it is conditional (code artifacts only),
     rarely co-present with a crowded strip, and "▶ Run" is already compact. */
}

@media (max-width: 380px) {
  /* AUDIT FIX (2026-07-28) — this rule reintroduced the very bug the ≤900px block
     had just fixed, on the SMALLEST phones. A flat `max-width: 120px` overrides
     the relative `min(128px, 100%)` cap above (same specificity, later in source
     order), and the strip is only ~96-102px at these widths — so every tab was
     120px inside a 96px container and NONE could be scrolled fully into view.
     Measured `inside: false` for all three tabs at 320/360/375/380px while 381px
     was correct, which is the unmistakable fingerprint of a breakpoint override.
     Caught by sweeping 320-381px during the audit; the 390/768 e2e viewports had
     stepped right over it.
     Keep the tighter 120px arm for the small-phone measure, but keep it RELATIVE
     so it can never exceed its own scroll container. */
  .art-tab { max-width: min(120px, 100%); padding: 8px 10px; }
  .artifact-markdown.markdown-body { font-size: 13.5px; }
  /* Applies to the buttons that still carry a LABEL at this width (Run, Edit,
     Revert). Copy/Download/Export went icon-only at ≤640px above and are pinned
     to 44px there by a (0,2,0) selector, which outranks this (0,1,0) rule — so
     this cannot shrink a 44px tap target back under the HIG floor. Verified by
     measurement at 375px, not by reading. */
  .art-btn { padding: 0 10px; }
}

/* Respect reduced-motion: disable panel + tab transitions/animations. */
@media (prefers-reduced-motion: reduce) {
  .ws-artifacts-pane,
  .ws-root.artifacts-open .ws-artifacts-pane,
  .art-tab, .art-btn { animation: none !important; transition: none !important; }
}

/* ─────────────────────────────────────────────────────────────────────
   FULLSCREEN (frontier parity 2026-07-08) — ⛶ button in the panel header
   maximizes the artifacts pane over the whole viewport (Claude parity).
   Class lives on the OUTER #ws-artifacts-pane so it beats the split-pane
   grid sizing without touching the grid template. Escape or ✕ exits.
   ───────────────────────────────────────────────────────────────────── */
.ws-artifacts-pane.art-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1200;            /* above the workspace takeover + topbar */
  width: auto;
  max-width: none;
  border-left: none;
  /* POLISH (2026-07-08): ease IN instead of snapping (replaces the split-pane
     slide-in, which reads wrong for a maximize). Charts re-flow with their
     own animated resize; Escape hint toast fires from toggleFullscreen().
     Covered by the prefers-reduced-motion block above (!important). */
  animation: art-fs-in .3s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 24px 80px rgba(26,22,18,.28);
}
@keyframes art-fs-in {
  from { opacity: .55; transform: scale(.985); }
  to   { opacity: 1;   transform: none; }
}
.ws-artifacts-pane.art-fullscreen .artifacts-panel { height: 100%; }
/* Fullscreen is viewport-wide — give the reading column a comfortable measure. */
.ws-artifacts-pane.art-fullscreen .artifact-markdown.markdown-body {
  max-width: 860px;
  margin: 0 auto;
}

/* ─────────────────────────────────────────────────────────────────────────
   WAVE 2B — Editable / versioned artifacts: the edit + version toolbar.
   Sits between the header and the body; hidden until the user clicks "Edit".
   ───────────────────────────────────────────────────────────────────────── */
.artifacts-editbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule, #E5D9C4);
  background: var(--eggshell, #FFF5E6);
}
.artifacts-editbar[hidden] { display: none; }

.art-version-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.art-version-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft, #5A554F);
  letter-spacing: .01em;
}
.art-version-select {
  flex: 0 1 auto;
  min-width: 120px;
  padding: 5px 8px;
  font-size: 13px;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 5px;
  background: var(--warm-white, #FFFDF8);
  color: var(--ink, #2C2C2C);
}
.art-version-select:disabled { opacity: .55; cursor: not-allowed; }
.art-revert-btn { margin-left: auto; }
.art-revert-btn:disabled { opacity: .5; cursor: not-allowed; }

.art-edit-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.art-edit-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  font-size: 13.5px;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 6px;
  background: var(--warm-white, #FFFDF8);
  color: var(--ink, #2C2C2C);
}
.art-edit-input:focus-visible {
  outline: none;
  border-color: var(--heritage-red, #CC0000);
  box-shadow: 0 0 0 3px var(--rule-gold, rgba(212,168,67,.30));
}
.art-edit-submit { flex: 0 0 auto; }

.art-edit-status {
  font-size: 12px;
  min-height: 1em;
  color: var(--ink-soft, #5A554F);
}
.art-edit-status.is-busy  { color: var(--heritage-purple, #5B2C8A); }
.art-edit-status.is-ok    { color: var(--vitality-green, #2D8C3C); }
.art-edit-status.is-warn  { color: var(--gold-dark, #A07830); }
.art-edit-status.is-error { color: var(--heritage-red, #CC0000); }

@media (max-width: 640px) {
  .art-edit-form { flex-wrap: wrap; }
  .art-edit-input { flex-basis: 100%; }
}

/* ─────────────────────────────────────────────────────────────────────────
   LIVE STREAMING PREVIEW + VERSION HISTORY (D-2 / D-4, 2026-08-07)

   Scope note (D-7 convention): 33 = shell/layout/mobile · 34 = artifact
   rendering (this file) · 35 = execution output. Everything below is artifact
   chrome, so it belongs here and 33-workspace.css stays untouched.

   Colours use the same var(--token, #literal-fallback) pattern as the rest of
   this file, so the .ws-root dark-mode token remap in 90-dark-mode.css carries
   them automatically — no [data-theme="dark"] block needed.
   ───────────────────────────────────────────────────────────────────────── */

/* ── Live preview tab marker ─────────────────────────────────────────────── */
/* A pulsing gold dot on tabs whose artifact is still being written by the
   model. Honest signalling: the tab exists, but the server may still reshape
   it on `done` (reconcile collapses local previews to the authoritative set). */
.art-tab.is-preview { border-style: dashed; border-color: var(--rule, #E5D9C4); }
.art-tab-live {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--heritage-gold, #D4A843);
  animation: art-live-pulse 1.4s ease-in-out infinite;
}
@keyframes art-live-pulse {
  0%, 100% { opacity: .35; transform: scale(.85); }
  50%      { opacity: 1;   transform: scale(1); }
}

/* ── Deferred-kind streaming skeleton (html / mermaid) ───────────────────── */
/* Shown INSTEAD of a partially-streamed document. The model's partial source
   is never injected here — only a character count — so this adds no new sink. */
.artifact-preview-skeleton {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 220px;
  padding: 32px 24px;
  text-align: center;
}
.artifact-preview-skeleton .aps-bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(420px, 82%);
}
.artifact-preview-skeleton .aps-bar {
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--rule, #E5D9C4) 0%,
    var(--eggshell, #FFF5E6) 50%,
    var(--rule, #E5D9C4) 100%);
  background-size: 200% 100%;
  animation: art-skel-shimmer 1.5s linear infinite;
}
.artifact-preview-skeleton .aps-bar:nth-child(2) { width: 92%; animation-delay: .12s; }
.artifact-preview-skeleton .aps-bar:nth-child(3) { width: 78%; animation-delay: .24s; }
.artifact-preview-skeleton .aps-bar:nth-child(4) { width: 86%; animation-delay: .36s; }
@keyframes art-skel-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.artifact-preview-skeleton .aps-note {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft, #5A554F);
}
.artifact-preview-skeleton .aps-sub {
  font-size: 12px;
  color: var(--ink-muted, #8A837B);
  font-variant-numeric: tabular-nums;
}

/* ── Version history panel (D-4) ─────────────────────────────────────────── */
/* Sits between the header and the body, like the editbar, but is reachable
   WITHOUT entering edit mode — reading the change trail is a read-only act. */
.artifacts-historybar {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--rule, #E5D9C4);
  background: var(--eggshell, #FFF5E6);
  max-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.artifacts-historybar[hidden] { display: none; }

.art-history-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted, #8A837B);
  margin-bottom: 8px;
}

.art-version-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.art-version-empty {
  font-size: 12.5px;
  color: var(--ink-muted, #8A837B);
  padding: 4px 0;
}

.art-version-item {
  position: relative;
  padding: 6px 0 6px 16px;
}
/* Timeline rail connecting the version dots. */
.art-version-item::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--rule, #E5D9C4);
}
.art-version-item:first-child::before { top: 12px; }
.art-version-item:last-child::before  { bottom: calc(100% - 12px); }

.art-version-line {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}
.art-version-dot {
  position: absolute;
  left: 0;
  top: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warm-white, #FFFDF8);
  border: 1.5px solid var(--rule-strong, #C9B99A);
  box-sizing: border-box;
}
.art-version-item.is-current .art-version-dot {
  background: var(--heritage-red, #CC0000);
  border-color: var(--heritage-red, #CC0000);
}

.art-version-num {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-strong, #1A1410);
  font-variant-numeric: tabular-nums;
}
.art-version-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--heritage-red, #CC0000);
  background: rgba(204, 0, 0, .08);
  border-radius: 3px;
  padding: 1px 5px;
}
.art-version-time {
  font-size: 11.5px;
  color: var(--ink-muted, #8A837B);
  margin-left: auto;
  white-space: nowrap;
  cursor: help;
}
/* The user's own edit instruction, verbatim and escaped. Clamped to 2 lines so
   a long prompt can't push the list into a scrolling wall of text. */
.art-version-prompt {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft, #5A554F);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .artifacts-historybar { max-height: 190px; }
  .art-version-time { margin-left: 0; }
}

/* Motion discipline: matches the existing reduced-motion block above. */
@media (prefers-reduced-motion: reduce) {
  .art-tab-live,
  .artifact-preview-skeleton .aps-bar {
    animation: none !important;
  }
  .art-tab-live { opacity: .9; }
}

.artifact-validation { padding: 12px 16px; border-top: 1px solid var(--border-color, #ddd); font-size: 12px; overflow-wrap: anywhere; }
.artifact-validation p { margin: 6px 0 0; }
/* ============================================================
   36-market-monitor.css
   Market Monitor module — e-commerce price/stock/review intel.
   Hero metrics, live scrape trigger, per-market summary cards,
   products table + expandable detail rows, Market Intel Signals
   panel, and the Excel tracker import flow.
   ============================================================ */

/* ── Manager badge (shared by scrape + import cards) ── */
.mm-manager-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(91, 44, 138, 0.12);
  color: var(--heritage-purple, #5B2C8A);
  border: 1px solid rgba(91, 44, 138, 0.25);
  vertical-align: middle;
}

/* ============================================================
   INTELLIGENCE-FIRST LAYOUT (2026-06-16)
   ① Intelligence Summary  ② Action Items  ③ Market Health
   ④ Price Movers  ⑤ Catalog (collapsed)  ⑥ Admin (collapsed)
   ============================================================ */

/* Shared section title (with optional count pill) */
.mm-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ① Intelligence Summary banner */
.mm-intel-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius, 10px);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid transparent;
}
.mm-intel-icon { font-size: 1.3rem; flex-shrink: 0; }
.mm-intel-text { min-width: 0; }
.mm-intel-loading {
  background: var(--rule-soft, rgba(0,0,0,0.03));
  color: var(--ink-soft, #4B5563);
  font-weight: 500;
}
.mm-intel-alert {
  background: rgba(204, 0, 0, 0.08);
  border-color: rgba(204, 0, 0, 0.25);
  color: var(--heritage-red, #CC0000);
}
.mm-intel-clear {
  background: rgba(39, 174, 96, 0.10);
  border-color: rgba(39, 174, 96, 0.28);
  color: var(--success-deep, #1e7e4f);
}

/* ② Action Items */
.mm-action-card { border-left: 4px solid var(--heritage-red, #CC0000); }
.mm-action-count {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--heritage-red, #CC0000);
  color: #fff;
}
/* Mini breakdown next to the header count ("3 OOS · 2 price · 12 new") */
.mm-action-breakdown {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-mute, #6B7280);
}
.mm-action-items { margin-top: 12px; }

/* ── Grouped action items (2026-06-16 redesign) ───────────────── */
.mm-action-group {
  margin-bottom: 12px;
  border-left: 4px solid var(--color, #8A8478);
  border-radius: 0 var(--radius, 10px) var(--radius, 10px) 0;
  background: var(--bg-card, #fff);
  border-top: 1px solid var(--rule, #e3e3e3);
  border-right: 1px solid var(--rule, #e3e3e3);
  border-bottom: 1px solid var(--rule, #e3e3e3);
  overflow: hidden;
}
.mm-action-group.red  { --color: var(--heritage-red); }
.mm-action-group.gold { --color: var(--heritage-gold); }
.mm-action-group.grey { --color: #8A8478; }

.mm-action-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  user-select: none;
  min-height: 44px;
  box-sizing: border-box;
}
.mm-action-group-header:hover { background: var(--rule-soft, rgba(0,0,0,0.02)); }
.mm-action-group-icon { font-size: 1.05rem; line-height: 1; flex-shrink: 0; }
.mm-action-group-label { font-weight: 600; font-size: 14px; color: var(--ink-strong, #1a1a1a); }
.mm-action-group-count {
  background: var(--color, #8A8478);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}
.mm-action-group-hint {
  font-size: 0.74rem;
  color: var(--ink-mute, #6B7280);
  font-style: italic;
}
.mm-action-group-spacer { flex: 1; }
.mm-group-bulk { flex-shrink: 0; font-size: 12px; white-space: nowrap; }

.mm-action-group-items {
  padding: 0 12px;
  max-height: 4000px;
  overflow: hidden;
  transition: max-height 220ms ease, opacity 160ms ease, padding 160ms ease;
}
.mm-action-group.mm-group-collapsed .mm-action-group-items {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.mm-action-group .mm-action-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #E8DFC9;
  border-left: none;
  border-radius: 0;
  background: none;
}
.mm-action-group .mm-action-item:last-child { border-bottom: none; }
.mm-action-item-dot {
  color: var(--color, #8A8478);
  font-size: 0.7rem;
  line-height: 1;
  flex-shrink: 0;
}
.mm-action-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
}
.mm-action-item-product {
  font-weight: 600;
  color: var(--ink-strong, #1a1a1a);
}
.mm-action-item-context {
  color: #5A554F;
  font-size: 13px;
}
.mm-action-item-sub { color: var(--ink-mute, #6B7280); font-size: 12px; }
.mm-action-item-btn { margin-left: auto; flex-shrink: 0; }

/* Price direction coloring inside a context string */
.mm-price-down { color: var(--success-deep, #1e7e4f); font-weight: 700; }
.mm-price-up   { color: var(--danger, #c0392b);       font-weight: 700; }
.mm-action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mm-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius, 10px);
  border: 1px solid var(--rule, #e3e3e3);
  background: var(--bg-card, #fff);
  transition: opacity 300ms ease, transform 300ms ease;
}
.mm-action-item.mm-action-oos { border-left: 3px solid var(--danger, #c0392b); }
.mm-action-item.mm-action-signal { border-left: 3px solid var(--heritage-gold, #D4A843); }
.mm-action-resolved { opacity: 0; transform: translateX(16px); }
.mm-action-icon { font-size: 1.15rem; flex-shrink: 0; line-height: 1.3; }
.mm-action-text { flex: 1; min-width: 0; }
.mm-action-title {
  font-weight: 600;
  color: var(--ink-strong, #1a1a1a);
  overflow: hidden;
  text-overflow: ellipsis;
}
.mm-action-sub { font-size: 0.78rem; margin-top: 2px; }
.mm-action-btn { flex-shrink: 0; }
.mm-action-empty {
  padding: 18px 14px;
  text-align: center;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--success-deep, #1e7e4f);
  background: rgba(39, 174, 96, 0.06);
  border-radius: var(--radius, 10px);
}
.mm-action-more {
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--heritage-purple, #5B2C8A);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  padding: 4px 2px;
}
.mm-action-more:hover { text-decoration: underline; }
.mm-action-overflow { margin-top: 8px; }

/* ③ Market Health cards */
.mm-health-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.mm-health-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute, #6B7280);
}
/* #352: the brand scope sentence above the health cards. Real text, not a
   hover hint, because screenshots are how this gets reported. */
.mm-health-brand-scope {
  margin: 0 0 10px;
  font-size: 0.8rem;
  line-height: 1.4;
}
.mm-health-cards {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.mm-health-card {
  /* #163 (2026-08-03): the card grew from 3 stats to 4 (#76 pantry, #117
     delisted) but min-width stayed at the 3-stat 180px, so a single flex row of
     4 uppercase labels overflowed the padding box — PRODUCTS clipped to
     "PRODUC", DELISTED to "DELIS", and the Pantry+ stat fell off the card edge
     entirely. Stats now wrap 2x2 (see .mm-health-card-stats), so the card only
     needs to fit TWO labels per row, and min-width is raised just enough for
     the widest locale pair (es: "productos" + "agotados"). */
  flex: 1 1 200px;
  min-width: 200px;
  /* Belt-and-braces: nothing inside the card may paint past its border. */
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  padding: 14px 16px;
  border-radius: var(--radius, 10px);
  border: 1px solid var(--rule, #e3e3e3);
  background: var(--bg-card, #fff);
  border-top-width: 3px;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 80ms ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mm-health-card:hover {
  box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,0.08));
  transform: translateY(-1px);
}
.mm-health-card:active { transform: translateY(0); }
.mm-health-card-active {
  box-shadow: 0 0 0 2px var(--heritage-red, #CC0000);
}
.mm-health-green  { border-top-color: #27ae60; }
.mm-health-yellow { border-top-color: var(--heritage-gold, #D4A843); }
.mm-health-red    { border-top-color: var(--danger, #c0392b); }
.mm-health-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mm-health-dot { font-size: 0.8rem; }
.mm-health-card-name {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink-strong, #1a1a1a);
  /* #163: a long market label must ellipsize inside the card, never widen it. */
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Feedback #62/#63/#69 (2026-07-27): platform chip + zip / national subtitle.
   The head row wraps so a long market name + chip never overflows the card. */
.mm-health-card-head { flex-wrap: wrap; }
.mm-health-card-sub {
  font-size: 0.72rem;
  color: var(--ink-mute, #6B7280);
  margin-top: -4px;
  letter-spacing: 0.02em;
  /* #163: the zip / national-hint / stale-OOS footnotes wrap inside the card
     instead of forcing it wider (the stale footnote is the longest string on
     the card in zh/zh-HK). */
  min-width: 0;
  overflow-wrap: anywhere;
}
.mm-health-card-zip { font-variant-numeric: tabular-nums; }
/* #133 — stale-OOS footnote on the health card. Muted amber: informational, and
   explicitly NOT part of the red/yellow outage tone (stale rows are excluded
   from the sold-out count that drives the card colour). */
.mm-health-card-stale {
  color: #8A6416;
  font-weight: 600;
}
[data-theme="dark"] .mm-health-card-stale { color: #D4A843; }
.mm-platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--rule, #e3e3e3);
  background: var(--bg-subtle, #f7f7f5);
  color: var(--ink-mute, #6B7280);
  white-space: nowrap;
}
.mm-platform-weee { border-color: #bfe3cd; color: #1e7a45; }
.mm-platform-yami,
.mm-platform-yamibuy { border-color: #ddd0ea; color: #6b3fa0; }
/* #163 (2026-08-03) — FOUR stats, not three. A non-wrapping flex row could not
   fit PRODUCTS + SOLD OUT + DELISTED + PANTRY+ inside a 180px card, so the last
   stat overflowed the card edge on desktop (the mobile <=640px stack hid the bug
   on phones). auto-fit grid: 2x2 on a normal card, and it collapses to a single
   4-wide row by itself whenever a card is wide enough to hold it. Labels stay
   full in all 4 locales — this is a layout fix, not a copy truncation. */
.mm-health-card-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 10px 12px;
  /* Never let an intrinsic-width child push the grid past the card. */
  min-width: 0;
  max-width: 100%;
}
.mm-health-stat {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  /* Grid items default to min-width:auto, which is what let a long label
     ("in Pantry+" / "productos") blow out the track. */
  min-width: 0;
}
.mm-health-stat strong {
  font-size: 1.1rem;
  color: var(--ink-strong, #1a1a1a);
}
.mm-health-stat strong,
.mm-health-stat span {
  /* #163: numbers and labels clip with an ellipsis at the stat boundary rather
     than punching through the card border. */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mm-health-stat span {
  font-size: 0.7rem;
  color: var(--ink-mute, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mm-health-stat-oos strong { color: var(--danger, #c0392b); }
/* #76 (2026-07-28): Pantry+ count replaced the meaningless cross-SKU avg price
   on the Market Health cards. Amber (not red) — Pantry+ is "off the local
   shelf", a softer signal than hard OOS, so it must not read as an outage. */
.mm-health-stat-pantry strong { color: var(--warning, #b8860b); }

/* #117 (2026-07-29): the health card's single "OOS" stat merged SOLD OUT with
   DELISTED (not_found). Those are different problems, so the card now shows both:
   sold-out stays the primary danger-red number (and is the clickable drilldown),
   delisted is a muted secondary — a delisting is an assortment question, not an
   outage, and must not read as one. */
.mm-health-stat-delisted strong {
  color: var(--ink-mute, #6B7280);
  font-size: 1rem;
}
/* Sold-out count doubles as a drilldown into the exact rows behind it. */
.mm-health-stat-link { cursor: pointer; }
.mm-health-stat-link strong {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.mm-health-stat-link:hover strong { text-decoration-style: solid; }
.mm-health-stat-link:focus-visible {
  outline: 2px solid var(--danger, #c0392b);
  outline-offset: 2px;
  border-radius: 3px;
}
/* All four stats must still fit a narrow card without the grid wrapping oddly.
   #163: on phones the card is full-width (see the <=640px stack), so the grid
   is pinned to an explicit 2x2 and the type steps down slightly. */
@media (max-width: 560px) {
  .mm-health-card-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
  }
  .mm-health-stat strong { font-size: 1rem; }
  .mm-health-stat span { font-size: 0.64rem; letter-spacing: 0.02em; }
}

/* ④ Price Movers */
.mm-movers-window { font-size: 0.78rem; font-weight: 400; }
.mm-movers-table { width: 100%; }
.mm-mover-brand {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.mm-mover-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.mm-mover-up   { background: rgba(192, 57, 43, 0.12); color: var(--danger, #c0392b); }
.mm-mover-down { background: rgba(39, 174, 96, 0.12); color: var(--success-deep, #1e7e4f); }
.mm-mover-flat { background: var(--rule-soft, rgba(0,0,0,0.05)); color: var(--ink-mute, #6B7280); }

/* ⑤ Catalog toggle (collapsed by default) */
.mm-catalog-card { padding: 0; overflow: hidden; }
.mm-catalog-toggle,
.mm-admin-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: var(--ink-strong, #1a1a1a);
}
.mm-catalog-toggle-label,
.mm-admin-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
}
.mm-catalog-caret,
.mm-admin-caret { transition: transform 160ms ease; flex-shrink: 0; }
.mm-catalog-toggle[aria-expanded="true"] .mm-catalog-caret,
.mm-admin-toggle[aria-expanded="true"] .mm-admin-caret { transform: rotate(180deg); }
.mm-catalog-body,
.mm-admin-body {
  padding: 0 20px 18px;
  max-height: 6000px;
  overflow: hidden;
  transition: max-height 260ms ease, opacity 180ms ease, padding 180ms ease;
}
.mm-catalog-body.mm-collapsed,
.mm-admin-body.mm-collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* ⑥ Admin section blocks */
.mm-admin-card { padding: 0; overflow: hidden; }
.mm-admin-card .mm-admin-toggle {
  border-left: 4px solid var(--heritage-purple, #5B2C8A);
}
.mm-admin-block {
  padding: 16px 0;
  border-top: 1px solid var(--rule, #e3e3e3);
}
.mm-admin-block:first-child { border-top: none; }
.mm-admin-block-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink-strong, #1a1a1a);
  margin-bottom: 4px;
}

/* ── Summary chips next to the table title ── */
.mm-summary-chips {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.mm-last-updated {
  font-size: 0.8rem;
  font-weight: 400;
}

/* ─────────────────────────────────────────────────────────
   Live scrape trigger card (manager only)
   ───────────────────────────────────────────────────────── */
.mm-scrape-card {
  border-left: 4px solid var(--heritage-red, #CC0000);
}
.mm-scrape-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.mm-scrape-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.mm-scrape-result {
  margin-top: 14px;
}
.mm-scrape-pending {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius, 10px);
  background: var(--rule-soft, rgba(0,0,0,0.03));
  color: var(--ink-soft, #4B5563);
  font-size: 0.92rem;
}

/* Reuse import result card styling for scrape result (defined below). */

/* ─────────────────────────────────────────────────────────
   Per-market summary cards
   ───────────────────────────────────────────────────────── */
.mm-market-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.mm-market-card {
  text-align: left;
  cursor: pointer;
  padding: 14px 16px;
  border-radius: var(--radius, 10px);
  border: 1px solid var(--rule, #e3e3e3);
  background: var(--bg-card, #fff);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 80ms ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mm-market-card:hover {
  border-color: var(--heritage-gold, #D4A843);
  box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,0.08));
}
.mm-market-card:active { transform: translateY(1px); }
.mm-market-card-active {
  border-color: var(--heritage-red, #CC0000);
  box-shadow: 0 0 0 1px var(--heritage-red, #CC0000);
}
.mm-market-card-warn {
  border-left: 3px solid var(--danger, #c0392b);
}
.mm-market-card-name {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink-strong, #1a1a1a);
}
.mm-market-card-stats {
  display: flex;
  gap: 16px;
}
.mm-market-stat {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.mm-market-stat strong {
  font-size: 1.1rem;
  color: var(--ink-strong, #1a1a1a);
}
.mm-market-stat span {
  font-size: 0.7rem;
  color: var(--ink-mute, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mm-market-stat-oos strong { color: var(--danger, #c0392b); }

/* ─────────────────────────────────────────────────────────
   Products table
   ───────────────────────────────────────────────────────── */
.mm-table { width: 100%; }
.mm-platform {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.mm-expand-caret {
  display: inline-block;
  width: 1em;
  color: var(--ink-mute, #6B7280);
  transition: transform 120ms ease;
}
.mm-row-expanded { background: var(--rule-soft, rgba(0,0,0,0.02)); }
.mm-row-expanded td { font-weight: 600; }
/* Caret rotates via CSS on expand — the JS no longer swaps ▸/▾ text (the
   transform transition above was dead code with a textContent swap). */
.mm-row-expanded .mm-expand-caret { transform: rotate(90deg); }

/* HARD guard: collapsed detail rows stay hidden at EVERY viewport width.
   07-dashboard.css turns `.data-table tr` into `display:block` cards at
   ≤560px, which overrode the UA [hidden] rule and made every collapsed
   .mm-detail-row render as an empty card box on phones (Kevin bug report
   2026-07-08). Same fix pattern as .ded-tab-pane[hidden]. */
.data-table tr.mm-detail-row[hidden] { display: none !important; }

/* Stock badge */
.mm-stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.mm-stock-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.mm-stock-badge.stock-in {
  background: rgba(39, 174, 96, 0.12);
  color: var(--success-deep, #1e7e4f);
}
.mm-stock-badge.stock-oos {
  background: rgba(192, 57, 43, 0.12);
  color: var(--danger, #c0392b);
}
.mm-stock-badge.stock-low {
  /* Feedback #18 (Yang Yao Chen): warmer orange so Low Stock ≠ muted Unknown gray */
  background: rgba(230, 126, 34, 0.18);
  color: #b35400;
  border: 1px solid rgba(230, 126, 34, 0.45);
  font-weight: 700;
}
.mm-stock-badge.stock-not-found {
  background: var(--rule-soft, rgba(0,0,0,0.05));
  color: var(--ink-mute, #6B7280);
}
/* Feedback #133 (Hong Zhi, 2026-07-30) — "Not carried": this market has NEVER
   listed the SKU. It is an assortment gap, not an outage, so the badge is
   deliberately NEUTRAL slate-grey with a solid outline: clearly visible (we do
   not hide the fact) but visually distinct from the red OOS badge and from the
   borderless "Not found" delisting badge. Colour is the whole point of the
   fix — Zhi read a red OOS chip on Chicago/Tampa items Weee simply doesn't
   carry. Must never reuse --danger. */
.mm-stock-badge.stock-not-carried {
  background: var(--rule-soft, rgba(100, 116, 139, 0.10));
  color: var(--ink-mute, #64748B);
  border: 1px solid rgba(100, 116, 139, 0.35);
  font-weight: 600;
}
/* #133 (Hong Zhi, 2026-07-31) — STALE sold-out. Deliberately NOT red: the badge
   no longer asserts a current stock-out, it reports the last date we actually
   saw the item. Amber-ish neutral (distinct from the grey `not_carried` badge,
   because "we lost sight of it" and "it was never here" are different facts),
   dashed border to read as provisional/unverified. */
.mm-stock-badge.stock-stale-oos {
  background: rgba(180, 130, 40, 0.10);
  color: #8A6416;
  border: 1px dashed rgba(180, 130, 40, 0.45);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mm-stock-badge.stock-stale-oos .mm-stock-dot { background: #B4822C; }
.mm-stock-badge.stock-unknown {
  background: var(--rule-soft, rgba(0,0,0,0.04));
  color: var(--ink-mute, #8a9096);
  border: 1px dashed var(--rule, rgba(0,0,0,0.18));
  font-weight: 500;
}
[data-theme="dark"] .mm-stock-badge.stock-low {
  background: rgba(230, 126, 34, 0.22);
  color: #f0a060;
  border-color: rgba(230, 126, 34, 0.5);
}
[data-theme="dark"] .mm-stock-badge.stock-not-carried {
  background: rgba(148, 163, 184, 0.14);
  color: #94A3B8;
  border-color: rgba(148, 163, 184, 0.38);
}
[data-theme="dark"] .mm-stock-badge.stock-stale-oos {
  background: rgba(212, 168, 67, 0.14);
  color: #D4A843;
  border-color: rgba(212, 168, 67, 0.42);
}
[data-theme="dark"] .mm-stock-badge.stock-unknown {
  background: rgba(255, 255, 255, 0.04);
  color: #9aa0a6;
  border-color: rgba(255, 255, 255, 0.18);
}

.mm-promo { color: var(--ink, #333); }
.mm-promo-active {
  color: var(--danger, #c0392b);
  font-weight: 700;
}

/* Pagination */
.mm-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  justify-content: flex-end;
}
.mm-page-info { font-size: 0.85rem; }

/* ── Expandable detail panel ── */
.mm-detail-panel { padding: 8px 4px 12px; }
.mm-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 720px) {
  .mm-detail-grid { grid-template-columns: 1fr; }
}
.mm-detail-h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-strong, #1a1a1a);
}
.mm-detail-empty {
  font-size: 0.85rem;
  padding: 8px 0;
}
/* #103: a failed movers load keeps the card + controls and reads as a FAILURE,
   not as a neutral "no results" — hiding the section is what made users report
   that Price Movers had disappeared. */
.mm-movers-failed {
  color: var(--danger, #C0392B);
}
.mm-history-list, .mm-review-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}
.mm-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--rule-soft, rgba(0,0,0,0.02));
}
.mm-history-date { min-width: 56px; }
.mm-history-price { font-weight: 600; }
.mm-history-promo {
  color: var(--danger, #c0392b);
  font-size: 0.76rem;
}

/* Reviews */
.mm-review-item {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--rule, #e3e3e3);
  font-size: 0.84rem;
}
.mm-review-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.mm-review-stars { color: var(--heritage-gold, #D4A843); font-size: 0.8rem; }
.mm-review-lang {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(91, 44, 138, 0.1);
  color: var(--heritage-purple, #5B2C8A);
}
.mm-review-date { font-size: 0.74rem; margin-left: auto; }
.mm-review-title { font-weight: 600; margin-bottom: 2px; }
.mm-review-body { color: var(--ink-soft, #4B5563); line-height: 1.4; }

.mm-sent-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.mm-sent-positive { background: rgba(39, 174, 96, 0.12); color: var(--success-deep, #1e7e4f); }
.mm-sent-negative { background: rgba(192, 57, 43, 0.12); color: var(--danger, #c0392b); }
.mm-sent-neutral  { background: var(--rule-soft, rgba(0,0,0,0.05)); color: var(--ink-mute, #6B7280); }

/* ─────────────────────────────────────────────────────────
   Market Intel Signals panel (collapsible)
   ───────────────────────────────────────────────────────── */
.mm-signals-card { padding: 0; overflow: hidden; }
.mm-signals-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: var(--ink-strong, #1a1a1a);
}
.mm-signals-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
}
.mm-signals-count {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--danger, #c0392b);
  color: #fff;
}
.mm-signals-caret { transition: transform 160ms ease; }
.mm-signals-header[aria-expanded="false"] .mm-signals-caret { transform: rotate(-90deg); }
.mm-signals-body {
  padding: 0 20px 18px;
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 220ms ease, opacity 180ms ease, padding 180ms ease;
}
.mm-signals-body.mm-collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.mm-signals-empty {
  padding: 12px 4px;
  font-size: 0.9rem;
}

.mm-signal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mm-signal-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius, 10px);
  border: 1px solid var(--rule, #e3e3e3);
  background: var(--bg-card, #fff);
  border-left-width: 4px;
  transition: opacity 300ms ease, transform 300ms ease;
}
.mm-sev-card-high   { border-left-color: var(--danger, #c0392b); }
.mm-sev-card-medium { border-left-color: var(--heritage-gold, #D4A843); }
.mm-sev-card-low    { border-left-color: var(--ink-mute, #9aa0a6); }
.mm-signal-resolved {
  opacity: 0;
  transform: translateX(16px);
}
.mm-signal-icon {
  font-size: 1.2rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.mm-signal-text { flex: 1; min-width: 0; }
.mm-signal-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mm-signal-title {
  font-weight: 600;
  color: var(--ink-strong, #1a1a1a);
}
.mm-signal-sub {
  font-size: 0.78rem;
  margin-top: 3px;
}
.mm-signal-type { font-weight: 600; }
.mm-signal-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.mm-signal-logged {
  font-size: 0.76rem;
  margin-top: 6px;
  color: var(--success-deep, #1e7e4f);
}
.mm-signal-action-form {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.mm-signal-action-input {
  flex: 1;
  min-width: 160px;
}

/* Severity badges */
.mm-sev-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
}
.mm-sev-high   { background: rgba(192, 57, 43, 0.14); color: var(--danger, #c0392b); }
.mm-sev-medium { background: rgba(212, 168, 67, 0.2); color: var(--heritage-gold-dark, #9a7a1f); }
.mm-sev-low    { background: var(--rule-soft, rgba(0,0,0,0.05)); color: var(--ink-mute, #6B7280); }

@media (max-width: 560px) {
  .mm-signal-card { flex-wrap: wrap; }
  .mm-signal-buttons { flex-direction: row; width: 100%; }
}

/* ─────────────────────────────────────────────────────────
   Import flow (manager only) + shared result card
   ───────────────────────────────────────────────────────── */
.mm-import-pending {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius, 10px);
  background: var(--rule-soft, rgba(0,0,0,0.03));
  color: var(--ink-soft, #4B5563);
  font-size: 0.92rem;
}
.mm-import-result-card { margin: 0; }
.mm-import-result-head {
  font-size: 0.95rem;
  margin-bottom: 10px;
}
.mm-import-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.mm-import-stat { text-align: center; }
.mm-import-stat-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink-strong, #1a1a1a);
}
.mm-import-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute, #6B7280);
}

/* ── STEP 3 (2026-06-15): Schedule a Report / Create Alert card ── */
.mm-schedule-card .form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--heritage-purple);
  display: block;
  margin-bottom: 4px;
}
.mm-schedule-card .form-input,
.mm-schedule-card .form-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 6px;
  font-size: 14px;
}
.mm-schedule-card #mm-sched-mine .data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--heritage-purple);
}
.mm-schedule-card #mm-sched-mine .data-table td { padding: 6px 10px; font-size: 13px; }

/* ─────────────────────────────────────────────────────────
   Mobile responsiveness — intelligence-first sections
   ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Health cards stack vertically (no horizontal scroll on phones). */
  .mm-health-cards {
    flex-direction: column;
    overflow-x: visible;
  }
  .mm-health-card { min-width: 0; width: 100%; }

  /* Action items: the quick-action button drops full-width below the text. */
  .mm-action-item { flex-wrap: wrap; }
  .mm-action-btn { width: 100%; margin-top: 4px; }

  /* Grouped action items: stack the row vertically, full-width buttons,
     44px touch targets. */
  .mm-action-group .mm-action-item {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .mm-action-item-main { flex-direction: column; gap: 1px; }
  .mm-action-item-btn {
    width: 100%;
    margin-left: 0;
    margin-top: 6px;
    min-height: 44px;
  }
  .mm-action-group-header { flex-wrap: wrap; min-height: 44px; }
  .mm-group-bulk { min-height: 40px; }

  /* Intelligence banner a touch tighter. */
  .mm-intel-summary { padding: 14px 16px; font-size: 0.96rem; }

  /* Collapsible bodies lose the side padding crunch. */
  .mm-catalog-body,
  .mm-admin-body { padding-left: 14px; padding-right: 14px; }
  .mm-catalog-toggle,
  .mm-admin-toggle { padding: 14px 16px; }
}

/* ============================================================
   UX AUDIT FIXES (2026-06-16) — Eliza's lens
   Empty-state, sort headers, danger zone, export buttons,
   noted-OOS rows, top search, "so what" clause.
   ============================================================ */

/* ── Empty / onboarding intelligence summary (0 products) ── */
.mm-intel-empty {
  background: rgba(120, 120, 128, 0.08);
  border-color: rgba(120, 120, 128, 0.24);
  color: var(--text-secondary, #555);
}

/* ── /stats failed (bug hunt M6): an error, not the empty onboarding state ── */
.mm-intel-error {
  background: rgba(204, 0, 0, 0.06);
  border-color: rgba(204, 0, 0, 0.24);
  color: var(--text-secondary, #555);
}

/* ── "So what" interpretive clause in the intel banner ── */
.mm-intel-sowhat {
  font-weight: 600;
  opacity: 0.92;
}

/* ── Top "find a product" search (in Action Items card) ── */
.mm-top-search { margin: 8px 0 12px; }
.mm-top-search .form-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.92rem;
}

/* ── Export CSV ghost buttons ── */
.mm-export-btn {
  font-size: 0.78rem;
  white-space: nowrap;
}
.mm-catalog-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mm-catalog-head .mm-catalog-toggle { flex: 1; }
.mm-catalog-head .mm-export-btn { flex: 0 0 auto; margin-right: 10px; }
/* #161 — two catalog exports sit side by side (latest snapshot + full price
   history). Grouping them keeps the margin-right offset above intact for the
   pair rather than doubling it between the buttons. */
.mm-catalog-exports { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.mm-catalog-exports .mm-export-btn { margin-right: 0; }
.mm-catalog-exports { margin-right: 10px; }

.mm-signals-head-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mm-signals-head-row .mm-signals-header { flex: 1; }
.mm-signals-head-row .mm-export-btn { flex: 0 0 auto; margin-right: 10px; }

/* ── Sortable column headers (▲ / ▼ indicator) ── */
th.mm-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.mm-sortable:hover { color: var(--heritage-red, #CC0000); }
th.mm-sort-active { color: var(--heritage-red, #CC0000); }
.mm-sort-ind {
  font-size: 0.72em;
  display: inline-block;
  min-width: 0.9em;
}

/* ── Noted OOS rows (alert handled, product still out of stock) ── */
.mm-action-item.mm-action-noted {
  opacity: 0.55;
  background: rgba(120, 120, 128, 0.06);
}
.mm-action-item.mm-action-noted .mm-action-title,
.mm-action-item.mm-action-noted .mm-action-item-product {
  text-decoration: none;
}
.mm-action-item.mm-action-noted .mm-action-sub,
.mm-action-item.mm-action-noted .mm-action-item-context {
  font-style: italic;
}

/* ── ⚠️ Danger Zone (destructive ops, visually separated) ── */
.mm-danger-zone {
  margin-top: 22px;
  border: 1px solid rgba(192, 57, 43, 0.40);
  border-radius: var(--radius, 10px);
  background: rgba(192, 57, 43, 0.04);
  overflow: hidden;
}
.mm-danger-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--danger, #c0392b);
  font-size: 0.92rem;
}
.mm-danger-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mm-danger-caret { transition: transform 0.18s ease; }
.mm-danger-toggle[aria-expanded="false"] .mm-danger-caret { transform: rotate(-90deg); }
.mm-danger-body {
  padding: 4px 16px 16px;
  border-top: 1px solid rgba(192, 57, 43, 0.20);
}
.mm-danger-body.mm-collapsed { display: none; }
.mm-danger-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mm-danger-actions .btn {
  border-color: rgba(192, 57, 43, 0.5);
  color: var(--danger, #c0392b);
}
.mm-danger-actions .btn:hover {
  background: rgba(192, 57, 43, 0.10);
}

/* ── Mobile: 44px touch targets + danger zone separation ── */
@media (max-width: 640px) {
  .mm-export-btn,
  .mm-danger-toggle,
  .mm-danger-actions .btn { min-height: 44px; }
  .mm-catalog-head { flex-wrap: wrap; }
  .mm-catalog-head .mm-export-btn { width: 100%; margin-right: 0; }
  /* #161 — stack the export pair on narrow screens so neither label truncates. */
  .mm-catalog-exports { flex-direction: column; align-items: stretch; width: 100%; margin-right: 0; gap: 6px; }
  .mm-signals-head-row { flex-wrap: wrap; }
  .mm-signals-head-row .mm-export-btn { width: 100%; margin-right: 0; }
  .mm-danger-actions .btn { width: 100%; }
}

/* Proposal-form product picker (raw product_id → friendly name search) */
.mm-pp-wrap { position: relative; }
.mm-pp-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  max-height: 240px; overflow-y: auto; margin-top: 2px;
  background: #fff; border: 1px solid rgba(0,0,0,0.16); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.mm-pp-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 11px; cursor: pointer; border-bottom: 1px solid rgba(0,0,0,0.05);
  font-size: 13px; line-height: 1.3;
}
.mm-pp-item:last-child { border-bottom: none; }
.mm-pp-item:hover { background: rgba(204,0,0,0.06); }
.mm-pp-selected { min-height: 16px; }
/* #79/#80 (2026-07-28): all-products affordance on the OOS/Pantry alert form.
   The hint explains that a blank product watches the whole monitored catalog;
   the button appears only after a product is picked, so the user can get back
   to all-products without re-selecting the job type. */
.mm-pp-allhint { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mm-pp-allhint .mm-pp-clear { padding: 2px 8px; font-size: 11px; }

/* ══════════════ Reviews & Sentiment (sentiment pipeline, 2026-07-08) ══════════════ */

/* Catalog rating column — color tier: green ≥ 4.0, gold 3.0–3.9, red < 3.0 */
.mm-rating-cell { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mm-rating-good { color: var(--success-deep, #1e7e4f); }
.mm-rating-ok   { color: var(--heritage-gold-dark, #9a7a1f); }
.mm-rating-bad  { color: var(--danger, #c0392b); }
.mm-rating-n { font-size: 12px; font-weight: 400; }
[data-theme="dark"] .mm-rating-good { color: #6FD89A; }
[data-theme="dark"] .mm-rating-ok   { color: var(--heritage-gold, #d4a843); }
[data-theme="dark"] .mm-rating-bad  { color: #ff8a7a; }

/* Rating / review-count trend sparklines */
.mm-trends { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.mm-trend { flex: 1 1 180px; min-width: 160px; padding: 8px 10px; border-radius: 8px;
  background: var(--surface-2, rgba(0,0,0,0.035)); }
.mm-trend-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.mm-trend-label { font-size: 12px; color: var(--text-mute, #777); }
.mm-trend-val { font-size: 14px; font-weight: 700; color: var(--heritage-gold-dark, #9a7a1f); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .mm-trend { background: rgba(255,255,255,0.05); }
[data-theme="dark"] .mm-trend-val { color: var(--heritage-gold, #d4a843); }
.mm-sparkline { display: block; width: 100%; height: 36px; color: var(--heritage-red, #cc0000); opacity: 0.85; }
.mm-sparkline .mm-spark-pt { cursor: crosshair; }
.mm-sparkline .mm-spark-pt:hover { fill: currentColor; fill-opacity: 0.35; }
[data-theme="dark"] .mm-sparkline { color: #ff6b6b; }

/* Sentiment count strip */
.mm-sentiment-strip { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.mm-sentiment-strip .mm-chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.mm-chip-pos { background: rgba(46, 160, 67, 0.14); color: #1f7a33; }
.mm-chip-neu { background: rgba(0, 0, 0, 0.07); color: var(--text-mute, #666); }
.mm-chip-neg { background: rgba(192, 57, 43, 0.14); color: #a83226; }
[data-theme="dark"] .mm-chip-pos { background: rgba(46, 160, 67, 0.22); color: #6fd68a; }
[data-theme="dark"] .mm-chip-neu { background: rgba(255, 255, 255, 0.10); color: #aaa; }
[data-theme="dark"] .mm-chip-neg { background: rgba(192, 57, 43, 0.24); color: #ff8a7a; }

/* Platform + sentiment polarity filter chips (All / Yami / Weee; All|Neg|Neu|Pos) */
.mm-review-platform-filter,
.mm-review-sentiment-filter { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; align-items: center; }
.mm-review-filter-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-mute, #666); margin-right: 2px;
}
[data-theme="dark"] .mm-review-filter-label { color: #aaa; }
.mm-pf-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(0,0,0,0.14); background: transparent; border-radius: 999px;
  padding: 4px 12px; font-size: 12px; cursor: pointer; min-height: 28px;
  color: var(--text, #333);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.mm-pf-chip:hover { background: rgba(204,0,0,0.06); border-color: rgba(204,0,0,0.3); }
.mm-pf-chip:active { transform: scale(0.97); }
.mm-pf-chip:focus-visible { outline: 2px solid var(--heritage-red, #cc0000); outline-offset: 2px; }
.mm-pf-chip.mm-pf-active { background: var(--heritage-red, #cc0000); border-color: var(--heritage-red, #cc0000); color: #fff; }
.mm-pf-count {
  font-size: 10px; font-weight: 700; line-height: 1; padding: 2px 6px; border-radius: 999px;
  background: rgba(0,0,0,0.08); color: inherit; font-variant-numeric: tabular-nums;
}
.mm-pf-chip.mm-pf-active .mm-pf-count { background: rgba(255,255,255,0.22); }
/* Polarity chip idle tints (hint color before selection) */
.mm-pf-chip.mm-sent-chip-negative { border-color: rgba(192, 57, 43, 0.35); }
.mm-pf-chip.mm-sent-chip-positive { border-color: rgba(46, 160, 67, 0.35); }
.mm-pf-chip.mm-sent-chip-neutral { border-color: rgba(0, 0, 0, 0.18); }
/* Active polarity tints — Negative is visually primary (red) per design */
.mm-pf-chip.mm-sent-chip-negative.mm-pf-active {
  background: #c0392b; border-color: #c0392b; color: #fff;
  box-shadow: 0 1px 5px rgba(192, 57, 43, 0.35);
}
.mm-pf-chip.mm-sent-chip-positive.mm-pf-active {
  background: #2e9e44; border-color: #2e9e44; color: #fff;
  box-shadow: 0 1px 5px rgba(46, 160, 67, 0.28);
}
.mm-pf-chip.mm-sent-chip-neutral.mm-pf-active {
  background: #6b7280; border-color: #6b7280; color: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18);
}
[data-theme="dark"] .mm-pf-chip { border-color: rgba(255,255,255,0.22); color: #ddd; }
[data-theme="dark"] .mm-pf-chip:hover { background: rgba(255,107,107,0.12); border-color: rgba(255,107,107,0.4); }
[data-theme="dark"] .mm-pf-chip.mm-pf-active { background: #a52a2a; border-color: #a52a2a; color: #fff; }
[data-theme="dark"] .mm-pf-count { background: rgba(255,255,255,0.12); }
[data-theme="dark"] .mm-pf-chip.mm-sent-chip-negative { border-color: rgba(255, 138, 122, 0.4); }
[data-theme="dark"] .mm-pf-chip.mm-sent-chip-positive { border-color: rgba(111, 214, 138, 0.4); }
[data-theme="dark"] .mm-pf-chip.mm-sent-chip-neutral { border-color: rgba(255, 255, 255, 0.22); }
[data-theme="dark"] .mm-pf-chip.mm-sent-chip-negative.mm-pf-active {
  background: #a52a2a; border-color: #a52a2a; color: #fff;
}
[data-theme="dark"] .mm-pf-chip.mm-sent-chip-positive.mm-pf-active {
  background: #24803a; border-color: #24803a; color: #fff;
}
[data-theme="dark"] .mm-pf-chip.mm-sent-chip-neutral.mm-pf-active {
  background: #4b5563; border-color: #4b5563; color: #fff;
}

/* V1.1: clickable negative-count chip in the Sentiment tab (button reset +
   affordance) — opens the product detail pre-filtered to Negative. */
button.mm-chip.mm-chip-click {
  font: inherit; border: 1px solid rgba(192, 57, 43, 0.35); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
  transition: background 0.15s ease, transform 0.1s ease;
}
button.mm-chip.mm-chip-click:hover { background: rgba(192, 57, 43, 0.22); }
button.mm-chip.mm-chip-click:active { transform: scale(0.96); }
button.mm-chip.mm-chip-click:focus-visible { outline: 2px solid #c0392b; outline-offset: 2px; }
[data-theme="dark"] button.mm-chip.mm-chip-click { border-color: rgba(255, 138, 122, 0.4); }
[data-theme="dark"] button.mm-chip.mm-chip-click:hover { background: rgba(192, 57, 43, 0.36); }

/* V1.1: "Showing X of Y {sentiment} reviews" note under the review list */
.mm-review-more-note {
  font-size: 12px; padding: 8px 2px 2px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* Per-review platform badge — brand-tinted (Yami warm orange, Weee green) */
.mm-review-platform {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 4px; background: rgba(0,0,0,0.07); color: var(--text-mute, #666);
}
.mm-review-platform.mm-plat-yami { background: rgba(232, 89, 12, 0.12); color: #b34a00; }
.mm-review-platform.mm-plat-weee { background: rgba(47, 158, 68, 0.12); color: #24803a; }
[data-theme="dark"] .mm-review-platform { background: rgba(255,255,255,0.10); color: #aaa; }
[data-theme="dark"] .mm-review-platform.mm-plat-yami { background: rgba(232, 89, 12, 0.22); color: #ffab70; }
[data-theme="dark"] .mm-review-platform.mm-plat-weee { background: rgba(47, 158, 68, 0.22); color: #7fd694; }

/* Verified buyer badge */
.mm-review-verified {
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px;
  background: rgba(46, 160, 67, 0.12); color: #1f7a33; white-space: nowrap;
}
[data-theme="dark"] .mm-review-verified { background: rgba(46, 160, 67, 0.20); color: #6fd68a; }

/* Review body clamp + “Show more” */
.mm-review-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mm-review-clamp.mm-review-expanded { display: block; -webkit-line-clamp: unset; overflow: visible; }
.mm-review-more {
  background: none; border: none; padding: 4px 0 0; margin: 0; cursor: pointer;
  font-size: 0.78rem; font-weight: 600; color: var(--heritage-red, #cc0000);
}
.mm-review-more:hover { text-decoration: underline; }
.mm-review-more:focus-visible { outline: 2px solid var(--heritage-red, #cc0000); outline-offset: 2px; border-radius: 3px; }
[data-theme="dark"] .mm-review-more { color: #ff8a7a; }

/* Review photo thumbnails */
.mm-review-photos { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.mm-review-photo {
  width: 48px; height: 48px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--rule, #e3e3e3); background: var(--rule-soft, rgba(0,0,0,0.04));
}
[data-theme="dark"] .mm-review-photo { border-color: rgba(255,255,255,0.14); }

/* Review-list swap + detail-panel open read as transitions, not flashes */
@keyframes mm-fade-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}
.mm-review-list-wrap.mm-fade-in { animation: mm-fade-in 0.18s ease-out; }
.mm-detail-panel > .mm-detail-grid { animation: mm-fade-in 0.2s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .mm-review-list-wrap.mm-fade-in,
  .mm-detail-panel > .mm-detail-grid { animation: none; }
  .mm-pf-chip { transition: none; }
}

/* Mobile: touch-friendly chips + stacked trends.
   Brand chips in the global filter bar are scoped separately — do NOT flex:1
   them here or they wrap into tall multi-row blocks (Kevin 2026-07-11). */
@media (max-width: 640px) {
  .mm-trends { flex-direction: column; }
  .mm-review-platform-filter:not(.mm-gf-brand) .mm-pf-chip,
  .mm-review-sentiment-filter .mm-pf-chip,
  .mm-stocktype-filter .mm-pf-chip,
  .mm-oos-window .mm-pf-chip {
    min-height: 40px;
    padding: 8px 12px;
    flex: 1 1 auto;
    justify-content: center;
  }
  .mm-review-more { min-height: 44px; padding: 8px 0; }
  .mm-review-photo { width: 56px; height: 56px; }
}

/* ─────────────────────────────────────────────────────────
   Top-level tabs: Overview | Reviews & Sentiment (2026-07-08)
   Mirrors the proven ded-tabs pattern from deductions.
   ───────────────────────────────────────────────────────── */
.mm-tabs {
  display: flex;
  gap: 4px;
  margin: 4px 0 20px;
  border-bottom: 1px solid var(--rule, #e5e5e5);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mm-tabs::-webkit-scrollbar { display: none; }

.mm-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-mute, #6b7280);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  position: relative;
  border-radius: 8px 8px 0 0;
}
.mm-tab:hover { color: var(--ink-soft, #374151); background: rgba(204, 0, 0, 0.04); }
.mm-tab .mm-tab-emoji { font-size: 16px; line-height: 1; }
/* Animated sliding underline — grows from center on activation. */
.mm-tab::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--heritage-red, #CC0000);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 200ms ease;
}
.mm-tab.is-active {
  color: var(--heritage-red, #CC0000);
}
.mm-tab.is-active::after { transform: scaleX(1); }
.mm-tab-pane[hidden] { display: none !important; }

@media (max-width: 640px) {
  .mm-tabs { gap: 0; }
  .mm-tab {
    flex: 1 0 auto;
    justify-content: center;
    padding: 11px 14px;
    font-size: 13px;
    min-height: 44px;
  }
}

/* ── Reviews & Sentiment tab: summary stat cards ── */
.mm-sent-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.mm-sent-stat-card {
  flex: 1 1 140px;
  min-width: 140px;
  padding: 14px 16px;
  border: 1px solid var(--rule, #e3e3e3);
  border-radius: var(--radius, 10px);
  background: var(--warm-white, #fff);
  text-align: center;
}
.mm-sent-stat-wide { flex: 2 1 240px; }
.mm-sent-stat-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink-strong, #1a1a1a);
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
}
.mm-sent-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute, #6B7280);
  margin-top: 4px;
}

/* Inline sentiment chip strip (table cells + breakdown card) */
.mm-sentiment-strip.mm-sent-inline {
  display: inline-flex;
  gap: 5px;
  margin-bottom: 0;
  flex-wrap: nowrap;
}
.mm-sent-inline .mm-chip { font-size: 11px; padding: 2px 8px; }
.mm-sent-pending { font-size: 0.85rem; }

@media (max-width: 640px) {
  .mm-sent-summary { gap: 10px; }
  .mm-sent-stat-card { flex: 1 1 calc(50% - 10px); min-width: calc(50% - 10px); }
  .mm-sent-stat-wide { flex: 1 1 100%; min-width: 100%; }
}

/* ══════════════ OOS Analytics tab + full-module polish (2026-07-08) ══════════════ */

/* Tab panes: one consistent fade-in across all three tabs (no layout shift —
   opacity/translate only). Gated behind prefers-reduced-motion below. */
.mm-tab-pane { animation: mm-fade-in 0.2s ease-out; }
.mm-tab-pane[hidden] { animation: none; }
.mm-tab:focus-visible {
  outline: 2px solid var(--heritage-red, #cc0000);
  outline-offset: -2px;
  border-radius: 6px 6px 0 0;
}

/* Stat cards (shared by Sentiment + OOS tabs): dark-mode-safe surface —
   var(--bg-card) is remapped to --surface-alt inside .mm-* in dark mode,
   var(--warm-white) was NOT (it left the cards white on dark). Numbers use
   tabular figures so cards don't jitter as values change. */
.mm-sent-stat-card { background: var(--bg-card, #fff); }
.mm-sent-stat-val { font-variant-numeric: tabular-nums; }
.mm-stat-danger .mm-sent-stat-val { color: var(--danger, #c0392b); }
.mm-stat-ok .mm-sent-stat-val { color: var(--success-deep, #1e7e4f); }

/* OOS trend card */
.mm-oos-window { display: inline-flex; gap: 6px; margin-left: auto; }
.mm-oos-window .mm-win-chip { min-height: 28px; }
.mm-oos-trend-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 8px;
}
.mm-oos-trend-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink-strong, #1a1a1a);
  font-variant-numeric: tabular-nums;
}
.mm-oos-trend-note { font-size: 0.8rem; }
#mm-oos-trend .mm-sparkline { height: 64px; }

/* Currently-OOS table */
.mm-oos-days { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mm-oos-days-bad { color: var(--danger, #c0392b); }

/* Chronic OOS list */
.mm-chronic-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mm-chronic-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--rule, #e3e3e3);
  border-left: 3px solid var(--heritage-gold, #D4A843);
  border-radius: var(--radius, 10px);
  background: var(--bg-card, #fff);
}
.mm-chronic-rank {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink-mute, #6B7280);
  min-width: 26px;
  font-variant-numeric: tabular-nums;
}
.mm-chronic-main { flex: 1; min-width: 0; }
.mm-chronic-main strong { color: var(--ink-strong, #1a1a1a); }
.mm-chronic-flag {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--danger, #c0392b);
  margin-top: 2px;
}

/* Recovery time */
.mm-recovery-subhead {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute, #6B7280);
  margin: 16px 0 8px;
}
.mm-recovery-subhead:first-child { margin-top: 10px; }
.mm-recovery-plats .mm-sent-stat-card { flex: 1 1 150px; min-width: 150px; }

/* Motion gating — every MM animation respects prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .mm-tab-pane { animation: none; }
  .mm-tab,
  .mm-health-card,
  .mm-catalog-caret,
  .mm-admin-caret,
  .mm-signals-caret,
  .mm-danger-caret,
  .mm-expand-caret { transition: none; }
}

/* Mobile (≤640px): full-width window chips, wrapping chronic rows.
   Tables already convert to data-label card stacks at ≤560px (07-dashboard),
   and .mm-pf-chip gets ≥44px touch targets from the earlier media block. */
@media (max-width: 640px) {
  .mm-oos-window { width: 100%; margin-left: 0; }
  .mm-oos-window .mm-win-chip { flex: 1; }
  .mm-chronic-item { flex-wrap: wrap; }
  .mm-chronic-item .mm-stock-badge { margin-left: 38px; }
}

/* Dark mode — tab bar + new OOS elements (pattern matches 90-dark-mode.css
   .mm- coverage; the broad [class*=" mm-"] var remap handles --bg-card/--ink). */
[data-theme="dark"] .mm-tabs { border-bottom-color: var(--border-light, #3a3128); }
[data-theme="dark"] .mm-tab { color: var(--text-muted, #999); }
[data-theme="dark"] .mm-tab:hover { color: var(--text-secondary, #ccc); }
[data-theme="dark"] .mm-tab.is-active { color: #ff8a7a; }
[data-theme="dark"] .mm-tab::after { background: #ff8a7a; }
[data-theme="dark"] .mm-tab:hover { background: rgba(255, 107, 107, 0.08); }
[data-theme="dark"] .mm-sent-stat-card,
[data-theme="dark"] .mm-chronic-item {
  background: var(--surface-alt);
  border-color: var(--border-light);
}
[data-theme="dark"] .mm-chronic-item { border-left-color: var(--heritage-gold, #D4A843); }
[data-theme="dark"] .mm-oos-trend-val { color: var(--text-primary); }
[data-theme="dark"] .mm-oos-days-bad,
[data-theme="dark"] .mm-chronic-flag,
[data-theme="dark"] .mm-stat-danger .mm-sent-stat-val { color: #ff8a7a; }
[data-theme="dark"] .mm-stat-ok .mm-sent-stat-val { color: #6FD89A; }

/* ═══════════════════════════════════════════════════════════
   Global region + product filters (Eliza, 2026-07-09)
   One bar under the tabs, applies across Overview / Reviews /
   OOS Analytics. Region + debounced product search + reset.
   ═══════════════════════════════════════════════════════════ */
.mm-global-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 2px;
}
.mm-global-filters .mm-gf-region { min-width: 180px; }
.mm-gf-search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 200px;
  max-width: 440px;
}
.mm-gf-search-wrap .mm-gf-search { width: 100%; padding-right: 34px; }
/* Hide the native WebKit clear so we don't get two ✕ buttons. */
.mm-gf-search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.mm-gf-clear-search {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 7px 9px;
  border-radius: 50%;
  color: var(--text-mute, #888);
  transition: color 0.15s ease, background 0.15s ease;
}
.mm-gf-clear-search:hover { color: var(--heritage-red, #cc0000); background: rgba(204,0,0,0.06); }
.mm-gf-clear-search:focus-visible { outline: 2px solid var(--heritage-red, #cc0000); outline-offset: 1px; }
.mm-gf-reset { white-space: nowrap; }

/* Result counts — "Showing X of Y products". */
.mm-gf-count { font-size: 12px; color: var(--text-mute, #888); white-space: nowrap; }
/* ZONE BADGE (Canada MM Phase 0, 2026-08-05).
   Rendered only for a non-US zone, so this rule never applies to an existing
   US user's header. Sized to sit inline with .mm-gf-count without changing the
   filter bar's height. `[hidden]` is honored explicitly because the badge base
   class may set a display value that would otherwise override it. */
.mm-zone-badge { font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.mm-zone-badge[hidden] { display: none; }

/* CURRENCY NOTE (CA-MM Phase 1, 2026-08-06).
   Companion to the per-cell C$ prefix: states the board's currency once, in
   the filter bar. Hidden for USD, so this rule is dead CSS on a US board and
   Eliza's filter-bar height is unchanged. Muted + nowrap so it reads as
   metadata next to the zone badge rather than competing with the filters. */
.mm-currency-note { font-size: 11px; letter-spacing: .02em; white-space: nowrap; color: var(--text-mute, #888); }
.mm-currency-note[hidden] { display: none; }
.mm-gf-count-line { font-size: 12px; color: var(--text-mute, #888); margin: 2px 0 8px; }

/* ADMIN ZONE SWITCH — segmented US | Canada (moved here 2026-08-14).

   Previously an unstyled <select> inside the Full Catalog toolbar, which
   starts COLLAPSED — so the control that retargets the whole page was
   invisible until an admin expanded an unrelated card.

   `margin-left: auto` parks it at the far RIGHT of the (sticky) global filter
   bar so it reads as page-level chrome rather than as one more filter in the
   row. It narrows nothing; it swaps the dataset. Admin-only, so on almost
   every session in prod these rules apply to nothing at all. */
.mm-zone-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.mm-zone-switch[hidden] { display: none; }
.mm-zone-switch-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-mute, #888);
  white-space: nowrap;
}
.mm-zone-seg {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border, #e5e0d8);
  border-radius: 8px;
  background: var(--bg-subtle, #f4f1ec);
}
.mm-zone-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-mute, #888);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}
.mm-zone-seg-btn:hover { color: var(--text, #2a2118); }
.mm-zone-seg-btn.is-active,
.mm-zone-seg-btn[aria-checked="true"] {
  background: var(--surface, #fffdf8);
  color: var(--text, #2a2118);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .10);
}
/* Roving tabindex means only ONE segment is tabbable, so losing the focus ring
   would strand a keyboard user with no visible position. */
.mm-zone-seg-btn:focus-visible {
  outline: 2px solid var(--heritage-red, #cc0000);
  outline-offset: 1px;
}
.mm-zone-seg-flag { font-size: 12px; line-height: 1; }

/* Stated fact where the Refresh CTA sits on a Canada board. POST /scrape has
   no CA job, so the button is hidden rather than left to fire a US scrape
   under a Canada header (see renderFreshnessBar). */
.mm-fresh-refresh-na {
  font-size: 12px;
  line-height: 1.35;
  max-width: 260px;
  text-align: right;
}

[data-theme="dark"] .mm-zone-seg { border-color: var(--border-light, #3a3128); background: rgba(255,255,255,.04); }
[data-theme="dark"] .mm-zone-seg-btn.is-active,
[data-theme="dark"] .mm-zone-seg-btn[aria-checked="true"] {
  background: rgba(255,255,255,.10);
  color: var(--text, #f0ece6);
}

/* Smooth swap when a filter re-renders a table (generic; the review list
   already has a scoped variant above). */
.mm-fade-in { animation: mm-fade-in 0.18s ease-out; }

/* Dark mode */
[data-theme="dark"] .mm-gf-clear-search:hover { color: #ff8a7a; background: rgba(255,107,107,0.12); }

/* Mobile: stack the bar vertically, full-width controls, tight gaps.
   Brand chips stay a single horizontal scroll row (not a wrapped grid).

   Critical flex bugs fixed 2026-07-11 (Kevin feedback on 1155ec9):
   1) .mm-gf-search-wrap desktop flex:1 1 220px becomes HEIGHT basis in a
      column flex parent → ~220px empty air under the search field.
   2) brand row needs min-width:0 + width:100% or it expands to fit all
      chips (min-width:auto) and never creates an overflow scroll. */
@media (max-width: 640px) {
  .mm-tabs { margin: 0 0 8px; }
  .mm-global-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 4px 0 0;
  }
  .mm-global-filters .mm-gf-region {
    min-width: 0;
    width: 100%;
    min-height: 40px;
    height: 40px;
  }
  /* Kill the 220px main-axis basis that balloons height in column layout */
  .mm-global-filters .mm-gf-search-wrap,
  .mm-gf-search-wrap {
    flex: 0 0 auto;
    flex-basis: auto;
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: 0;
  }
  .mm-global-filters .mm-gf-search {
    min-height: 40px;
    height: 40px;
  }
  .mm-gf-reset {
    align-self: flex-start;
    min-height: 36px;
    height: auto;
    padding: 6px 10px;
  }
  /* Zone switch: drop the desktop right-park (margin-left:auto does nothing in
     a column flex parent) and give the segments a real 36px tap target. */
  .mm-global-filters .mm-zone-switch {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
  .mm-zone-seg { flex: 0 1 auto; }
  .mm-zone-seg-btn { min-height: 36px; padding: 6px 14px; }
  .mm-fresh-refresh-na { max-width: none; text-align: left; }
  /* Brand chips: constrained width + min-width:0 so overflow-x actually scrolls */
  .mm-global-filters .mm-gf-brand,
  .mm-gf-brand.mm-review-platform-filter,
  #mm-gf-brand {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 6px;
    margin: 0 !important;            /* override .mm-review-platform-filter margin-bottom:8px */
    padding: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;                    /* allow shrink below content size */
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    touch-action: pan-x;
  }
  .mm-global-filters .mm-gf-brand::-webkit-scrollbar,
  .mm-gf-brand.mm-review-platform-filter::-webkit-scrollbar,
  #mm-gf-brand::-webkit-scrollbar { display: none; height: 0; }
  .mm-global-filters .mm-gf-brand .mm-pf-chip,
  .mm-gf-brand .mm-pf-chip,
  #mm-gf-brand .mm-pf-chip {
    flex: 0 0 auto !important;
    min-width: max-content;
    min-height: 34px;
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mm-fade-in { animation: none; }
  .mm-gf-clear-search { transition: none; }
}


/* ── Pantry (Weee Pantry+ soft-OOS, Eliza 2026-07-09) ──
   🟡 yellow badge sits between green in-stock and red OOS. */
.mm-stock-badge.stock-pantry {
  background: rgba(230, 176, 20, 0.16);
  color: var(--warning-deep, #9a6f12);
}
/* #135: Pantry+ count chip in the catalog summary row. Amber, matching the
   🟡 badge above — deliberately NOT the red .vc-chip-expired outage style,
   because a Pantry+ SKU is still buyable. */
.mm-pantry-chip { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* #135 residual: the ZERO chip. Jenna Yang could not tell "0 Pantry+ in Los
   Angeles" (a real measurement) from "the number failed to load", because the
   chip was suppressed at 0. It now renders — in the NEUTRAL total style, never
   amber. Amber says "watch this"; an empty Pantry+ shelf is not a problem to
   watch, it is simply the answer. */
.mm-pantry-chip-zero {
  font-variant-numeric: normal;
  font-style: italic;
  opacity: 0.85;
}
/* #135 residual: a measured 0 on the health card is muted rather than amber,
   for the same reason — and is never mistaken for a missing value because the
   stat always carries an explanatory title attribute. */
.mm-health-stat-pantry-zero strong { color: var(--text-mute, #8a8178); font-weight: 600; }
.mm-pantry-moved {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--warning-deep, #9a6f12);
  white-space: nowrap;
}
/* Stock-type chip group in the catalog toolbar; chips reuse .mm-pf-chip and
   wrap on narrow screens like the platform filter. */
.mm-stocktype-filter {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
/* OOS Analytics: yellow accent for the "In Pantry" stat card. */
.mm-sent-stat-card.mm-stat-warn .mm-sent-stat-val {
  color: var(--warning-deep, #9a6f12);
}
/* Dark mode: keep the pantry yellow readable on dark surfaces. */
[data-theme="dark"] .mm-stock-badge.stock-pantry {
  background: rgba(230, 176, 20, 0.22);
  color: #e6c35c;
}
[data-theme="dark"] .mm-pantry-moved { color: #e6c35c; }
[data-theme="dark"] .mm-sent-stat-card.mm-stat-warn .mm-sent-stat-val { color: #e6c35c; }

/* =========================================================
   Sentiment Phase 1B (2026-07-09) — brand chips, aspect
   breakdown, theme pills, competitive comparison, theme trends
   ========================================================= */

/* ── Global brand filter chips (in the shared filter bar) ──
   Desktop may wrap; mobile forces a single horizontal scroll row
   (see ≤640 block — min-width:0 is required for overflow-x). */
.mm-gf-brand {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

/* ── Aspect breakdown (detail panel) ── */
.mm-aspect-block { margin-top: 14px; }
.mm-aspect-h4 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mm-aspect-hint { font-size: 11px; font-weight: 400; }
.mm-aspect-rows { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.mm-aspect-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.mm-aspect-row:hover { background: rgba(204, 0, 0, 0.05); }
.mm-aspect-row:focus-visible { outline: 2px solid var(--heritage-red, #cc0000); outline-offset: 2px; }
.mm-aspect-row.mm-aspect-active {
  background: rgba(204, 0, 0, 0.08);
  border-color: rgba(204, 0, 0, 0.35);
}
.mm-aspect-name { font-size: 12.5px; font-weight: 600; }
.mm-aspect-bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.07);
  min-width: 60px;
}
.mm-aspect-seg { display: block; height: 100%; }
.mm-aspect-seg-pos { background: #3f9d58; }
.mm-aspect-seg-neu { background: #b9b2a6; }
.mm-aspect-seg-neg { background: #cc4433; }
.mm-aspect-counts { font-size: 11px; white-space: nowrap; color: var(--text-mute, #888); }
.mm-aspect-enriched { font-size: 11px; margin-top: 4px; }

/* Per-review aspect badges */
.mm-review-aspects { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.mm-aspect-badge {
  font-size: 10.5px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.mm-aspect-badge-pos { background: rgba(63, 157, 88, 0.12); color: #2c7a43; border-color: rgba(63, 157, 88, 0.3); }
.mm-aspect-badge-neu { background: rgba(0, 0, 0, 0.05); color: #6f6a60; border-color: rgba(0, 0, 0, 0.12); }
.mm-aspect-badge-neg { background: rgba(204, 68, 51, 0.1); color: #a83525; border-color: rgba(204, 68, 51, 0.3); }

/* Theme pills (detail panel) */
.mm-theme-block { margin-top: 12px; }
.mm-theme-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mm-theme-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: none;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.mm-theme-pill:hover { background: rgba(204, 0, 0, 0.06); border-color: rgba(204, 0, 0, 0.3); }
.mm-theme-pill:focus-visible { outline: 2px solid var(--heritage-red, #cc0000); outline-offset: 2px; }
.mm-theme-pill.mm-theme-active { background: var(--heritage-red, #cc0000); border-color: var(--heritage-red, #cc0000); color: #fff; }
.mm-theme-count {
  font-size: 10.5px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}
.mm-theme-pill.mm-theme-active .mm-theme-count { background: rgba(255, 255, 255, 0.22); }

/* Review filter note ("Filtered by: Taste · Clear filter") */
.mm-review-filter-note { font-size: 12px; margin-top: 8px; }
.mm-review-filter-clear {
  margin-left: 8px;
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--heritage-red, #cc0000);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* ── Competitive comparison ── */
.mm-compare-hint { font-size: 12px; margin-bottom: 8px; }
.mm-compare-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 132px; overflow-y: auto; padding: 2px; }
.mm-compare-chip { max-width: 100%; }
.mm-compare-chip-brand { font-size: 10px; opacity: 0.7; margin-left: 6px; }
.mm-compare-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.mm-compare-max { font-size: 12px; color: var(--danger, #cc0000); }
.mm-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 6px;
}
.mm-compare-col {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mm-compare-col-lkk { border-color: rgba(204, 0, 0, 0.4); box-shadow: 0 0 0 1px rgba(204, 0, 0, 0.12); }
.mm-compare-lkk-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--heritage-red, #cc0000);
  color: #fff;
  vertical-align: middle;
}
.mm-compare-col-name { font-size: 13.5px; line-height: 1.3; }
.mm-compare-rating { font-size: 15px; font-weight: 700; }
.mm-compare-rated { font-size: 11px; font-weight: 400; }
.mm-compare-radar { display: flex; justify-content: center; }
/* Audit M3 (2026-07-09): bar fallback when <3 aspects have data (radar would degenerate) */
.mm-compare-bars { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 12px 4px; }
.mm-compare-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.mm-compare-bar-label { flex: 0 0 72px; text-align: right; }
.mm-compare-bar-track { flex: 1; height: 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.08); overflow: hidden; }
.mm-compare-bar-fill { height: 100%; border-radius: 4px; background: var(--heritage-red, #cc0000); }
.mm-compare-bar-pct { flex: 0 0 36px; font-weight: 700; }
[data-theme="dark"] .mm-compare-bar-track { background: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] .mm-compare-bar-fill { background: #ff6b6b; }
.mm-compare-aspects { display: flex; flex-direction: column; gap: 3px; }
.mm-compare-aspect-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.07);
}
.mm-compare-insights { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.mm-compare-insight { border-left: 3px solid; border-radius: 4px; padding: 8px 12px; }
.mm-insight-adv { border-color: #3f9d58; background: rgba(63, 157, 88, 0.07); }
.mm-insight-gap { border-color: #cc4433; background: rgba(204, 68, 51, 0.06); }
.mm-compare-insight-title { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.mm-compare-insight-line { font-size: 12.5px; padding: 1px 0; }

/* Radar chart */
.mm-radar-ring { fill: none; stroke: rgba(0, 0, 0, 0.12); stroke-width: 1; }
.mm-radar-axis { stroke: rgba(0, 0, 0, 0.08); stroke-width: 1; }
.mm-radar-value { fill: rgba(204, 0, 0, 0.18); stroke: var(--heritage-red, #cc0000); stroke-width: 1.5; stroke-linejoin: round; }
.mm-radar-dot { fill: var(--heritage-red, #cc0000); }
.mm-radar-label { font-size: 9px; fill: var(--text-mute, #888); }

/* ── Theme trends ── */
.mm-themes-scope { font-size: 12px; font-weight: 400; margin-left: 8px; }
.mm-themes-list { display: flex; flex-direction: column; gap: 4px; }
.mm-theme-row {
  display: grid;
  grid-template-columns: 34px minmax(90px, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.mm-theme-row:hover { background: rgba(204, 0, 0, 0.05); }
.mm-theme-row:focus-visible { outline: 2px solid var(--heritage-red, #cc0000); outline-offset: 2px; }
.mm-theme-row.mm-theme-row-active { background: rgba(204, 0, 0, 0.08); border-color: rgba(204, 0, 0, 0.35); }
.mm-theme-rank { font-size: 11px; font-weight: 700; color: var(--text-mute, #888); }
.mm-theme-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.mm-theme-mentions { font-size: 12px; white-space: nowrap; }
.mm-theme-trend { font-size: 12px; font-weight: 600; white-space: nowrap; }
.mm-trend-up { color: #2c7a43; }
.mm-trend-down { color: #a83525; }
.mm-trend-flat { color: var(--text-mute, #888); }
.mm-themes-drill {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 10px;
}
.mm-themes-drill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.mm-themes-drill-note { font-size: 11px; margin-top: 6px; }
.mm-drill-product { font-size: 12px; }

/* ── Dark mode ── */
[data-theme="dark"] .mm-aspect-row:hover { background: rgba(255, 107, 107, 0.1); }
[data-theme="dark"] .mm-aspect-row.mm-aspect-active { background: rgba(255, 107, 107, 0.14); border-color: rgba(255, 107, 107, 0.4); }
[data-theme="dark"] .mm-aspect-bar { background: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .mm-aspect-seg-pos { background: #4caf6d; }
[data-theme="dark"] .mm-aspect-seg-neu { background: #77716a; }
[data-theme="dark"] .mm-aspect-seg-neg { background: #e0604e; }
[data-theme="dark"] .mm-aspect-badge-pos { background: rgba(76, 175, 109, 0.18); color: #7fd49c; border-color: rgba(76, 175, 109, 0.4); }
[data-theme="dark"] .mm-aspect-badge-neu { background: rgba(255, 255, 255, 0.08); color: #b6b0a6; border-color: rgba(255, 255, 255, 0.18); }
[data-theme="dark"] .mm-aspect-badge-neg { background: rgba(224, 96, 78, 0.16); color: #ef9184; border-color: rgba(224, 96, 78, 0.4); }
[data-theme="dark"] .mm-theme-pill { border-color: rgba(255, 255, 255, 0.22); color: #ddd; }
[data-theme="dark"] .mm-theme-pill:hover { background: rgba(255, 107, 107, 0.12); border-color: rgba(255, 107, 107, 0.4); }
[data-theme="dark"] .mm-theme-pill.mm-theme-active { background: #a52a2a; border-color: #a52a2a; color: #fff; }
[data-theme="dark"] .mm-theme-count { background: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] .mm-review-filter-clear { color: #ff8a80; }
[data-theme="dark"] .mm-compare-col { border-color: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] .mm-compare-col-lkk { border-color: rgba(255, 107, 107, 0.5); box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.18); }
[data-theme="dark"] .mm-compare-aspect-line { border-bottom-color: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .mm-insight-adv { background: rgba(76, 175, 109, 0.1); }
[data-theme="dark"] .mm-insight-gap { background: rgba(224, 96, 78, 0.1); }
[data-theme="dark"] .mm-radar-ring { stroke: rgba(255, 255, 255, 0.16); }
[data-theme="dark"] .mm-radar-axis { stroke: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .mm-radar-value { fill: rgba(255, 107, 107, 0.2); stroke: #ff6b6b; }
[data-theme="dark"] .mm-radar-dot { fill: #ff6b6b; }
[data-theme="dark"] .mm-theme-row:hover { background: rgba(255, 107, 107, 0.1); }
[data-theme="dark"] .mm-theme-row.mm-theme-row-active { background: rgba(255, 107, 107, 0.14); border-color: rgba(255, 107, 107, 0.4); }
[data-theme="dark"] .mm-trend-up { color: #7fd49c; }
[data-theme="dark"] .mm-trend-down { color: #ef9184; }
[data-theme="dark"] .mm-themes-drill { border-top-color: rgba(255, 255, 255, 0.12); }

/* ── Mobile ── */
@media (max-width: 640px) {
  .mm-aspect-row { grid-template-columns: 76px 1fr; }
  .mm-aspect-counts { grid-column: 1 / -1; }
  .mm-compare-grid { grid-template-columns: 1fr; }
  .mm-theme-row { grid-template-columns: 28px 1fr auto; }
  .mm-theme-sent { grid-column: 2; }
  .mm-theme-trend { grid-column: 3; }
  .mm-compare-chips { max-height: 180px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .mm-aspect-row, .mm-theme-pill, .mm-theme-row { transition: none; }
}

/* =========================================================
   Reviews & Sentiment polish pass (2026-07-09)
   Stat-card weight + hover lift, skeleton loaders, aspect-bar
   % labels + amber neutral, radar readability, review-card
   typography, relative timestamps, theme-trend pills, drill
   animation, dark mode + mobile (390px) coverage.
   ========================================================= */

/* ── ① Sentiment stat cards: visual weight + hover lift ── */
.mm-sent-stat-card {
  border-top: 3px solid var(--heritage-gold, #D4A843);
  background:
    linear-gradient(180deg, rgba(212, 168, 67, 0.06), rgba(212, 168, 67, 0) 58%),
    var(--bg-card, #fff);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.mm-sent-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.10));
}
.mm-sent-stat-val { font-size: 1.75rem; min-height: 36px; }
/* Status accents recolor the top border too (OOS tab shares the class). */
.mm-sent-stat-card.mm-stat-danger { border-top-color: var(--danger, #c0392b); }
.mm-sent-stat-card.mm-stat-ok     { border-top-color: var(--success-deep, #1e7e4f); }
.mm-sent-stat-card.mm-stat-warn   { border-top-color: var(--warning-deep, #9a6f12); }
[data-theme="dark"] .mm-sent-stat-card {
  background:
    linear-gradient(180deg, rgba(212, 168, 67, 0.08), rgba(212, 168, 67, 0) 58%),
    var(--surface-alt);
}
[data-theme="dark"] .mm-sent-stat-card:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4); }

/* ── ⑦ Skeleton loaders for the summary cards ── */
.mm-sent-stat-skel { pointer-events: none; }
.mm-skel-line {
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.11) 50%, rgba(0, 0, 0, 0.06) 75%);
  background-size: 200% 100%;
  animation: mm-skel-shimmer 1.2s linear infinite;
}
.mm-skel-val   { height: 26px; width: 58%; margin: 5px auto 0; }
.mm-skel-label { height: 10px; width: 44%; margin: 10px auto 2px; }
@keyframes mm-skel-shimmer { to { background-position: -200% 0; } }
[data-theme="dark"] .mm-skel-line {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.07) 25%, rgba(255, 255, 255, 0.13) 50%, rgba(255, 255, 255, 0.07) 75%);
  background-size: 200% 100%;
}

/* ── ② Filter chips: filled active state gets a subtle glow ── */
.mm-pf-chip.mm-pf-active { box-shadow: 0 1px 5px rgba(204, 0, 0, 0.28); }
[data-theme="dark"] .mm-pf-chip.mm-pf-active { box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45); }

/* ── ③ Aspect bars: taller track, green/amber/red gradients, % label ── */
.mm-aspect-bar { height: 12px; border-radius: 6px; min-width: 0; }
.mm-aspect-seg { transition: filter 0.12s ease; }
.mm-aspect-seg-pos { background: linear-gradient(90deg, #2f9e50, #4cb96a); }
.mm-aspect-seg-neu { background: linear-gradient(90deg, #d9a83f, #e6bd63); }
.mm-aspect-seg-neg { background: linear-gradient(90deg, #c0392b, #e0604e); }
.mm-aspect-row:hover .mm-aspect-seg { filter: brightness(1.06); }
.mm-aspect-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-right: 7px;
  font-size: 11.5px;
}
.mm-pct-good { color: var(--success-deep, #1e7e4f); }
.mm-pct-mid  { color: var(--warning-deep, #9a6f12); }
.mm-pct-bad  { color: var(--danger, #c0392b); }
[data-theme="dark"] .mm-aspect-seg-pos { background: linear-gradient(90deg, #3f9d58, #5fc47d); }
[data-theme="dark"] .mm-aspect-seg-neu { background: linear-gradient(90deg, #c99b3a, #e6c35c); }
[data-theme="dark"] .mm-aspect-seg-neg { background: linear-gradient(90deg, #d05545, #ef7d6b); }
[data-theme="dark"] .mm-pct-good { color: #6FD89A; }
[data-theme="dark"] .mm-pct-mid  { color: #e6c35c; }
[data-theme="dark"] .mm-pct-bad  { color: #ff8a7a; }

/* ── ④ Radar chart readability + hover ── */
.mm-radar { max-width: 100%; height: auto; }
.mm-radar-label { font-size: 10px; font-weight: 600; fill: var(--ink-mute, #6B7280); }
.mm-radar-dot { cursor: crosshair; transition: r 0.12s ease; }
.mm-radar-dot:hover { r: 4.5; }
[data-theme="dark"] .mm-radar-label { fill: #b6b0a6; }

/* ── ⑤ Review cards: typography + hover ── */
.mm-review-item {
  padding: 10px 12px;
  background: var(--bg-card, #fff);
  transition: border-color 0.12s ease;
}
.mm-review-item:hover { border-color: rgba(212, 168, 67, 0.55); }
.mm-review-title { font-size: 0.9rem; }
.mm-review-body { line-height: 1.5; }
.mm-review-stars { letter-spacing: 1px; }
.mm-review-date { cursor: default; }
[data-theme="dark"] .mm-review-item:hover { border-color: rgba(212, 168, 67, 0.45); }

/* ── ⑥ Theme trends: pill trend badges + drill-open animation ── */
.mm-theme-trend { padding: 2px 9px; border-radius: 999px; }
.mm-trend-up   { background: rgba(63, 157, 88, 0.12); }
.mm-trend-down { background: rgba(204, 68, 51, 0.10); }
.mm-trend-flat { background: rgba(0, 0, 0, 0.05); }
[data-theme="dark"] .mm-trend-up   { background: rgba(76, 175, 109, 0.16); }
[data-theme="dark"] .mm-trend-down { background: rgba(224, 96, 78, 0.14); }
[data-theme="dark"] .mm-trend-flat { background: rgba(255, 255, 255, 0.08); }
/* [hidden] → display:none, so unhiding restarts the fade (click-to-drill). */
.mm-themes-drill { animation: mm-fade-in 0.2s ease-out; }
.mm-themes-drill[hidden] { animation: none; }

/* ── ⑨ Mobile (≤640px incl. 390px): stacked cards, no bar overflow, scaled radar ── */
@media (max-width: 640px) {
  .mm-sent-stat-val { font-size: 1.45rem; min-height: 32px; }
  .mm-aspect-bar { min-width: 0; width: 100%; }
  .mm-aspect-counts { white-space: normal; }
  .mm-compare-radar .mm-radar { width: min(190px, 100%); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .mm-sent-stat-card, .mm-aspect-seg, .mm-radar-dot, .mm-review-item { transition: none; }
  .mm-sent-stat-card:hover { transform: none; }
  .mm-skel-line { animation: none; }
  .mm-themes-drill { animation: none; }
}

/* =========================================================
   OOS Analytics + global module polish (2026-07-09)
   Severity indicators, rank badges, recovery bars, sticky
   tab/filter bars, cohesive filter controls, dark + mobile.
   ========================================================= */

/* ── Sticky tab bar + global filter bar (desktop/tablet) ──
   The window is the scroll container; the app topbar is sticky at top:0
   (z-index 5). The MM tab bar pins just below it, the filter bar below that. */
[data-module="market-monitor"] {
  --mm-sticky-top: calc(var(--header-h, 72px) + env(safe-area-inset-top, 0px) + 6px);
  --mm-tabs-h: 46px;
}
.mm-tabs {
  position: sticky;
  top: var(--mm-sticky-top);
  z-index: 4;
  min-height: var(--mm-tabs-h);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.mm-global-filters {
  position: sticky;
  top: calc(var(--mm-sticky-top) + var(--mm-tabs-h) - 1px);
  z-index: 3;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 0 10px;
  margin: 0 0 2px;
  border-bottom: 1px solid var(--rule-soft, rgba(0, 0, 0, 0.05));
}
[data-theme="dark"] .mm-tabs,
[data-theme="dark"] .mm-global-filters {
  background: rgba(24, 27, 39, 0.92);
}
[data-theme="dark"] .mm-global-filters { border-bottom-color: var(--border-light, #3a3128); }

/* ── Cohesive global filter controls: one consistent 38px height ── */
.mm-global-filters .filter-select,
.mm-global-filters .form-input {
  height: 38px;
  box-sizing: border-box;
}
.mm-global-filters .mm-gf-reset { height: 38px; }

/* ── Typography: consistent card heading size across all 3 tabs ── */
[data-module="market-monitor"] .card-title { font-size: 1.02rem; }

/* ── Currently-OOS: severity indicators (>30d red, >7d amber) ── */
.mm-oos-current-card { border-left: 3px solid var(--danger, #c0392b); }
.mm-oos-days-pill {
  display: inline-block;
  font-size: 0.86rem;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--rule-soft, rgba(0, 0, 0, 0.05));
  color: var(--ink-soft, #4B5563);
}
.mm-oos-days-pill.mm-oos-sev-amber {
  background: rgba(212, 168, 67, 0.18);
  color: var(--warning-deep, #9a6f12);
}
.mm-oos-days-pill.mm-oos-sev-red {
  background: rgba(192, 57, 43, 0.14);
  color: var(--danger, #c0392b);
  font-size: 0.92rem;
}
tr.mm-oos-row-amber > td:first-child { box-shadow: inset 3px 0 0 var(--heritage-gold, #D4A843); }
tr.mm-oos-row-red   > td:first-child { box-shadow: inset 3px 0 0 var(--danger, #c0392b); }

/* ── Chronic offenders: position badges + prominent count badge ── */
.mm-chronic-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  font-size: 0.78rem;
  background: var(--rule-soft, rgba(0, 0, 0, 0.06));
  color: var(--ink-mute, #6B7280);
}
.mm-chronic-rank.mm-rank-1 { background: rgba(212, 168, 67, 0.28); color: #7a5c10; }
.mm-chronic-rank.mm-rank-2 { background: rgba(140, 140, 148, 0.22); color: #4d4d55; }
.mm-chronic-rank.mm-rank-3 { background: rgba(176, 108, 62, 0.20); color: #8a4f26; }
.mm-chronic-item.mm-chronic-top { border-left-color: var(--danger, #c0392b); }
.mm-chronic-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.mm-chronic-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(192, 57, 43, 0.12);
  color: var(--danger, #c0392b);
  white-space: nowrap;
}
.mm-chronic-days { font-size: 0.78rem; }

/* ── Recovery time: comparison bars (platform cards + product table) ── */
.mm-bar-track {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.07);
  overflow: hidden;
  min-width: 56px;
}
.mm-bar-track .mm-bar-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--heritage-red, #cc0000);
}
.mm-recovery-plat-bar { margin: 8px auto 6px; max-width: 120px; }
.mm-recovery-avg-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mm-recovery-avg-wrap .mm-bar-track { flex: 1; max-width: 110px; }

/* ── Trend: visible axis baseline + consistent sparkline sizing ── */
.mm-oos-trend-chart {
  border-bottom: none;
  padding-bottom: 0;
  overflow-x: auto;
}
#mm-oos-trend .mm-sparkline {
  height: 120px;
  max-width: 100%;
  color: var(--heritage-red, #cc0000);
}
.mm-sparkline.mm-spark-axes {
  /* Fixed aspect when axes/text present — avoid preserveAspectRatio=none text squash */
  height: auto;
  min-height: 120px;
}
.mm-spark-axis {
  stroke: var(--rule, #d0d0d0);
  stroke-width: 1;
}
.mm-spark-grid {
  stroke: var(--rule-soft, rgba(0,0,0,0.08));
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
.mm-spark-tick {
  fill: var(--ink-mute, #6B7280);
  font-size: 10px;
  font-family: var(--font-sans, system-ui, sans-serif);
}
[data-theme="dark"] .mm-spark-axis { stroke: rgba(255, 255, 255, 0.18); }
[data-theme="dark"] .mm-spark-grid { stroke: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .mm-spark-tick { fill: var(--text-secondary, #aaa); }
.mm-trend .mm-sparkline { height: 36px; }
/* Period selector pills (30d/60d/90d) */
.mm-oos-window .mm-win-chip {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding: 4px 14px;
}

/* ── Pantry section: amber accent (vs red full-OOS card) ── */
.mm-oos-pantry-card { border-left: 3px solid var(--heritage-gold, #D4A843); }
.mm-pantry-table .mm-pantry-moved {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(230, 176, 20, 0.16);
  margin-left: 2px;
}

/* ── Dark mode ── */
[data-theme="dark"] .mm-oos-current-card { border-left-color: #e05a4a; }
[data-theme="dark"] .mm-oos-pantry-card { border-left-color: var(--heritage-gold, #D4A843); }
[data-theme="dark"] .mm-oos-days-pill { background: rgba(255, 255, 255, 0.08); color: var(--text-secondary, #ccc); }
[data-theme="dark"] .mm-oos-days-pill.mm-oos-sev-amber { background: rgba(230, 176, 20, 0.22); color: #e6c35c; }
[data-theme="dark"] .mm-oos-days-pill.mm-oos-sev-red { background: rgba(224, 96, 78, 0.2); color: #ff8a7a; }
[data-theme="dark"] tr.mm-oos-row-red > td:first-child { box-shadow: inset 3px 0 0 #e05a4a; }
[data-theme="dark"] .mm-chronic-rank { background: rgba(255, 255, 255, 0.1); color: var(--text-secondary, #ccc); }
[data-theme="dark"] .mm-chronic-rank.mm-rank-1 { background: rgba(212, 168, 67, 0.3); color: #e6c35c; }
[data-theme="dark"] .mm-chronic-rank.mm-rank-2 { background: rgba(190, 190, 200, 0.2); color: #cfcfd6; }
[data-theme="dark"] .mm-chronic-rank.mm-rank-3 { background: rgba(200, 130, 80, 0.24); color: #e8a877; }
[data-theme="dark"] .mm-chronic-item.mm-chronic-top { border-left-color: #e05a4a; }
[data-theme="dark"] .mm-chronic-badge { background: rgba(224, 96, 78, 0.18); color: #ff8a7a; }
[data-theme="dark"] .mm-bar-track { background: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .mm-bar-track .mm-bar-fill { background: #ff6b6b; }
[data-theme="dark"] .mm-oos-trend-chart { border-bottom-color: var(--border-light, #3a3128); }
[data-theme="dark"] .mm-pantry-table .mm-pantry-moved { background: rgba(230, 176, 20, 0.2); }

/* ── Mobile (≤640px, incl. 390px) ── */
@media (max-width: 640px) {
  /* Taller tabs on mobile → adjust the sticky offset for the filter bar. */
  [data-module="market-monitor"] { --mm-tabs-h: 49px; }
  /* The stacked filter bar is too tall to pin on phones — unstick it
     (the tab bar stays sticky for orientation). */
  .mm-global-filters {
    position: static;
    padding: 0;
    border-bottom: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* Reinforced: no leftover sticky padding / air under search */
    gap: 6px;
    margin: 4px 0 0;
  }
  .mm-recovery-avg-wrap .mm-bar-track { max-width: none; }
  .mm-chronic-meta { gap: 6px; }

  .mm-tabs { margin-bottom: 8px; }
  .mm-global-filters .filter-select,
  .mm-global-filters .form-input {
    height: 40px;
    min-height: 40px;
  }
  /* Re-assert search wrap sizing after sticky block (cascade safety) */
  .mm-global-filters .mm-gf-search-wrap {
    flex: 0 0 auto;
    flex-basis: auto;
    width: 100%;
    max-width: none;
    min-height: 0;
  }
  /* Re-assert brand scroll after any later flex-wrap:wrap rules */
  #mm-gf-brand.mm-gf-brand {
    flex-wrap: nowrap !important;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
  }
  /* Hero metrics sit above the filter stack — keep them compact too. */
  [data-module="market-monitor"] .page-hero-metrics { margin-top: 10px; gap: 6px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .mm-tab::after { transition: none; }
  .mm-tab { transition: none; }
  .mm-tabs,
  .mm-global-filters {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* =========================================================
   Overview catalog UX polish (2026-07-09)
   Smooth detail expand/collapse, row hover + hierarchy,
   numeric alignment, search spinner, skeleton rows,
   price-trend sparkline caption, mobile touch targets.
   ========================================================= */

/* ── Product rows: hover state + visual hierarchy ── */
.mm-table tr.mm-product-row { transition: background 120ms ease; }
.mm-table tr.mm-product-row:hover { background: rgba(204, 0, 0, 0.035); }
.mm-table tr.mm-product-row:hover .mm-expand-caret { color: var(--heritage-red, #cc0000); }
.mm-table tr.mm-product-row:hover .mm-product-name { color: var(--heritage-red, #cc0000); }
.mm-product-name { color: var(--ink-strong, #1a1a1a); transition: color 120ms ease; }
.mm-table td.mm-brand-cell { color: var(--ink-mute, #6B7280); font-size: 0.86rem; }

/* Numeric/date columns: right-aligned, tabular figures (prices line up). */
.mm-table th.mm-num,
.mm-table td.mm-num { text-align: right; font-variant-numeric: tabular-nums; }

/* Data density: slightly tighter rows than the 14px base (desktop only —
   phones convert rows into data-label card stacks at ≤560px). */
@media (min-width: 561px) {
  .mm-table tbody td { padding: 9px 14px; }
  .mm-table thead th { padding: 10px 14px; }
}

/* ── Detail row: animated expand/collapse (grid 0fr ↔ 1fr) ── */
.mm-table tr.mm-detail-row > td { padding-top: 0; padding-bottom: 0; }
.mm-detail-anim {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 220ms ease;
}
.mm-detail-anim-inner { overflow: hidden; min-height: 0; }
.mm-detail-anim.mm-detail-open { grid-template-rows: 1fr; }
.mm-detail-anim .mm-detail-panel { padding-top: 10px; padding-bottom: 14px; }

/* ── Search inputs: in-flight spinner (debounce + fetch feedback) ── */
.mm-search-wrap { position: relative; }
.mm-search-wrap .form-input { width: 100%; }

/* #75 (2026-07-28): catalog search suggestion dropdown. Deliberately reuses
   .mm-comp-results / .mm-comp-result (Competitive pickers) so this module has
   exactly ONE dropdown look. .mm-search-wrap is already position:relative, so
   the absolutely-positioned listbox anchors correctly with no new layout.
   Only the stacking fix below is new: the results panel must clear the sticky
   filter bar it drops out of. */
.mm-search-picker { position: relative; }
.mm-search-picker .mm-search-results { z-index: 40; min-width: 240px; }
/* Keep the in-flight spinner from sitting on top of the open listbox. */
.mm-search-picker.mm-searching::after { z-index: 41; }
.mm-searching::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(204, 0, 0, 0.22);
  border-top-color: var(--heritage-red, #cc0000);
  border-radius: 50%;
  animation: mm-spin 0.7s linear infinite;
  pointer-events: none;
}
/* Spinner and the ✕ clear button share the right edge — spinner wins. */
.mm-gf-search-wrap.mm-searching .mm-gf-clear-search { visibility: hidden; }
@keyframes mm-spin { to { transform: rotate(360deg); } }

/* ── Catalog skeleton rows (loading state mirrors the 8-column table) ── */
.mm-skeleton {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 10px 4px 12px;
}
.mm-skel-row { display: flex; gap: 14px; align-items: center; }
.mm-skel-row:first-child .mm-skel-cell { height: 9px; opacity: 0.65; }
.mm-skel-cell {
  height: 13px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.12) 50%, rgba(0,0,0,0.06) 75%);
  background-size: 200% 100%;
  animation: mm-skel-shimmer 1.2s ease-in-out infinite;
}
@keyframes mm-skel-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Price-trend sparkline in the detail panel ── */
.mm-price-trend { margin-bottom: 10px; }
.mm-trend-range {
  font-size: 11px;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* ── Dark mode ── */
[data-theme="dark"] .mm-table tr.mm-product-row:hover { background: rgba(255, 255, 255, 0.045); }
[data-theme="dark"] .mm-table tr.mm-product-row:hover .mm-expand-caret,
[data-theme="dark"] .mm-table tr.mm-product-row:hover .mm-product-name { color: #ff8a7a; }
[data-theme="dark"] .mm-table td.mm-brand-cell { color: var(--text-muted, #999); }
[data-theme="dark"] .mm-searching::after {
  border-color: rgba(255, 107, 107, 0.28);
  border-top-color: #ff8a7a;
}
[data-theme="dark"] .mm-skel-cell {
  background: linear-gradient(90deg, rgba(255,255,255,0.07) 25%, rgba(255,255,255,0.13) 50%, rgba(255,255,255,0.07) 75%);
  background-size: 200% 100%;
}

/* ── Mobile (≤640px): touch targets + full-width filters ── */
@media (max-width: 640px) {
  .mm-toolbar .filter-select { width: 100%; min-height: 44px; }
  .mm-search-wrap { width: 100%; }
  .mm-search-wrap .form-input { min-height: 44px; }
  .mm-pagination { justify-content: center; }
  .mm-pagination .btn { min-height: 44px; flex: 1 1 auto; }
  /* Card-stacked rows: numeric right-align reads wrong under data-labels. */
  .mm-table td.mm-num { text-align: left; }
  .mm-skel-row { gap: 8px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .mm-detail-anim { transition: none; }
  .mm-table tr.mm-product-row,
  .mm-product-name { transition: none; }
  .mm-skel-cell { animation: none; }
  .mm-searching::after { animation-duration: 1.6s; }
}

/* ── Weee Sell-out tab (2026-07-14) ─────────────────────────────── */
.mm-so-freshness {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.mm-so-fresh-item {
  flex: 1; min-width: 130px; background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e5e0d8); border-radius: 10px;
  padding: 10px 14px; text-align: center;
}
.mm-so-fresh-val { font-weight: 700; font-size: 1.02rem; color: var(--lkk-red, #CC0000); }
.mm-so-fresh-label { font-size: .72rem; color: var(--text-mute, #8a8478); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.mm-so-fresh-empty { padding: 14px; color: var(--text-mute, #8a8478); }

.mm-so-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 10px; border-bottom: 1px solid var(--border-color, #eee5d8);
  cursor: pointer; border-radius: 8px; transition: background .12s ease;
}
.mm-so-row:hover, .mm-so-row:focus-visible { background: rgba(212, 168, 67, 0.08); outline: none; }
.mm-so-row.is-critical { border-left: 3px solid #B3261E; padding-left: 8px; }
.mm-so-rank {
  flex: 0 0 26px; height: 26px; border-radius: 50%;
  background: #FFF5E6; color: #8B0000; font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.mm-so-main { flex: 1; min-width: 0; }
.mm-so-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mm-so-signal { font-size: .86rem; margin-top: 4px; color: var(--text-color, #2c2c2c); }
.mm-so-action { font-size: .82rem; margin-top: 3px; color: #A07830; font-style: italic; }
.mm-so-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.mm-so-drop { font-weight: 700; color: #B3261E; font-size: .95rem; }
.mm-so-spark { display: block; }

.mm-so-sev {
  font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.so-sev-critical { background: #FCE8E6; color: #B3261E; }
.so-sev-warning  { background: #FFF4D6; color: #8a6d00; }
.so-sev-info     { background: #E8F0FE; color: #3A5FA0; }
.so-sev-ok       { background: #E6F4EA; color: #1e7a34; }

.mm-so-type-chip {
  font-size: .7rem; padding: 2px 8px; border-radius: 999px;
  background: var(--chip-bg, #f2ede4); color: var(--text-mute, #6a645c); white-space: nowrap;
}
.mm-so-type-chip.is-primary { background: #FFF5E6; color: #8B0000; font-weight: 600; }
.mm-so-type-chip.is-fused   { background: #EFE6F7; color: #5B2C8A; font-weight: 600; }

.mm-so-detail { padding: 0 10px 8px 46px; }
.mm-so-detail-inner { background: rgba(255, 245, 230, .45); border-radius: 10px; padding: 10px; }
.mm-so-heat th, .mm-so-heat td { font-size: .78rem; padding: 4px 8px; text-align: right; white-space: nowrap; }
.mm-so-heat th[scope="row"] { text-align: left; font-weight: 600; }
.mm-so-nat-row { font-weight: 700; border-bottom: 2px solid var(--border-color, #e5d8c4); }
.mm-so-price-row td { font-size: .72rem; }
.mm-so-cell-empty { color: #c9c2b6; text-align: center !important; }
.mm-so-nosale { color: #B3261E; font-weight: 700; }

.mm-so-shelf { margin-top: 10px; font-size: .82rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mm-so-shelf-chip { padding: 2px 8px; border-radius: 999px; font-size: .74rem; }
.mm-so-shelf-chip.is-ok  { background: #E6F4EA; color: #1e7a34; }
.mm-so-shelf-chip.is-bad { background: #FCE8E6; color: #B3261E; font-weight: 600; }

@media (max-width: 640px) {
  .mm-so-side { display: none; }
  .mm-so-detail { padding-left: 10px; }
  .mm-so-fresh-item { min-width: 46%; }
}

/* ============================================================
   Freshness bar — Data as of / stale badges / top Refresh CTA
   (pilot trust UX, 2026-07-14)
   ============================================================ */
.mm-freshness {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius, 10px);
  border: 1px solid var(--rule, #e3e3e3);
  background: var(--bg-card, #fff);
}
.mm-freshness-loading { font-size: 0.86rem; }
.mm-freshness-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}
.mm-freshness-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 110px;
}
.mm-freshness-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute, #6B7280);
}
.mm-freshness-overall { font-size: 0.82rem; }
.mm-freshness-since { font-size: 0.76rem; display: block; }
.mm-fresh-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.mm-fresh-chip {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--rule-soft, rgba(0,0,0,0.03));
  min-width: 140px;
  max-width: 280px;
}
.mm-fresh-chip-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.mm-fresh-chip-name {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.2;
}
.mm-fresh-chip-meta {
  font-size: 0.78rem;
  color: var(--ink-soft, #4B5563);
  line-height: 1.3;
}
.mm-fresh-chip-prev {
  font-size: 0.72rem;
  color: var(--ink-mute, #6B7280);
  line-height: 1.3;
}
.mm-fresh-chip-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-top: 2px;
}
.mm-fresh-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: #9CA3AF;
}
.mm-fresh-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mm-fresh-refresh { white-space: nowrap; min-height: 36px; }

/* Level colors: fresh <8h, stale 8–24h, old >24h, none/error */
.mm-fresh-fresh .mm-fresh-dot,
.mm-fresh-dot.mm-fresh-fresh { background: #27AE60; }
.mm-fresh-chip.mm-fresh-fresh {
  border-color: rgba(39, 174, 96, 0.28);
  background: rgba(39, 174, 96, 0.08);
}
.mm-fresh-chip.mm-fresh-fresh .mm-fresh-chip-badge { color: #1e7e4f; }

.mm-fresh-stale .mm-fresh-dot,
.mm-fresh-dot.mm-fresh-stale { background: #D4A843; }
.mm-fresh-chip.mm-fresh-stale {
  border-color: rgba(212, 168, 67, 0.35);
  background: rgba(212, 168, 67, 0.10);
}
.mm-fresh-chip.mm-fresh-stale .mm-fresh-chip-badge { color: #8a6d00; }

.mm-fresh-old .mm-fresh-dot,
.mm-fresh-none .mm-fresh-dot,
.mm-fresh-error .mm-fresh-dot,
.mm-fresh-dot.mm-fresh-old,
.mm-fresh-dot.mm-fresh-none,
.mm-fresh-dot.mm-fresh-error { background: #CC0000; }
.mm-fresh-chip.mm-fresh-old,
.mm-fresh-chip.mm-fresh-none,
.mm-fresh-chip.mm-fresh-error {
  border-color: rgba(204, 0, 0, 0.28);
  background: rgba(204, 0, 0, 0.07);
}
.mm-fresh-chip.mm-fresh-old .mm-fresh-chip-badge,
.mm-fresh-chip.mm-fresh-none .mm-fresh-chip-badge,
.mm-fresh-chip.mm-fresh-error .mm-fresh-chip-badge { color: var(--heritage-red, #CC0000); }

.mm-fresh-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}
.mm-fresh-pill.mm-fresh-fresh { background: rgba(39,174,96,0.14); color: #1e7e4f; }
.mm-fresh-pill.mm-fresh-stale { background: rgba(212,168,67,0.16); color: #8a6d00; }
.mm-fresh-pill.mm-fresh-old,
.mm-fresh-pill.mm-fresh-none,
.mm-fresh-pill.mm-fresh-error { background: rgba(204,0,0,0.12); color: #CC0000; }

.mm-fresh-alert {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.4;
}
.mm-fresh-alert-error {
  background: rgba(204, 0, 0, 0.08);
  border: 1px solid rgba(204, 0, 0, 0.22);
  color: var(--heritage-red, #CC0000);
}
.mm-fresh-alert-empty {
  background: rgba(120, 120, 128, 0.08);
  border: 1px solid rgba(120, 120, 128, 0.2);
  color: var(--text-secondary, #555);
}

.mm-scrape-error-card {
  border-left: 4px solid var(--danger, #CC0000);
  padding: 12px 14px;
}
.mm-scrape-error-hint { margin-top: 6px; font-size: 0.84rem; }
.mm-scrape-plat-errors { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.mm-scrape-plat-error {
  font-size: 0.86rem;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(204, 0, 0, 0.06);
  color: var(--heritage-red, #B3261E);
}

@media (max-width: 640px) {
  .mm-freshness-inner { align-items: stretch; }
  .mm-fresh-actions { margin-left: 0; width: 100%; }
  .mm-fresh-refresh { width: 100%; min-height: 44px; }
  .mm-fresh-chip { min-width: calc(50% - 4px); flex: 1 1 140px; }
}

/* ══════════════ Utility classes — inline-style lift (2026-07-16 polish) ══════════════
   Replaces repeated inline style="..." patterns in market-monitor.js with
   token-aware classes. Dynamic values (bar widths, heat alphas) stay inline. */

/* Spacing */
.mm-mt-4  { margin-top: 4px; }
.mm-mt-6  { margin-top: 6px; }
.mm-mt-8  { margin-top: 8px; }
.mm-mt-10 { margin-top: 10px; }
.mm-mt-12 { margin-top: 12px; }
.mm-mt-14 { margin-top: 14px; }
.mm-mt-18 { margin-top: 18px; }
.mm-mb-6  { margin-bottom: 6px; }
.mm-mb-10 { margin-bottom: 10px; }
.mm-ml-6  { margin-left: 6px; }
.mm-ml-auto { margin-left: auto; }

/* #136 residual: "My requests" empty + error states. Previously BOTH rendered as
   an entirely blank container, so a failed fetch was pixel-identical to "you
   have no requests" — Jenna Yang had 1 pending proposal and saw nothing, and had
   no way to know whether her submission had landed. */
.mm-mine-error { padding: 8px 0; }
.mm-mine-empty td { padding: 12px 10px; font-style: italic; }
/* The requested scope, rendered under each request name. Silent scope loss (her
   Seattle selection persisting as config={}) went unnoticed for a day precisely
   because the saved config was never displayed to anyone. */
.mm-mine-scope { margin-top: 2px; }

/* Layout */
.mm-row-flex { display: flex; align-items: center; gap: 8px; }
.mm-toolbar { margin-top: 10px; gap: 10px; }
.mm-search-grow { flex: 1; min-width: 200px; }
.mm-maxw-320 { max-width: 320px; }
.mm-maxw-520 { max-width: 520px; }
.mm-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mm-w-full { width: 100%; }
.mm-pad-10 { padding: 10px; }

/* Shimmer placeholder heights (loading states sized to their content) */
.mm-shimmer-h54  { height: 54px; }
.mm-shimmer-h56  { height: 56px; }
.mm-shimmer-h80  { height: 80px; }
.mm-shimmer-h88  { height: 88px; }
.mm-shimmer-h90  { height: 90px; }
.mm-shimmer-h100 { height: 100px; }
.mm-shimmer-h120 { height: 120px; }
.mm-shimmer-h140 { height: 140px; }
.mm-shimmer-h160 { height: 160px; }
.mm-shimmer-h200 { height: 200px; }
.mm-shimmer-h220 { height: 220px; }
.mm-shimmer-h240 { height: 240px; }
.mm-shimmer-flex { flex: 1; }

/* Small text */
.mm-fs-78 { font-size: 0.78em; }
.mm-fs-80 { font-size: 0.8em; }
.mm-fs-82 { font-size: 0.82em; }
.mm-fs-85 { font-size: 0.85em; }

/* Data-source note under the intel summary */
.mm-data-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-mute, #888);
  line-height: 1.5;
}

/* Brand-red / error text — token-aware, readable on dark surfaces */
.mm-text-error { color: var(--heritage-red, #CC0000); }
[data-theme="dark"] .mm-text-error { color: #ff8a7a; }

/* Result-card accent borders (scrape / import / sellout outcomes) */
.mm-accent-success { border-left: 4px solid var(--success, #27ae60); }
.mm-accent-warning { border-left: 4px solid var(--warning, #D4A843); }
.mm-accent-danger  { border-left: 4px solid var(--danger, #CC0000); }

/* Scheduler proposal status chips (rides on .mm-stock-badge base shape) */
.mm-chip-pending  { background: #FFF4D6; color: #8a6d00; }
.mm-chip-approved { background: #E6F4EA; color: #1e7a34; }
.mm-chip-rejected { background: #FCE8E6; color: #CC0000; }
[data-theme="dark"] .mm-chip-pending  { background: rgba(212, 168, 67, 0.18); color: #e8c87a; }
[data-theme="dark"] .mm-chip-approved { background: rgba(39, 174, 96, 0.18); color: #6fd598; }
[data-theme="dark"] .mm-chip-rejected { background: rgba(204, 0, 0, 0.18); color: #ff8a7a; }

/* Scheduler form bits */
#mm-dismiss-all { margin-left: auto; font-size: 12px; }
#mm-sched-err { min-height: 18px; font-size: 0.85em; margin-top: 6px; }

/* Product picker: results popover starts hidden — JS shows it via style.display = 'block' */
.mm-pp-results { display: none; }
.mm-pp-thumb { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; flex: none; }
.mm-pp-item .mm-pp-brand { font-size: 0.85em; }

/* Signal action input density */
.mm-signal-action-input { padding: 7px 10px; }

/* Clickable product rows (catalog / sentiment / OOS) */
.mm-table tr.mm-product-row { cursor: pointer; }

/* ═══════════════════════════════════════════════════════════════════
   Market Monitor feedback batch #32,37-41,44 (2026-07-22)
   ═══════════════════════════════════════════════════════════════════ */

/* #44 — price/rating chart with auto y-domain: overlay stacking */
.mm-spark-stack { position: relative; }
.mm-spark-stack .mm-spark-overlay { position: absolute; inset: 0; pointer-events: none; }
.mm-spark-effective { stroke: var(--gold, #d4a843); stroke-dasharray: 3 2; }
.mm-spark-legend { display: flex; gap: 14px; margin-top: 4px; font-size: 11px; }
.mm-legend-item { display: inline-flex; align-items: center; gap: 5px; color: var(--text-mute, #6b7280); }
.mm-legend-item::before { content: ""; width: 12px; height: 2px; border-radius: 1px; }
.mm-legend-regular::before { background: var(--heritage-red, #cc0000); }
.mm-legend-effective::before { background: var(--gold, #d4a843); }

/* #38 — price history market chips */
.mm-history-markets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.mm-history-region.mm-history-loading { opacity: 0.55; transition: opacity 0.15s; }

/* #41 — catalog identity cell */
.mm-ids-stack { display: flex; flex-direction: column; line-height: 1.25; }
.mm-id-primary { font-variant-numeric: tabular-nums; font-size: 12px; }
.mm-id-sap { font-size: 10.5px; }
.mm-ids-cell { white-space: nowrap; }

/* #41 — detail identity block + copy buttons */
.mm-identity-block { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; padding: 8px 10px; background: var(--surface-2, #f6f6f4); border-radius: 8px; }
.mm-id-item { display: flex; flex-direction: column; gap: 2px; }
.mm-id-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.mm-id-value { font-size: 13px; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.mm-id-copy { border: none; background: transparent; cursor: pointer; font-size: 13px; padding: 0 2px; color: var(--heritage-red, #cc0000); line-height: 1; opacity: 0.7; }
.mm-id-copy:hover { opacity: 1; }
[data-theme="dark"] .mm-identity-block { background: rgba(255,255,255,0.05); }

/* #37+#40 — Price Movers v2 controls */
.mm-movers-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.mm-movers-dirs { display: inline-flex; gap: 6px; }
.mm-movers-select { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-mute, #6b7280); }
.mm-movers-select select { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border, #d9d9d6); background: var(--surface, #fff); font-size: 12px; }
.mm-movers-showall { margin-top: 8px; }
[data-theme="dark"] .mm-movers-select select { background: #1e1e1e; border-color: #333; color: #eee; }

/* #39 — Delisted chip + badge */
.mm-pf-chip.mm-pf-delisted.mm-pf-active { background: var(--heritage-red, #cc0000); color: #fff; }
.mm-delisted-badge { margin-left: 6px; font-size: 10px; }

/* ============================================================
   2026-07-27 feedback wave — Train D (#50, #54, #58)
   ============================================================ */

/* #50 — Action Items market + product filters.
   Sits between the card subtitle and the action list. Mirrors the catalog
   toolbar spacing so the two filter bars read as the same control language. */
.mm-action-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 4px; }
.mm-action-filters .filter-select { min-width: 150px; }
.mm-action-filters .mm-search-grow { flex: 1 1 220px; min-width: 180px; }
.mm-action-filters .mm-gf-count { font-size: 12px; color: var(--text-mute, #6b7280); white-space: nowrap; }
.mm-action-empty .btn { display: inline-block; margin-top: 10px; }

/* #54 — Price & Stock History date-range filter. */
.mm-history-range {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 0 0 12px; padding: 8px 10px;
  background: var(--surface-2, #f6f6f4); border-radius: 8px;
}
.mm-history-range-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.mm-history-range-custom { display: inline-flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.mm-hist-date-label { display: inline-flex; flex-direction: column; gap: 2px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.mm-hist-date { padding: 3px 6px; font-size: 12px; border-radius: 6px; min-width: 132px; }
.mm-hist-avail { font-size: 11.5px; white-space: nowrap; }
/* #89 — Export CSV action inside the history filter bar. Pushed to the far
   right on desktop; wraps to its own full-width row on narrow screens so it
   never squeezes the date inputs. */
.mm-history-range-actions { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
@media (max-width: 640px) {
  .mm-history-range-actions { margin-left: 0; width: 100%; }
  .mm-history-range-actions .btn { width: 100%; }
}
[data-theme="dark"] .mm-history-range { background: rgba(255,255,255,0.05); }
[data-theme="dark"] .mm-hist-date { background: #1e1e1e; border-color: #333; color: #eee; }

/* #58 — Out-of-Stock Summary report (period × region × warehouse). */
.mm-oos-summary-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 2px; }
.mm-oos-summary-filters .filter-select { min-width: 150px; }
/* #241 — calendar-month picker. `display:flex` on the toolbar would otherwise
   override the HTML `hidden` attribute on a flex child, so the month select
   would stay visible in every period mode. Sizing is inherited from
   .filter-select above (incl. the 720px full-width rule). */
.mm-oos-summary-filters .mm-oos-sum-month[hidden] { display: none; }
.mm-oos-sum-kpis { margin-bottom: 14px; }
.mm-oos-sum-kpi.mm-tone-urgent .mm-sent-stat-val { color: var(--heritage-red, #cc0000); }
.mm-oos-sum-kpi.mm-tone-ok .mm-sent-stat-val { color: var(--success, #1a7f37); }
.mm-oos-sum-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.mm-oos-sum-block { min-width: 0; }
.mm-oos-sum-table, .mm-oos-sum-detail { width: 100%; font-size: 12.5px; }
.mm-oos-sum-table th.mm-num, .mm-oos-sum-table td.mm-num,
.mm-oos-sum-detail th.mm-num, .mm-oos-sum-detail td.mm-num { text-align: right; font-variant-numeric: tabular-nums; }
.mm-oos-sum-detail { margin-top: 6px; }

/* Mobile: stack the filter bars and let tables scroll rather than overflow. */
@media (max-width: 720px) {
  .mm-action-filters .filter-select,
  .mm-oos-summary-filters .filter-select { min-width: 0; width: 100%; }
  .mm-action-filters .mm-search-grow { flex-basis: 100%; }
  .mm-hist-avail { margin-left: 0; }
  .mm-oos-sum-grid { grid-template-columns: 1fr; }
  .mm-oos-sum-table, .mm-oos-sum-detail { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ═══════════════════════════════════════════════════════════════════
   #70 — Competitive Insight (Competitor vs Lee Kum Kee).
   Pair report + category scout. Mobile-first: every grid collapses to a
   single column and chips wrap rather than overflow.
   ═══════════════════════════════════════════════════════════════════ */
.mm-comp-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 2px; }
.mm-comp-filters .filter-select { min-width: 150px; }
.mm-comp-note { font-size: 11.5px; line-height: 1.5; margin: 6px 0 10px; }

/* ── Pair pickers ── */
.mm-comp-pickers {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: start;
  padding: 12px; border: 1px solid var(--border-light, #e6e0d8); border-radius: 10px;
  background: var(--bg-subtle, #f7f7f5);
}
.mm-comp-picker { min-width: 0; position: relative; }
.mm-comp-picker-label {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-mute, #666); margin-bottom: 6px;
}
.mm-comp-picker-lkk .mm-comp-picker-label { color: var(--heritage-red, #cc0000); }
.mm-comp-vs {
  align-self: center; font-weight: 800; font-size: 13px; color: var(--text-mute, #666);
  padding: 0 4px; white-space: nowrap;
}
.mm-comp-brand-chips { margin-bottom: 6px; }

/* Typeahead dropdown. Absolute so it overlays instead of shoving layout. */
.mm-comp-results {
  position: absolute; z-index: 20; left: 0; right: 0; margin-top: 4px;
  max-height: 260px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg-card, #fff); border: 1px solid var(--border-light, #e6e0d8);
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.mm-comp-result {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0;
  background: transparent; cursor: pointer; border-bottom: 1px solid var(--border-light, #f0ece6);
}
.mm-comp-result:last-child { border-bottom: 0; }
.mm-comp-result:hover, .mm-comp-result:focus-visible { background: rgba(204,0,0,0.06); }
.mm-comp-result-name { display: block; font-size: 12.5px; font-weight: 600; }
/* #140: platform badge inside a dropdown option / chosen chip. The badge is a
   reused component (.mm-platform-badge) whose default sizing is tuned for card
   headers, so it is scaled down here to sit inline with 12.5px option text
   without changing its height. */
.mm-comp-result-name .mm-platform-badge,
.mm-comp-chosen-name .mm-platform-badge {
  margin-left: 6px;
  font-size: 9.5px;
  vertical-align: 1px;
}
.mm-comp-result-meta { display: block; font-size: 11px; margin-top: 2px; }
.mm-comp-result-empty { padding: 10px; font-size: 12px; }

.mm-comp-chosen:empty { display: none; }
.mm-comp-chosen-card {
  position: relative; margin-top: 8px; padding: 8px 30px 8px 10px;
  border-radius: 8px; background: var(--bg-card, #fff);
  border: 1px solid var(--border-light, #e6e0d8);
}
.mm-comp-chosen-name { font-size: 12.5px; font-weight: 700; }
.mm-comp-chosen-meta { font-size: 11px; margin-top: 2px; }
.mm-comp-clear { position: absolute; top: 4px; right: 4px; padding: 2px 6px; line-height: 1; }

/* ── Headline: who is cheaper, by how much ── */
.mm-comp-headline {
  margin-top: 14px; padding: 14px; border-radius: 10px; text-align: center;
  border: 1px solid var(--border-light, #e6e0d8); background: var(--bg-card, #fff);
  border-top-width: 4px;
}
.mm-comp-headline-good   { border-top-color: var(--success-deep, #1e7e4f); }
.mm-comp-headline-bad    { border-top-color: var(--danger, #c0392b); }
.mm-comp-headline-parity { border-top-color: var(--text-mute, #999); }
.mm-comp-headline-gap { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.mm-comp-headline-good .mm-comp-headline-gap { color: var(--success-deep, #1e7e4f); }
.mm-comp-headline-bad  .mm-comp-headline-gap { color: var(--danger, #c0392b); }
.mm-comp-headline-text { font-size: 13.5px; font-weight: 600; margin-top: 4px; }
.mm-comp-headline-sub  { font-size: 11.5px; margin-top: 3px; }

.mm-comp-band-warning {
  margin-top: 10px; padding: 8px 10px; border-radius: 8px; font-size: 12px;
  background: rgba(212,168,67,0.14); border: 1px solid rgba(212,168,67,0.5);
}

/* ── Side-by-side comparison ── */
.mm-comp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.mm-comp-side {
  min-width: 0; padding: 12px; border-radius: 10px;
  border: 1px solid var(--border-light, #e6e0d8); background: var(--bg-card, #fff);
}
.mm-comp-side-lkk  { border-left: 4px solid var(--heritage-red, #cc0000); }
.mm-comp-side-comp { border-left: 4px solid var(--text-mute, #999); }
.mm-comp-side-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-mute, #666);
}
.mm-comp-side-name { font-size: 13.5px; font-weight: 700; margin-top: 4px; line-height: 1.35; }
.mm-comp-side-meta { font-size: 11.5px; margin-top: 2px; }
.mm-comp-side-price { font-size: 24px; font-weight: 800; margin-top: 8px; font-variant-numeric: tabular-nums; }
.mm-comp-side-price-sub { font-size: 11px; }
.mm-comp-side-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin: 10px 0 0; }
.mm-comp-side-stats > div { min-width: 0; }
.mm-comp-side-stats dt { font-size: 10.5px; color: var(--text-mute, #666); }
.mm-comp-side-stats dd { margin: 2px 0 0; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mm-comp-side-terms {
  margin-top: 10px; padding: 6px 8px; border-radius: 6px; font-size: 11.5px;
  background: rgba(212,168,67,0.12);
}

/* ── Deterministic insight cards ── */
.mm-comp-insights { display: grid; grid-template-columns: 1fr; gap: 8px; }
.mm-comp-insight {
  padding: 10px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.5;
  border-left: 3px solid var(--text-mute, #999); background: var(--bg-subtle, #f7f7f5);
}
.mm-comp-tone-good    { border-left-color: var(--success-deep, #1e7e4f); }
.mm-comp-tone-bad     { border-left-color: var(--danger, #c0392b); }
.mm-comp-tone-neutral { border-left-color: var(--gold, #d4a843); }
.mm-comp-tone-muted   { border-left-color: var(--text-mute, #999); opacity: 0.85; }

.mm-comp-deltas { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.mm-comp-delta {
  display: flex; align-items: baseline; gap: 6px; padding: 6px 10px;
  border-radius: 999px; background: var(--bg-subtle, #f7f7f5); font-size: 12px;
}
.mm-comp-delta-label { color: var(--text-mute, #666); }
.mm-comp-delta-val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Category scout (suggestions only) ── */
.mm-comp-scout-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 2px; }
.mm-comp-scout-filters .filter-select { min-width: 180px; }
.mm-comp-scout-warning {
  padding: 8px 10px; border-radius: 8px; font-size: 12px; margin-bottom: 10px;
  background: rgba(212,168,67,0.14); border: 1px solid rgba(212,168,67,0.5);
}
.mm-comp-scout-table { width: 100%; font-size: 12.5px; }
.mm-comp-scout-table th.mm-num, .mm-comp-scout-table td.mm-num {
  text-align: right; font-variant-numeric: tabular-nums;
}
.mm-comp-cell-sub { font-size: 11px; margin-top: 2px; }
.mm-comp-conf {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.mm-comp-conf-high { background: rgba(30,126,79,0.14); color: var(--success-deep, #1e7e4f); }
.mm-comp-conf-low  { background: rgba(0,0,0,0.07); color: var(--text-mute, #666); }
.mm-comp-needs-confirm { font-size: 11.5px; color: var(--gold-deep, #a67c00); font-weight: 600; }
.mm-comp-likely { font-size: 11.5px; color: var(--success-deep, #1e7e4f); font-weight: 600; }

/* ── Dark mode ── */
[data-theme="dark"] .mm-comp-pickers { background: #1c1c1c; border-color: var(--border-light, #3a3128); }
[data-theme="dark"] .mm-comp-results,
[data-theme="dark"] .mm-comp-chosen-card,
[data-theme="dark"] .mm-comp-headline,
[data-theme="dark"] .mm-comp-side { background: #1e1e1e; border-color: #333; }
[data-theme="dark"] .mm-comp-result { border-bottom-color: #2c2c2c; }
[data-theme="dark"] .mm-comp-result:hover { background: rgba(204,0,0,0.18); }
[data-theme="dark"] .mm-comp-insight,
[data-theme="dark"] .mm-comp-delta { background: #232323; }
[data-theme="dark"] .mm-comp-conf-low { background: rgba(255,255,255,0.08); color: #bbb; }

/* ── Mobile: single column, full-width controls, scrollable table ── */
@media (max-width: 720px) {
  .mm-comp-filters .filter-select,
  .mm-comp-scout-filters .filter-select { min-width: 0; width: 100%; }
  .mm-comp-pickers { grid-template-columns: 1fr; }
  .mm-comp-vs { justify-self: center; padding: 2px 0; }
  .mm-comp-grid { grid-template-columns: 1fr; }
  .mm-comp-headline-gap { font-size: 26px; }
  .mm-comp-side-price { font-size: 21px; }
  .mm-comp-scout-table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ─────────────────────────────────────────────────────────────────
   Custom date range (feedback #101, Che Yee Man, 2026-07-29)
   Native <input type="date"> pair revealed by the "Custom range…"
   option on the OOS Summary + Competitive period selects. Native
   inputs keep locale formatting, keyboard and screen-reader support
   free across all four languages.
   ───────────────────────────────────────────────────────────────── */
.mm-range-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mm-range-wrap[hidden] { display: none; }
.mm-range-input {
  min-width: 140px;
  /* Match .filter-select metrics so the row height never shifts when the
     inputs appear — a jumping toolbar reads as a layout bug. */
  font: inherit;
  line-height: normal;
}
.mm-range-sep {
  color: var(--text-mute, #777);
  user-select: none;
}
/* Inverted range (from > to). The request is deliberately NOT sent, so the
   field itself has to explain why nothing refreshed. */
.mm-range-input.mm-range-invalid {
  border-color: #cc0000;
  box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.15);
}
[data-theme="dark"] .mm-range-sep { color: #999; }

@media (max-width: 720px) {
  /* Stack the pair full-width; two date inputs side by side do not fit a
     phone, and a squeezed native picker is unusable. */
  .mm-range-wrap { display: grid; grid-template-columns: 1fr; width: 100%; gap: 4px; }
  .mm-range-input { min-width: 0; width: 100%; }
  .mm-range-sep { display: none; }
}

/* ── GMV Impact tab (#142, Cherie — 2026-08-02) ──────────────────
   One ranked table: SKU · GMV (Δ MoM) · Diagnosis · Evidence ·
   $ at risk · Action. Reuses the sell-out severity pills and
   freshness tiles so the two tabs read as one system. */
.mm-gmv-table th, .mm-gmv-table td {
  font-size: .82rem;
  vertical-align: top;
  padding: 8px 10px;
}
.mm-gmv-row { cursor: pointer; transition: background .12s ease; }
.mm-gmv-row:hover,
.mm-gmv-row:focus-visible { background: rgba(212, 168, 67, 0.08); outline: none; }
.mm-gmv-row:focus-visible { outline: 2px solid var(--lkk-gold, #D4A843); outline-offset: -2px; }

.mm-gmv-evidence { max-width: 340px; color: var(--text-color, #2c2c2c); }
.mm-gmv-action   { max-width: 300px; color: #A07830; font-style: italic; }

.mm-gmv-up   { color: #1e7a34; font-weight: 600; }
.mm-gmv-down { color: #B3261E; font-weight: 700; }

.mm-gmv-risk { font-weight: 700; color: #B3261E; white-space: nowrap; }
/* The estimate marker is deliberately always visible next to any dollar
   figure — a number without its uncertainty is the failure mode here. */
.mm-gmv-est {
  display: inline-block; margin-left: 4px;
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 1px 5px; border-radius: 999px;
  background: #E8F0FE; color: #3A5FA0; vertical-align: middle;
}

.mm-gmv-detail-row > td { background: rgba(255, 245, 230, .45); }
.mm-gmv-detail { padding: 10px 4px; }
.mm-gmv-detail-title { font-weight: 700; font-size: .84rem; margin-bottom: 6px; }
.mm-gmv-shelf-table th, .mm-gmv-shelf-table td {
  font-size: .76rem; padding: 4px 8px; text-align: right; white-space: nowrap;
}
.mm-gmv-shelf-table th:first-child,
.mm-gmv-shelf-table td:first-child { text-align: left; }
.mm-gmv-formula {
  margin-top: 8px; font-size: .78rem;
  background: var(--card-bg, #fff); border: 1px dashed var(--border-color, #e5d8c4);
  border-radius: 8px; padding: 8px 10px;
}
.mm-gmv-promo-note { margin-top: 6px; font-size: .74rem; }

.mm-gmv-boundaries { margin-top: 4px; }
.mm-gmv-scope-card .mm-gmv-boundary-list {
  margin: 6px 0 0; padding-left: 18px; font-size: .8rem;
  color: var(--text-mute, #6a645c);
}
.mm-gmv-boundary-list li { margin-bottom: 5px; }
.mm-gmv-month { max-width: 160px; }

@media (max-width: 900px) {
  .mm-gmv-evidence, .mm-gmv-action { max-width: none; }
}
@media (max-width: 640px) {
  /* Drop the two prose columns on phones — SKU, GMV, Δ, diagnosis and
     $ at risk are the decision-critical ones; evidence + action stay
     available in the expanded row detail. */
  .mm-gmv-table th:nth-child(5), .mm-gmv-table td:nth-child(5),
  .mm-gmv-table th:nth-child(7), .mm-gmv-table td:nth-child(7) { display: none; }
  .mm-gmv-table th, .mm-gmv-table td { font-size: .76rem; padding: 6px; }
}
/* Evidence + action restated inside the expanded row so the mobile column
   hiding above never loses them (relocated, not dropped). Hidden on desktop
   where both columns are already visible. */
.mm-gmv-detail-restate { display: none; font-size: .8rem; margin-bottom: 8px; }
.mm-gmv-detail-restate > div + div { margin-top: 4px; }
@media (max-width: 640px) {
  .mm-gmv-detail-restate { display: block; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Shelf check tab (feedback #160, Emily Liu — 2026-08-03)
   Photo → vision price candidates → HUMAN CONFIRM → Weee/Yami compare.
   The visual language exists to make the confirm gate obvious: an
   unconfirmed row is visibly incomplete (gated compare cells, "?" on the
   suggested SKU) so nobody reads a suggestion as a fact.
   ═══════════════════════════════════════════════════════════════════════ */

/* Honesty callout: price-only tags are expected; confirming is expected work. */
.mm-shelf-note {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-left: 4px solid var(--gold, #D4A843);
  background: var(--surface-2, #faf7f2);
  border-radius: 4px;
  font-size: .85rem;
  line-height: 1.5;
  color: var(--text, #2c2924);
}

.mm-shelf-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.mm-shelf-field { display: flex; flex-direction: column; gap: 4px; min-width: 240px; }
.mm-shelf-label { font-size: .78rem; font-weight: 600; color: var(--text-mute, #6a645c); }
.mm-shelf-actions { display: flex; align-items: center; gap: 8px; }
.mm-shelf-filename { font-size: .8rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mm-shelf-status { flex-basis: 100%; font-size: .84rem; min-height: 1.2em; }
.mm-shelf-status.is-loading { color: var(--text-mute, #6a645c); }
.mm-shelf-status.is-success { color: var(--success, #1B7F38); }
/* #168 partial-batch state: some photos scanned, some failed. Distinct from
   is-error (whole batch failed) so "6 of 8" does not read as total failure. */
.mm-shelf-status.is-warning { color: var(--warning, #A9601B); }
.mm-shelf-status.is-error   { color: var(--heritage-red, #CC0000); }

.mm-shelf-image-notes { font-size: .8rem; margin: 0 0 10px; }

/* ── Rows table ── */
.mm-shelf-table th.num, .mm-shelf-table td.num { text-align: right; }
.mm-shelf-table td { vertical-align: middle; }

/* The compare cells are BLANK until confirmed — this cell IS the gate, made
   visible. Muted + italic so it reads as "not yet", not as "zero". */
.mm-shelf-gated {
  text-align: center !important;
  font-style: italic;
  font-size: .8rem;
  color: var(--text-mute, #6a645c);
  background: var(--surface-2, #faf7f2);
}

.mm-shelf-sku { font-weight: 500; }
.mm-shelf-sku.is-confirmed { color: var(--success, #1B7F38); font-weight: 600; }
.mm-shelf-score { font-size: .75rem; }

.mm-shelf-delta-up   { color: var(--heritage-red, #CC0000); font-weight: 600; }
.mm-shelf-delta-down { color: var(--success, #1B7F38); font-weight: 600; }
.mm-shelf-delta-flat { color: var(--text-mute, #6a645c); }
.mm-shelf-delta-none { color: var(--text-mute, #6a645c); }

.mm-shelf-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  background: var(--surface-3, #f0ece4);
  color: var(--text-mute, #6a645c);
}
.mm-shelf-badge.is-confirmed { background: #e6f4ea; color: #1B7F38; }
.mm-shelf-badge.is-rejected  { background: #fdecea; color: #CC0000; }
/* Swarm6 D3/D4: US / Canada label on a shelf photo (list + detail). */
.mm-shelf-zone {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 600;
  background: var(--surface-3, #f0ece4);
  color: var(--text-mute, #6a645c);
}
.mm-shelf-zone.is-us     { background: #e8f0fe; color: #1a4fa0; }
.mm-shelf-zone.is-canada { background: #fdecea; color: #a30000; }
.mm-shelf-zone-line { margin: 0 0 6px; }
.mm-shelf-badge.is-pending   { background: #fef6e0; color: #8a6d1f; }
.mm-shelf-badge.is-unmatched { background: var(--surface-3, #f0ece4); color: #6a645c; }
.mm-shelf-badge.is-failed    { background: #fdecea; color: #CC0000; }
.mm-shelf-badge.is-ready     { background: #e6f4ea; color: #1B7F38; }

.mm-shelf-row.is-rejected { opacity: .6; }
/* Three actions now live here (#167: Confirm / Choose SKU / Not this), so the
   cell wraps on narrow viewports instead of forcing a horizontal scroll that
   would push "Choose SKU" off-screen — i.e. re-hiding the control this feedback
   existed to surface. */
.mm-shelf-row-actions { white-space: nowrap; }
.mm-shelf-row-actions .btn + .btn { margin-left: 4px; }

.mm-shelf-legend { font-size: .78rem; margin: 8px 0 0; }

/* ── #167 export bar (above the rows table) ── */
.mm-shelf-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}
.mm-shelf-export-hint { font-size: .78rem; }

/* ── Manual catalog picker (revealed per row) ── */
.mm-shelf-picker { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.mm-shelf-picker-results { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.mm-shelf-choice {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border, #e4ded4);
  border-radius: 4px;
  background: var(--surface, #fff);
  font-size: .84rem;
  text-align: left;
  cursor: pointer;
}
.mm-shelf-choice:hover {
  border-color: var(--heritage-red, #CC0000);
  background: var(--surface-2, #faf7f2);
}

@media (max-width: 900px) {
  .mm-shelf-field { min-width: 100%; }
  /* Let the 3-button action cell wrap rather than overflow (see note above). */
  .mm-shelf-row-actions { white-space: normal; }
  .mm-shelf-row-actions .btn { margin: 2px 2px 0 0; }
  .mm-shelf-row-actions .btn + .btn { margin-left: 0; }
  .mm-shelf-export-hint { flex-basis: 100%; }
}
@media (max-width: 640px) {
  /* Pack hint and the two delta columns fold away first — shelf price, the
     SKU question, and the two platform prices are the decision-critical ones. */
  .mm-shelf-table th:nth-child(2), .mm-shelf-table td:nth-child(2),
  .mm-shelf-table th:nth-child(7), .mm-shelf-table td:nth-child(7),
  .mm-shelf-table th:nth-child(8), .mm-shelf-table td:nth-child(8) { display: none; }
  .mm-shelf-table th, .mm-shelf-table td { font-size: .76rem; padding: 6px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Flyer / Offline price watch (Eliza, 2026-08-04)

   Market Monitor was online-only. This tab turns the weekly PAPER circular
   into confirmed offline prices + an LKK-vs-Haday rollup.

   Two visual jobs the styling has to do, both of them honesty work:
     1. The rollup card must never let a CONFIRMED count and a TO-REVIEW count
        read as one number. Pending is deliberately smaller, muted, and on its
        own line under the headline figure.
     2. A multi-buy deal we could NOT split ("BUY 2 GET 1 FREE") must look like
        a deliberate refusal, not a blank cell / rendering bug.
   ═══════════════════════════════════════════════════════════════════════ */

.mm-flyer-note {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-left: 4px solid var(--gold, #D4A843);
  background: var(--surface-2, #faf7f2);
  border-radius: 4px;
  font-size: .85rem;
  line-height: 1.5;
  color: var(--text, #2c2924);
}

.mm-flyer-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.mm-flyer-field { display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.mm-flyer-label { font-size: .78rem; font-weight: 600; color: var(--text-mute, #6a645c); }
.mm-flyer-date { max-width: 190px; }

/* #294 (Eliza, 2026-08-23): the STATE input holds a 2-letter code, so it gets a
   narrow field instead of inheriting the 220px min-width meant for a typed
   store banner. Overriding min-width (not just width) because .mm-flyer-field
   sets the floor — without this the state box is as wide as the banner box and
   the toolbar wraps a row early on a laptop. The mobile block below resets
   min-width to 100% for every field, so this stays desktop-only by design. */
.mm-flyer-field.mm-flyer-field-state { min-width: 120px; max-width: 140px; }

/* #295: the "pages were reduced to fit the AI reader" notice, shown next to a
   SUCCESSFUL read. Muted rather than warning-coloured — the read worked and the
   rows are real; this is a fidelity caveat she should see before trusting the
   digits, not an error competing with the green status line. */
.mm-flyer-reduced-note {
  margin-top: 4px;
  font-size: .78rem;
  color: var(--text-mute, #6a645c);
}
.mm-flyer-actions { display: flex; align-items: center; gap: 8px; }
.mm-flyer-filename { font-size: .8rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* #333 (Eliza): paste a flyer link. The field is wide because a circular URL is
   long and she needs to see enough of it to tell one week's ad from another. */
.mm-flyer-url-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.mm-flyer-field-url { flex: 1 1 auto; min-width: 0; }
.mm-flyer-field-url .form-input { width: 100%; }
/* She reviews and pastes flyers on a phone in a store, so the control stacks
   rather than squeezing the input down to nothing. */
@media (max-width: 640px) {
  .mm-flyer-url-row { flex-direction: column; align-items: stretch; }
  .mm-flyer-url-row .btn { width: 100%; }
}

/* #338: the paste field's own message line, directly under the input.
   Separate from .mm-flyer-status because that one is shared with every other
   action on the tab and gets overwritten; a refusal here has to survive until
   she acts on it. min-height 0 when empty so it adds no gap on first paint. */
.mm-flyer-url-msg { font-size: .84rem; line-height: 1.35; margin: .25rem 0 0; }
.mm-flyer-url-msg:empty { margin: 0; }
.mm-flyer-url-msg.is-ok    { color: var(--success, #1B7F38); }
.mm-flyer-url-msg.is-error { color: var(--heritage-red, #CC0000); }

.mm-flyer-status { flex-basis: 100%; font-size: .84rem; min-height: 1.2em; }
.mm-flyer-status.is-loading { color: var(--text-mute, #6a645c); }
.mm-flyer-status.is-success { color: var(--success, #1B7F38); }
.mm-flyer-status.is-error   { color: var(--heritage-red, #CC0000); }

.mm-flyer-page-notes { font-size: .8rem; margin: 0 0 10px; }

/* ── #192 (Lauren Luo, 2026-08-06) ──────────────────────────────────────────
   "cannot open the flyer file when click open button". The scan DID open; it
   rendered a full viewport above the button, because Price Watch (#175/#176)
   was inserted between the result block and the history table. openScan() now
   scrolls the result into view and writes a status line; this header is what
   the eye lands on when it arrives, so it has to read as "you are here" rather
   than as another table caption. Heritage red keyline, matching the module's
   other identity marks. */
.mm-flyer-opened-head {
  margin: 0 0 10px;
  padding: 6px 10px;
  border-left: 3px solid var(--heritage-red, #CC0000);
  background: var(--surface-2, #faf7f2);
  border-radius: 0 6px 6px 0;
  font-size: .86rem;
  color: var(--text, #2c2924);
}

/* The original upload is never persisted (metadata only — see renderScan).
   Muted and unboxed ON PURPOSE: this is a standing fact about how the module
   works, not a warning about this particular scan, and styling it like the
   truncation callout would read as "something went wrong with your file". */
.mm-flyer-no-file {
  margin: 0 0 10px;
  font-size: .78rem;
  line-height: 1.45;
}

/* Truncation notice: gold like the other honesty callouts, NOT red — reading
   the first 3 pages is the designed behaviour, not an error. */
.mm-flyer-truncated {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--gold, #D4A843);
  background: var(--surface-2, #faf7f2);
  border-radius: 3px;
  font-size: .8rem;
  color: var(--text, #2c2924);
}

/* ── LKK vs Haday rollup ── */
.mm-flyer-summary { margin-bottom: 12px; }
.mm-flyer-sumgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.mm-flyer-sumcell {
  padding: 10px 12px;
  border: 1px solid var(--border, #e4ded4);
  border-radius: 6px;
  background: var(--surface, #fff);
  border-top: 3px solid var(--border, #e4ded4);
}
/* LKK red, Haday a neutral slate: the competitor must not get a colour that
   reads as an alert on its own — the NUMBER is the signal, not the hue. */
.mm-flyer-sumcell.is-lkk     { border-top-color: var(--heritage-red, #CC0000); }
.mm-flyer-sumcell.is-haday   { border-top-color: #4a6fa5; }
/* Kikkoman + Amoy are first-class buckets (Eliza, 2026-08-04), so they get their
   own accent rather than sharing 'other'. Distinct hues, not shades of one, so a
   glance at the rollup separates the three competitor houses. */
.mm-flyer-sumcell.is-kikkoman { border-top-color: #7a4fa5; }
.mm-flyer-sumcell.is-amoy     { border-top-color: #2f8f7f; }
.mm-flyer-sumcell.is-other   { border-top-color: var(--gold, #D4A843); }
.mm-flyer-sumcell.is-unknown { border-top-color: var(--border, #e4ded4); }

.mm-flyer-sumtag {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-mute, #6a645c);
}
.mm-flyer-sumcount { font-size: 1.6rem; font-weight: 700; line-height: 1.2; color: var(--text, #2c2924); }
.mm-flyer-sumrange { font-size: .82rem; color: var(--text-mute, #6a645c); }
/* Deliberately smaller + muted: an unreviewed count must never be mistaken for
   part of the confirmed headline figure. */
.mm-flyer-sumpending {
  margin-top: 4px;
  font-size: .74rem;
  font-style: italic;
  color: #8a6d1f;
}

/* ── Rows table ── */
.mm-flyer-table th.num, .mm-flyer-table td.num { text-align: right; }
.mm-flyer-table td { vertical-align: middle; }

.mm-flyer-deal { font-weight: 600; font-size: .84rem; }
.mm-flyer-unit { font-size: .78rem; white-space: nowrap; }
/* The refusal to divide, made visible. Amber + italic = "we deliberately did
   not compute this", distinct from an em-dash meaning "nothing here". */
.mm-flyer-nosplit {
  font-size: .74rem;
  font-style: italic;
  color: #8a6d1f;
  white-space: nowrap;
}

.mm-flyer-sku { font-weight: 500; }
.mm-flyer-sku.is-confirmed { color: var(--success, #1B7F38); font-weight: 600; }
.mm-flyer-score { font-size: .75rem; }

.mm-flyer-tagsel { font-size: .78rem; padding: 2px 6px; min-width: 104px; }

.mm-flyer-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  background: var(--surface-3, #f0ece4);
  color: var(--text-mute, #6a645c);
}
.mm-flyer-badge.is-confirmed  { background: #e6f4ea; color: #1B7F38; }
.mm-flyer-badge.is-rejected   { background: #fdecea; color: #CC0000; }
.mm-flyer-badge.is-pending    { background: #fef6e0; color: #8a6d1f; }
.mm-flyer-badge.is-unmatched  { background: var(--surface-3, #f0ece4); color: #6a645c; }
.mm-flyer-badge.is-failed     { background: #fdecea; color: #CC0000; }
.mm-flyer-badge.is-ready      { background: #e6f4ea; color: #1B7F38; }
.mm-flyer-badge.is-processing { background: #fef6e0; color: #8a6d1f; }

/* ── Intake mode (Eliza, 2026-08-04): flyer image/PDF vs filled spreadsheet ── */
.mm-flyer-sheet-hint {
  flex-basis: 100%;
  font-size: .8rem;
  line-height: 1.45;
  margin-top: -2px;
}
.mm-flyer-srcchip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .74rem;
  white-space: nowrap;
  background: var(--surface-3, #f0ece4);
  color: var(--text-mute, #6a645c);
}
.mm-flyer-srcchip.is-sheet { background: #e8f1ee; color: #22705f; }
/* #244: the Flipp intake mode. Distinct hue from the sheet chip so the three
   provenances are tellable apart at a glance in the history table. */
.mm-flyer-srcchip.is-flipp { background: #e7eef8; color: #2a5599; }
/* #333: the URL intake. A fourth distinct hue so all four provenances are
   tellable apart at a glance, which is the whole job of this chip. */
.mm-flyer-srcchip.is-url { background: #f3ecf8; color: #6b3fa0; }
.mm-flyer-source.is-url {
  margin-top: 4px;
  font-size: .82rem;
  color: var(--text-mute, #6a645c);
}
/* Flipp options are collapsed by default — the zone defaults are right for the
   common case, and two more always-visible fields would crowd the upload path. */
.mm-flyer-flipp-opts { margin-top: 8px; }
.mm-flyer-flipp-opts > summary {
  cursor: pointer;
  font-size: .82rem;
  padding: 2px 0;
}
.mm-flyer-flipp-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.mm-flyer-flipp-fields .mm-flyer-field { flex: 1 1 200px; }
.mm-flyer-source {
  font-size: .84rem;
  margin: 0 0 8px;
  padding: 6px 10px;
  border-left: 3px solid #2f8f7f;
  background: var(--surface-2, #faf7f2);
  border-radius: 0 6px 6px 0;
}

.mm-flyer-row.is-rejected { opacity: .6; }
/* Three actions now live here (#171: Confirm / Choose SKU / Not this). Same
   reasoning as .mm-shelf-row-actions: let the cell wrap on narrow viewports
   rather than forcing a horizontal scroll that would push "Choose SKU" off
   screen — i.e. re-hiding the very control this feedback existed to surface. */
.mm-flyer-row-actions { white-space: normal; }
.mm-flyer-row-actions .btn { margin: 2px 0; }
.mm-flyer-row-actions .btn + .btn { margin-left: 4px; }

/* ── #320 (Eliza, 2026-08-30): "why sometimes i can reject the SKU and
   sometimes, it rejected button not shown"

   Half of that report is by design (a decided row swaps Reject for Undo, #268)
   and is answered in copy. The other half is THIS: the actions cell is the last
   of nine or ten columns, and .table-wrap scrolls horizontally. On a narrow
   window the whole column sits past the right edge, so the button is present in
   the DOM, enabled, and simply off screen. "Sometimes not shown" is literally
   true, and no amount of button logic fixes it.

   Pinning the column to the right edge means the ruling controls are on screen
   at every width, whatever the horizontal scroll position. It is layout only:
   no row ever gains or loses a button here.

   position: sticky (not fixed) so the cell still scrolls VERTICALLY with its
   row. z-index sits above normal cells but below the sticky header if one is
   added later. The background is opaque on purpose — a transparent sticky cell
   lets the scrolled-under columns show through and the buttons become unreadable
   the moment they overlap text. */
.mm-flyer-table th:last-child,
.mm-flyer-table td.mm-flyer-row-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface-1, #fff);
  /* Hairline that reads as "this column is pinned", so the operator understands
     why it does not move rather than thinking the table is broken. */
  box-shadow: -6px 0 6px -6px rgba(0, 0, 0, .18);
}
/* The row tints (#171 next-up, rejected dimming) paint the TR, which a sticky
   cell with its own background would otherwise punch a hole in. Inherit so the
   pinned cell keeps its row's colour instead of showing a white notch. */
.mm-flyer-table tr.is-next-up td.mm-flyer-row-actions { background: inherit; }

/* #319: the "Not sauce" shortcut. A ghost button like plain Reject — it is a
   sibling ruling, not a more important one, and promoting it would push her
   toward the reasoned reject on rows where plain Reject is the honest answer. */
.mm-flyer-notsauce { font-style: italic; }

/* #319: the recorded reason under a rejected row's status badge. Small and
   muted: it explains a decision already made, so it must not compete with the
   status itself or with the pending rows that still need her attention. */
.mm-flyer-reject-reason {
  display: inline-block;
  margin-top: 2px;
  font-size: .72rem;
  line-height: 1.2;
}

.mm-flyer-legend { font-size: .78rem; margin: 8px 0 0; }

/* ── #201 delete control (history table) ──
   Ghost button so it never competes with Open for the primary click, but tinted
   with the danger token so the destructive one is distinguishable at a glance —
   two identical grey buttons side by side is how an operator deletes the scan
   they meant to open. Colour is NOT the only signal: the label says "Delete"
   and a confirm dialog names the store and week before anything is removed. */
.mm-flyer-delete { color: var(--danger, #c0392b); }
.mm-flyer-delete:hover:not(:disabled) {
  color: var(--danger, #c0392b);
  border-color: var(--danger, #c0392b);
}

/* ── #172 export bar (above the rows table) ── */
.mm-flyer-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}
.mm-flyer-export-hint { font-size: .78rem; }

/* ── #175/#176 Price Watch card (cross-scan multi-week download) ──
   Deliberately built from the SAME tokens as the upload card above rather than
   a new surface treatment: it sits between two existing flyer cards, and a
   panel with its own greys would read as a bolted-on island in dark mode. */
.mm-flyer-watch-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.mm-flyer-watch-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.mm-flyer-watch-meta { font-size: .82rem; margin-top: 10px; }
.mm-flyer-watch-hint { font-size: .78rem; margin: 6px 0 0; }

/* #213 (Xin, 2026-08-10): "what does unmatch means (does it indicate that we did
   not confirm the product?)". Collapsed by default so it answers the question
   on demand without pushing the download buttons down the page. */
.mm-flyer-watch-legend { margin-top: 8px; font-size: .78rem; }
.mm-flyer-watch-legend > summary {
  cursor: pointer;
  color: var(--text-muted, #6b7280);
  user-select: none;
}
.mm-flyer-watch-legend > summary:hover { color: var(--text, #111827); }
.mm-flyer-watch-legend-list {
  margin: 8px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted, #6b7280);
  line-height: 1.5;
}

/* #248 (Eliza, 2026-08-16): the multi-store rollup. She asked to see CT +
   Chinatown + Feilong "on the summary page" — so the stores are shown as chips
   with the ad week bound visually to the price. The week is deliberately NOT
   muted into invisibility: a price whose week you cannot read is the bug. */
.mm-flyer-watch-range {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface-2, #f9fafb);
}
.mm-flyer-watch-range-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: .82rem;
  margin-bottom: 8px;
}
.mm-flyer-watch-range-head .text-mute { font-size: .76rem; }
.mm-flyer-watch-range-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mm-flyer-range-name { font-size: .8rem; font-weight: 600; }
.mm-flyer-range-name .text-mute { font-weight: 400; }
.mm-flyer-range-grouped {
  font-weight: 400;
  font-size: .7rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3, #eef2ff);
  color: var(--text-muted, #6b7280);
  cursor: help;
}
.mm-flyer-range-stores {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}
.mm-flyer-range-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  background: var(--surface, #fff);
  font-size: .74rem;
  line-height: 1.4;
}
.mm-flyer-range-store { font-weight: 600; }
.mm-flyer-range-week {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #6b7280);
}
.mm-flyer-range-price {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

@media (max-width: 900px) {
  /* Stack rather than squeeze: two side-by-side controls plus two buttons
     overflow a phone, and a horizontally scrolling control row is how the
     download button ends up off-screen — the exact discoverability failure
     #175 was filed about. */
  .mm-flyer-watch-controls { flex-direction: column; align-items: stretch; }
  .mm-flyer-watch-actions .btn { flex: 1 1 auto; }
}

/* ── Manual catalog picker (revealed per row) ── */
.mm-flyer-picker { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.mm-flyer-picker-results { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.mm-flyer-choice {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border, #e4ded4);
  border-radius: 4px;
  background: var(--surface, #fff);
  font-size: .84rem;
  text-align: left;
  cursor: pointer;
}
.mm-flyer-choice:hover {
  border-color: var(--heritage-red, #CC0000);
  background: var(--surface-2, #faf7f2);
}

/* #256: a catalog hit whose pack size does NOT match the size printed in the ad.
   Still clickable — the operator may know something we do not — but it can no
   longer be picked by accident. This is the guard against binding the 750 ml
   Haday SKU onto a 1.9 L flyer line, which would publish a ~2.5× unit-price
   error into the worksheet. Amber, not red: it is a caution, not a refusal. */
.mm-flyer-choice.is-pack-mismatch {
  border-color: #d9a72c;
  background: #fdf9ef;
}
.mm-flyer-pack-warn {
  font-size: .72rem;
  color: #8a6d1f;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .mm-flyer-field { min-width: 100%; }
  .mm-flyer-date { max-width: 100%; }
}
@media (max-width: 640px) {
  /* Pack size folds away first, then brand: the PRICE, the multi-buy deal and
     the LKK/Haday tag are the decision-critical columns on a phone in a store. */
  .mm-flyer-table th:nth-child(3), .mm-flyer-table td:nth-child(3) { display: none; }
  .mm-flyer-table th, .mm-flyer-table td { font-size: .76rem; padding: 6px; }
  .mm-flyer-sumcount { font-size: 1.3rem; }
  /* #320: on a phone the pinned column would eat a third of a 360px viewport,
     and the cell already wraps its buttons onto their own lines here. Unpinning
     is safe because the table is narrow enough to reach by scrolling, and it is
     UNPINNING ONLY — display stays visible, so Reject is still rendered. */
  .mm-flyer-table th:last-child,
  .mm-flyer-table td.mm-flyer-row-actions {
    position: static;
    box-shadow: none;
  }
}

/* ─────────────────────────────────────────────────────────────
   OOS Analytics → Weee PO Fill cross-link (IA Option F, 2026-08-06)

   Signpost pinned at the top of #mm-pane-oos. "OOS" on this tab means
   STOREFRONT availability; the vendor PO-fill question lives in its own
   module (#/weee-oos), which has no sidebar row. Built on the shared
   .card so it inherits radius/shadow/dark-mode; only layout + the
   link-affordance state are new.
   ───────────────────────────────────────────────────────────── */
.mm-oos-crosslink {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  border-left: 3px solid var(--heritage-gold, #D4A843);
  transition: border-color .15s ease, transform .15s ease;
}
.mm-oos-crosslink:hover,
.mm-oos-crosslink:focus-visible {
  border-left-color: var(--heritage-red, #CC0000);
  transform: translateX(2px);
}
.mm-oos-crosslink-icon { font-size: 1.5rem; line-height: 1; flex: 0 0 auto; }
.mm-oos-crosslink-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.mm-oos-crosslink-eyebrow {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--heritage-gold, #D4A843);
}
.mm-oos-crosslink-title { font-weight: 600; font-size: .95rem; color: var(--text-primary, #1a1a1a); }
.mm-oos-crosslink-text { font-size: .82rem; line-height: 1.45; opacity: .8; }
.mm-oos-crosslink-cta {
  flex: 0 0 auto;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--heritage-red, #CC0000);
}

@media (max-width: 640px) {
  /* Stack on a phone: the CTA drops under the copy rather than squeezing it. */
  .mm-oos-crosslink { flex-wrap: wrap; gap: 10px; }
  .mm-oos-crosslink-body { flex-basis: 100%; order: 2; }
  .mm-oos-crosslink-cta { order: 3; }
}

/* ============================================================
   2026-08-10 feedback wave — Eliza Jen #206 / #207
   #206: delisted chip + per-market delisted stat become DRILLDOWNS.
   #207: fulfillment ("warehouse") column + badges on the OOS tab.
   ============================================================ */

/* #206 — the delisted chip is now a <button>. Reset UA button chrome so it
   stays visually identical to the sibling <span> chips, and add the affordance
   (pointer + hover lift) that says "this is clickable". */
.vc-chip.mm-chip-drill {
  font: inherit;
  border: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.vc-chip.mm-chip-drill:hover { filter: brightness(0.94); }
.vc-chip.mm-chip-drill:focus-visible {
  outline: 2px solid var(--heritage-red, #cc0000);
  outline-offset: 2px;
}

/* #206 — per-market Delisted stat drilldown affordance. Mirrors the existing
   sold-out stat treatment so both numbers on a Market Health card read as
   equally clickable. */
.mm-health-stat.mm-health-stat-drill { cursor: pointer; }
.mm-health-stat.mm-health-stat-drill:hover strong { text-decoration: underline; }
.mm-health-stat.mm-health-stat-drill:focus-visible {
  outline: 2px solid var(--heritage-red, #cc0000);
  outline-offset: 2px;
  border-radius: 4px;
}

/* #207 — fulfillment badges. Three MEASURED states get colour; the UNKNOWN
   state is deliberately neutral/muted so it never reads as a finding. */
.mm-ful-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
/* Warehouse (Pantry+) — amber: distribution is weakening upstream. */
.mm-ful-pantry { background: rgba(212, 168, 67, 0.16); color: #8a6d1f; }
/* Local — neutral green-grey: the outage is local, not a warehouse problem. */
.mm-ful-local { background: rgba(107, 114, 128, 0.14); color: var(--text-mute, #4b5563); }
/* Mixed — purple: both happened, needs a human read. */
.mm-ful-mixed { background: rgba(124, 58, 237, 0.14); color: #6d28d9; }
/* Unknown is NOT a badge — plain muted text, so absence of evidence never
   looks like a measured result. */
.mm-ful-unknown { font-size: 0.75rem; font-style: italic; }

/* #207 — the Warehouse (Pantry+) filter chip, matching the #39 delisted chip. */
.mm-pf-chip.mm-pf-pantry.mm-pf-active { background: #b8860b; color: #fff; }

[data-theme="dark"] .mm-ful-pantry { background: rgba(212, 168, 67, 0.22); color: #e8c76a; }
[data-theme="dark"] .mm-ful-local  { background: rgba(156, 163, 175, 0.18); color: #cbd5e1; }
[data-theme="dark"] .mm-ful-mixed  { background: rgba(167, 139, 250, 0.20); color: #c4b5fd; }

/* Fulfillment badges sit inline in the chronic list's meta row — keep them from
   forcing a wrap on narrow cards. */
.mm-chronic-meta .mm-ful-badge,
.mm-chronic-meta .mm-ful-unknown { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   #247 (Jen, Eliza Man Fai, 2026-08-16) — "Find the flyer behind a price"

   "in the price watch extracted, there is CT supermarket pricing of HADAY
   premium soy 1.9L, but i cannot find the flyer here"

   The return path from an extract cell to the scan that produced it, plus the
   two honesty surfaces #247 needs: the brand-chip notice (the global LKK chip
   does not filter flyer scans) and the explained missing-scan state.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Collapsed by default: it is a lookup tool, not a thing every operator needs
   open. Same discipline as the #213 status legend directly above. */
.mm-flyer-find { margin-top: 12px; font-size: .82rem; }
.mm-flyer-find > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--lkk-red, #cc0000);
  user-select: none;
}
.mm-flyer-find > summary:hover { text-decoration: underline; }
.mm-flyer-find-hint {
  font-size: .78rem;
  margin: 8px 0 0;
  max-width: 78ch;
  line-height: 1.5;
}
.mm-flyer-find-controls,
.mm-flyer-find-byid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 10px;
}
/* The Scan-ID door is visually secondary to the product hunt: most operators
   search by name, and only someone holding the workbook pastes an id. */
.mm-flyer-find-byid {
  padding-top: 10px;
  border-top: 1px dashed var(--border, #e5e7eb);
}
.mm-flyer-find-status { font-size: .8rem; margin-top: 8px; min-height: 1.1em; }
.mm-flyer-find-status.is-loading { color: var(--text-muted, #6b7280); }
.mm-flyer-find-status.is-success { color: var(--success-text, #166534); }
.mm-flyer-find-status.is-error { color: var(--danger-text, #b91c1c); }
.mm-flyer-find-results { margin-top: 8px; }
.mm-flyer-find-table { font-size: .8rem; }
.mm-flyer-find-brand { font-size: .74rem; }
/* Monospace so a pasted id can be compared against the spreadsheet cell
   character by character — flyerscan_4d619ef02642 is unreadable otherwise. */
.mm-flyer-find-scanid {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .72rem;
  word-break: break-all;
}
.mm-flyer-find-actions { white-space: nowrap; }
/* An estimated week is a fallback to the upload date, never a printed ad week
   (the builder's week_is_estimated rule). Marked so it cannot pass as one. */
.mm-flyer-find-est {
  font-size: .68rem;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--warn-bg, #fef3c7);
  color: var(--warn-text, #92400e);
}
.mm-flyer-find-filenote { font-size: .74rem; margin: 8px 0 0; max-width: 78ch; }

/* Missing scan: dimmed but STILL READABLE. Store / week / price / scan id stay
   legible because those four facts remain true after the scan is gone — the row
   is de-emphasised, not hidden, and never removed. */
.mm-flyer-find-row-gone { opacity: .72; }
.mm-flyer-find-gone {
  display: block;
  font-size: .7rem;
  color: var(--danger-text, #b91c1c);
  margin-top: 2px;
}
.mm-flyer-find-missing,
.mm-flyer-find-empty {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: .82rem;
  line-height: 1.55;
}
/* Amber, not red: an empty week is a wrong-week nudge with a one-click fix,
   not a failure. */
.mm-flyer-find-empty {
  background: var(--warn-bg, #fef3c7);
  border-left: 3px solid var(--warn-border, #f59e0b);
}
.mm-flyer-find-empty > p { margin: 0 0 8px; }
.mm-flyer-find-missing {
  background: var(--danger-bg, #fef2f2);
  border-left: 3px solid var(--danger-border, #ef4444);
}
.mm-flyer-find-missing > p { margin: 0 0 6px; }
.mm-flyer-find-missing > p:last-child { margin-bottom: 0; }

/* The brand-chip notice. Informational blue, NOT a warning: nothing is broken,
   the chrome above simply does not govern this pane and saying so is the fix. */
.mm-flyer-brand-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--info-bg, #eff6ff);
  border-left: 3px solid var(--info-border, #3b82f6);
  font-size: .8rem;
  line-height: 1.5;
}
.mm-flyer-brand-note[hidden] { display: none; }
.mm-flyer-brand-note-text { flex: 1 1 32ch; }

@media (max-width: 640px) {
  .mm-flyer-find-controls,
  .mm-flyer-find-byid { flex-direction: column; align-items: stretch; }
  .mm-flyer-find-controls .btn,
  .mm-flyer-find-byid .btn { width: 100%; }
}


/* ── #250 (Eliza, 2026-08-17): honest "could not read this offer" row state ──
 *
 * "lee kum kee vegan oyster sauce is on promotion in CT supermarket but the
 * message cannot be decoded, how can i confirm this."
 *
 * A row whose product name or per-unit split vision could not read used to render
 * as a bare em-dash, which reads as a broken table rather than a deliberate refusal
 * to invent a value. These styles make the refusal legible WITHOUT making it look
 * like an error: the row is still fully actionable (Choose SKU stays available), so
 * a red error treatment would overstate it. Amber/notice, matching .mm-flyer-nosplit
 * above, which is the same class of statement ("we will not divide this deal").
 */
.mm-flyer-unread {
  font-size: .78rem;
  font-style: italic;
  color: #8a6d1f;
}

/* #257: the SKU cell on a competitor row that HAS a bindable catalog SKU but is
   not bound yet. It replaces "Not in our catalog" — a claim the client used to
   make without checking — with an instruction. Styled as actionable text rather
   than muted, because muted is what it looked like when it was a dead end. */
.mm-flyer-bindable {
  font-size: .8rem;
  font-weight: 500;
  color: var(--heritage-red, #CC0000);
}

.mm-flyer-undecoded {
  margin-top: .3rem;
  padding: .38rem .5rem;
  border-left: 3px solid #d9a72c;
  border-radius: 3px;
  background: #fdf7e6;
  font-size: .74rem;
  line-height: 1.45;
  color: #6d5717;
  /* The copy is a full sentence, so it must wrap inside the cell rather than
   * stretch the table (the truncation class the #250 screenshot shows on the
   * header text). */
  white-space: normal;
  max-width: 30rem;
}

.mm-flyer-undecoded-tag {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: .68rem;
  color: #8a6d1f;
}

/* Choose SKU on a row where Confirm is (correctly) refused, or where vision could
 * not read the offer. It is the only action that can move such a row forward, so it
 * needs to catch the eye — but it stays a GHOST button by design (#171 made Confirm
 * the single primary because accepting a correct suggestion is the common path, and a
 * second primary on every gated row would flatten that hierarchy). Emphasis, not
 * promotion: a heritage-red tint and a weight bump, no rank change. */
.mm-flyer-row .btn.is-next-step {
  border-color: var(--brand-red, #cc0000);
  color: var(--brand-red, #cc0000);
  font-weight: 600;
}

.mm-flyer-row .btn.is-next-step:hover,
.mm-flyer-row .btn.is-next-step:focus-visible {
  background: rgba(204, 0, 0, .06);
}
/* ─────────────────────────────────────────────────────────────
   #251–254 (Eliza Jen, 2026-08-16) — OOS Analytics definitions,
   scope, export group, legend, and the honest row-cap note.

   OOS-pane <details> starts OPEN so a screenshot of the tab she asked
   from actually shows Sold out vs Delisted. Overview health chips stay
   collapsed. The failure mode being fixed is tooltip-only copy.
   ───────────────────────────────────────────────────────────── */
.mm-oos-defs {
  padding: 0;
  border-left: 3px solid var(--info-border, #3b82f6);
}
.mm-oos-defs-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  font-size: .86rem;
}
.mm-oos-defs-summary::-webkit-details-marker { display: none; }
.mm-oos-defs-summary::after {
  content: '▾';
  margin-left: auto;
  font-size: .8rem;
  opacity: .6;
  transition: transform .15s ease;
}
.mm-oos-defs[open] > .mm-oos-defs-summary::after { transform: rotate(180deg); }
.mm-oos-defs-icon { flex: 0 0 auto; font-size: 1rem; }
.mm-oos-defs-heads { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.mm-oos-defs-title { font-weight: 600; }
.mm-oos-defs-scope { font-size: .78rem; opacity: .72; }
.mm-oos-defs-body {
  padding: 2px 16px 14px;
  border-top: 1px solid var(--border-subtle, #e5e7eb);
}
.mm-oos-defs-list { margin: 12px 0 0; display: grid; gap: 8px; }
.mm-oos-def { display: flex; flex-direction: column; gap: 2px; }
.mm-oos-def dt {
  margin: 0;
  font-weight: 600;
  font-size: .8rem;
}
.mm-oos-def dd {
  margin: 0;
  font-size: .8rem;
  line-height: 1.55;
  padding-left: 10px;
  border-left: 3px solid var(--border-subtle, #e5e7eb);
}
/* Status-coded left rails so the four states read as four DIFFERENT facts at a
   glance — never-carried deliberately does NOT share the delisted colour. */
.mm-oos-def-soldOut dd { border-left-color: var(--danger, #dc2626); }
.mm-oos-def-delisted dd { border-left-color: var(--heritage-gold, #D4A843); }
.mm-oos-def-unavailable dd { border-left-color: var(--text-mute, #9ca3af); }
.mm-oos-def-notCarried dd { border-left-color: var(--info-border, #3b82f6); }

.mm-oos-scope-list {
  margin: 14px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: .78rem;
  line-height: 1.55;
  opacity: .88;
}

/* Two-format download group. Excel first: #253 and #254 both asked for Excel. */
.mm-oos-export-group { display: inline-flex; gap: 6px; margin-left: auto; }

/* #258 ("where to download the file? i do not see the icon").
   The buttons were word-only, so there was literally no icon to see. The glyph
   goes BEFORE the label and is aria-hidden — the accessible name still comes
   from the button text, so a screen reader says "Download Excel", not
   "down-arrow Download Excel". Icon AND word: an unlabelled glyph fails the
   same way for a non-native reader, and a word alone is what she just missed. */
.mm-export-ico {
  margin-right: 6px;
  font-size: .95em;
  line-height: 1;
  display: inline-block;
}
/* The OOS download must survive a screenshot and a phone. On the Overview
   health head the group is pushed right by the shared margin-left:auto above;
   nothing else is needed there. */
.mm-oos-export-btn { white-space: nowrap; }

/* ---- #254 reopened: the KPI tile strip gets its own head ----
   Her screenshot is the top of the OOS Analytics tab: the tiles, nothing else.
   #258's three placements all live BELOW this strip, so on her viewport the
   download was off-screen and she reported it missing a second time. This head
   sits directly above the tiles so the control is in the same frame as the
   15.1% it explains. */
.mm-oos-kpi-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.mm-oos-kpi-title {
  font-weight: 650;
  font-size: .95rem;
  color: var(--ink, #111827);
}
/* The hint states what is IN the file (date range + calculation sheet), because
   the ticket is not "add a button", it is "show me how the rate was derived". */
.mm-oos-kpi-hint {
  margin: 0 0 10px;
  font-size: .78rem;
  line-height: 1.55;
  opacity: .85;
  max-width: 78ch;
}

/* ---- #259 evidence panel: the SKUs behind a clicked count ---- */
.mm-oos-evidence { margin-top: 12px; }
.mm-oos-ev-card {
  border: 1px solid var(--line, #E5E7EB);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--surface, #fff);
}
.mm-oos-ev-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.mm-oos-ev-title { font-weight: 700; font-size: .9rem; }
.mm-oos-ev-close { margin-left: auto; }
.mm-oos-ev-group { margin-top: 10px; }
.mm-oos-ev-group-head {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-mute, #6B7280);
  margin-bottom: 4px;
}
/* The clicked bucket is emphasised, but the others stay VISIBLE — the whole
   point of #259 is that the neighbouring facts are what explain the number. */
.mm-oos-ev-focus .mm-oos-ev-group-head { color: var(--ink, #111827); }
.mm-oos-ev-list { list-style: none; margin: 0; padding: 0; }
.mm-oos-ev-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line-soft, #F3F4F6);
}
.mm-oos-ev-row:last-child { border-bottom: 0; }
.mm-oos-ev-name {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: var(--brand, #CC0000);
  font-size: .85rem;
  font-weight: 600;
}
.mm-oos-ev-name:hover { text-decoration: underline; }
.mm-oos-ev-size { font-weight: 400; color: var(--ink-mute, #6B7280); }
.mm-oos-ev-id { margin-left: auto; font-size: .75rem; color: var(--ink-mute, #6B7280); }
.mm-oos-ev-note { margin-top: 10px; font-size: .75rem; line-height: 1.5; }

/* ---- #261 delist honesty: the evidence under a "delisted" row ----
   Ka Wing could find NY 50/4/61 on Weee while we called them delisted. The row
   now carries WHY we say what we say (last confirmed date + observed miss
   streak) and a link to check. The base .mm-oos-ev-row is a single-baseline
   flex line, so allow wrapping: the evidence line and the link take a full-width
   second row instead of squeezing the SKU name. */
.mm-oos-ev-row { flex-wrap: wrap; }
.mm-oos-ev-evidence {
  flex: 1 0 100%;
  font-size: .72rem;
  line-height: 1.45;
  margin-top: 2px;
}
.mm-oos-ev-weee {
  flex: 0 0 auto;
  font-size: .72rem;
  font-weight: 600;
  color: var(--brand, #CC0000);
  text-decoration: underline;
  margin-top: 2px;
}
/* Unconfirmed is deliberately NOT styled as an error/kill state. A row that was
   buyable days ago must not read as a dead listing. */
.mm-oos-ev-group-note {
  font-size: .73rem;
  line-height: 1.5;
  margin-bottom: 6px;
}
.mm-oos-ev-dwell {
  margin-top: 10px;
  font-size: .75rem;
  line-height: 1.5;
}
/* #261: the "how long do they stay?" answer inside the definitions panel. */
.mm-oos-defs-howlong {
  margin: 10px 0 0;
  font-size: .78rem;
  line-height: 1.55;
  color: var(--ink-mute, #6B7280);
}
@media (max-width: 640px) {
  .mm-oos-ev-id { display: none; }
}

/* On-screen formula legend (#254). Same wording as the workbook Notes sheet. */
.mm-oos-legend {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 8px;
  background: var(--surface-subtle, #f9fafb);
  border-left: 3px solid var(--heritage-gold, #D4A843);
}
.mm-oos-legend-line {
  margin: 0 0 6px;
  font-size: .78rem;
  line-height: 1.55;
}
.mm-oos-legend-line:last-child { margin-bottom: 0; }
.mm-oos-legend-scope { opacity: .8; }

/* #253: the table cap, stated. Silence here reads as "only 50 SKUs were OOS". */
.mm-oos-cap-note {
  margin-top: 8px;
  font-size: .76rem;
  font-style: italic;
}

/* #260: sold-out RUNS in the detail table. Each run on its own line so "two
   separate stockouts" cannot be misread as one long date range. */
.mm-oos-ep-cell { white-space: nowrap; }
.mm-oos-ep-runs {
  font-size: .76rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
/* The badge is the signal: >1 run means First/Last hides a restock. */
.mm-oos-ep-badge {
  display: inline-block;
  margin-bottom: 3px;
  padding: 1px 6px;
  border-radius: 9px;
  font-size: .68rem;
  font-weight: 600;
  background: var(--heritage-gold, #D4A843);
  color: #3a2c00;
}

@media (max-width: 640px) {
  .mm-oos-export-group { margin-left: 0; width: 100%; }
  /* #254: on a phone the head stacks, so the pair keeps full-width tap targets
     rather than crushing against the title. */
  .mm-oos-kpi-head { align-items: stretch; }
  .mm-oos-kpi-head .mm-oos-export-group { margin-left: 0; width: 100%; }
  .mm-oos-export-group .btn { flex: 1 1 0; }
  .mm-oos-defs-summary { padding: 11px 13px; }
  .mm-oos-defs-body { padding: 2px 13px 12px; }
  /* Runs wrap rather than force a horizontal scroll on the whole table. */
  .mm-oos-ep-cell { white-space: normal; }

  /* Layout sweep 2026-10-25 (phone, en/es, all 5 placements: health, kpi,
     operational, trend, summary). The group did not wrap, so the two
     buttons were squeezed to 44px and drawn on top of each other
     ("ownloa") and the format hint ran off the right edge. On the Overview
     health head the label and "Clear filter" were squeezed too.
     Now: the head wraps, the group takes its own full-width row, the two
     buttons share one row at their natural width (wrapping to two rows if a
     locale needs it), and the hint gets its own line and wraps. */
  .mm-health-head { flex-wrap: wrap; }
  .mm-health-head .mm-health-label,
  .mm-health-head .mm-health-clear { flex: 0 0 auto; }
  .mm-oos-export-group {
    flex: 1 1 100%;
    flex-wrap: wrap;
    min-width: 0;
  }
  .mm-oos-export-group .btn {
    flex: 1 1 auto;
    min-width: fit-content;
  }
  .mm-oos-export-group .mm-export-format-hint {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}


/* ── #255 (Wang, Xin, 2026-08-17): flyer scan history — filters, honest
   count, Load more ─────────────────────────────────────────────────────────
   "Unable to see the history of all flyers uploaded. Can only see most recent
   but it doesn't cover everything that user submits."

   The card previously held a bare 15-row table. It now carries a filter bar and
   a count line, so the styling job is to keep those two READABLE rather than
   decorative: the count line is the sentence that stops a windowed list from
   passing as the whole ledger, so it must not look like helper chrome. */
.mm-flyer-history-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.mm-flyer-history-filters .filter-select { min-width: 150px; }

/* "Only mine" sits inline with the selects; the label is the click target so a
   tap near the words toggles rather than missing a 13px box. */
.mm-flyer-hist-mine {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary, #555);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.mm-flyer-hist-mine input { cursor: pointer; margin: 0; }

/* showing N of M. Deliberately NOT muted to the same grey as row hints: it is
   load-bearing honesty about completeness, not a caption. */
.mm-flyer-history-count {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary, #555);
}
.mm-flyer-history-count:empty { display: none; }

/* LOW-2: week/store as dismissible chips so a store filter is visible without
   re-reading the select. One chip per active non-mine filter. */
.mm-flyer-hist-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.mm-flyer-hist-chips[hidden] { display: none; }
.mm-flyer-hist-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(204, 0, 0, 0.28);
  background: rgba(204, 0, 0, 0.06);
  color: var(--text-primary, #222);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  line-height: 1.3;
}
.mm-flyer-hist-chip:hover { background: rgba(204, 0, 0, 0.12); }
.mm-flyer-hist-chip span { font-size: 0.95rem; line-height: 1; color: #CC0000; }

.mm-flyer-history-more {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.mm-flyer-history-more .btn[hidden] { display: none; }

@media (max-width: 640px) {
  /* Stacked so a banner name is never truncated to the point where two stores
     read identically — picking the wrong store is how an operator concludes
     their upload is missing. */
  .mm-flyer-history-filters { flex-direction: column; align-items: stretch; }
  .mm-flyer-history-filters .filter-select { width: 100%; min-width: 0; }
  .mm-flyer-history-more .btn { width: 100%; }
}

/* ─────────────────────────────────────────────────────────────
   CANADA HONESTY NOTICE (Sandra Creighton ask, 2026-08-14)
   ─────────────────────────────────────────────────────────────
   Sandra asked whether the Canada board shows T&T WEST pricing. It shows the
   national .com catalog with no store selected. This block is that answer,
   rendered ABOVE the numbers it qualifies.

   DESIGN CONSTRAINT THAT DRIVES EVERYTHING BELOW: this board will be
   screenshotted into a Canada channel and forwarded. So the disclosure is
   default-open, full-width, and high-contrast — never a tooltip, never
   collapsed, never colour-only. Same lesson as .mm-oos-defs above (#251), where
   a title= hint was invisible in exactly the screenshot Eliza sent back asking
   what the labels meant.

   It borrows the .mm-oos-defs skeleton on purpose — one disclosure idiom on this
   page, so a reader who has learned to trust the blue-railed info card reads
   this one the same way.
   ───────────────────────────────────────────────────────────── */
.mm-ca-honesty {
  padding: 0;
  /* Amber, not the info-blue of .mm-oos-defs. This is a CAVEAT about the numbers
     below it, not a glossary — it should read as "read me before you believe the
     board", which blue does not carry. */
  border-left: 3px solid var(--heritage-gold, #D4A843);
  background: var(--warn-bg, rgba(212, 168, 67, .07));
}
.mm-ca-honesty-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  font-size: .86rem;
}
.mm-ca-honesty-summary::-webkit-details-marker { display: none; }
.mm-ca-honesty-summary::after {
  content: '▾';
  margin-left: auto;
  font-size: .8rem;
  opacity: .6;
  transition: transform .15s ease;
}
.mm-ca-honesty[open] > .mm-ca-honesty-summary::after { transform: rotate(180deg); }
.mm-ca-honesty-icon { flex: 0 0 auto; font-size: 1rem; }
.mm-ca-honesty-heads { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.mm-ca-honesty-title { font-weight: 600; }
/* The one-line version of the whole notice. Load-bearing: it stays visible even
   if a reader folds the card, so "national catalog, no store selected" survives
   the collapse. */
.mm-ca-honesty-scope { font-size: .78rem; opacity: .78; font-weight: 500; }

.mm-ca-honesty-body {
  padding: 2px 16px 14px;
  border-top: 1px solid var(--border-subtle, #e5e7eb);
}
.mm-ca-honesty-list {
  margin: 12px 0 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  font-size: .82rem;
  line-height: 1.55;
}
/* Colour-coded rails, but every item also leads with its own sentence — colour
   is never the only carrier of meaning (the notice has to survive greyscale
   print and colour-blind readers, both of which happen in forwarded decks). */
.mm-ca-honesty-list li {
  padding-left: 10px;
  border-left: 3px solid var(--border-subtle, #e5e7eb);
}
.mm-ca-h-price   { border-left-color: var(--heritage-gold, #D4A843) !important; }
.mm-ca-h-oos     { border-left-color: var(--danger, #dc2626) !important; }
.mm-ca-h-reviews { border-left-color: var(--success, #16a34a) !important; }

/* The postal-code row: the literal answer to "does it show West pricing?".
   Boxed rather than bulleted so it does not read as a fourth caveat — it is a
   REQUEST to Sandra's team, and it is the one line on this card that has a
   next action attached to it. */
.mm-ca-honesty-postal {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: .8rem;
  line-height: 1.5;
  background: var(--surface-2, rgba(0, 0, 0, .035));
  border: 1px dashed var(--border-subtle, #e5e7eb);
}
.mm-ca-postal-icon { flex: 0 0 auto; }
/* Dashed + amber while empty: an unfilled slot, visibly awaiting input. Solid +
   quiet once codes exist, because at that point the open question is the
   scraper work, not the missing data. */
.mm-ca-postal-none { border-color: var(--heritage-gold, #D4A843); }
.mm-ca-postal-has  { border-style: solid; }

.mm-ca-honesty-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle, #e5e7eb);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  font-size: .78rem;
  line-height: 1.5;
}
.mm-ca-honesty-src { opacity: .85; max-width: 60ch; }
.mm-ca-honesty-src strong { margin-right: 4px; }
/* Green, matching the reviews rail above: "this is the layer that works today"
   is the one positive instruction on an otherwise cautionary card. */
.mm-ca-honesty-cta {
  flex: 0 0 auto;
  background: var(--success, #16a34a);
  color: #fff;
  border-color: var(--success, #16a34a);
}
.mm-ca-honesty-cta:hover { filter: brightness(1.07); }

@media (max-width: 640px) {
  /* Full-width CTA and stacked footer — on a phone the button must not end up a
     thin sliver beside a paragraph, because tapping through to Reviews is the
     action this card exists to produce. */
  .mm-ca-honesty-foot { flex-direction: column; align-items: stretch; }
  .mm-ca-honesty-cta { width: 100%; }
  .mm-ca-honesty-src { max-width: none; }
}

/* ── #268 (Lauren, 2026-08-19): sauce-only filter bar ──────────────────────
   Sits directly above the confirm queue. Deliberately quiet — this is a VIEW
   control, not a decision control, and it must not compete with Confirm for
   attention on a screen whose whole job is row triage. */
.mm-flyer-filterbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}
.mm-flyer-sauce-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.mm-flyer-sauce-toggle input { cursor: pointer; }
/* The honesty half of the filter: how many rows it is hiding right now. Muted,
   but never absent while the filter is on — a filtered queue that does not say
   it is filtered is how someone confirms an incomplete week. */
.mm-flyer-sauce-count { font-size: 12px; }

/* ── #298 (Eliza, 2026-08-25): focus toggle + the confirm-path answer ──────
   The focus toggle is the DEFAULT-ON filter, so it reads slightly stronger than
   the #268 sauce toggle beside it — a control that is already hiding rows when
   the page opens must be the first thing she can find to turn off. Still a view
   control though: weight, not colour, and it never competes with Confirm. */
.mm-flyer-focus-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.mm-flyer-focus-toggle input { cursor: pointer; }

/* The answer to "one button or both?", in the queue header where it is read
   BEFORE the first click. Not a tooltip (hover-only, invisible on touch) and
   not a toast (gone before she reaches the row). Muted and full-width so it
   reads as guidance rather than an error. */
.mm-flyer-confirm-hint {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted, #6b7280);
  max-width: 78ch;
}

@media (max-width: 640px) {
  .mm-flyer-filterbar { gap: 6px; }
  /* Stack the two toggles on a phone rather than letting the count wrap
     between them, which reads as if the count belongs to one toggle. */
  .mm-flyer-filterbar { align-items: flex-start; }
  .mm-flyer-confirm-hint { font-size: 11.5px; }
}

/* ── #268: retailer flyer sources ─────────────────────────────────────────
   Status colours are deliberately NOT a red/green pass-fail. "No public flyer
   source" is not a failure of ours or hers — it is a fact about the retailer,
   and painting it red would imply something is broken and fixable here. Green
   is reserved for a source that genuinely returns readable prices. */
.mm-flyer-sources-head { font-size: 13px; margin: 0 0 8px; }
.mm-flyer-sources-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mm-flyer-source-row {
  border: 1px solid var(--border, #e5e7eb);
  border-left: 3px solid var(--border, #e5e7eb);
  border-radius: 6px;
  padding: 8px 10px;
}
.mm-flyer-source-row.is-ok    { border-left-color: var(--success, #16a34a); }
.mm-flyer-source-row.is-warn  { border-left-color: var(--warning, #d97706); }
.mm-flyer-source-row.is-none  { border-left-color: var(--border, #cbd5e1); }
.mm-flyer-source-main {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; justify-content: space-between;
}
.mm-flyer-source-name { font-weight: 600; font-size: 13px; }
.mm-flyer-source-badge {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--border, #e5e7eb); white-space: nowrap;
}
.mm-flyer-source-badge.is-ok   { color: var(--success, #16a34a); border-color: currentColor; }
.mm-flyer-source-badge.is-warn { color: var(--warning, #d97706); border-color: currentColor; }
/* The measurement behind the claim. Small, but never hidden — a status with no
   date and no method rots into folklore. */
.mm-flyer-source-note { font-size: 12px; margin-top: 4px; }
.mm-flyer-source-meta { font-size: 11px; margin-top: 2px; }
.mm-flyer-sources-foot { font-size: 12px; margin: 10px 0 0; max-width: 70ch; }

@media (max-width: 640px) {
  .mm-flyer-source-main { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* ── #298 job path: remaining-work meter, next-to-review, done state ───────
   Eliza: "help the employees do their job faster and properly."

   The filter made the queue quiet; quiet is not finished. These three surfaces
   answer "how much is left", "which row next", and "am I done" — the questions
   she previously had to answer by counting rows.

   DESIGN RULE HERE: the meter is INFORMATION, not an alarm. It gets weight and
   a neutral rail, never a red/amber status colour. Remaining work is the normal
   state of a fresh flyer, and painting it as a warning would make every upload
   look like a problem. Only the done state earns a colour, and it is green
   because it is genuinely the end of the task. */
.mm-flyer-meter {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  justify-content: space-between;
  padding: 8px 12px; margin: 0 0 8px;
  border: 1px solid var(--border, #e5e7eb);
  border-left: 3px solid var(--brand, #cc0000);
  border-radius: 6px;
  background: var(--surface-2, #fafafa);
}
.mm-flyer-remaining { font-weight: 600; font-size: 13.5px; }
/* The two-step split. Muted: it qualifies the headline, it does not compete
   with it — and it must not read as an error, because a gated LKK row is a
   correct state, not a fault. */
.mm-flyer-remaining-gated { font-size: 12px; color: var(--text-mute, #6b7280); }
.mm-flyer-meter-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* The bulk action. Secondary on purpose: it is the FAST path, not the default
   path. Making it primary would put a multi-row publish at the same visual rank
   as a single considered Confirm, which is the wrong hierarchy for the one
   control here that acts on more than one price per click. */
.mm-flyer-confirm-remaining { white-space: nowrap; }

/* Next-to-review target. A left rail + tint, NOT a background fill: the row's
   own status colouring (is-confirmed / is-unmatched) must stay readable
   underneath, so the highlight has to be additive rather than a repaint. */
.mm-flyer-row.is-next-up > td {
  background: color-mix(in srgb, var(--brand, #cc0000) 5%, transparent);
}
.mm-flyer-row.is-next-up > td:first-child {
  box-shadow: inset 3px 0 0 0 var(--brand, #cc0000);
}
/* Respect the platform setting — the scroll is smooth in JS, so anyone who has
   asked for reduced motion gets an instant jump instead. */
@media (prefers-reduced-motion: reduce) {
  .mm-flyer-row.is-next-up > td { transition: none; }
}

/* The done state. The one place green is earned. */
.mm-flyer-done {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; margin: 0 0 10px;
  border: 1px solid var(--success, #16a34a);
  border-left: 3px solid var(--success, #16a34a);
  border-radius: 6px;
  background: color-mix(in srgb, var(--success, #16a34a) 6%, transparent);
}
.mm-flyer-done-ico { font-size: 18px; line-height: 1.2; }
.mm-flyer-done-body { flex: 1 1 auto; min-width: 0; }
.mm-flyer-done-title { margin: 0; font-weight: 600; font-size: 14px; }
/* The honesty line: when focus is still hiding rows, this is where we say so.
   Never smaller than 12px — a disclosure nobody can read is not a disclosure. */
.mm-flyer-done-desc { margin: 4px 0 0; font-size: 12.5px; max-width: 70ch; }
.mm-flyer-done-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

@media (max-width: 640px) {
  .mm-flyer-meter { flex-direction: column; align-items: flex-start; gap: 6px; }
  .mm-flyer-meter-actions { width: 100%; }
  .mm-flyer-meter-actions .btn { flex: 1 1 auto; }
  .mm-flyer-done { flex-direction: column; }
  .mm-flyer-done-actions .btn { flex: 1 1 auto; }
}

/* ═══════════════════════════════════════════════════════════════════════
   #300 (Cherie Che, 2026-08-28) — OOS LOOKUP.
   One SKU, one row per region. The three availability states are given
   three different visual weights so the table is readable at a glance
   WITHOUT the reader having to parse the numbers first:
     unobserved → muted (we have no evidence)
     in stock   → normal (measured, healthy)
     out of stock → red accent (measured, a real problem)
   ═══════════════════════════════════════════════════════════════════════ */
.mm-oos-lookup-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.mm-oos-lookup-search {
  min-width: 260px;
  flex: 1 1 260px;
}

.mm-oos-lookup-header {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface-2, #faf7f2);
  border: 1px solid var(--border, #e6e0d6);
  border-radius: 8px;
}
.mm-oosl-identity {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 20px;
}
.mm-oosl-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mm-oosl-field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #8a8178);
}
.mm-oosl-field-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #2b2622);
  overflow-wrap: anywhere;
}
.mm-oosl-ambiguous {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-muted, #8a8178);
}

.mm-oos-lookup-table {
  width: 100%;
}
.mm-oos-lookup-table .mm-oosl-status {
  white-space: normal;
  min-width: 200px;
}

/* Measured and healthy. */
.mm-oosl-row-in_stock .mm-oosl-status { color: var(--success-text, #2f6b3f); }
/* Measured and sold out. */
.mm-oosl-row-oos .mm-oosl-status { color: var(--danger-text, #b3261e); font-weight: 600; }
/* NO evidence. Muted and italic so it never reads as a healthy zero — this is
   the visual half of the honesty rule the API enforces with a null rate. */
.mm-oosl-row-unobserved { color: var(--text-muted, #8a8178); }
.mm-oosl-row-unobserved .mm-oosl-status { font-style: italic; }

.mm-oosl-total td {
  border-top: 2px solid var(--border-strong, #cfc6b8);
  font-weight: 700;
  background: var(--surface-2, #faf7f2);
}

.mm-oosl-legend {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted, #8a8178);
}

@media (max-width: 640px) {
  .mm-oos-lookup-search { min-width: 100%; flex-basis: 100%; }
  .mm-oosl-identity { grid-template-columns: 1fr 1fr; }
}

/* #254: metric basis belongs beside the number, including on narrow screens. */
.mm-kpi-basis { flex: 1 1 100%; grid-column: 1 / -1; min-width: 0; margin: 8px 0; overflow-wrap: anywhere; }

.mm-operational-kpi-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

.mm-export-format-hint { flex-basis: 100%; max-width: 38rem; font-size: 0.8rem; white-space: normal; }
/* ============================================================================
   36-workspace-palette.css — Capability palette (composer discovery surface)
   ----------------------------------------------------------------------------
   NEW FILE (2026-08-07). Deliberately separate from 33-workspace.css so the
   capability-discovery work is one reviewable, revertible unit — deleting this
   file and the import removes the palette without touching workspace chrome.

   Owns:
     .ws-palette-btn   the ✨ composer affordance (visible half of the dual entry)
     .ws-palette*      the overlay, card, search, grouped list, footer

   Tokens only (var(--…) from 49-design-system.css). Dark mode inherits because
   every colour here is a token, so 90-dark-mode.css needs no companion block.
   ========================================================================== */

/* ── Composer affordance ─────────────────────────────────────────────────
   Sits beside #ws-attach. Mirrors .ws-attach geometry exactly so the button
   row stays optically even; only the hover accent differs (heritage red) to
   read as "capability" rather than "file". */
.ws-palette-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.ws-palette-btn:hover {
  background: var(--surface-2, #f3f4f6);
  color: var(--lkk-red, #cc0000);
}
.ws-palette-btn:focus-visible {
  outline: 2px solid var(--lkk-red, #cc0000);
  outline-offset: 2px;
}
.ws-palette-btn[aria-expanded="true"] {
  background: var(--surface-2, #f3f4f6);
  color: var(--lkk-red, #cc0000);
}

/* ── Overlay ─────────────────────────────────────────────────────────────
   Fixed + centred toward the top so the card sits near the composer rather
   than dead-centre; the user's eye is already at the bottom of the screen. */
.ws-palette {
  position: fixed;
  inset: 0;
  z-index: 1200;                 /* above the artifact pane, below toasts */
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px 92px;          /* clears the composer */
  background: rgba(17, 24, 39, .32);
  backdrop-filter: blur(2px);
  animation: ws-palette-fade .12s ease-out;
}
.ws-palette[hidden] { display: none; }

@keyframes ws-palette-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ws-palette-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Card ────────────────────────────────────────────────────────────── */
.ws-palette-card {
  width: 100%;
  max-width: 640px;
  max-height: min(60vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--surface-1, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, .22);
  overflow: hidden;
  animation: ws-palette-rise .14s ease-out;
}

.ws-palette-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.ws-palette-titles { min-width: 0; }
.ws-palette-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-1, #111827);
  letter-spacing: -.01em;
}
/* The floor line. Never hardcodes a floor name — the server supplies it. */
.ws-palette-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}
.ws-palette-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted, #6b7280);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.ws-palette-close:hover { background: var(--surface-2, #f3f4f6); color: var(--text-1, #111827); }
.ws-palette-close:focus-visible { outline: 2px solid var(--lkk-red, #cc0000); outline-offset: 1px; }

/* ── Search ──────────────────────────────────────────────────────────── */
.ws-palette-search {
  margin: 10px 12px 6px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text-1, #111827);
  background: var(--surface-2, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  outline: none;
}
.ws-palette-search:focus {
  border-color: var(--lkk-red, #cc0000);
  background: var(--surface-1, #fff);
}
.ws-palette-search::placeholder { color: var(--text-muted, #9ca3af); }

/* ── List ────────────────────────────────────────────────────────────── */
.ws-palette-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 8px 8px;
  overscroll-behavior: contain;    /* don't scroll the thread behind the card */
}
.ws-palette-group { margin-bottom: 6px; }
.ws-palette-group-label {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 8px 4px;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted, #6b7280);
  background: var(--surface-1, #fff);
}

.ws-palette-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 2px;
  text-align: left;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background .1s ease;
}
.ws-palette-item.active,
.ws-palette-item:hover { background: var(--surface-2, #f3f4f6); }
.ws-palette-item:focus-visible { outline: 2px solid var(--lkk-red, #cc0000); outline-offset: -2px; }

.ws-palette-item-main { display: flex; align-items: center; gap: 8px; }
.ws-palette-item-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1, #111827);
}
.ws-palette-badge {
  flex: 0 0 auto;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 999px;
  color: var(--lkk-red, #cc0000);
  background: rgba(204, 0, 0, .08);
}
.ws-palette-item-blurb {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted, #6b7280);
}
/* The example prompt — italic + quoted so it reads as "the thing you'd type",
   which is the whole teaching mechanism of the palette. */
.ws-palette-item-ex {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-style: italic;
  color: var(--text-2, #4b5563);
}
.ws-palette-item-ex::before { content: '\201C'; }
.ws-palette-item-ex::after  { content: '\201D'; }

/* ── Empty / error / footer ──────────────────────────────────────────── */
.ws-palette-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
}
.ws-palette-retry {
  display: inline-block;
  margin-left: 8px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--lkk-red, #cc0000);
  background: transparent;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  cursor: pointer;
}
.ws-palette-retry:hover { background: var(--surface-2, #f3f4f6); }

.ws-palette-foot {
  padding: 8px 16px;
  font-size: 11.5px;
  color: var(--text-muted, #9ca3af);
  border-top: 1px solid var(--border, #e5e7eb);
  background: var(--surface-2, #f9fafb);
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ws-palette { padding: 0 8px 76px; }
  .ws-palette-card { max-height: 70vh; border-radius: 12px; }
  .ws-palette-item-blurb { display: none; }   /* label + example only on small screens */
}

/* Motion-sensitive users: keep the surface, drop the movement. */
@media (prefers-reduced-motion: reduce) {
  .ws-palette,
  .ws-palette-card { animation: none; }
}
/* ==========================================================================
   37 — Workspace attachments UX  (2026-08-07)
   ==========================================================================
   Additive layer for the composer attachment strip. The BASE chip styles
   (.ws-attachment-chip, .ws-attachment-thumb, .ws-attachments, the drop
   overlay) already live in 33-workspace.css and are NOT redefined here —
   this file only adds the states that pass introduced:

     .is-reading        chip mid-FileReader, with a determinate bar + cancel
     .ws-attachment-bar progress track/fill
     .ws-attachment-meter   aggregate "N of 60 MB" indicator
     .ws-attachment-analyze one-click analyze_document prompt insert
     .ws-attachment-error   persistent rejection panel (errorState pattern)

   Loads AFTER 33 (numeric order in build-css.sh), so the few overlapping
   selectors win without !important.
   ========================================================================== */

/* The strip now holds two rows: chips (+ meter) and the rejection panel.
   33 styles .ws-attachments as a horizontal flex row of chips; wrapping the
   chips in their own flex row lets the error panel sit BELOW them full-width
   instead of being squeezed onto the chip line. */
.ws-attachments {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.ws-attachment-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* ── Reading state ──────────────────────────────────────────────────── */

.ws-attachment-chip.is-reading {
  /* A file being read is not yet a real attachment — mute it so the eye
     lands on what is actually ready to send. */
  opacity: 0.85;
  background: var(--eggshell-shade, #f4f1ea);
}

.ws-attachment-chip-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}

.ws-attachment-chip.is-reading .ws-attachment-chip-name {
  /* The base rule sizes for a single-line chip; inside the stacked body the
     name must still ellipsis rather than push the bar out of the chip. */
  max-width: 160px;
}

.ws-attachment-bar {
  display: block;
  width: 100%;
  min-width: 90px;
  height: 3px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.10);
  overflow: hidden;
}

.ws-attachment-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: var(--heritage-red, #cc0000);
  transition: width 120ms linear;
}

/* Providers that don't report lengthComputable leave the fill at 0. Show an
   indeterminate sweep so a stuck-looking 0% still reads as "working". */
.ws-attachment-bar[aria-valuenow="0"] .ws-attachment-bar-fill {
  width: 35%;
  animation: ws-att-indeterminate 1.1s ease-in-out infinite;
}

@keyframes ws-att-indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

/* ── Aggregate meter ────────────────────────────────────────────────── */

.ws-attachment-meter {
  font-size: 11.5px;
  color: var(--ink-mute, #6b6b6b);
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--eggshell-shade, #f4f1ea);
  white-space: nowrap;
  flex: 0 0 auto;
}

/* Approaching the server's 60 MB combined ceiling — warn BEFORE the wall. */
.ws-attachment-meter.is-tight {
  color: var(--heritage-red, #cc0000);
  background: rgba(204, 0, 0, 0.08);
  font-weight: 600;
}

/* ── Analyze with AI ────────────────────────────────────────────────── */

.ws-attachment-analyze {
  flex: 0 0 auto;
  border: 1px solid var(--rule-gold, #d4a843);
  background: transparent;
  color: var(--ink, #1a1a1a);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 7px;
  margin-left: 2px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.ws-attachment-analyze:hover {
  background: var(--rule-gold, #d4a843);
  color: #1a1a1a;
}

.ws-attachment-analyze:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--rule-gold, #d4a843);
}

/* ── Rejection panel (errorState pattern, inline) ───────────────────── */

.ws-attachment-error {
  border: 1px solid rgba(204, 0, 0, 0.28);
  background: rgba(204, 0, 0, 0.05);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}

.ws-attachment-error-head {
  display: flex;
  align-items: center;
  gap: 7px;
}

.ws-attachment-error-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--heritage-red, #cc0000);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.ws-attachment-error-title {
  margin: 0;
  flex: 1 1 auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--heritage-red, #cc0000);
}

.ws-attachment-error-dismiss {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--ink-mute, #6b6b6b);
  font-size: 15px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
}

.ws-attachment-error-dismiss:hover {
  background: rgba(204, 0, 0, 0.10);
  color: var(--heritage-red, #cc0000);
}

.ws-attachment-error-dismiss:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--rule-gold, #d4a843);
}

.ws-attachment-error-list {
  margin: 5px 0 0;
  padding-left: 24px;
  font-size: 12px;
  color: var(--ink, #1a1a1a);
}

.ws-attachment-error-list li { margin: 2px 0; }

/* The "what to do next" line — the reason this panel exists rather than a
   toast. Ops/Marketing users need the next step, not just the failure. */
.ws-attachment-error-next {
  margin: 6px 0 0 24px;
  font-size: 11.5px;
  color: var(--ink-mute, #6b6b6b);
}

/* ── Mobile ─────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  /* Apple HIG tap targets — the analyze/cancel controls sit inside a chip
     that is already tight on a phone. */
  .ws-attachment-analyze { padding: 6px 10px; font-size: 11.5px; }
  .ws-attachment-error-dismiss { padding: 6px 9px; }
  .ws-attachment-chip.is-reading .ws-attachment-chip-name { max-width: 120px; }
  .ws-attachment-meter { font-size: 11px; }
}

/* ── Reduced motion ─────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .ws-attachment-bar-fill { transition: none; }
  .ws-attachment-bar[aria-valuenow="0"] .ws-attachment-bar-fill {
    animation: none;
    width: 100%;
    opacity: 0.4;
  }
}
/* ============================================================
   38-creative-studio.css
   Creative Studio module — AI marketing creative mockups.
   Guided brief form + live prompt preview, generate loading,
   results gallery, 80/20 banner, detail modal, history grid.
   Brand accents: Heritage Red / Gold / Purple.
   Aligned to AIOP design system: radius/shadow tokens,
   640/480/380/720 breakpoints, card hover, 44px touch targets.
   ============================================================ */

/* ── Tabs ── */
.cs-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.cs-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: color 140ms ease, border-color 140ms ease;
}
.cs-tab.is-active {
  color: var(--heritage-red);
  border-bottom-color: var(--heritage-red);
}
.cs-tab:hover { color: var(--ink); }

/* ── Layout: form + results side by side ── */
.cs-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px;
  align-items: start;
}
.cs-form { padding: 22px; overflow: hidden; box-sizing: border-box; min-width: 0; }
.cs-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
  min-width: 0;
}
.cs-form-grid > * { min-width: 0; }
.cs-form-grid .form-input { max-width: 100%; min-width: 0; box-sizing: border-box; }
.cs-form .form-field { margin-bottom: 14px; }

/* Form section grouping — serif micro-heads chunk the brief */
.cs-form-section + .cs-form-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--rule-soft);
}
.cs-form-section-head {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--heritage-purple);
  margin: 0 0 12px;
}
/* Hero is the one required field — give it faint emphasis */
.cs-form .form-field.cs-hero-field .form-label { color: var(--heritage-red); }
.cs-form textarea[name="hero"] { min-height: 84px; }

/* ── Empty / meta helpers (extracted from inline styles) ── */
.cs-empty-state { padding: 48px 24px; text-align: center; }
.cs-empty-icon { font-size: 2.4rem; margin-bottom: 8px; }
.cs-empty-heading {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink-strong);
}
/* Actionable empty states — dashed CTA framing */
.cs-grid-empty { border: 2px dashed var(--rule); background: var(--paper); grid-column: 1 / -1; }
.cs-grid-empty .cs-grid-empty-cta { margin-top: 14px; }
.cs-empty-body {
  margin-top: 6px;
  font-size: 0.88rem;
  max-width: 340px;
  margin-inline: auto;
}
.cs-detail-created {
  font-size: 0.76rem;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}
.cs-meta-line {
  font-size: 0.76rem;
  text-align: center;
  margin-top: 10px;
}
.cs-history-card-meta { font-size: 0.74rem; }

/* ── Misc inline-style replacements ── */
.is-hidden { display: none !important; }
.cs-warn-body { margin-top: 4px; font-size: 0.86rem; }
.cs-step-optional { font-weight: 400; }
.cs-none-selected { font-size: 0.82rem; }
.cs-loading-body { font-size: 0.84rem; margin-bottom: 14px; }
.cs-loading-status {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-soft);
  margin: 2px 0 10px;
}
.cs-fill-h { height: 100%; }
.cs-shimmer-120 { height: 120px; }
.cs-shimmer-80 { height: 80px; }
.cs-error-heading { font-weight: 700; color: var(--heritage-red); }
.cs-error-heading::before { content: '⚠ '; }
.cs-error-state {
  border-left: 3px solid var(--danger);
  text-align: left;
}
.cs-retry-btn { margin-top: 14px; }
.cs-banner-detail { margin: 14px 0; }
.cs-detail-section { margin-top: 14px; }
.cs-detail-section-sm { margin-top: 10px; }
.cs-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.cs-picker-search { margin-bottom: 12px; }
.cs-picker-hint { font-size: 0.78rem; margin-top: 10px; }
.cs-picker-empty { padding: 24px; text-align: center; }
.cs-picker-sub { font-size: 0.72rem; }
.cs-shots-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink-strong);
}
.cs-shots-subtitle { font-size: 0.84rem; color: var(--ink-mute); }
.cs-grid-empty-icon { font-size: 1.8rem; }
.cs-upload-icon { font-size: 1.8rem; }
.cs-upload-heading { font-weight: 600; margin-top: 6px; }
.cs-upload-hint { font-size: 0.82rem; margin-top: 4px; }
.cs-hidden-input { display: none; }
.cs-shot-archive { margin-top: 6px; font-size: 0.74rem; }

/* ── Prompt preview (collapsible) ── */
.cs-preview {
  margin: 6px 0 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--paper);
}
.cs-preview > summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--heritage-purple);
}
.cs-preview-text {
  margin: 10px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
  font-family: var(--font-mono, ui-monospace, monospace);
  max-height: 220px;
  overflow: auto;
}

/* ── Form footer + 80/20 note ── */
.cs-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule-soft);
  padding-top: 14px;
  margin-top: 4px;
}
#cs-generate-btn {
  padding: 12px 24px;
  font-size: 1rem;
  min-height: 48px;
}
.cs-8020-note {
  font-size: 0.75rem;
  line-height: 1.4;
  max-width: 58%;
}
.cs-cap-note {
  font-size: 0.72rem;
  margin-top: 8px;
}
.cs-warn {
  padding: 14px 16px;
  margin-bottom: 16px;
  border-left: 3px solid var(--heritage-gold-dark);
  background: rgba(212, 168, 67, 0.1);
}

/* ── 80/20 banner ── */
.cs-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.84rem;
  line-height: 1.45;
  background: rgba(204, 0, 0, 0.05);
  border-left: 3px solid var(--heritage-red);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.cs-banner-pill {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: var(--heritage-red);
  color: var(--warm-white);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ── Gallery ── */
.cs-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.cs-card-skeleton {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule-soft);
  overflow: hidden;
  background: var(--paper);
}
.cs-loading-head {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  color: var(--ink-strong);
  margin-bottom: 4px;
}
.cs-loading { padding: 22px; }

.cs-result-card {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.cs-result-card:hover {
  border-color: var(--rule-gold);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.cs-img-wrap {
  position: relative;
  width: 100%;
  background: var(--paper);
}
.cs-img {
  display: block;
  width: 100%;
  height: auto;
  cursor: pointer;
}
.cs-img-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.cs-img-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.62);
  color: var(--warm-white);
  padding: 3px 7px;
  border-radius: var(--radius-sm);
}
.cs-card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* equal thirds, never wraps */
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--rule-soft);
}
.cs-card-actions .btn {
  min-height: 40px;
  padding: 8px 6px;
  font-size: 0.78rem;
  gap: 4px;
}

/* ── Detail modal ── */
.cs-detail-img-wrap {
  text-align: center;
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 8px;
  margin-bottom: 4px;
}
.cs-detail-img {
  max-width: 100%;
  max-height: 50vh;
  height: auto;
  border-radius: var(--radius);
}
.cs-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 18px;
}
.cs-detail-grid > div { display: flex; flex-direction: column; gap: 3px; }
.cs-detail-grid .uppercase-label { font-size: 0.66rem; }
.cs-detail-grid > div > div:last-child {
  font-size: 0.95rem;
  color: var(--ink-strong);
  font-weight: 500;
}

/* ── History grid ── */
.cs-history-grid { margin-top: 4px; }
.cs-history-thumb { aspect-ratio: 3 / 4; }
.cs-history-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}
.cs-history-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  font-size: 1.6rem;
  color: var(--ink-soft);
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.10), rgba(91, 44, 138, 0.06));
}
.cs-history-placeholder span {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.86rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
}
.cs-history-meta { padding: 10px 12px; }
.cs-history-hero {
  font-weight: 600;
  font-size: 0.86rem;
  margin-bottom: 4px;
  color: var(--ink-strong);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────
   Product Shot Integration — image-to-image (90/10)
   ───────────────────────────────────────────────────────── */

/* Products step in the create form */
.cs-products-step {
  border: 1px dashed var(--rule);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 4px;
  background: var(--paper);
}
.cs-products-step .form-label { margin-bottom: 8px; }
.cs-selected-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.cs-shot-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--heritage-red);
  color: var(--warm-white);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}
.cs-shot-chip em { font-style: normal; opacity: 0.8; font-weight: 400; }
.cs-shot-chip-x {
  background: rgba(255,255,255,0.25);
  border: none;
  color: var(--warm-white);
  border-radius: 50%;
  min-width: 24px;
  min-height: 24px;
  width: 24px;
  height: 24px;
  line-height: 1;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cs-shot-chip-x:hover { background: rgba(255,255,255,0.45); }
.cs-add-product { font-size: 0.84rem; }
.cs-exact-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.85rem;
  cursor: pointer;
}
.cs-9010-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 12px;
  border-left: 3px solid var(--heritage-gold-dark);
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(212,168,67,0.16), rgba(91,44,138,0.10));
  font-size: 0.82rem;
}
.cs-9010-pill, .cs-banner-pill.cs-9010 {
  background: var(--heritage-gold);
  color: var(--ink-strong);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

/* "Made with" provenance chips on results */
.cs-made-with {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 10px;
  font-size: 0.82rem;
  color: var(--ink-mute);
}
.cs-made-with-chip {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
  color: var(--ink-strong);
}

/* Picker + admin shot grid */
.cs-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
}
.cs-picker-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 10px;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  background: var(--warm-white);
  text-align: center;
}
.cs-picker-card:hover {
  border-color: var(--rule-gold);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.cs-picker-card.is-picked {
  border-color: var(--heritage-red);
  box-shadow: 0 0 0 2px rgba(204,0,0,0.25);
}
.cs-shot-admin-card { cursor: default; }
/* Demote the destructive archive control — reveal on hover, red on intent */
.cs-shot-archive {
  opacity: 0;
  transition: opacity 140ms ease, color 120ms ease;
  color: var(--ink-mute);
}
.cs-shot-admin-card:hover .cs-shot-archive,
.cs-shot-admin-card:focus-within .cs-shot-archive { opacity: 1; }
@media (hover: none) { .cs-shot-archive { opacity: 1; } }
.cs-shot-archive:hover { color: var(--heritage-red); }
.cs-picker-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 6px;
}
.cs-picker-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cs-picker-name {
  font-weight: 600;
  font-size: 0.82rem;
  line-height: 1.3;
  margin-bottom: 2px;
  color: var(--ink-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-picker-sub { line-height: 1.4; }

/* Shots tab header + filters */
.cs-shots-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
}
.cs-shots-head .btn { flex-shrink: 0; white-space: nowrap; }
.cs-shots-subtitle { margin-top: 4px; }
.cs-shots-filters {
  margin-bottom: 14px;
  position: relative;
}
.cs-shots-filters::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 1;
}
/* Wizard step-1 reuses .cs-shots-filters (#cs-w1-search) — same left pad as Product Library */
.cs-shots-filters > .form-input,
#cs-shots-search,
#cs-w1-search { padding-left: 34px; box-sizing: border-box; }

/* Upload modal */
.cs-upload-drop {
  border: 2px dashed var(--rule);
  border-radius: var(--radius-lg);
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(212, 168, 67, 0.03);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.cs-upload-drop:hover { border-color: var(--heritage-gold); background: rgba(212, 168, 67, 0.06); }
.cs-upload-drop.is-over {
  border-color: var(--heritage-gold);
  background: rgba(212, 168, 67, 0.10);
  transform: scale(1.005);
}
.cs-upload-drop:focus-within {
  outline: 2px solid var(--heritage-gold);
  outline-offset: 2px;
}
.cs-upload-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.cs-upload-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 10px;
}
.cs-upload-thumb {
  width: 64px; height: 64px;
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--rule);
}
.cs-upload-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.cs-upload-row-grid { display: grid; grid-template-columns: 1fr 130px; gap: 6px; }
.cs-up-variant { color: var(--ink-soft); }
.cs-upload-remove {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
}
.cs-upload-remove:hover { background: rgba(204,0,0,0.06); color: var(--heritage-red); }

/* ─────────────────────────────────────────────────────────
   Responsive — AIOP breakpoints: 720 (tablet), 640 (mobile),
   480 (tight), 380 (ultra-small).
   ───────────────────────────────────────────────────────── */

/* Tablet — stack form/results, 2-col detail grid */
@media (max-width: 720px) {
  .cs-layout { grid-template-columns: 1fr; }
  .cs-detail-grid { grid-template-columns: 1fr 1fr; }
  .cs-8020-note { max-width: 100%; }
}

/* Primary mobile — gallery to 2 columns, shots head stacks */
@media (max-width: 640px) {
  .cs-gallery { grid-template-columns: repeat(2, 1fr); }
  .cs-form-grid { grid-template-columns: 1fr; }
  .cs-shots-head { flex-direction: column; align-items: stretch; }
  .cs-9010-banner { flex-wrap: wrap; }
  .cs-upload-row-grid { grid-template-columns: 1fr; }
}

/* Tight mobile — single-column gallery, stack footer, tighten padding */
@media (max-width: 480px) {
  .cs-form { padding: 14px; }
  .cs-gallery { grid-template-columns: 1fr; }
  .cs-form-footer { flex-direction: column; align-items: stretch; }
  .cs-form-footer .btn { width: 100%; }
  .cs-8020-note { margin-bottom: 8px; }
  .cs-detail-grid { grid-template-columns: 1fr; }
  .cs-banner { flex-wrap: wrap; }
  .cs-picker-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* Ultra-small phones — scrollable tabs, tighter tab padding */
@media (max-width: 380px) {
  .cs-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .cs-tab { padding: 8px 10px; font-size: 0.85rem; }
}

/* ── #28 Staggered gallery fade-in (uses canonical fadeIn keyframe) ── */
.cs-gallery > .cs-result-card { animation: fadeIn 280ms ease both; }
.cs-gallery > .cs-result-card:nth-child(2) { animation-delay: 60ms; }
.cs-gallery > .cs-result-card:nth-child(3) { animation-delay: 120ms; }
.cs-gallery > .cs-result-card:nth-child(4) { animation-delay: 180ms; }
@media (prefers-reduced-motion: reduce) {
  .cs-gallery > .cs-result-card { animation: none; }
}

/* ── #1 Collapse result-card action labels to icons on small cards ── */
@media (max-width: 640px) {
  .cs-card-actions .btn .cs-btn-label { display: none; }
  .cs-card-actions .btn { font-size: 0.95rem; }
}

/* ════════════════════════════════════════════════════════
   UX WIZARD REDESIGN (2026-07-20) — guided 4-step flow,
   generation theater, results, My Creations, templates.
   Eggshell surfaces · Heritage Red actives · gold checks.
   ════════════════════════════════════════════════════════ */

/* ── Wizard layout: vertical step rail + step body ── */
.cs-wizard {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 18px;
  align-items: start;
}
.cs-step-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 12px;
}
.cs-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  padding: 10px 12px;
  min-height: 44px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
.cs-step-item:disabled { opacity: 0.45; cursor: not-allowed; }
.cs-step-item:not(:disabled):hover { color: var(--ink); background: rgba(212, 168, 67, 0.06); }
.cs-step-item.is-active {
  color: var(--heritage-red);
  border-left-color: var(--heritage-red);
  background: rgba(204, 0, 0, 0.04);
}
.cs-step-item.is-active .cs-step-label {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.98rem;
}
.cs-step-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid var(--rule);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--warm-white);
  color: var(--ink-soft);
}
.cs-step-item.is-active .cs-step-dot {
  border-color: var(--heritage-red);
  background: var(--heritage-red);
  color: var(--warm-white);
}
.cs-step-item.is-done .cs-step-dot {
  border-color: var(--heritage-gold-dark);
  background: var(--heritage-gold);
  color: var(--ink-strong);
}

.cs-step-card { padding: 22px; }
.cs-step-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--ink-strong);
}
.cs-step-sub { font-size: 0.88rem; margin: 4px 0 16px; max-width: 560px; }
.cs-step-search { margin-bottom: 12px; }

/* Wizard nav (back / next) */
.cs-wiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--rule-soft);
  padding-top: 14px;
  margin-top: 18px;
}
.cs-wiz-nav .btn { min-height: 44px; }
.cs-create-btn { padding: 12px 26px; font-size: 1rem; min-height: 48px; }

/* ── Step 1: inline product grid ── */
.cs-w1-grid { max-height: 46vh; }
.cs-pick-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--heritage-red);
  color: var(--warm-white);
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.cs-picker-thumb { position: relative; }
.cs-picker-card.is-picked .cs-picker-thumb {
  outline: 2px solid var(--heritage-gold);
  outline-offset: 1px;
}
.cs-w1-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 0.85rem;
}
.cs-w1-footer .cs-exact-toggle { margin-top: 0; }

/* Feedback #88: truncation must be visible. The picker used to fetch a flat
   first-100 of a 174-product library, so products late in the alphabet were
   silently absent and users filed requests for products we already own. */
.cs-w1-grid-status {
  margin-top: 10px;
  font-size: 0.8rem;
  line-height: 1.4;
}
.cs-w1-grid-more {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.cs-w1-grid-more .cs-w1-more-btn { font-size: 0.85rem; }
.cs-campaign-link {
  display: inline-block;
  background: none;
  border: none;
  padding: 10px 0 0;
  color: var(--heritage-purple);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cs-campaign-link:hover { color: var(--heritage-red); }
.cs-campaign-note {
  border: 1px dashed var(--rule);
  border-left: 3px solid var(--heritage-purple);
  border-radius: var(--radius);
  background: rgba(91, 44, 138, 0.05);
  padding: 14px 16px;
  font-size: 0.88rem;
  margin-bottom: 8px;
}
.cs-campaign-note .btn { margin-top: 10px; display: inline-flex; }

/* ── Step 2: format cards + channel chips + output options ── */
.cs-format-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.cs-format-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  min-height: 104px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--warm-white);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.cs-format-card:hover {
  border-color: var(--rule-gold);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.cs-format-card.is-selected {
  border: 2px solid var(--heritage-red);
  background: rgba(204, 0, 0, 0.03);
  padding: 13px; /* compensate the 2px border */
}
.cs-format-icon { font-size: 1.5rem; }
.cs-format-name { font-weight: 700; font-size: 0.92rem; color: var(--ink-strong); }
.cs-format-desc { font-size: 0.76rem; line-height: 1.35; }
.cs-format-tick {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--heritage-gold);
  color: var(--ink-strong);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Chips (channels / starters / templates / filters) */
.cs-chip-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ink-mute);
  margin-right: 4px;
}
.cs-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--rule);
  background: var(--warm-white);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 36px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.cs-chip:hover { border-color: var(--rule-gold); color: var(--ink); }
.cs-chip.is-selected {
  border-color: var(--heritage-red);
  background: rgba(204, 0, 0, 0.06);
  color: var(--heritage-red);
}
.cs-channel-row, .cs-starter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

/* EGG · "Bottle Me" (hidden until unlocked). Understated on purpose: a
   secondary pill + one muted helper line, never a billboard. */
.cs-egg-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 2px 0 14px;
}
.cs-egg-toggle.is-active {
  border-color: var(--heritage-red);
  background: rgba(204, 0, 0, 0.06);
  color: var(--heritage-red);
}
.cs-egg-help {
  font-size: 0.78rem;
  flex: 1 1 260px;
  min-width: 0;
}
.cs-egg-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  border: 1px solid var(--rule-gold);
  border-radius: 999px;
  padding: 1px 8px;
  margin: 2px 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--warm-white);
  white-space: nowrap;
}

.cs-output-options {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 10px 14px;
  margin-bottom: 4px;
}
.cs-output-options > summary {
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--heritage-purple);
}
.cs-output-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.cs-quality-note { font-size: 0.76rem; margin-top: 6px; }
.cs-cost-line { font-size: 0.8rem; margin-top: 8px; font-weight: 600; }

/* ── Step 3: story ── */
.cs-char-count { font-size: 0.72rem; text-align: right; margin-top: 3px; }
.cs-field-hint { font-size: 0.74rem; margin-top: 3px; }
.cs-more-options {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 10px 14px;
  margin: 6px 0 14px;
}
.cs-more-options > summary {
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--heritage-purple);
}
.cs-more-options .form-field { margin-top: 12px; }
.cs-template-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 36px;
}
.cs-template-chip { padding-right: 8px; }
.cs-template-x {
  background: none;
  border: none;
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 0.68rem;
  padding: 2px 4px;
  border-radius: 50%;
  min-width: 20px;
  min-height: 20px;
}
.cs-template-x:hover { color: var(--heritage-red); background: rgba(204,0,0,0.08); }
.cs-template-empty { font-size: 0.8rem; }
.cs-template-save { font-size: 0.8rem; }

/* ── Step 4: review ── */
.cs-review-summary {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper);
  padding: 6px 16px;
  margin-bottom: 16px;
}
.cs-review-row {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
}
.cs-review-row + .cs-review-row { border-top: 1px solid var(--rule-soft); }
.cs-review-value { font-size: 0.9rem; color: var(--ink-strong); min-width: 0; }
.cs-review-hero {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cs-review-edit { font-size: 0.76rem; padding: 6px 10px; min-height: 36px; }
.cs-review-thumbs { display: inline-flex; gap: 4px; margin-right: 8px; vertical-align: middle; }
.cs-review-thumb {
  display: inline-flex;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--warm-white);
}
.cs-review-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cs-cost-est { color: var(--ink-soft); font-weight: 600; }

/* ── Generation theater ── */
.cs-theater {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 24px;
  padding: 28px;
  align-items: center;
}
.cs-theater-left { text-align: center; }
.cs-theater-mark {
  font-size: 2.6rem;
  margin-bottom: 10px;
  animation: csSteam 2.4s ease-in-out infinite;
}
.cs-theater-thumbs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.cs-theater-thumbs .cs-review-thumb {
  width: 64px; height: 64px;
  animation: csSteam 2.4s ease-in-out infinite;
}
@keyframes csSteam {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-4px); opacity: 0.88; }
}
.cs-theater-expect { font-size: 0.8rem; margin-top: 4px; }
.cs-theater-stages { display: flex; flex-direction: column; gap: 14px; }
.cs-stage {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  color: var(--ink-mute);
}
.cs-stage .cs-stage-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--rule);
  background: var(--warm-white);
  flex-shrink: 0;
  transition: border-color 200ms ease, background 200ms ease;
}
.cs-stage.is-active { color: var(--ink-strong); font-weight: 600; }
.cs-stage.is-active .cs-stage-dot {
  border-color: var(--heritage-red);
  background: rgba(204, 0, 0, 0.15);
  animation: csPulse 1.4s ease-in-out infinite;
}
.cs-stage.is-done { color: var(--ink-soft); }
.cs-stage.is-done .cs-stage-dot {
  border-color: var(--heritage-gold-dark);
  background: var(--heritage-gold);
}
@keyframes csPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(204, 0, 0, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(204, 0, 0, 0.06); }
}
@media (prefers-reduced-motion: reduce) {
  .cs-theater-mark, .cs-theater-thumbs .cs-review-thumb, .cs-stage.is-active .cs-stage-dot { animation: none; }
}
.cs-theater-timer {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--ink-mute);
  margin-left: 4px;
}
.cs-theater-cancel { align-self: flex-start; margin-top: 8px; }

/* ── Results ── */
.cs-results-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.cs-results-gallery .cs-hero-card { grid-column: span 2; }
.cs-partial-warn {
  padding: 12px 16px;
  margin-bottom: 14px;
  border-left: 3px solid var(--heritage-gold-dark);
  background: rgba(212, 168, 67, 0.12);
  font-size: 0.86rem;
}
/* #118: PNG+JPEG adds a 4th control; was still 3-col → orphan wrap */
.cs-card-actions-4 { grid-template-columns: repeat(4, 1fr); }
.cs-star {
  position: absolute;
  top: 8px; right: 8px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.88);
  color: var(--heritage-gold-dark);
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  transition: transform 120ms ease, background 120ms ease;
}
.cs-star:hover { transform: scale(1.1); background: var(--warm-white); }
.cs-star.is-fav { color: var(--heritage-gold-dark); }

/* ── Creations delete: destructive thumb overlay, mirrors .cs-star geometry so
   the 4-col .cs-card-actions grid does not have to grow to 5 on mobile. Sits
   BELOW the star (top offset 8 + 34 + 6) on the same right rail. ── */
.cs-trash {
  position: absolute;
  top: 48px; right: 8px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-mute, #6b6b6b);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}
.cs-trash:hover {
  transform: scale(1.1);
  background: var(--warm-white);
  color: var(--danger, #c0392b);
}
.cs-trash:disabled { opacity: 0.5; cursor: progress; transform: none; }

/* Destructive tint for the detail-modal delete button. Ghost base keeps it
   visually subordinate to Download (primary) — destructive but not shouty. */
.cs-btn-danger { color: var(--danger, #c0392b); }
.cs-btn-danger:hover:not(:disabled) {
  color: var(--danger, #c0392b);
  border-color: var(--danger, #c0392b);
  background: rgba(192, 57, 43, 0.06);
}
.cs-more-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cs-more-menu .btn { justify-content: flex-start; min-height: 44px; }

/* ── My Creations filters ── */
.cs-creations-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px 140px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.cs-fav-filter { justify-self: start; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .cs-theater { grid-template-columns: 1fr; text-align: center; }
  .cs-theater-stages { align-items: center; }
  .cs-theater-cancel { align-self: center; }
}
@media (max-width: 720px) {
  .cs-wizard { grid-template-columns: 1fr; }
  .cs-step-rail {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 6px;
  }
  .cs-step-item {
    border-left: none;
    border-bottom: 3px solid transparent;
    border-radius: var(--radius) var(--radius) 0 0;
    flex-shrink: 0;
    padding: 8px 10px;
  }
  .cs-step-item.is-active { border-bottom-color: var(--heritage-red); }
  .cs-output-grid { grid-template-columns: 1fr; }
  .cs-creations-filters { grid-template-columns: 1fr 1fr; }
  .cs-creations-search { grid-column: 1 / -1; }
  .cs-review-row { grid-template-columns: 84px 1fr; }
  .cs-review-row .cs-review-edit { grid-column: 2; justify-self: start; }
}
@media (max-width: 480px) {
  .cs-step-card { padding: 14px; }
  .cs-results-gallery .cs-hero-card { grid-column: auto; }
  .cs-format-cards { grid-template-columns: 1fr 1fr; }
  .cs-wiz-nav { flex-wrap: wrap; }
  .cs-wiz-nav .btn { flex: 1; }
}

/* ════════════════════════════════════════════════════════
   POLISH 2026-07-20 — mobile + desktop
   P1–P12 per POLISH-BRIEF. CSS-only. Eggshell / Heritage
   Red / gold; hover lifts gated to fine pointers.
   ════════════════════════════════════════════════════════ */

/* ── P3: hover lifts only on fine pointers (kill sticky-hover on touch) ── */
@media (hover: none), (pointer: coarse) {
  .cs-result-card:hover,
  .cs-format-card:hover,
  .cs-picker-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: var(--rule);
  }
  .cs-star:hover { transform: none; }
  .cs-trash:hover { transform: none; color: var(--text-mute, #6b6b6b); }
  .cs-upload-drop.is-over { transform: none; }
}
/* Desktop keyboard parity: focus-within = hover treatment (P12) */
@media (hover: hover) and (pointer: fine) {
  .cs-result-card:focus-within,
  .cs-picker-card:focus-within,
  .cs-format-card:focus-within {
    border-color: var(--rule-gold);
    box-shadow: var(--shadow-sm);
  }
}

/* ── P6: visible focus rings on CS interactive controls ── */
.cs-step-item:focus-visible,
.cs-format-card:focus-visible,
.cs-chip:focus-visible,
.cs-tab:focus-visible,
.cs-picker-card:focus-visible,
.cs-star:focus-visible,
.cs-trash:focus-visible,
.cs-shot-chip-x:focus-visible,
.cs-template-x:focus-visible,
.cs-campaign-link:focus-visible,
.cs-review-edit:focus-visible,
.cs-card-actions .btn:focus-visible {
  outline: 2px solid var(--heritage-gold-dark);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.cs-step-item:focus-visible,
.cs-format-card:focus-visible,
.cs-picker-card:focus-visible { border-radius: var(--radius); }
.cs-chip:focus-visible,
.cs-star:focus-visible,
.cs-trash:focus-visible,
.cs-shot-chip-x:focus-visible { border-radius: 999px; }

/* ── P2: ≥40px touch targets on coarse pointers ── */
@media (pointer: coarse) {
  .cs-chip { min-height: 42px; padding: 10px 16px; }
  .cs-star { width: 40px; height: 40px; }
  .cs-trash { width: 40px; height: 40px; top: 54px; }
  .cs-card-actions .btn { min-height: 44px; }
  .cs-review-edit { min-height: 40px; padding: 8px 12px; }
  .cs-tab { padding: 12px 16px; }
  /* Enlarge hit areas without visual bloat (pseudo-element halo) */
  .cs-shot-chip-x, .cs-template-x { position: relative; }
  .cs-shot-chip-x::after,
  .cs-template-x::after {
    content: '';
    position: absolute;
    inset: -9px;
  }
}

/* ── P5 + item 17/20: desktop — content cap, rail under header, 4-up formats ── */
@media (min-width: 1100px) {
  .cs-step-body { max-width: 760px; }
  /* Review + theater breathe wider */
  .cs-step-body:has(.cs-review-summary) { max-width: 900px; }
  .cs-theater { max-width: 900px; }
  .cs-format-cards { grid-template-columns: repeat(4, minmax(160px, 1fr)); }
  .cs-partial-warn, .cs-banner { max-width: 900px; }
}
.cs-step-rail { top: calc(var(--header-h, 72px) + 8px); }
/* Desktop results: comfortable min card width */
@media (min-width: 1024px) {
  .cs-results-gallery { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* ── P9: tabs overflow-x from 640 (was 380) ── */
@media (max-width: 640px) {
  .cs-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .cs-tabs::-webkit-scrollbar { display: none; }
  .cs-tab { flex-shrink: 0; }
}

/* ── P10: 16px input floor on small screens (prevent iOS zoom) ── */
@media (max-width: 720px) {
  .cs-step-card .form-input,
  .cs-step-card textarea,
  .cs-step-card select,
  .cs-form .form-input,
  .cs-form textarea,
  .cs-creations-filters .form-input,
  .cs-creations-filters select,
  .cs-picker-search .form-input,
  #cs-shots-search,
  #cs-w1-search {
    font-size: 16px;
  }
}

/* ── P1 + P4 + item 10: mobile wizard — sticky footer, rail snap, picker height ── */
@media (max-width: 720px) {
  /* P4: step rail horizontal scroll-snap */
  .cs-step-rail {
    top: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .cs-step-rail::-webkit-scrollbar { display: none; }
  .cs-step-item { scroll-snap-align: center; }

  /* P1: sticky Next/Create bar with safe-area — spans card width */
  .cs-step-card .cs-wiz-nav {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: var(--warm-white);
    margin: 18px -22px -22px;
    padding: 12px 22px max(12px, env(safe-area-inset-bottom, 12px));
    border-top: 1px solid var(--rule-soft);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: 0 -4px 12px rgba(60, 42, 12, 0.05);
  }

  /* Item 10: picker grid keeps usable height above sticky nav */
  .cs-w1-grid { max-height: min(52vh, 420px); }

  /* Item 19/7: creations filters 2×2 through tablet */
  .cs-creations-filters { grid-template-columns: 1fr 1fr; }
  .cs-creations-search { grid-column: 1 / -1; }
}
/* Between 720–900: avoid awkward 4-col filter wrap */
@media (min-width: 721px) and (max-width: 900px) {
  .cs-creations-filters { grid-template-columns: minmax(160px, 1fr) 1fr 1fr auto; }
}

/* ── P7: theater / review / filters responsive cleanup ── */
@media (max-width: 480px) {
  .cs-theater { padding: 16px 14px; gap: 16px; }
  .cs-theater-stages { align-items: stretch; }
  .cs-stage { justify-content: flex-start; text-align: left; }
  .cs-theater-cancel { align-self: center; }

  /* Item 11: review rows stack cleanly */
  .cs-review-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 0;
  }
  .cs-review-row .cs-review-edit {
    grid-column: 1;
    justify-self: start;
    margin-top: 2px;
  }

  /* Filters single column, full-width selects */
  .cs-creations-filters { grid-template-columns: 1fr; }
  .cs-creations-filters select,
  .cs-creations-filters .form-input { width: 100%; }
  .cs-fav-filter { justify-self: stretch; }

  /* Sticky nav margins track the 14px card padding at ≤480 */
  .cs-step-card .cs-wiz-nav {
    margin: 18px -14px -14px;
    padding: 12px 14px max(12px, env(safe-area-inset-bottom, 12px));
  }

  /* P8: card actions stay tappable when labels collapse to icons */
  .cs-card-actions .btn { min-height: 44px; }
}

/* ── P4/item 14: ultra-small + short landscape — number-only rail ── */
@media (max-width: 380px) {
  .cs-step-item { padding: 8px; min-width: 44px; justify-content: center; }
  .cs-step-item .cs-step-label { display: none; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .cs-step-item .cs-step-label { display: none; }
  .cs-step-item { min-width: 44px; justify-content: center; }
  .cs-step-card .cs-wiz-nav { position: static; margin: 18px 0 0; padding: 14px 0 0; box-shadow: none; }
}

/* ── Item 22: readable empty/warn states on ultrawide ── */
.cs-partial-warn { max-width: 760px; }
.cs-empty-state { max-width: 640px; margin-inline: auto; }

/* ── Item 20: tighten vertical rhythm between chip rows ── */
.cs-channel-row + .cs-channel-row,
.cs-starter-row + .cs-starter-row { margin-top: -4px; }

/* ── P11: extend reduced-motion coverage to polish/transition effects ── */
@media (prefers-reduced-motion: reduce) {
  .cs-result-card,
  .cs-format-card,
  .cs-picker-card,
  .cs-star,
  .cs-trash,
  .cs-upload-drop,
  .cs-chip,
  .cs-step-item,
  .cs-tab {
    transition: none;
    animation: none;
  }
  .cs-result-card:hover,
  .cs-format-card:hover,
  .cs-picker-card:hover { transform: none; }
  .cs-upload-drop.is-over { transform: none; }
}

/* ════════════════════════════════════════════════════════
   CARD BUTTON CONTAINMENT (2026-07-20) — library CTA +
   creation/result action rows must never clip mid-word.
   ════════════════════════════════════════════════════════ */

/* ── F1: Product Library grid — wider floor so the full CTA fits.
   Scoped to #cs-shots-grid; wizard step-1 picker (#cs-w1-grid)
   has no CTA button and stays dense. ── */
#cs-shots-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
@media (max-width: 480px) {
  #cs-shots-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
}

/* F1: library card + CTA fully contained — wrap, never clip */
.cs-picker-card { overflow: hidden; }
.cs-use-shot,
.cs-download-shot,
.cs-shot-archive {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  white-space: normal;   /* override .btn nowrap */
  line-height: 1.25;
  text-align: center;
  padding: 8px 6px;
  font-size: 0.8rem;
  gap: 5px;
}
.cs-use-shot,
.cs-download-shot { margin-top: 8px; }

/* ── F2: result/creation action rows — contain, collapse by CARD width ── */
.cs-result-card {
  container-type: inline-size;
  container-name: cs-card;
}
.cs-card-actions { min-width: 0; }
.cs-card-actions .btn {
  min-width: 0;
  width: 100%;
  overflow: hidden;
}
.cs-card-actions .btn .cs-btn-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;   /* non-CQ fallback: never a hard mid-word clip */
  white-space: nowrap;
}
/* Icon-only when the card itself is narrow (not just the viewport).
   300px ≈ where 3 labeled buttons ("Variation") fit at 0.78rem. */
@container cs-card (max-width: 300px) {
  .cs-card-actions .btn .cs-btn-label { display: none; }
  .cs-card-actions .btn { font-size: 0.95rem; min-height: 44px; }
}

/* ── F3: wizard nav buttons never clip when flexed full-width ≤480 ── */
@media (max-width: 480px) {
  .cs-wiz-nav .btn { min-width: 0; white-space: normal; line-height: 1.2; }
}

/* ════════════════════════════════════════════════════════
   B12–B15 PILOT POLISH (2026-07-20) — edit modal, usage
   note, per-card feedback strip, 4-button action row.
   ════════════════════════════════════════════════════════ */

/* B12+#118: edit path = PNG+JPEG+Edit+Var+More (5) */
.cs-card-actions-edit { grid-template-columns: repeat(5, 1fr); }
@container cs-card (max-width: 360px) {
  .cs-card-actions-edit .btn .cs-btn-label { display: none; }
  .cs-card-actions-edit .btn { font-size: 0.95rem; min-height: 44px; }
}
@container cs-card (max-width: 420px) {
  .cs-card-actions-4 .btn .cs-btn-label { display: none; }
  .cs-card-actions-4 .btn { font-size: 0.95rem; min-height: 44px; }
}

/* B12: keep-fidelity toggle inside the edit modal */
.cs-edit-fidelity { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; }

/* #109: positional coaching copy in the edit modal. There is no mask brush —
   the whole image is re-rendered from the instruction — so the modal teaches
   users to name the region in words. Compact + muted: guidance, not a banner. */
.cs-edit-hint {
  font-size: 0.76rem;
  line-height: 1.45;
  margin: 6px 0 0;
  opacity: 0.85;
}

/* B14: royalty / usage honesty note — compact, muted, never shouty */
.cs-usage-note {
  font-size: 0.76rem;
  line-height: 1.4;
  margin: 8px 0 4px;
  opacity: 0.85;
}

/* B15: per-card feedback strip — quiet inline row under the actions */
.cs-card-feedback { margin-top: 2px; }
.cs-card-feedback .feedback-module-strip {
  margin: 0;
  padding: 5px 10px;
  font-size: 0.74rem;
  border-radius: 8px;
}
.cs-card-feedback .feedback-module-strip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── S5: Brand Library (DAM) references in wizard Step 1 ─────────────── */
.cs-dam-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 2px 0 8px;
}
/* Entry affordance — bordered ghost pill matching cs-chip craft, library SVG */
.cs-dam-browse {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--rule);
  background: var(--warm-white);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.cs-dam-browse svg { flex: 0 0 auto; }
.cs-dam-browse:hover:not(:disabled) {
  border-color: var(--rule-gold);
  background: var(--paper);
  color: var(--ink);
}
.cs-dam-browse:disabled { opacity: 0.5; cursor: not-allowed; }
.cs-dam-hint { font-size: 0.78rem; flex: 1 1 220px; min-width: 0; }
/* Calm degraded-state note (disabled / unmapped) — gold hairline, not scary */
.cs-dam-note {
  margin: 0 0 10px;
  padding: 8px 12px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-mute);
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-left: 2px solid var(--rule-gold);
  border-radius: 8px;
}
.cs-dam-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.cs-dam-chips.is-empty { display: none; }
/* Selected reference chip — proxy thumb + name + honest badge + remove */
.cs-dam-chip {
  gap: 7px;
  max-width: 100%;
  padding: 4px 9px 4px 4px;
  min-height: 34px;
  cursor: default;
}
.cs-dam-chip:hover { border-color: var(--rule); color: var(--ink-soft); }
.cs-dam-chip-thumb {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  overflow: hidden;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--eggshell-shade);
  color: var(--ink-mute);
}
.cs-dam-chip-thumb-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  /* contain on the eggshell stage — never cover-crop brand assets */
  object-fit: contain;
  display: block;
  padding: 2px;
}
.cs-dam-chip-thumb-fallback { display: inline-flex; line-height: 0; }
.cs-dam-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.cs-dam-chip-badge {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(212, 168, 67, 0.14);
  border: 1px solid var(--rule-gold);
  color: var(--ink-mute);
}
/* ── "My reference" (feedback #86) ──
   Reuses the Brand Library chip/row layout wholesale; only the provenance
   badge is re-tinted so a user's OWN upload never reads as an approved,
   gold-hairlined LKK Brand Library asset. Neutral ink, not gold. */
.cs-myref-row { margin-top: 4px; }
.cs-myref-chip .cs-dam-chip-badge {
  background: rgba(120, 120, 128, 0.12);
  border: 1px solid var(--rule);
  color: var(--ink-mute);
}
/* #173 — the chip is a RENDERED PDF PAGE, not a photograph. A rasterized page
   looks like any other image in a 40px thumb, so the distinction has to be
   stated, not implied. Deliberately NOT gold: like the "Mine" badge, a user's
   own PDF must never read as an approved Brand Library asset. */
.cs-myref-chip .cs-myref-chip-pdf {
  background: rgba(204, 0, 0, 0.08);
  border: 1px solid rgba(204, 0, 0, 0.28);
  color: var(--ink-mute);
}
.cs-dam-chip-x {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--ink-mute);
  line-height: 0;
  padding: 4px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 120ms ease, background 120ms ease;
}
.cs-dam-chip-x:hover { color: var(--heritage-red); background: rgba(204, 0, 0, 0.07); }
/* Honest provenance on results / detail — gold hairline + type hierarchy */
.cs-dam-provenance {
  display: flex;
  align-items: baseline;
  gap: 10px;
  border-left: 2px solid var(--rule-gold);
  padding: 2px 0 2px 12px;
  margin: 6px 0 10px;
  font-size: 0.8rem;
}
.cs-dam-provenance-label {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-mute);
}
.cs-dam-provenance-body { color: var(--ink-mute); min-width: 0; }
.cs-dam-provenance-body em { color: var(--ink-soft); }
.cs-review-dam { font-size: 0.85em; }
/* Deep-link prefill loading card */
.cs-step-loading {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cs-step-loading .loading-shimmer { width: 100%; max-width: 420px; }

@media (max-width: 480px) {
  .cs-dam-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .cs-dam-browse { justify-content: center; width: 100%; }
  .cs-dam-hint { flex: 1 1 auto; }
  .cs-dam-chip { padding: 4px 9px 4px 4px; min-height: 34px; }
  .cs-dam-chip-name { max-width: 140px; }
}

/* ── #91a Market / on-image text (Format step + Review) ──
   Chips reuse .cs-chip; only the block wrapper, the on-image text field and the
   honesty badge are new. Rows mirror .cs-channel-row so the market chips sit
   visually with the channel/aspect controls they belong beside. */
.cs-market-block {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.cs-market-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.cs-market-row:last-of-type { margin-bottom: 0; }
.cs-market-block .cs-field-hint { margin: 0 0 10px; }
.cs-ontext-field { margin: 10px 0 4px; }
.cs-ontext-field .form-input { max-width: 420px; }

/* Honesty badge — amber (advisory) by default, red when the operator opted into
   AI-rendered on-image text, because that is the path a human MUST verify. */
.cs-honesty {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 9px 12px;
  font-size: 0.8rem;
  line-height: 1.45;
  border-left: 3px solid var(--heritage-gold-dark);
  background: rgba(212, 168, 67, 0.1);
  border-radius: var(--radius-sm);
}
.cs-honesty.is-warn {
  border-left-color: var(--heritage-red);
  background: rgba(204, 0, 0, 0.06);
}
.cs-honesty-pill {
  flex-shrink: 0;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: var(--heritage-gold-dark);
  color: var(--warm-white);
  padding: 3px 9px;
  border-radius: 999px;
}
.cs-honesty.is-warn .cs-honesty-pill { background: var(--heritage-red); }
.cs-review-ontext { font-weight: 600; }

@media (max-width: 480px) {
  .cs-market-block { padding: 10px 11px; }
  .cs-honesty { flex-wrap: wrap; }
  .cs-ontext-field .form-input { max-width: 100%; }
}

/* ── #114: "Start from my image" discovery cards (wizard Step 1 top) ────
   The My-reference upload already existed but read as a secondary row below
   the product grid, so pilot users believed the studio was catalog-only.
   These two labelled cards make both starting points visible up front. */
.cs-start-choices { margin: 2px 0 14px; }
.cs-start-choices-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.cs-start-choices-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cs-start-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--warm-white);
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.cs-start-card:hover { border-color: var(--heritage-red); background: var(--paper); }
.cs-start-card-icon { font-size: 1.1rem; line-height: 1.3; flex-shrink: 0; }
.cs-start-card-copy { display: flex; flex-direction: column; gap: 2px; }
.cs-start-card-title { font-weight: 600; }
.cs-start-card-sub { font-size: 0.8rem; color: var(--text-mute); }
/* Landing flash on the upload row the start card routes to. */
.cs-myref-row.is-highlight {
  outline: 2px solid var(--heritage-red);
  outline-offset: 4px;
  border-radius: var(--radius);
}

/* ── #118: route back into the wizard from the My Creations gallery ───── */
.cs-creations-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cs-creations-bar-hint { font-size: 0.85rem; }

@media (max-width: 720px) {
  .cs-start-choices-row { grid-template-columns: 1fr; }
  .cs-creations-bar { flex-direction: column; align-items: stretch; }
  .cs-creations-bar .cs-creations-new { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cs-start-card { transition: none; }
}

/* ── #109 Region mask editor (brush + circle → alpha PNG) ───────────── */
.cs-mask-block {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--border, #e2ded7);
  border-radius: 8px;
  background: var(--surface-2, #faf8f5);
}
.cs-mask-toggle { margin-bottom: 4px; }
.cs-mask-host { margin-top: 10px; }
.cs-mask-editor { display: flex; flex-direction: column; gap: 8px; }
.cs-mask-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.cs-mask-tools, .cs-mask-actions { display: flex; gap: 6px; }
.cs-mask-toolbar .btn { padding: 4px 10px; font-size: 0.85rem; }
.cs-mask-tool.is-active {
  background: var(--lkk-red, #cc0000);
  color: #fff;
  border-color: var(--lkk-red, #cc0000);
}
.cs-mask-size {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-mute, #6b6560);
}
.cs-mask-size-input { width: 120px; max-width: 40vw; }
/* The stage is the coordinate reference: the canvas overlays the image exactly,
   both scaled to the same CSS box. Stroke coords are converted to natural px on
   export, so any display scale here is safe. */
.cs-mask-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #f0ece6;
}
.cs-mask-img { display: block; max-width: 100%; height: auto; user-select: none; }
.cs-mask-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;   /* let us own drag gestures on touch devices */
}
.cs-mask-hint { font-size: 0.8rem; }
@media (max-width: 640px) {
  .cs-mask-toolbar { gap: 6px; }
  .cs-mask-toolbar .btn { padding: 4px 8px; font-size: 0.8rem; }
  .cs-mask-size-input { width: 90px; }
}

/* ── #131 package-fidelity hint (Eliza Jen, MOS soup base) ──────────────────
   Persistent inline warning shown on wizard step 3 when the brief is
   package-critical (soup base / MOS-class pouch) but no reference image is
   selected. Deliberately NOT a toast: a 4-second toast is missable, and the
   operator needs this while editing the brief. Amber = "fixable", not error. */
.cs-pack-hint {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid #d4a843;
  border-left: 4px solid #d4a843;
  border-radius: 6px;
  background: #fdf8ec;
  font-size: 0.85rem;
  line-height: 1.45;
}
.cs-pack-hint[hidden] { display: none; }
.cs-pack-hint-title { font-weight: 600; color: #7a5c10; margin-bottom: 4px; }
.cs-pack-hint-body { color: #5c5347; }
.cs-pack-hint-list { margin: 6px 0 0; padding-left: 18px; color: #5c5347; }
.cs-pack-hint-list li { margin: 2px 0; }
@media (max-width: 640px) {
  .cs-pack-hint { font-size: 0.8rem; padding: 8px 10px; }
}

/* ─────────────────────────────────────────────────────────────────────────
   CS-CA-LIB (2026-08-05) — product library region tabs (US | Canada)

   Feedback #88 ("There are no Canada product in this catalog") was half a
   paging bug and half a real gap: the shot library holds the US range. These
   tabs are the wall made visible. Styled as a SECONDARY filter row, visually
   subordinate to the primary .cs-tabs — switching market is a filter, not a
   navigation event.
   ───────────────────────────────────────────────────────────────────────── */
.cs-region-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 4px 0 10px;
}
.cs-region-legend {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
}
.cs-region-tab {
  appearance: none;
  border: 1px solid var(--border, #ddd6c9);
  background: #fff;
  color: #5c5347;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cs-region-tab:hover { border-color: var(--heritage-gold, #d4a843); }
.cs-region-tab:focus-visible {
  outline: 2px solid var(--heritage-gold, #d4a843);
  outline-offset: 2px;
}
.cs-region-tab.is-active {
  background: var(--heritage-red, #cc0000);
  border-color: var(--heritage-red, #cc0000);
  color: #fff;
}
/* The count is the honesty affordance: "Canada 130" reads as a stocked shelf,
   "Canada 0" reads as an empty one. An unlabeled toggle reads as neither. */
.cs-region-count {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(0,0,0,0.07);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
.cs-region-tab.is-active .cs-region-count { background: rgba(255,255,255,0.22); }

/* Coverage line — states how many shots came from a catalogue crop and how
   many of those are imperfect. Partial coverage shipped honestly beats a
   library that implies completeness it does not have. */
.cs-region-coverage {
  font-size: 0.8rem;
  line-height: 1.45;
  margin: 0 0 10px;
}

/* Per-card badges (region + imperfect-crop). Sit over the thumb, top-left, so
   they never collide with the .cs-pick-badge check mark (top-right). */
.cs-shot-badges {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  pointer-events: none;
}
.cs-shot-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.cs-shot-badge-region { background: #1f4e79; color: #fff; }
.cs-shot-badge-weak   { background: #fdf8ec; color: #7a5c10; border: 1px solid #d4a843; }

@media (max-width: 640px) {
  .cs-region-legend { display: none; }
  .cs-region-tab { padding: 4px 10px; font-size: 0.78rem; }
}

/* ── #165 · Generic unbranded promo poster (Eliza Jen, 2026-08-05) ──────────
   Step 3 swaps to a seven-field typographic brief. Two columns on desktop so
   the paired "buy / get" fields sit side by side and read like the poster they
   describe; single column under 720px (the module's existing mobile breakpoint
   family) so the fields never squeeze below a usable width. */
.cs-poster-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-top: 12px;
}
/* The address and the headline each carry the most characters of their row and
   anchor the layout, so they span the full width instead of being cramped. */
.cs-poster-field:nth-child(2),
.cs-poster-field:nth-child(3) { grid-column: 1 / -1; }
.cs-poster-field { min-width: 0; }
.cs-poster-count { font-variant-numeric: tabular-nums; }

/* Review step: one line per rendered string, so the operator proofs the exact
   copy going onto customer-facing artwork rather than a summary of it. */
.cs-review-poster { display: flex; flex-direction: column; gap: 3px; }
.cs-review-poster-line { display: block; line-height: 1.35; }

@media (max-width: 720px) {
  .cs-poster-grid { grid-template-columns: 1fr; }
  .cs-poster-field:nth-child(2),
  .cs-poster-field:nth-child(3) { grid-column: auto; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CS-CA-GALLERY + CS-CA-PACK — Shared Gallery tab + honest download pack
   (Canada marketing onboarding, Sharon Ho / 2026-08-14)

   Reuses the existing .cs-gallery grid and the .cs-region-tab / .cs-region-count
   pills from CS-CA-LIB rather than inventing a second visual language for the
   same idea (a market filter is a market filter). Only the pieces that are
   genuinely new to this surface are styled here.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Intro card: title + the consent line ────────────────────────────────────
   The consent sentence is styled as a CALLOUT, not fine print. The gallery only
   works if users believe nothing of theirs is here unless they published it, so
   the rule gets visual weight equal to the invitation to browse. */
.cs-gal-intro { margin-bottom: 16px; }
.cs-gal-intro-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.cs-gal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--ink-strong);
}
.cs-gal-total {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-mute);
}
.cs-gal-sub { margin: 6px 0 0; font-size: 0.88rem; line-height: 1.5; }
.cs-gal-consent {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-left: 3px solid var(--heritage-gold, #d4a843);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--eggshell-shade, #f7f3ea);
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ── Filter row ───────────────────────────────────────────────────────────── */
.cs-gal-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.cs-gal-filters-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cs-gal-sort { width: auto; min-width: 150px; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.cs-gal-card { display: flex; flex-direction: column; }
.cs-gal-thumb { position: relative; }
.cs-gal-img { cursor: zoom-in; }

/* Market provenance rides ON the image, because "which market made this" is the
   first question a cross-market gallery has to answer. */
.cs-gal-region-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.cs-gal-mine-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--heritage-gold, #d4a843);
  color: #3a2f16;
  font-size: 0.7rem;
  font-weight: 700;
}
.cs-gal-byline { font-size: 0.78rem; margin-top: 2px; }
/* The author's note is their voice, so it reads as a quotation rather than as
   another metadata field. */
.cs-gal-note {
  margin: 6px 0 0;
  font-size: 0.82rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink-soft);
}

/* ── Prompt disclosure ────────────────────────────────────────────────────────
   Sharon's stated purpose was "so they can regenerate", which makes the prompt
   the payload — not a tooltip. <details> keeps the grid scannable while making
   the prompt one click away and fully selectable. */
.cs-gal-prompt {
  margin: 8px 12px 0;
  border-top: 1px solid var(--rule-soft);
  padding-top: 8px;
}
.cs-gal-prompt > summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--heritage-red, #cc0000);
  list-style: none;
}
.cs-gal-prompt > summary::-webkit-details-marker { display: none; }
.cs-gal-prompt > summary::before { content: '▸ '; }
.cs-gal-prompt[open] > summary::before { content: '▾ '; }
.cs-gal-prompt > summary:focus-visible {
  outline: 2px solid var(--heritage-gold, #d4a843);
  outline-offset: 2px;
}
.cs-gal-prompt-body { padding-top: 8px; }
.cs-gal-prompt-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
/* pre + wrapping: a prompt is long, and truncating it would defeat the purpose
   of publishing it. max-height keeps one verbose card from owning the viewport. */
.cs-gal-prompt-text {
  margin: 0;
  padding: 8px 10px;
  max-height: 190px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--eggshell-shade, #f7f3ea);
  border: 1px solid var(--rule-soft);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.cs-gal-prompt-hint { font-size: 0.75rem; margin: 6px 0; }

/* ── Share row on My Creations cards ────────────────────────────────────────
   A second action row rather than a 6-up squeeze: pack / vector-help / share are
   a different KIND of action (distribution) from download / variation / remix
   (iteration), and at 6 columns every label truncates to uselessness. */
.cs-card-actions-share {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  border-top: 1px solid var(--rule-soft);
  margin-top: 6px;
  padding-top: 6px;
}
.cs-card-actions-share .btn { min-width: 0; }
.cs-card-actions-share .cs-btn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* "Shared" is a STATE, not a call to action — gold-tinted and quiet, so a
   published card reads as settled rather than as another button to press. */
.cs-cr-share.is-shared {
  border-color: var(--heritage-gold, #d4a843);
  color: var(--heritage-gold-dark, #a37d1f);
  background: rgba(212, 168, 67, 0.10);
}

/* ── Gallery detail modal ─────────────────────────────────────────────────── */
.cs-gal-modal {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.cs-gal-modal-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--rule-soft);
  background: var(--paper);
}
.cs-gal-modal-meta { min-width: 0; }
.cs-gal-modal-by { font-size: 0.8rem; color: var(--text-mute); margin-bottom: 8px; }
.cs-gal-modal-row { font-size: 0.86rem; line-height: 1.5; margin-bottom: 4px; }
.cs-gal-modal-row .text-mute { display: inline-block; min-width: 92px; }

/* Mobile: the module's existing 720px family. The modal stacks (an image beside
   a prompt is unreadable on a phone) and the share row drops to a single column
   so the labels stay legible instead of ellipsing to one character. */
@media (max-width: 720px) {
  .cs-gal-modal { grid-template-columns: 1fr; }
  .cs-gal-filters { align-items: stretch; }
  .cs-gal-filters-right { justify-content: space-between; }
  .cs-gal-sort { flex: 1 1 auto; }
  .cs-card-actions-share { grid-template-columns: 1fr; }
}

/* ── CS-CA-NOTES — honest-limits disclosures (Canada onboarding 2026-08-17) ───
   Two collapsed notes: the recipe-card template reality (Hoi Ying) and the
   multi-reference / certification-mark reality (Judy). Collapsed by default so
   they inform without nagging; gold left rule marks them as "read this before
   you're surprised" rather than as an error. */
.cs-ca-note-wrap.is-hidden { display: none; }
.cs-ca-note {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-left: 3px solid var(--heritage-gold, #d4a843);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--eggshell-shade, #f7f3ea);
  font-size: 0.83rem;
  line-height: 1.5;
}
.cs-ca-note > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-strong);
  list-style: none;
}
.cs-ca-note > summary::-webkit-details-marker { display: none; }
.cs-ca-note > summary::before { content: 'ⓘ  '; color: var(--heritage-gold-dark, #a37d1f); }
.cs-ca-note > summary:focus-visible {
  outline: 2px solid var(--heritage-gold, #d4a843);
  outline-offset: 2px;
}
.cs-ca-note p { margin: 8px 0 0; color: var(--ink-soft); }
.cs-ca-note-strong { font-weight: 600; color: var(--ink-strong) !important; }
.cs-ca-note-cta { margin-top: 10px; }

/* ═══════════════════════════════════════════════════════════════
   ENHANCE TAB (#263, Ho Wai Yin Sharon 2026-08-19)
   upload → size → preview → download. Mobile-first: the compare grid
   collapses to a single column so the before/after stacks rather than
   shrinking both panes into unreadable thumbnails on a phone.
   ═══════════════════════════════════════════════════════════════ */
.cs-enh-card { padding: 20px; }
.cs-enh-title { margin: 0 0 6px; font-size: 1.05rem; color: var(--ink-strong); }
.cs-enh-sub {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
  max-width: 68ch;
}

/* ── Step 1 · upload dropzone ── */
.cs-enh-drop {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 2px dashed var(--border-strong, #d8cdb8);
  border-radius: var(--radius-md, 10px);
  background: var(--eggshell-shade, #f7f3ea);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.cs-enh-drop:hover,
.cs-enh-drop.is-drag {
  border-color: var(--heritage-gold, #d4a843);
  background: #fffdf7;
}
.cs-enh-drop:focus-visible {
  outline: 2px solid var(--heritage-gold, #d4a843);
  outline-offset: 2px;
}
.cs-enh-drop.has-file { cursor: default; }
.cs-enh-dropinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: center;
}
.cs-enh-dropicon { font-size: 1.6rem; }
.cs-enh-dropinner p { margin: 0; color: var(--ink-soft); font-size: 0.88rem; }
.cs-enh-thumb {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border-radius: var(--radius-sm, 6px);
  background: #fff;
  border: 1px solid var(--border-soft, #e6ddc9);
  flex: 0 0 auto;
}
.cs-enh-fileinfo { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.cs-enh-fileinfo strong {
  color: var(--ink-strong);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-enh-fileinfo span { color: var(--ink-soft); font-size: 0.82rem; }

/* ── Step 2 · size picker (exactly three native sizes) ── */
.cs-enh-sizes { margin-top: 18px; }
.cs-enh-sizes[aria-disabled="true"] { opacity: 0.55; }
.cs-enh-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-strong);
}
.cs-enh-sizegrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.cs-enh-size {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 10px;
  border: 1px solid var(--border-soft, #e6ddc9);
  border-radius: var(--radius-sm, 6px);
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cs-enh-size:hover:not(:disabled) { border-color: var(--heritage-gold, #d4a843); }
.cs-enh-size:disabled { cursor: not-allowed; }
.cs-enh-size.is-active {
  border-color: var(--heritage-red, #c00);
  box-shadow: inset 0 0 0 1px var(--heritage-red, #c00);
}
.cs-enh-sizename { font-weight: 600; font-size: 0.86rem; color: var(--ink-strong); }
.cs-enh-sizepx { font-size: 0.78rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* Direction note — a downsize must never read as an upscale. */
.cs-enh-dir { margin: 10px 0 0; font-size: 0.82rem; line-height: 1.5; }
.cs-enh-dir-upscale { color: var(--ink-soft); }
.cs-enh-dir-downscale,
.cs-enh-dir-same {
  padding: 8px 12px;
  border-left: 3px solid var(--heritage-gold, #d4a843);
  background: var(--eggshell-shade, #f7f3ea);
  border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0;
  color: var(--ink-strong);
}

/* ── Honest-limits copy ── */
.cs-enh-limits {
  margin: 12px 0 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 78ch;
}
.cs-enh-cap { font-weight: 600; color: var(--ink-strong); }

.cs-enh-actions { margin-top: 18px; }
.cs-enh-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--danger, #b3261e);
  border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0;
  background: #fdf2f1;
  color: var(--danger-strong, #8c1d18);
  font-size: 0.86rem;
  line-height: 1.5;
}

/* ── Step 3 · side-by-side compare ── */
.cs-enh-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}
.cs-enh-pane { margin: 0; min-width: 0; }
.cs-enh-pane figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--ink-strong);
}
.cs-enh-dims {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.cs-enh-pane img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-soft, #e6ddc9);
  background: #fff;
}

/* ── Step 4 · download ── */
.cs-enh-resultactions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.cs-enh-usage {
  margin: 12px 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 78ch;
}

@media (max-width: 700px) {
  .cs-enh-card { padding: 14px; }
  .cs-enh-sizegrid { grid-template-columns: 1fr; }
  .cs-enh-compare { grid-template-columns: 1fr; }
  .cs-enh-drop { flex-direction: column; text-align: center; }
  .cs-enh-fileinfo { align-items: center; }
  .cs-enh-fileinfo strong { white-space: normal; word-break: break-word; }
  .cs-enh-resultactions .btn { flex: 1 1 auto; }
}

/* ── #390 · Finish labels (deterministic curved-label finishing) ─────────
   Editor over the Creative Studio panel. Geometry is edited on two canvases
   (scene + source) with ≥44px pointer targets; the layout collapses to a
   single column with a Scene/Source toggle under 900px. */
.cs-lf { display: flex; flex-direction: column; gap: 14px; }
.cs-lf-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cs-lf-title-wrap { flex: 1 1 240px; min-width: 0; }
.cs-lf-title { margin: 0; font-size: 1.1rem; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.cs-lf-title-sub { font-weight: 400; color: var(--ink-soft); font-size: 0.9rem; }
.cs-lf-status { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.cs-lf-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; border: 1px solid var(--rule, #ddd); color: var(--ink-soft); background: var(--surface, #fff); }
.cs-lf-chip.is-ok { border-color: #1b8a4c; color: #1b8a4c; }
.cs-lf-chip.is-warn { border-color: #e0902a; color: #b06a12; }
.cs-lf-honesty { margin: 0; font-size: 0.8rem; line-height: 1.5; max-width: 90ch; }
.cs-lf-conflict[hidden] { display: none; }
.cs-lf-conflict { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 10px; background: #fff4e5; border: 1px solid #e0902a; color: #7a4a00; }
.cs-lf-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.cs-lf-col { min-width: 0; }
.cs-lf-col h4, .cs-lf-section h4 { margin: 0 0 8px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.cs-lf-sources h4 + h4 { margin-top: 16px; }
.cs-lf-source { display: grid; grid-template-columns: 48px 1fr; gap: 8px; padding: 8px; border: 1px solid var(--rule, #e5e5e5); border-radius: 10px; margin-bottom: 8px; background: var(--surface, #fff); }
.cs-lf-source-thumb { width: 48px; height: 64px; object-fit: contain; background: #f3f0ea; border-radius: 6px; image-orientation: none; }
.cs-lf-source-name { font-size: 0.85rem; font-weight: 600; overflow-wrap: anywhere; }
.cs-lf-source-meta { font-size: 0.72rem; }
.cs-lf-badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 0.68rem; font-weight: 600; margin-top: 4px; border: 0; cursor: default; }
.cs-lf-badge-lib { background: #e8f1ff; color: #1d4f9c; }
.cs-lf-badge-ref { background: #f3e8ff; color: #5b2a9c; }
button.cs-lf-badge { cursor: pointer; }
.cs-lf-add { grid-column: 1 / -1; min-height: 40px; }
.cs-lf-panel-item { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; align-items: center; width: 100%; text-align: left; padding: 8px; border-radius: 8px; border: 1px solid var(--rule, #e5e5e5); background: var(--surface, #fff); margin-bottom: 6px; min-height: 44px; cursor: pointer; }
.cs-lf-panel-item.is-selected { border-color: #c8102e; box-shadow: 0 0 0 2px rgba(200,16,46,0.12); }
.cs-lf-panel-num { width: 22px; height: 22px; border-radius: 50%; background: #c8102e; color: #fff; font-size: 0.72rem; display: grid; place-items: center; }
.cs-lf-panel-name { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-lf-panel-state { font-size: 0.68rem; padding: 1px 6px; border-radius: 999px; }
.cs-lf-panel-state.is-ok { background: #e6f5ec; color: #1b8a4c; }
.cs-lf-panel-state.is-warn { background: #fff4e5; color: #b06a12; }
.cs-lf-canvases { display: flex; flex-direction: column; gap: 12px; }
.cs-lf-view-toggle { display: none; gap: 6px; }
.cs-lf-canvas-wrap { border: 1px solid var(--rule, #e5e5e5); border-radius: 12px; padding: 8px; background: var(--surface, #fff); }
.cs-lf-canvas-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.75rem; margin-bottom: 6px; flex-wrap: wrap; }
.cs-lf-hint { font-size: 0.7rem; }
.cs-lf-canvas { display: block; max-width: 100%; border-radius: 8px; background: #f3f0ea; cursor: crosshair; touch-action: none; outline-offset: 2px; }
.cs-lf-canvas:focus-visible { outline: 2px solid #2a6fdb; }
.cs-lf-inspector { border: 1px solid var(--rule, #e5e5e5); border-radius: 12px; padding: 12px; background: var(--surface, #fff); }
.cs-lf-insp-src { font-size: 0.78rem; margin-bottom: 8px; }
.cs-lf-details { margin: 6px 0; }
.cs-lf-details summary { cursor: pointer; font-size: 0.8rem; font-weight: 600; padding: 4px 0; }
.cs-lf-geom { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; margin: 6px 0; }
.cs-lf-num { display: flex; flex-direction: column; font-size: 0.68rem; color: var(--ink-soft); }
.cs-lf-num input { width: 100%; min-height: 32px; font-size: 0.8rem; padding: 2px 6px; }
.cs-lf-range { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 6px; font-size: 0.75rem; margin: 4px 0; }
.cs-lf-identity { margin-top: 12px; border-top: 1px solid var(--rule, #e5e5e5); padding-top: 10px; }
.cs-lf-identity h5 { margin: 0 0 4px; font-size: 0.82rem; }
.cs-lf-identity-help { margin: 0 0 8px; font-size: 0.72rem; line-height: 1.4; }
.cs-lf-field { display: flex; flex-direction: column; gap: 3px; font-size: 0.75rem; }
.cs-lf-field select { min-height: 36px; }
.cs-lf-check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.78rem; padding: 6px 0; line-height: 1.35; }
.cs-lf-check input { margin-top: 2px; width: 18px; height: 18px; flex: 0 0 18px; }
.cs-lf-identity-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.cs-lf-identity-actions .btn { min-height: 40px; }
.cs-lf-mismatch { margin-top: 6px; }
.cs-lf-section { border: 1px solid var(--rule, #e5e5e5); border-radius: 12px; padding: 12px; background: var(--surface, #fff); }
.cs-lf-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 8px 0; }
.cs-lf-note { flex: 1 1 260px; min-height: 36px; }
.cs-lf-callout { padding: 10px 12px; border-radius: 8px; background: #fff4e5; color: #7a4a00; font-size: 0.8rem; line-height: 1.45; }
.cs-lf-rev-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.cs-lf-rev { position: relative; flex: 0 0 auto; width: 96px; border: 2px solid transparent; border-radius: 8px; padding: 0; background: #f3f0ea; cursor: pointer; overflow: hidden; }
.cs-lf-rev img { display: block; width: 96px; height: 96px; object-fit: cover; }
.cs-lf-rev.is-selected { border-color: #c8102e; }
.cs-lf-rev-label { position: absolute; left: 4px; bottom: 4px; font-size: 0.66rem; background: rgba(0,0,0,0.6); color: #fff; padding: 1px 6px; border-radius: 999px; }
.cs-lf-stale { display: inline-block; font-size: 0.64rem; padding: 1px 6px; border-radius: 999px; background: #fff4e5; color: #b06a12; border: 1px solid #e0902a; vertical-align: middle; }
.cs-lf-rev .cs-lf-stale { position: absolute; top: 4px; right: 4px; }
.cs-lf-result-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.cs-lf-result-img-wrap { position: relative; display: inline-block; max-width: 100%; }
.cs-lf-result-img { display: block; max-width: 100%; max-height: 70vh; border-radius: 8px; image-orientation: none; }
.cs-lf-mask-overlay[hidden] { display: none; }
.cs-lf-mask-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0.45; mix-blend-mode: multiply; filter: sepia(1) saturate(12) hue-rotate(-40deg); }
.cs-lf-proof { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.72rem; margin: 8px 0; }
.cs-lf-result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cs-lf-result-actions .btn { min-height: 40px; }
.cs-lf-empty { font-size: 0.8rem; padding: 6px 0; }
.cs-lf-error { padding: 20px; }
.cs-lf-picker-intro { margin: 0 0 10px; font-size: 0.85rem; }
.cs-lf-picker-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cs-lf-picker-cols h4 { margin: 0 0 6px; font-size: 0.85rem; display: flex; gap: 8px; align-items: center; }
.cs-lf-picker-list { max-height: 44vh; overflow: auto; border: 1px solid var(--rule, #e5e5e5); border-radius: 8px; padding: 4px; }
.cs-lf-pick { display: grid; grid-template-columns: 20px 1fr; gap: 2px 8px; padding: 8px; border-radius: 6px; min-height: 44px; cursor: pointer; align-items: center; }
.cs-lf-pick:hover { background: #f7f4ee; }
.cs-lf-pick input { width: 18px; height: 18px; grid-row: span 2; }
.cs-lf-pick-name { font-size: 0.82rem; }
.cs-lf-pick-meta { font-size: 0.7rem; color: var(--ink-soft); grid-column: 2; }
.cs-lf-picker-err { margin-top: 8px; font-size: 0.8rem; }

@media (max-width: 1100px) {
  .cs-lf-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .cs-lf-inspector { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .cs-lf-grid { grid-template-columns: 1fr; }
  .cs-lf-view-toggle { display: flex; }
  .cs-lf-canvases[data-view="scene"] .cs-lf-canvas-wrap[data-pane="source"] { display: none; }
  .cs-lf-canvases[data-view="source"] .cs-lf-canvas-wrap[data-pane="scene"] { display: none; }
  .cs-lf-picker-cols { grid-template-columns: 1fr; }
  .cs-lf-top-actions { width: 100%; }
  .cs-lf-top-actions .btn { width: 100%; min-height: 44px; }
  .cs-lf-geom { grid-template-columns: 1fr 1fr; }
}
.cs-lf-callout-inline { margin: 6px 0; font-size: 0.74rem; }

/* ── #390 continuation 2 · observations, foreground mask, advanced, scene revision ── */
.cs-lf-obs { margin: 6px 0; }
.cs-lf-obs-label { display: block; font-size: 0.76rem; margin-bottom: 4px; }
.cs-lf-obs-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.cs-lf-obs-btn { min-height: 36px; padding: 4px 10px; font-size: 0.74rem; }
.cs-lf-obs-btn.is-match.is-selected { background: #e6f5ec; border-color: #1b8a4c; color: #1b8a4c; }
.cs-lf-obs-btn.is-mismatch.is-selected { background: #fdecec; border-color: #c8102e; color: #a30c25; }
.cs-lf-obs-btn.is-unknown.is-selected { background: #f1f1f1; border-color: #999; color: #444; }
.cs-lf-obs-head { margin: 10px 0 4px; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.cs-lf-obs-word.is-mismatch { color: #a30c25; font-weight: 600; }
.cs-lf-obs-word.is-match { color: #1b8a4c; font-weight: 600; }
.cs-lf-obs-word.is-unknown { color: #666; }
.cs-lf-callout-inline { margin: 6px 0; font-size: 0.75rem; }
.cs-lf-note-inline { font-size: 0.74rem; margin: 4px 0; }
.cs-lf-check-variant { border: 1px solid var(--rule, #e5e5e5); border-radius: 8px; padding: 6px 8px; }
.cs-lf-vertices { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 220px; overflow: auto; }
.cs-lf-vertex { display: grid; grid-template-columns: 28px 1fr 1fr 32px; gap: 4px; align-items: center; padding: 2px; border-radius: 6px; }
.cs-lf-vertex.is-selected { background: #e8f1ff; }
.cs-lf-vertex input { min-height: 30px; font-size: 0.76rem; padding: 2px 4px; width: 100%; }
.cs-lf-vertex-pick { width: 28px; height: 28px; border-radius: 50%; border: 1px solid #2a6fdb; background: #fff; color: #2a6fdb; font-size: 0.7rem; cursor: pointer; }
.cs-lf-vertex.is-selected .cs-lf-vertex-pick { background: #2a6fdb; color: #fff; }
.cs-lf-vertex-del { min-height: 28px; padding: 0 6px; }
.cs-lf-rgb { display: grid; grid-template-columns: 1fr repeat(3, 56px); gap: 4px; align-items: center; font-size: 0.72rem; margin: 4px 0; }
.cs-lf-rgb input { min-height: 30px; font-size: 0.76rem; padding: 2px 4px; }
.cs-lf-review-block { margin-top: 12px; border-top: 1px solid var(--rule, #e5e5e5); padding-top: 10px; }
.cs-lf-review-block h5 { margin: 0 0 6px; font-size: 0.85rem; }
.cs-lf-review-summary { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.cs-lf-revise { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.cs-lf-revise .btn { min-height: 44px; }
.cs-lf-revise-help { font-size: 0.74rem; max-width: 60ch; }
.cs-lf-link { background: none; border: 0; padding: 0; color: #1d4f9c; text-decoration: underline; cursor: pointer; font: inherit; font-size: 0.74rem; }
.cs-scene-revision { padding: 12px 14px; margin-bottom: 12px; border: 1px solid #2a6fdb; background: #f3f7ff; border-radius: 12px; }
.cs-scene-revision-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.cs-scene-revision-body { font-size: 0.82rem; margin: 6px 0; }
.cs-scene-revision-list { margin: 6px 0; padding-left: 18px; font-size: 0.8rem; line-height: 1.5; }
.cs-scene-revision-note, .cs-scene-revision-unavail { font-size: 0.78rem; margin: 4px 0; }
.cs-scene-revision-unavail { color: #b06a12; }
.cs-scene-revision-pre { white-space: pre-wrap; font-size: 0.72rem; background: #fff; border: 1px solid var(--rule, #e5e5e5); border-radius: 8px; padding: 8px; max-height: 240px; overflow: auto; }
.cs-scene-revision-honest { font-size: 0.74rem; margin-top: 6px; }
.cs-scene-revision-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.cs-scene-revision-actions .btn { min-height: 44px; }
.cs-lf-canvases.is-mask .cs-lf-canvas[id="cs-lf-scene"] { cursor: cell; }
.cs-lf-range-exact { grid-template-columns: 1fr 1fr 72px; }
.cs-lf-range-exact input[type="number"] { min-height: 30px; font-size: 0.74rem; padding: 2px 4px; }
/* ============================================================
   39-inq-brief.css — I&Q Monday Brief module
   LKK brand: Heritage Red #CC0000 (headings), Gold #D4A843 (accents),
   Purple #5B2C8A (editor pick). Mobile-first; tested at 390px.
   ============================================================ */

:root {
  --inq-red: #CC0000;
  --inq-gold: #D4A843;
  --inq-purple: #5B2C8A;
}

[data-module="inq-brief"] {
  --inq-card-bg: var(--card-bg, #fff);
  --inq-border: var(--border-color, #e5e2dc);
  --inq-mute: var(--text-mute, #888);
}

/* ── Tabs ───────────────────────────────────────────────── */
.inq-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--inq-border);
  padding-bottom: 2px;
}
.inq-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--inq-mute);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}
.inq-tab:hover { color: var(--text, #2b2b2b); background: rgba(0,0,0,.03); }
.inq-tab[aria-selected="true"] {
  color: var(--inq-red);
  border-bottom-color: var(--inq-red);
}

.inq-pane { animation: inq-fade .18s ease; }
@keyframes inq-fade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* ── Empty / error states ───────────────────────────────── */
.inq-empty {
  text-align: center;
  padding: 36px 20px;
}
.inq-empty-icon { font-size: 34px; margin-bottom: 8px; }
.inq-empty-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.inq-empty-body { font-size: 13px; }

/* ── Masthead / 30-second read ──────────────────────────── */
.inq-masthead {
  border-left: 4px solid var(--inq-red);
  background: linear-gradient(90deg, rgba(204,0,0,.04), transparent 70%);
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
}
.inq-masthead-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.inq-masthead-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--inq-red);
}
.inq-masthead-meta { font-size: 12px; }
.inq-masthead-theme {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-size: 21px;
  font-style: italic;
  margin: 8px 0 10px;
  color: var(--text, #2b2b2b);
  line-height: 1.25;
}
.inq-masthead-bullets {
  margin: 6px 0 0;
  padding-left: 18px;
}
.inq-masthead-bullets li {
  margin-bottom: 5px;
  line-height: 1.45;
  font-size: 14px;
}

/* Chinese TL;DR callout */
.inq-zh-tldr {
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(212,168,67,.10);
  border: 1px solid rgba(212,168,67,.35);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}
.inq-zh-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--inq-gold);
  margin-right: 6px;
}

/* ── Reader sections + items ────────────────────────────── */
.inq-section { margin-bottom: 22px; }
.inq-section-head {
  font-size: 16px;
  font-weight: 700;
  color: var(--inq-red);
  margin: 0 0 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--inq-border);
  display: flex;
  align-items: center;
  gap: 7px;
}
.inq-section-icon { font-size: 17px; }
.inq-section-items { display: flex; flex-direction: column; gap: 12px; }

.inq-item {
  padding: 12px 14px;
  border: 1px solid var(--inq-border);
  border-radius: 8px;
  background: var(--inq-card-bg);
}
.inq-item-pick {
  border-color: rgba(91,44,138,.45);
  background: linear-gradient(180deg, rgba(91,44,138,.05), transparent);
  box-shadow: inset 3px 0 0 var(--inq-purple);
}
.inq-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}
.inq-item-headline {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  margin-bottom: 5px;
}
.inq-item-body { font-size: 14px; line-height: 1.55; color: var(--text, #2b2b2b); }
.inq-item-body p { margin: 0 0 8px; }
.inq-item-sowhat {
  font-size: 13.5px;
  line-height: 1.5;
  margin: 7px 0;
  padding: 7px 10px;
  background: rgba(0,0,0,.025);
  border-radius: 6px;
}
.inq-sowhat-label {
  font-weight: 700;
  color: var(--inq-red);
  margin-right: 4px;
}
.inq-item-foot { margin-top: 6px; font-size: 13px; }

/* ── Confidence badges ──────────────────────────────────── */
.inq-conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.inq-conf-confirmed { background: #E6F4EA; color: #1e7a34; }
.inq-conf-reported  { background: #FFF4D6; color: #8a6d00; }
.inq-conf-rumor     { background: #FCE8E6; color: var(--inq-red); }

/* ── Role chips ─────────────────────────────────────────── */
.inq-role-chips { display: inline-flex; gap: 3px; }
.inq-role-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: rgba(0,0,0,.04);
}

/* ── Editor's pick flag ─────────────────────────────────── */
.inq-pick-flag {
  font-size: 11px;
  font-weight: 700;
  color: var(--inq-purple);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(91,44,138,.10);
}

/* ── Source links ───────────────────────────────────────── */
.inq-src-link {
  color: var(--inq-red);
  text-decoration: none;
  font-weight: 500;
}
.inq-src-link:hover { text-decoration: underline; }
.inq-src-name { color: var(--inq-mute); font-size: 13px; }

/* ── Issue footer ───────────────────────────────────────── */
.inq-issue-footer {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px dashed var(--inq-border);
  font-size: 13px;
}

/* ── Archive ────────────────────────────────────────────── */
.inq-archive-row {
  border: 1px solid var(--inq-border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.inq-archive-row-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.inq-archive-row-head:hover { background: rgba(0,0,0,.025); }
.inq-archive-row-meta { display: flex; flex-direction: column; min-width: 64px; }
.inq-archive-num { font-weight: 700; color: var(--inq-red); font-size: 14px; }
.inq-archive-date { font-size: 12px; }
.inq-archive-theme {
  flex: 1;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.35;
}
.inq-archive-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.inq-archive-caret { transition: transform .18s; color: var(--inq-mute); }
.inq-archive-row-head[aria-expanded="true"] .inq-archive-caret { transform: rotate(180deg); }
.inq-archive-row-body {
  padding: 6px 14px 16px;
  border-top: 1px solid var(--inq-border);
}

/* ── Competitor Watch ───────────────────────────────────── */
.inq-comp-intro { margin-bottom: 12px; }
.inq-comp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.inq-comp-card { padding: 14px 16px; }
.inq-comp-anchor-card {
  border: 1px solid rgba(212,168,67,.5);
  box-shadow: inset 3px 0 0 var(--inq-gold), 0 1px 3px rgba(0,0,0,.05);
}
.inq-comp-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.inq-comp-name { font-weight: 700; font-size: 16px; }
.inq-comp-name-zh { font-weight: 500; font-size: 14px; color: var(--inq-mute); margin-left: 4px; }
.inq-comp-anchor {
  font-size: 11px;
  font-weight: 700;
  color: #8a6d00;
  background: rgba(212,168,67,.18);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.inq-comp-posture {
  font-size: 13.5px;
  line-height: 1.5;
  font-style: italic;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--inq-border);
}
.inq-comp-signals { display: flex; flex-direction: column; gap: 9px; }
.inq-comp-cat-head {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}
.inq-comp-cat-count {
  font-size: 10px;
  background: rgba(0,0,0,.06);
  border-radius: 999px;
  padding: 1px 6px;
  font-weight: 600;
}
.inq-comp-cat-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.45;
}
.inq-comp-cat-list li { margin-bottom: 3px; }
.inq-comp-nosignals, .inq-comp-foot { font-size: 12px; }
.inq-comp-foot { margin-top: 10px; display: flex; gap: 4px; flex-wrap: wrap; }

/* ── Editorial Desk ─────────────────────────────────────── */
.inq-ed-card { padding: 14px 16px; }
.inq-ed-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inq-ed-pool-filters { display: flex; gap: 8px; flex-wrap: wrap; }

.inq-pool-row {
  border: 1px solid var(--inq-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.inq-pool-row-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.inq-pool-section-badge {
  font-size: 11px;
  font-weight: 600;
  background: rgba(0,0,0,.05);
  padding: 2px 8px;
  border-radius: 999px;
}
.inq-pool-title { font-weight: 600; font-size: 14px; line-height: 1.35; }
.inq-pool-sowhat { font-size: 13px; line-height: 1.45; margin-top: 4px; }
.inq-pool-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  font-size: 13px;
}

/* Draft workspace */
.inq-draft-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.inq-draft-meta { display: flex; align-items: center; gap: 8px; }
.inq-draft-num { font-weight: 700; color: var(--inq-red); font-size: 14px; }
.inq-draft-theme {
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 18px;
  margin-bottom: 8px;
}
.inq-draft-section { margin-top: 14px; }
.inq-draft-section-head {
  font-size: 14px;
  font-weight: 700;
  color: var(--inq-red);
  margin: 0 0 8px;
}
.inq-draft-item {
  border: 1px solid var(--inq-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.inq-draft-item.inq-item-pick {
  border-color: rgba(91,44,138,.45);
  box-shadow: inset 3px 0 0 var(--inq-purple);
}
.inq-draft-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 7px; }
.inq-pick-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--inq-purple);
  cursor: pointer;
  margin-left: auto;
}
.inq-draft-headline { margin-bottom: 6px; font-weight: 600; }
.inq-draft-sowhat { margin-bottom: 6px; resize: vertical; }
.inq-draft-item-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}
.inq-item-saved { color: #1e7a34; font-size: 12px; font-weight: 600; }
.inq-draft-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--inq-border);
}

/* ── Status badges ──────────────────────────────────────── */
.inq-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}
.inq-status-draft     { background: rgba(0,0,0,.06); color: #555; }
.inq-status-review    { background: #FFF4D6; color: #8a6d00; }
.inq-status-approved  { background: #E6F4EA; color: #1e7a34; }
.inq-status-published { background: rgba(204,0,0,.10); color: var(--inq-red); }

/* ── Mobile (≤480px) ────────────────────────────────────── */
@media (max-width: 480px) {
  .inq-tabs { gap: 2px; }
  .inq-tab { padding: 8px 10px; font-size: 13px; }
  .inq-masthead-theme { font-size: 18px; }
  .inq-comp-grid { grid-template-columns: 1fr; }
  .inq-archive-row-head { flex-wrap: wrap; }
  .inq-archive-theme { flex-basis: 100%; order: 3; margin-top: 2px; }
  .inq-pick-toggle { margin-left: 0; }
  .inq-draft-actions { flex-direction: column; }
  .inq-draft-actions .btn { width: 100%; }
}
/* ===================================================================
   40-workspace-research.css — Deep Research modal + artifact sources
   Heritage Red #CC0000 · Gold #D4A843 · Purple #5B2C8A · Eggshell #FFF5E6
   RESEARCH WAVE (2026-07-03)
   =================================================================== */

/* ── modal overlay ─────────────────────────────────────────────────── */

.ws-research-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ws-r-fade-in 0.15s ease-out;
}

@keyframes ws-r-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.ws-research-modal {
  background: var(--eggshell-bright, #FFF5E6);
  border-radius: var(--radius-lg, 12px);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

/* ── header ────────────────────────────────────────────────────────── */

.ws-research-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--rule, #E5D9C4);
}

.ws-research-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink-strong, #1A1410);
}

.ws-research-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--ink-mute, #6B6560);
  line-height: 1;
  padding: 0 4px;
}

.ws-research-close:hover {
  color: var(--heritage-red, #CC0000);
}

/* ── tabs ──────────────────────────────────────────────────────────── */

.ws-research-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule, #E5D9C4);
  padding: 0 20px;
}

.ws-research-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-mute, #6B6560);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.ws-research-tab:hover {
  color: var(--ink-strong, #1A1410);
}

.ws-research-tab.active {
  color: var(--heritage-red, #CC0000);
  border-bottom-color: var(--heritage-red, #CC0000);
}

/* ── body / panels ─────────────────────────────────────────────────── */

.ws-research-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.ws-research-panel[hidden] {
  display: none;
}

/* ── form elements ─────────────────────────────────────────────────── */

.ws-research-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft, #4A4038);
  margin-bottom: 6px;
  margin-top: 12px;
}

.ws-research-label:first-child {
  margin-top: 0;
}

.ws-research-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.9rem;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: var(--radius, 8px);
  background: #fff;
  color: var(--ink-strong, #1A1410);
  resize: vertical;
  box-sizing: border-box;
}

.ws-research-input:focus {
  outline: none;
  border-color: var(--heritage-red, #CC0000);
  box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.12);
}

.ws-research-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.9rem;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: var(--radius, 8px);
  background: #fff;
  color: var(--ink-strong, #1A1410);
  box-sizing: border-box;
}

.ws-research-select:focus {
  outline: none;
  border-color: var(--heritage-red, #CC0000);
}

/* ── action buttons ────────────────────────────────────────────────── */

.ws-research-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.ws-research-btn {
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius, 8px);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.ws-research-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ws-research-btn-primary {
  background: var(--heritage-red, #CC0000);
  color: #fff;
}

.ws-research-btn-primary:hover:not(:disabled) {
  background: #a30000;
}

.ws-research-btn-secondary {
  background: transparent;
  color: var(--heritage-red, #CC0000);
  border: 1px solid var(--heritage-red, #CC0000);
}

.ws-research-btn-secondary:hover:not(:disabled) {
  background: rgba(204, 0, 0, 0.06);
}

/* ── topbar trigger ────────────────────────────────────────────────── */

.ws-research-trigger {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm, 6px);
  color: var(--ink-soft, #4A4038);
  transition: background 0.12s;
  display: inline-flex;
  align-items: center;
}

.ws-research-trigger:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* ── job list ──────────────────────────────────────────────────────── */

.ws-research-job {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule, #E5D9C4);
  flex-wrap: wrap;
}

.ws-research-job:last-child {
  border-bottom: none;
}

.ws-research-job-topic {
  flex: 1;
  font-size: 0.9rem;
  color: var(--ink-strong, #1A1410);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── status badges ─────────────────────────────────────────────────── */

.ws-research-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.ws-badge-queued {
  background: #f0ebe3;
  color: var(--ink-soft, #4A4038);
}

.ws-badge-running {
  background: rgba(204, 0, 0, 0.1);
  color: var(--heritage-red, #CC0000);
}

.ws-badge-done {
  background: rgba(212, 168, 67, 0.15);
  color: #8a6d1b;
}

.ws-badge-failed {
  background: rgba(204, 0, 0, 0.08);
  color: #a30000;
}

.ws-research-open {
  font-size: 0.82rem;
  padding: 4px 12px;
  border-radius: var(--radius-sm, 6px);
  background: var(--heritage-gold, #D4A843);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.ws-research-open:hover {
  background: #b8912e;
}

.ws-research-error-text {
  width: 100%;
  font-size: 0.8rem;
  color: #a30000;
  margin-top: 2px;
}

/* ── empty / loading ───────────────────────────────────────────────── */

.ws-research-empty {
  text-align: center;
  color: var(--ink-mute, #6B6560);
  font-size: 0.9rem;
  padding: 24px 0;
}

.ws-research-loading {
  text-align: center;
  padding: 32px 0;
  color: var(--ink-mute, #6B6560);
}

.ws-research-loading::after {
  content: '...';
  animation: ws-r-dots 1.2s steps(3, end) infinite;
}

@keyframes ws-r-dots {
  0%   { content: '.'; }
  33%  { content: '..'; }
  66%  { content: '...'; }
}

/* ── search results ────────────────────────────────────────────────── */

.ws-research-results {
  margin-top: 12px;
}

.ws-research-search-group h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute, #6B6560);
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule, #E5D9C4);
}

.ws-research-search-group:first-child h4 {
  margin-top: 0;
}

.ws-research-search-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: background 0.12s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ws-research-search-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.ws-research-search-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-strong, #1A1410);
}

.ws-research-search-snippet {
  font-size: 0.8rem;
  color: var(--ink-mute, #6B6560);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── artifact sources footer ───────────────────────────────────────── */

.artifact-sources {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 2px solid var(--heritage-gold, #D4A843);
}

.artifact-sources-head {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft, #4A4038);
  margin-bottom: 6px;
}

.artifact-sources-list {
  margin: 0;
  padding-left: 20px;
}

.artifact-sources-list li {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-soft, #4A4038);
}

.artifact-sources-list a {
  color: var(--heritage-red, #CC0000);
  text-decoration: none;
}

.artifact-sources-list a:hover {
  text-decoration: underline;
}

/* ── mobile adjustments ────────────────────────────────────────────── */

@media (max-width: 640px) {
  /* MOBILE POLISH (2026-07-08): slimmer topbar trigger on phones. Lives here
     (not 33-workspace.css) because this file loads after 33 — an override
     there would lose the cascade to the base .ws-research-trigger rule. */
  .ws-research-trigger {
    padding: 4px;
    font-size: 1rem;
  }

  .ws-research-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 32px);
    border-radius: var(--radius, 8px);
  }

  .ws-research-tab {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .ws-research-actions {
    flex-direction: column;
  }
}

/* ── Deep Research live progress (DEMO POLISH 2026-07-06) ─────────── */

.ws-rprog-steps {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-basis: 100%;
}

.ws-rprog-step {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-mute, #6B6560);
}

.ws-rprog-step.done   { color: var(--ink-soft, #4A4038); }
.ws-rprog-step.active { color: var(--heritage-red, #CC0000); font-weight: 600; }

.ws-rprog-ico {
  display: inline-flex;
  width: 16px;
  justify-content: center;
  flex: 0 0 16px;
}

.ws-rprog-step.done .ws-rprog-ico { color: var(--success, #2e7d32); font-weight: 700; }

.ws-rprog-spin {
  width: 10px;
  height: 10px;
  border: 2px solid var(--heritage-red, #CC0000);
  border-top-color: transparent;
  border-radius: 50%;
  animation: ws-rprog-rotate 0.8s linear infinite;
  display: inline-block;
}

@keyframes ws-rprog-rotate { to { transform: rotate(360deg); } }

.ws-rprog-detail {
  font-weight: 400;
  color: var(--ink-mute, #6B6560);
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

/* floating card (bottom-right of the workspace) */
.ws-rprog-card {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--warm-white, #FFFDF8);
  border: 1px solid var(--rule, #E5D9C4);
  border-left: 4px solid var(--heritage-red, #CC0000);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  padding: 12px 14px;
  animation: ws-rprog-in 0.22s ease-out;
}

@keyframes ws-rprog-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ws-rprog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ws-rprog-title { font-size: 0.9rem; font-weight: 700; color: var(--ink, #2C2520); }
.ws-rprog-title.done   { color: var(--success, #2e7d32); }
.ws-rprog-title.failed { color: var(--heritage-red, #CC0000); }

.ws-rprog-dismiss {
  border: none;
  background: none;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--ink-mute, #6B6560);
  cursor: pointer;
  padding: 2px 4px;
}

.ws-rprog-dismiss:hover { color: var(--ink, #2C2520); }

.ws-rprog-topic {
  font-size: 0.8rem;
  color: var(--ink-soft, #4A4038);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-rprog-error {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--heritage-red, #CC0000);
  line-height: 1.4;
}

.ws-rprog-card .ws-rprog-open { margin-top: 10px; width: 100%; }

@media (max-width: 640px) {
  .ws-rprog-card { right: 8px; bottom: 76px; width: calc(100vw - 16px); }
}

/* ═══════════════════════════════════════════════════════════════════
   A11Y + THEME HARDENING (2026-08-07 · polish-a11y P1-2 / P1-6 / F-04)

   Context for the next reader: this file was originally written against a
   different design system's vocabulary (--ink-400..900, --ink-border,
   --line, --eggshell-bg, --radius-md). None of those tokens were ever
   defined anywhere in the platform, so every var() silently fell through
   to its hardcoded hex. That had two consequences:
     1. Dark mode could not reach this file at all — 90-dark-mode.css
        remaps the REAL tokens scoped to [data-theme="dark"] .ws-root, and
        this file referenced none of them. Result: a blinding white modal.
     2. --ink-500 resolved to #666, #777 AND #888 in the same file.
   The var() references above are now remapped onto real tokens, which is
   the entire dark-mode fix — the modal mounts into #ws-root
   (research.js:105) so it inherits the scoped dark remap automatically.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Keyboard focus (P1-2) ──────────────────────────────────────────
   This file had ZERO :focus-visible rules (siblings: 33-workspace 13,
   53-workspaces 4, 34-artifacts 4). Keyboard users got no indication of
   position. Ring matches the platform idiom at 33-workspace.css:624. */
.ws-research-close:focus-visible,
.ws-research-tab:focus-visible,
.ws-research-btn-primary:focus-visible,
.ws-research-btn-secondary:focus-visible,
.ws-research-trigger:focus-visible,
.ws-research-open:focus-visible,
.ws-research-search-item:focus-visible,
.ws-research-input:focus-visible,
.ws-rprog-open:focus-visible,
.ws-rprog-dismiss:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--rule-gold);
}

/* ── Reduced motion rescue (P1-6) ───────────────────────────────────
   33-workspace.css:1575 kills animation wholesale for `.ws-root *`, and
   this overlay mounts inside #ws-root — so its spinners froze mid-arc
   with no rescue (unlike .ws-spinner, explicitly restored at :1582).
   Deep Research runs for minutes; a frozen spinner reads as "hung".
   Keep motion, just calmer. */
@media (prefers-reduced-motion: reduce) {
  .ws-rprog-spin {
    animation: ws-rprog-rotate 2.4s linear infinite !important;
  }
  /* The stepped ellipsis animates `content`, which reads as flicker.
     Freeze it at the full three dots rather than a random step. */
  .ws-research-loading::after {
    animation: none !important;
    content: '...';
  }
}

/* ── Dark-mode safety net ───────────────────────────────────────────
   research.js falls back to document.body when #ws-root is absent
   (:107, :423). In that path the .ws-root-scoped remap in
   90-dark-mode.css cannot apply, so re-point the same tokens for any
   research surface that ends up outside the workspace root. Scoped to
   these components only — no global ink remap (that carries the
   button-contrast risk documented in 90-dark-mode.css). */
[data-theme="dark"] .ws-research-modal-overlay,
[data-theme="dark"] .ws-rprog-card {
  --eggshell-bright: var(--bg-primary);
  --warm-white:      var(--surface);
  --ink-strong:      var(--text-primary);
  --ink:             var(--text-primary);
  --ink-soft:        var(--text-secondary);
  --ink-mute:        var(--text-muted);
  --rule:            var(--border-light);
}

/* Audit F2 2026-08-07: inputs keep literal #fff backgrounds; with light --ink-*
   in dark mode that is 1.10:1. Force surface + ink tokens. */
[data-theme="dark"] .ws-research-input,
[data-theme="dark"] .ws-research-select {
  background: var(--surface, #1a1b26);
  color: var(--text-primary, #F3F4F6);
  border-color: var(--border-light, #3B3F54);
}
[data-theme="dark"] .ws-badge-queued {
  background: var(--surface, #24253a);
  color: var(--text-secondary, #C8CAD8);
}

/* ── a11y: keyboard focus + reduced motion (2026-08-07) ─────────────────
   Escape/focus-return landed in research.js; these are the visual halves of
   the same contract. Without a focus ring the trap is invisible — the user is
   cycling through controls they cannot see. House convention: 2px heritage-red
   outline, 2px offset (04-components.css, 08-ai-tools.css).
   :focus-visible (not :focus) so mouse clicks don't paint rings. */

.ws-research-close:focus-visible,
.ws-research-tab:focus-visible,
.ws-research-btn:focus-visible,
.ws-research-input:focus-visible,
.ws-research-select:focus-visible,
.ws-rprog-dismiss:focus-visible,
.ws-rprog-open:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: 2px;
}

/* The dialog box itself takes focus only when it holds no focusable control
   (empty panel). Ring it too, otherwise focus looks lost. */
.ws-research-modal:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: -2px;
}

/* Vestibular safety. Two of these run INFINITELY (the stage spinner and the
   loading dots) for the whole multi-minute research job, so this is not
   cosmetic polish — it is the difference between a usable and a nauseating
   wait for motion-sensitive users. Progress must stay LEGIBLE, so the spinner
   keeps its shape and the dots keep a static '...' rather than vanishing. */
@media (prefers-reduced-motion: reduce) {
  .ws-research-modal-overlay { animation: none; }
  .ws-rprog-card { animation: none; }
  .ws-rprog-spin { animation: none; }
  .ws-research-loading::after { animation: none; content: '...'; }
  .ws-research-tab,
  .ws-research-btn,
  .ws-research-input,
  .ws-research-select,
  .ws-rprog-dismiss { transition: none; }
}
/* ============================================================
   41-mi-competitors.css
   Market Intelligence — Competitors (light editorial redesign,
   2026-07-05). Matches the AIOP design system: warm eggshell
   surfaces, Heritage Red / Gold accents, Playfair headlines.
   Replaces the earlier dark "terminal" inline styles.
   ============================================================ */

.mi-cmp-page {
  /* Threat palette tuned for light surfaces (AA on warm-white) */
  --thr-critical: #CC0000;
  --thr-high:     #B4531F;
  --thr-medium:   #8B6914;
  --thr-low:      #2D8C3C;
  --thr-watch:    #6B6560;
}

/* ── Toolbar ─────────────────────────────────────────────────── */
.mi-cmp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 18px;
}
.mi-cmp-toolbar .form-select { min-width: 150px; }
.mi-cmp-search { flex: 1; min-width: 200px; }

/* ── Primary-threat spotlight ────────────────────────────────── */
.mi-cmp-spotlight {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, 1.1fr) 1fr 1fr;
  gap: 20px;
  padding: 20px 22px 20px 26px;
  margin: 0 0 22px;
  background:
    linear-gradient(135deg, rgba(204, 0, 0, 0.045), rgba(212, 168, 67, 0.05) 70%, transparent),
    var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.mi-cmp-spotlight::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--heritage-red), var(--heritage-red-dark));
}
.mi-cmp-spotlight:hover {
  border-color: var(--rule-gold);
  box-shadow: var(--shadow);
}
.mi-cmp-spot-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--heritage-red);
  margin-bottom: 12px;
}
.mi-cmp-spot-label::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--heritage-red);
}
.mi-cmp-spot-head { display: flex; gap: 14px; align-items: center; }
.mi-cmp-spot-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--ink-strong);
  line-height: 1.15;
}
.mi-cmp-spot-hq { font-size: 0.82rem; color: var(--ink-mute); margin-top: 2px; }
.mi-cmp-spot-badges { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.mi-cmp-spot-rev { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.mi-cmp-spot-col-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 7px;
}
.mi-cmp-spot-counter .mi-cmp-spot-col-label { color: var(--heritage-gold-dark); }
.mi-cmp-spot-text { font-size: 0.88rem; line-height: 1.55; color: var(--ink-soft); }
.mi-cmp-spot-open {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--heritage-red);
}
.mi-cmp-spotlight:hover .mi-cmp-spot-open { text-decoration: underline; }

/* ── Tier sections ───────────────────────────────────────────── */
.mi-cmp-tier { margin: 0 0 24px; }
.mi-cmp-tier-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
}
.mi-cmp-tier-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--tier-color, var(--ink-faint));
  flex: none;
}
.mi-cmp-tier-name {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tier-color, var(--ink-mute));
}
.mi-cmp-tier-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 1px 8px;
}
.mi-cmp-tier-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--rule), transparent);
}

/* ── Watch List (research-only competitors) ──────────────────── */
.mi-cmp-watchlist {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid var(--rule);
}
.mi-cmp-watchlist-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink-strong);
  margin: 0 0 4px;
}
.mi-cmp-watchlist-desc {
  font-size: 0.86rem;
  color: var(--ink-mute);
  margin: 0 0 16px;
  max-width: 78ch;
}

/* ── Card grid ───────────────────────────────────────────────── */
.mi-cmp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}
.mi-cmp-card {
  position: relative;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.mi-cmp-card::before {
  /* Threat accent — slim top rule in the tier color */
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--threat, var(--ink-faint)), transparent 75%);
}
.mi-cmp-card:hover {
  transform: translateY(-2px);
  border-color: var(--rule-gold);
  box-shadow: var(--shadow);
}
.mi-cmp-selectable { outline: 2px dashed transparent; }
.mi-cmp-selected {
  outline: 2px solid var(--heritage-red);
  outline-offset: 2px;
}
.mi-cmp-check {
  position: absolute;
  top: 12px; right: 12px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--heritage-red);
  color: var(--warm-white);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  background: transparent;
  z-index: 2;
}
.mi-cmp-selected .mi-cmp-check { background: var(--heritage-red); }

.mi-cmp-card-head { display: flex; align-items: flex-start; gap: 12px; }
.mi-cmp-card-title { flex: 1; min-width: 0; }
.mi-cmp-name-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.mi-cmp-rank {
  flex: none;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-mute);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 2px 6px;
  font-variant-numeric: tabular-nums;
}
.mi-cmp-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.14rem;
  margin: 0 0 2px;
  line-height: 1.25;
  color: var(--ink-strong);
  overflow-wrap: anywhere;
}
.mi-cmp-hq { font-size: 0.79rem; color: var(--ink-mute); }

/* Logo tile — clean rounded square on paper */
.mi-cmp-logo {
  flex: none;
  border-radius: var(--radius);
  background: #FFFFFF;
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mi-cmp-logo img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 6px;
  box-sizing: border-box;
}
.mi-cmp-monogram {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: hsl(var(--mono-hue, 356), 55%, 32%);
  background: linear-gradient(160deg, hsl(var(--mono-hue, 356), 58%, 95%), hsl(var(--mono-hue, 356), 52%, 88%));
}

/* Threat badge — tinted pill, no glow */
.mi-threat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--threat, var(--ink-soft));
  background: color-mix(in srgb, var(--threat, var(--ink-mute)) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--threat, var(--ink-mute)) 30%, transparent);
}
.mi-threat-badge i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--threat, var(--ink-mute));
}
.mi-threat-proposed {
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--ink-mute);
  font-style: italic;
}

.mi-cmp-badge-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Meta facts strip */
.mi-cmp-meta {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 10px 16px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
}
.mi-cmp-meta-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  font-weight: 700;
  margin-bottom: 3px;
}
.mi-cmp-meta-val {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.mi-cmp-meta-sub { display: block; font-size: 0.72rem; font-weight: 400; color: var(--ink-mute); }

.mi-cmp-section-label {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  font-weight: 700;
  margin-top: 2px;
}
.mi-cmp-text { font-size: 0.86rem; line-height: 1.5; color: var(--ink-soft); }

/* Strength / vulnerability quick lines */
.mi-cmp-sv { display: flex; flex-direction: column; gap: 6px; }
.mi-cmp-sv-line {
  display: flex;
  gap: 8px;
  font-size: 0.83rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.mi-cmp-sv-line i {
  flex: none;
  font-style: normal;
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.5;
}
.mi-cmp-sv-plus i { color: var(--success); }
.mi-cmp-sv-minus i { color: var(--heritage-red); }

/* Pills */
.mi-cmp-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.mi-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.mi-pill-brand {
  background: rgba(204, 0, 0, 0.06);
  border-color: rgba(204, 0, 0, 0.18);
  color: var(--heritage-red-dark);
}
.mi-pill-channel {
  background: rgba(212, 168, 67, 0.12);
  border-color: rgba(212, 168, 67, 0.35);
  color: var(--heritage-gold-dark);
}
.mi-pill-presence {
  background: rgba(45, 140, 60, 0.08);
  border-color: rgba(45, 140, 60, 0.25);
  color: var(--success-deep);
}
.mi-pill-category {
  background: rgba(91, 44, 138, 0.07);
  border-color: rgba(91, 44, 138, 0.2);
  color: var(--heritage-purple);
}
.mi-pill-more {
  background: var(--paper);
  border-color: var(--rule);
  color: var(--ink-mute);
}

.mi-cmp-card-foot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--rule-soft);
}
.mi-cmp-expand-btn {
  background: none;
  border: none;
  color: var(--heritage-red);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  padding: 2px 0 0;
}
.mi-cmp-expand-btn:hover { text-decoration: underline; color: var(--heritage-red-dark); }

/* ── Empty / loading ─────────────────────────────────────────── */
.mi-cmp-empty {
  padding: 44px 20px;
  text-align: center;
  border: 1px dashed var(--rule);
  border-radius: var(--radius-lg);
  color: var(--ink-mute);
  background: var(--warm-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.mi-cmp-empty-title { font-size: 0.95rem; }
.mi-cmp-shimmer {
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, var(--eggshell-shade) 30%, var(--paper) 50%, var(--eggshell-shade) 70%);
  background-size: 200% 100%;
  animation: miCmpShimmer 1.4s linear infinite;
}
@keyframes miCmpShimmer { to { background-position: -200% 0; } }

/* ── Compare bar (sticky) ────────────────────────────────────── */
.mi-cmp-compare-bar {
  position: sticky;
  bottom: 14px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  background: var(--warm-white);
  border: 1px solid var(--rule-gold);
  box-shadow: var(--shadow-lg);
  z-index: 5;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}
.mi-cmp-compare-bar[hidden] { display: none; }

/* ── Dossier modal body ──────────────────────────────────────── */
.mi-cmp-dossier { display: flex; flex-direction: column; gap: 16px; }
.mi-cmp-dossier-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mi-cmp-dossier-id { flex: 1; min-width: 150px; }
.mi-cmp-dossier-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--ink-strong);
}
.mi-cmp-dossier-hq { font-size: 0.8rem; color: var(--ink-mute); margin-top: 2px; }
.mi-cmp-dossier-badges { display: flex; gap: 8px; flex-wrap: wrap; }

.mi-cmp-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.mi-cmp-fact {
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.mi-cmp-dossier-sec { display: flex; flex-direction: column; gap: 8px; }

/* Narrative blocks: overview / moat / weakness / counter / rationale */
.mi-cmp-block {
  padding: 13px 16px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-left: 3px solid var(--ink-faint);
}
.mi-cmp-block-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.mi-cmp-block-text { font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; color: var(--ink); }
.mi-cmp-block-moat { border-left-color: var(--heritage-gold); }
.mi-cmp-block-moat .mi-cmp-block-label { color: var(--heritage-gold-dark); }
.mi-cmp-block-weak { border-left-color: var(--success); background: rgba(45, 140, 60, 0.05); }
.mi-cmp-block-weak .mi-cmp-block-label { color: var(--success-deep); }
.mi-cmp-block-counter { border-left-color: var(--heritage-red); background: rgba(204, 0, 0, 0.04); }
.mi-cmp-block-counter .mi-cmp-block-label { color: var(--heritage-red); }
.mi-cmp-block-rationale { border-left-color: var(--heritage-purple); }
.mi-cmp-block-rationale .mi-cmp-block-label { color: var(--heritage-purple); }

/* Strengths / vulnerabilities two-column lists */
.mi-cmp-sv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.mi-cmp-sv-panel {
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--warm-white);
}
.mi-cmp-sv-panel ul { margin: 6px 0 0; padding: 0 0 0 2px; list-style: none; }
.mi-cmp-sv-panel li {
  display: flex;
  gap: 8px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-soft);
  padding: 3px 0;
}
.mi-cmp-sv-panel li::before { font-weight: 700; flex: none; }
.mi-cmp-sv-strengths li::before { content: '+'; color: var(--success); }
.mi-cmp-sv-vulns li::before { content: '–'; color: var(--heritage-red); }

/* Recent moves timeline */
.mi-cmp-moves { margin: 6px 0 0; padding: 0; list-style: none; }
.mi-cmp-moves li {
  position: relative;
  padding: 4px 0 4px 18px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.mi-cmp-moves li::before {
  content: '';
  position: absolute;
  left: 2px; top: 11px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--heritage-gold);
}

.mi-cmp-signals-link { color: var(--heritage-red); font-weight: 700; font-size: 0.88rem; text-decoration: none; }
.mi-cmp-signals-link:hover { text-decoration: underline; }

/* ── Compare table (clean .data-table treatment) ─────────────── */
.mi-cmp-compare-wrap { overflow-x: auto; }
.mi-cmp-compare-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.mi-cmp-compare-table th,
.mi-cmp-compare-table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
  text-align: left;
  min-width: 160px;
  color: var(--ink);
  line-height: 1.5;
}
.mi-cmp-compare-table thead th { border-bottom: 2px solid var(--rule); }
.mi-cmp-compare-table tbody tr:hover td { background: var(--paper); }
.mi-cmp-compare-table td:first-child,
.mi-cmp-compare-table th:first-child {
  min-width: 130px;
  position: sticky;
  left: 0;
  background: var(--warm-white);
  z-index: 1;
}
.mi-cmp-compare-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-mute) !important;
  font-weight: 700;
  white-space: nowrap;
}
.mi-cmp-compare-head { display: flex; align-items: center; gap: 11px; }
.mi-cmp-compare-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-strong);
  margin-bottom: 5px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .mi-cmp-spotlight { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 560px) {
  .mi-cmp-grid { grid-template-columns: 1fr; }
  .mi-cmp-compare-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .mi-cmp-toolbar .form-select { flex: 1 1 44%; min-width: 0; }
  .mi-cmp-search { flex: 1 1 100%; order: 1; }
  .mi-cmp-toolbar .btn { flex: 1 1 44%; justify-content: center; order: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .mi-cmp-card:hover, .mi-cmp-spotlight:hover { transform: none; }
  .mi-cmp-shimmer { animation: none; }
}
/* ============================================================
   42-market-research.css
   Market Research module (2026-07-07). Deep-research desk with
   region presets. Matches the AIOP design system: warm eggshell
   surfaces, Heritage Red / Gold accents.
   ============================================================ */

/* ── Tabs ────────────────────────────────────────────────────── */
.mr-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0;
}
.mr-tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-mute);
  cursor: pointer;
  white-space: nowrap;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.mr-tab:hover { color: var(--ink); }
.mr-tab:focus-visible {
  outline: 2px solid var(--heritage-gold);
  outline-offset: -2px;
}
.mr-tab.active {
  color: var(--heritage-red);
  border-bottom-color: var(--heritage-red);
}

.mr-intro { margin: 4px 0 12px; font-size: 0.92rem; }

/* ── Launch bar (region selector) ────────────────────────────── */
.mr-launch-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.mr-region-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mr-region-select { min-width: 220px; }

/* ── Template / competitor card grid ─────────────────────────── */
.mr-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.mr-tpl-card {
  position: relative;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.mr-tpl-card:hover {
  border-color: var(--heritage-gold);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.mr-tpl-card:focus-visible {
  outline: 2px solid var(--heritage-gold);
  outline-offset: 2px;
}
.mr-tpl-card.selected {
  border-color: var(--heritage-red);
  box-shadow: 0 0 0 1px var(--heritage-red);
}
.mr-tpl-icon { font-size: 22px; margin-bottom: 6px; }
.mr-tpl-name { font-weight: 700; margin-bottom: 4px; }
.mr-tpl-desc { font-size: 0.85rem; line-height: 1.4; }
.mr-tpl-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--heritage-gold-dark);
  background: rgba(212, 168, 67, 0.16);
  border: 1px solid rgba(212, 168, 67, 0.45);
  border-radius: 10px;
  padding: 2px 8px;
}

/* ── Launch form ─────────────────────────────────────────────── */
.mr-launch-form { margin-top: 14px; padding: 16px; }
.mr-launch-tpl-name { font-weight: 700; margin-bottom: 10px; }
.mr-topic { width: 100%; resize: vertical; margin-top: 6px; }
.mr-launch-actions { margin-top: 12px; display: flex; justify-content: flex-end; }

/* ── Job / progress card ─────────────────────────────────────── */
.mr-running { margin-top: 14px; }
.mr-job-card { padding: 14px 16px; }
.mr-job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.mr-job-topic { font-weight: 600; }
.mr-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 10px;
  padding: 2px 10px;
  white-space: nowrap;
}
.mr-badge-queued  { color: var(--ink-mute); background: rgba(107, 101, 96, 0.12); }
.mr-badge-running { color: var(--heritage-gold-dark); background: rgba(212, 168, 67, 0.18); }
.mr-badge-done    { color: var(--success); background: rgba(45, 140, 60, 0.12); }
.mr-badge-failed  { color: var(--heritage-red); background: rgba(204, 0, 0, 0.10); }

/* Pass B L3: Library posture badges (lead|enter only, enum-gated in JS).
   Dark overrides live in 90-dark-mode.css (audit L2 — keep dark rules centralized). */
.mr-badge-posture-lead  { color: var(--heritage-gold-dark); background: rgba(212,168,67,.16); border: 1px solid rgba(212,168,67,.4); }
.mr-badge-posture-enter { color: var(--heritage-red); background: rgba(204,0,0,.08); border: 1px solid rgba(204,0,0,.25); }

.mr-prog-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mr-prog-step { font-size: 0.85rem; color: var(--ink-mute); display: flex; gap: 8px; align-items: center; }
.mr-prog-step.done   { color: var(--success); }
.mr-prog-step.active { color: var(--ink); font-weight: 600; }
.mr-prog-ico { width: 16px; text-align: center; }
.mr-prog-step.active .mr-prog-ico { animation: mr-spin 1.2s linear infinite; display: inline-block; }
@keyframes mr-spin { to { transform: rotate(360deg); } }

.mr-error { padding: 14px 16px; color: var(--heritage-red); }
.mr-error-text { color: var(--heritage-red); font-size: 0.85rem; }

/* ── Empty / error states (icon + message + optional CTA) ───── */
.mr-empty { padding: 40px 24px; }
.mr-empty-msg { margin: 0 0 4px; color: var(--ink-mute); font-size: 0.92rem; }
.mr-empty .btn { margin-top: 10px; }
.mr-empty-error .empty-icon { color: var(--heritage-red); opacity: 0.55; }

/* ── Tab-switch fade (subtle; disabled for reduced motion) ──── */
.mr-fade-in { animation: mr-fade 0.18s ease; }
@keyframes mr-fade { from { opacity: 0.35; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .mr-fade-in { animation: none; }
  .mr-prog-step.active .mr-prog-ico { animation: none; }
  .mr-tpl-card:hover { transform: none; }
}

/* ── Competitive Intelligence cards ──────────────────────────── */
.mr-comp-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.mr-comp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mr-comp-name { font-weight: 700; }
.mr-comp-card { transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.mr-comp-card:hover { border-color: var(--heritage-gold); box-shadow: var(--shadow-sm); }
.mr-comp-region {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--heritage-gold-dark);
  white-space: nowrap;
}
.mr-comp-focus { font-size: 0.85rem; line-height: 1.4; }
.mr-comp-posture {
  font-size: 0.8rem;
  line-height: 1.4;
  border-left: 3px solid var(--heritage-gold);
  padding: 4px 10px;
  background: rgba(212, 168, 67, 0.08);
}
.mr-comp-actions { margin-top: auto; display: flex; justify-content: flex-end; }

/* ── Library ─────────────────────────────────────────────────── */
.mr-lib-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin: 0 0 10px;
}
.mr-lib-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 160px;
}
.mr-lib-filter .mr-region-label {
  margin: 0;
}
.mr-lib-filter .filter-select,
.mr-lib-filter .mr-region-select {
  width: 100%;
  min-width: 0;
}
.mr-lib-list { margin-top: 4px; }
.mr-lib-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  transition: border-color 0.15s ease;
}
.mr-lib-row:hover { border-color: var(--heritage-gold); }
.mr-lib-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
/* Badges inside the library main column must not stretch full-width
   (column flex default align-items:stretch turned chips into bars) */
.mr-lib-main .mr-badge { align-self: flex-start; }
.mr-lib-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.mr-lib-badges:empty { display: none; }
.mr-lib-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}
.mr-lib-topic {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mr-lib-meta { font-size: 0.8rem; }

/* ── Report viewer modal ─────────────────────────────────────── */
.mr-report-actions { display: flex; justify-content: flex-end; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.mr-report-md { line-height: 1.55; }
.mr-report-md table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 0.88rem; display: block; overflow-x: auto; }
.mr-report-md th, .mr-report-md td { border: 1px solid var(--rule); padding: 6px 10px; text-align: left; }
.mr-report-md th { background: rgba(212, 168, 67, 0.10); }
.mr-report-md h2 { margin-top: 20px; }

/* Mobile rules live in 97-mobile-optimize.css (single source, 640px). */

/* ── Category posture radio (PASS B B1) ──────────────────────── */
.mr-posture { border: none; margin: 10px 0 0; padding: 0; }
.mr-posture legend { padding: 0; margin-bottom: 4px; }
.mr-posture-option {
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 0; cursor: pointer;
}
.mr-posture-option input { flex: none; }
.mr-posture-name { font-weight: 600; font-size: 0.9rem; }
.mr-posture-desc { font-size: 0.8rem; }

/* ── Competitor watchlist chips (PASS B B3) ──────────────────── */
.mr-watchlist {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 8px 0 12px;
}
.mr-watchlist:empty { display: none; }
.mr-watchlist-label { font-size: 0.8rem; }
.mr-watch-chip {
  border: 1px solid var(--rule);
  background: rgba(212, 168, 67, 0.08);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.mr-watch-chip:hover, .mr-watch-chip:focus-visible {
  border-color: var(--heritage-gold);
  background: rgba(212, 168, 67, 0.18);
}
/* watch-chip mobile sizing moved to 97-mobile-optimize.css */

/* Pending watchlist note (Canada preset, 2026-08-17) — shown INSTEAD of the
   chip row when the market team still owes us the competitor list, so an
   empty row never reads as "this market has no competitors". The parent
   .mr-watchlist has :empty { display:none }, so this child is what makes
   the row visible at all. */
.mr-watchlist-pending {
  font-size: 0.8rem;
  color: var(--warning, #C68A1F);
  background: rgba(198, 138, 31, 0.1);
  border: 1px dashed rgba(198, 138, 31, 0.42);
  border-radius: 8px;
  padding: 6px 12px;
  line-height: 1.45;
}

/* ── H-2 (Pass C): pipeline badge + source filter ──────────────── */
/* Theme-safe: house badge palette + [data-theme="dark"] override in
   90-dark-mode.css. Was @media (prefers-color-scheme: dark) with an
   undefined --surface-2 var → OS-dark phones got a #334155 slate strip
   with dark light-theme text on light eggshell cards (solid dark bar). */
.mr-badge-pipeline {
  color: var(--ink-mute);
  background: rgba(107, 101, 96, 0.12);
  border: 1px solid rgba(107, 101, 96, 0.22);
}
.mr-view-run {
  font-size: 0.78rem;
  color: var(--link, #2563eb);
  text-decoration: none;
  white-space: nowrap;
  margin-left: 8px;
}
.mr-view-run:hover { text-decoration: underline; }
/* ============================================================
   43-marketing-pipeline.css
   Marketing Pipeline module (2026-07-08). Stage-gated multi-agent
   marketing funnel. Matches the AIOP design system: warm eggshell
   surfaces, Heritage Red / Gold accents.
   ============================================================ */

/* ── Toolbar / launch form ───────────────────────────────────── */
.mp-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.mp-launch-form { padding: 16px; margin-bottom: 14px; }
.mp-form-grid {
  display: grid;
  grid-template-columns: 2fr 1.4fr 2fr;
  gap: 12px;
}
.mp-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.mp-form-note { margin: 10px 0 0; font-size: 0.83rem; }
/* Region note under the market picker (Canada preset, 2026-08-17): warns
   BEFORE launch that this region's competitor list is still pending, so the
   empty competitor section in Stage 5 reads as a known gap, not a finding.
   :empty collapses it for every region whose list is real. */
.mp-region-note {
  margin-top: 6px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--warning, #C68A1F);
}
.mp-region-note:empty { display: none; }
.mp-launch-actions { margin-top: 12px; display: flex; justify-content: flex-end; gap: 8px; }

/* ── Run list rows ───────────────────────────────────────────── */
.mp-run-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.mp-run-row:hover { border-color: var(--heritage-gold); }
.mp-run-row:focus-visible { outline: 2px solid var(--heritage-gold); outline-offset: 2px; }
.mp-run-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mp-run-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.mp-run-meta { font-size: 0.8rem; }

/* ── Status badges ───────────────────────────────────────────── */
.mp-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 10px;
  padding: 2px 10px;
  white-space: nowrap;
}
.mp-badge-pending         { color: var(--ink-mute); background: rgba(107, 101, 96, 0.12); }
.mp-badge-skipped         { color: var(--ink-mute); background: rgba(107, 101, 96, 0.10); border: 1px dashed rgba(107, 101, 96, 0.35); }
.mp-badge-running         { color: var(--heritage-gold-dark); background: rgba(212, 168, 67, 0.18); }
.mp-badge-awaiting_review { color: var(--heritage-gold-dark); background: rgba(212, 168, 67, 0.25); border: 1px solid rgba(212, 168, 67, 0.5); }
.mp-badge-approved        { color: var(--success); background: rgba(45, 140, 60, 0.12); }
.mp-badge-completed       { color: var(--success); background: rgba(45, 140, 60, 0.14); }
.mp-badge-failed          { color: var(--heritage-red); background: rgba(204, 0, 0, 0.10); }
.mp-badge-archived        { color: var(--ink-mute); background: rgba(107, 101, 96, 0.10); }

/* ── Run head card (detail) ──────────────────────────────────── */
.mp-run-head-card { padding: 14px 16px; margin-bottom: 14px; }
.mp-run-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mp-run-title-lg { font-weight: 700; font-size: 1.05rem; }

/* ── Funnel (7 stage cards) ──────────────────────────────────── */
.mp-funnel {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.mp-stage-card {
  background: var(--surface, #fff);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm, 8px);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mp-stage-card:hover { border-color: var(--heritage-gold); box-shadow: var(--shadow-sm); }
.mp-stage-card:focus-visible { outline: 2px solid var(--heritage-gold); outline-offset: 2px; }
.mp-stage-card.selected { border-color: var(--heritage-red); box-shadow: 0 0 0 1px var(--heritage-red); }
.mp-stage-card.mp-stage-soon { opacity: 0.55; cursor: default; }
.mp-stage-card.mp-stage-soon:hover { border-color: var(--rule); box-shadow: none; }
.mp-stage-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(204, 0, 0, 0.08);
  color: var(--heritage-red);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
}
.mp-stage-soon .mp-stage-num { background: rgba(107, 101, 96, 0.12); color: var(--ink-mute); }
.mp-stage-name { font-weight: 600; font-size: 0.82rem; line-height: 1.25; min-height: 2.5em; }

/* ── Stage review panel ──────────────────────────────────────── */
.mp-stage-panel { padding: 16px; }
.mp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.mp-panel-title { font-weight: 700; }
.mp-panel-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mp-gate-actions { border-top: 1px solid var(--rule); padding-top: 12px; }
.mp-approved-note { margin: 10px 0 0; font-size: 0.83rem; }
.mp-edited-banner {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--heritage-gold-dark);
}
.mp-running-row { display: flex; align-items: center; gap: 8px; color: var(--ink-mute); }
.mp-spinner { display: inline-block; animation: mp-spin 1.2s linear infinite; }
@keyframes mp-spin { to { transform: rotate(360deg); } }

/* ── Artifact (markdown) ─────────────────────────────────────── */
.mp-artifact { line-height: 1.55; max-height: 520px; overflow-y: auto; padding-right: 6px; }
.mp-artifact table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 0.88rem; display: block; overflow-x: auto; }
.mp-artifact th, .mp-artifact td { border: 1px solid var(--rule); padding: 6px 10px; text-align: left; }
.mp-artifact th { background: rgba(212, 168, 67, 0.10); }
.mp-artifact h1 { font-size: 1.15rem; }
.mp-artifact h2 { margin-top: 18px; font-size: 1.02rem; }

/* ── Concept picker ──────────────────────────────────────────── */
.mp-concept-picker {
  margin-top: 12px;
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mp-concept-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.mp-concept-option:hover { border-color: var(--heritage-gold); }
.mp-concept-option:has(input:checked) { border-color: var(--heritage-red); box-shadow: 0 0 0 1px var(--heritage-red); }
.mp-concept-name { font-weight: 600; flex: 1; }
.mp-concept-score { font-size: 0.82rem; white-space: nowrap; }

/* ── Editor ──────────────────────────────────────────────────── */
.mp-edit-block { margin-top: 12px; border-top: 1px solid var(--rule); padding-top: 12px; }
.mp-edit-json {
  width: 100%;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.8rem;
  resize: vertical;
}

/* ── Errors / empty states ───────────────────────────────────── */
.mp-error { padding: 10px 14px; margin-top: 10px; color: var(--heritage-red); font-size: 0.88rem; }
.mp-error-text { color: var(--heritage-red); font-size: 0.85rem; margin-bottom: 4px; }
.mp-empty { padding: 40px 24px; }
.mp-empty-msg { margin: 0 0 4px; color: var(--ink-mute); font-size: 0.92rem; }
.mp-empty .btn { margin-top: 10px; }
.mp-empty-error .empty-icon { color: var(--heritage-red); opacity: 0.55; }

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .mp-spinner { animation: none; }
}

/* ── Mobile (390px target) ───────────────────────────────────── */
@media (max-width: 720px) {
  .mp-funnel {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(132px, 1fr);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .mp-funnel::-webkit-scrollbar { display: none; }
  .mp-form-grid { grid-template-columns: 1fr; }
  .mp-launch-actions .btn { flex: 1; min-height: 44px; }
  .mp-run-row { flex-wrap: wrap; }
  .mp-panel-actions .btn { min-height: 44px; flex: 1; }
  .mp-run-head { flex-wrap: wrap; }
  .mp-artifact { max-height: 400px; }
}

/* ── Dark mode ───────────────────────────────────────────────── */
[data-theme="dark"] .mp-stage-card { background: var(--surface-2, #1e1c1a); }
[data-theme="dark"] .mp-artifact th { background: rgba(212, 168, 67, 0.14); }
[data-theme="dark"] .mp-badge-pending,
[data-theme="dark"] .mp-badge-skipped,
[data-theme="dark"] .mp-badge-archived { color: var(--ink-mute); background: rgba(200, 195, 190, 0.12); }

/* ════════════════════════════════════════════════════════════════
   STAGE 3 — Synthetic Consumer Panel (mp-s3-*)
   Concurrent-build namespace: this block is owned by the Stage 3
   build; stages 5/6/7 use their own prefixes.
   ════════════════════════════════════════════════════════════════ */

/* ── Progress (running state) ────────────────────────────────── */
.mp-s3-progress { margin-top: 12px; }
.mp-s3-progress-bar {
  height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--surface-2, #efece8);
}
.mp-s3-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--heritage-red, #cc0000), var(--gold, #d4a843));
  border-radius: 4px; transition: width 0.6s ease;
}
.mp-s3-progress-text { margin-top: 6px; font-size: 0.82rem; }

/* ── Results shell ───────────────────────────────────────────── */
.mp-s3-results { display: flex; flex-direction: column; gap: 18px; margin-bottom: 12px; }
.mp-s3-method {
  padding: 10px 14px; font-size: 0.84rem; line-height: 1.45;
  border-left: 3px solid var(--gold, #d4a843);
  background: rgba(212, 168, 67, 0.08); border-radius: 0 6px 6px 0;
  color: var(--ink-mute);
}
.mp-s3-stats { font-size: 0.82rem; }
.mp-s3-section-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 10px; }
.mp-s3-pick-note { font-size: 0.82rem; margin: -4px 0 10px; }

/* ── Persona cards ───────────────────────────────────────────── */
.mp-s3-personas {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px;
}
.mp-s3-persona-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px; border: 1px solid var(--border, #e5e0da); border-radius: 8px;
  background: var(--surface-1, #fff);
}
.mp-s3-avatar {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.5px;
}
.mp-s3-persona-body { min-width: 0; }
.mp-s3-persona-name { font-weight: 600; font-size: 0.9rem; }
.mp-s3-persona-meta { font-size: 0.78rem; margin: 2px 0 4px; }
.mp-s3-persona-drivers {
  font-size: 0.8rem; color: var(--ink-mute); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── Tables (ranking + heatmap) ──────────────────────────────── */
.mp-s3-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mp-s3-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.mp-s3-table th {
  text-align: left; padding: 8px 10px; font-weight: 600;
  background: rgba(212, 168, 67, 0.10); white-space: nowrap;
}
.mp-s3-table td { padding: 8px 10px; border-bottom: 1px solid var(--border, #eee8e2); }
.mp-s3-winner-row { background: rgba(212, 168, 67, 0.07); }
.mp-s3-winner-tag {
  display: inline-block; margin-left: 6px; padding: 1px 8px;
  font-size: 0.7rem; font-weight: 700; border-radius: 10px;
  color: #fff; background: var(--heritage-red, #cc0000); vertical-align: middle;
}
.mp-s3-sig { font-size: 0.78rem; color: var(--ink-mute); white-space: nowrap; }

/* Heatmap cells: 5 quantile buckets, low → high appeal. */
.mp-s3-heatmap td { text-align: center; }
.mp-s3-heat-name { text-align: left !important; font-weight: 600; white-space: nowrap; }
.mp-s3-heat-cell { font-weight: 600; min-width: 52px; }
.mp-s3-heat-na { color: var(--ink-mute); }
.mp-s3-heat-q1 { background: rgba(204, 0, 0, 0.16); }
.mp-s3-heat-q2 { background: rgba(204, 0, 0, 0.07); }
.mp-s3-heat-q3 { background: rgba(212, 168, 67, 0.10); }
.mp-s3-heat-q4 { background: rgba(76, 145, 65, 0.14); }
.mp-s3-heat-q5 { background: rgba(76, 145, 65, 0.26); }

/* ── Focus group + raw report ────────────────────────────────── */
.mp-s3-fg summary, .mp-s3-raw summary {
  cursor: pointer; font-weight: 600; font-size: 0.9rem; padding: 6px 0;
}
.mp-s3-fg-body { padding: 8px 0 0; }
.mp-s3-fg-summary { font-size: 0.88rem; line-height: 1.5; }
.mp-s3-fg-themes { margin: 8px 0; font-size: 0.84rem; }
.mp-s3-theme-chip {
  display: inline-block; margin: 2px 4px 2px 0; padding: 2px 10px;
  font-size: 0.76rem; border-radius: 12px;
  background: rgba(212, 168, 67, 0.14); color: var(--ink, #2c2a26);
}
.mp-s3-fg-transcript {
  max-height: 360px; overflow-y: auto; padding: 10px 12px;
  border: 1px solid var(--border, #e5e0da); border-radius: 8px;
  background: var(--surface-2, #faf8f5);
}
.mp-s3-fg-turn { margin: 0 0 10px; font-size: 0.85rem; line-height: 1.45; }
.mp-s3-raw { margin-top: 4px; }

/* ── Mobile (390px target) ───────────────────────────────────── */
@media (max-width: 720px) {
  .mp-s3-personas { grid-template-columns: 1fr; }
  .mp-s3-table { font-size: 0.8rem; }
  .mp-s3-table th, .mp-s3-table td { padding: 6px 8px; }
}

/* ── Dark mode ───────────────────────────────────────────────── */
[data-theme="dark"] .mp-s3-persona-card { background: var(--surface-2, #1e1c1a); }
[data-theme="dark"] .mp-s3-progress-bar { background: rgba(200, 195, 190, 0.14); }
[data-theme="dark"] .mp-s3-fg-transcript { background: rgba(200, 195, 190, 0.06); }
[data-theme="dark"] .mp-s3-table th { background: rgba(212, 168, 67, 0.14); }
[data-theme="dark"] .mp-s3-heat-q1 { background: rgba(204, 0, 0, 0.30); }
[data-theme="dark"] .mp-s3-heat-q5 { background: rgba(76, 145, 65, 0.34); }

/* ============================================================
   Stage 5/6/7 components (mp-s5-* / mp-s6-* / mp-s7-*)
   Content Localization · Media Reporting · Brand Performance
   ============================================================ */

/* ── Shared ──────────────────────────────────────────────────── */
.mp-mini-list { margin: 4px 0 8px; padding-left: 18px; font-size: 0.86rem; line-height: 1.5; }
.mp-mini-list li { margin-bottom: 2px; }
.mp-raw-artifact { margin-top: 12px; border-top: 1px solid var(--rule); padding-top: 10px; }
.mp-raw-artifact > summary { cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--ink-mute); }
.mp-raw-artifact[open] > summary { margin-bottom: 8px; }

/* ── Stage 5: localization market cards ──────────────────────── */
/* Pending-competitor-list banner (Canada preset, 2026-08-17). Sits above the
   market cards when the region's list is owed by the market team — the
   missing "local competitors addressed" chips are labelled as a known gap. */
.mp-s5-pending {
  border: 1px dashed rgba(198, 138, 31, 0.42);
  background: rgba(198, 138, 31, 0.1);
  color: var(--warning, #C68A1F);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 10px;
}
.mp-s5-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 6px;
}
.mp-s5-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm, 8px);
  padding: 12px 14px;
  background: var(--surface, #fff);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mp-s5-head { display: flex; align-items: center; gap: 8px; }
.mp-s5-flag { font-size: 1.3rem; line-height: 1; }
.mp-s5-country { font-weight: 700; flex: 1; }
.mp-s5-lang {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--heritage-gold-dark);
  background: rgba(212, 168, 67, 0.16);
  border-radius: 8px;
  padding: 2px 8px;
  white-space: nowrap;
}
.mp-s5-tagline {
  margin: 0;
  padding: 6px 10px;
  border-left: 3px solid var(--heritage-red);
  background: rgba(204, 0, 0, 0.04);
  font-style: italic;
  font-size: 0.9rem;
}
.mp-s5-section { font-size: 0.85rem; }
.mp-s5-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  margin-bottom: 3px;
}
.mp-s5-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.mp-s5-chip {
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(107, 101, 96, 0.10);
  white-space: nowrap;
}
.mp-s5-chip-comp { background: rgba(204, 0, 0, 0.08); color: var(--heritage-red); }
.mp-s5-chip-dish { background: rgba(212, 168, 67, 0.14); color: var(--heritage-gold-dark); }

/* ── Pass A brand identity surfaces ────────────────────────── */
.mp-s4-register { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.mp-register-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.8rem; font-weight: 600;
  padding: 3px 12px; border-radius: 12px; white-space: nowrap;
}
.mp-register-golden_plaque { background: rgba(212, 168, 67, 0.16); color: var(--heritage-gold-dark); border: 1px solid rgba(212, 168, 67, 0.4); }
.mp-register-red_bridge { background: rgba(204, 0, 0, 0.08); color: var(--heritage-red); border: 1px solid rgba(204, 0, 0, 0.25); }
.mp-register-notes { font-size: 0.8rem; }
.mp-lane-badge {
  font-size: 0.72rem; font-weight: 600;
  padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}
.mp-lane-diaspora { background: rgba(91, 44, 138, 0.10); color: var(--heritage-purple, #5B2C8A); }
.mp-lane-mainstream { background: rgba(45, 140, 60, 0.10); color: #2D8C3C; }
.mp-lane-bridge { background: rgba(212, 168, 67, 0.14); color: var(--heritage-gold-dark); }
[data-theme="dark"] .mp-s5-chip-dish { background: rgba(212, 168, 67, 0.2); color: #e8c87a; }
[data-theme="dark"] .mp-register-golden_plaque { background: rgba(212, 168, 67, 0.2); color: #e8c87a; }
[data-theme="dark"] .mp-register-red_bridge { background: rgba(204, 0, 0, 0.18); color: #ff9b9b; }
[data-theme="dark"] .mp-lane-diaspora { background: rgba(91, 44, 138, 0.3); color: #c9a8ee; }
[data-theme="dark"] .mp-lane-mainstream { background: rgba(45, 140, 60, 0.22); color: #7fd28c; }
[data-theme="dark"] .mp-lane-bridge { background: rgba(212, 168, 67, 0.2); color: #e8c87a; }

.mp-s5-notes { border-top: 1px dashed var(--rule); padding-top: 8px; margin-top: auto; }
.mp-s5-notes > summary { cursor: pointer; font-size: 0.8rem; font-weight: 600; color: var(--heritage-gold-dark); }
.mp-s5-notes[open] > summary { margin-bottom: 6px; }
.mp-s5-tone { font-size: 0.84rem; margin: 6px 0; }
.mp-s5-reg li { color: var(--heritage-red); }

/* ── Stage 6: measurement dashboard ──────────────────────────── */
.mp-s6-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  margin: 14px 0 6px;
}
.mp-s6-sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm, 8px);
  margin-bottom: 12px;
}
.mp-s6-sources .mp-s6-label { margin: 0; }
.mp-s6-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(107, 101, 96, 0.08);
}
.mp-s6-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.mp-s6-dot.on { background: var(--success, #2d8c3c); box-shadow: 0 0 0 3px rgba(45, 140, 60, 0.15); }
.mp-s6-dot.off { background: var(--ink-mute); opacity: 0.5; }
.mp-s6-status { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--ink-mute); }
.mp-s6-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.mp-s6-kpi {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 12px;
  background: var(--surface, #fff);
}
.mp-s6-kpi { min-width: 0; }
.mp-s6-kpi-name { font-weight: 700; font-size: 0.88rem; overflow-wrap: anywhere; }
.mp-s6-kpi-target { color: var(--heritage-red); font-weight: 700; font-size: 0.94rem; margin: 2px 0; overflow-wrap: anywhere; }
.mp-s6-kpi-def { font-size: 0.78rem; line-height: 1.4; overflow-wrap: anywhere; }
/* Feedback #23 PR-B: KPI selection + per-KPI benchmark/lever chrome */
.mp-s6-kpi-help { font-size: 0.8rem; margin: 0 0 8px; }
.mp-s6-kpi-pick {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase;
  color: var(--ink-mute); margin-bottom: 4px; cursor: pointer;
}
.mp-s6-kpi-bench { font-size: 0.76rem; margin-top: 4px; overflow-wrap: anywhere; }
.mp-s6-kpi-levers { font-size: 0.72rem; margin-top: 2px; overflow-wrap: anywhere; }
.mp-s6-kpi-untracked { opacity: 0.55; }
/* Feedback #23 PR-D: KPI results tracking table */
.mp-s6-track { margin-top: 14px; }
.mp-s6-track-scroll { overflow-x: auto; }
.mp-s6-track-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.mp-s6-track-table th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--ink-mute); padding: 6px 8px;
  border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.mp-s6-track-table td {
  padding: 6px 8px; border-bottom: 1px dashed var(--rule);
  vertical-align: middle; min-width: 0; overflow-wrap: anywhere;
}
.mp-s6-track-name { font-weight: 700; }
.mp-s6-track-table .form-input { min-width: 130px; font-size: 0.8rem; padding: 4px 8px; }
.mp-s6-var { font-weight: 700; font-size: 0.76rem; white-space: nowrap; }
.mp-s6-var-on { color: var(--success, #2d8c3c); }
.mp-s6-var-above { color: var(--success, #2d8c3c); }
.mp-s6-var-below { color: var(--heritage-red, #CC0000); }
.mp-s6-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.85rem; margin-top: 12px; }
.mp-s6-bench-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.mp-s6-bench {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 12px;
}
.mp-s6-bench-channel { font-weight: 700; font-size: 0.86rem; margin-bottom: 6px; }
.mp-s6-bench-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  padding: 2px 0;
  border-bottom: 1px dashed var(--rule);
}
.mp-s6-bench-row:last-child { border-bottom: none; }
.mp-s6-bench-row > span { min-width: 0; overflow-wrap: anywhere; }
.mp-s6-bench-val { font-weight: 700; white-space: normal; text-align: right; }
.mp-s6-bench { min-width: 0; }

/* ── Stage 7: brand health scorecard ─────────────────────────── */
.mp-s7-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  margin: 12px 0 6px;
}
.mp-s7-scores { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.mp-s7-score-row {
  display: grid;
  grid-template-columns: 110px 1fr 36px 20px;
  align-items: center;
  gap: 10px;
}
.mp-s7-dim { font-weight: 600; font-size: 0.86rem; }
.mp-s7-bar {
  height: 10px;
  border-radius: 5px;
  background: rgba(107, 101, 96, 0.12);
  overflow: hidden;
}
.mp-s7-bar-fill {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--heritage-red), var(--heritage-gold));
}
.mp-s7-score { font-weight: 700; font-size: 0.88rem; text-align: right; }
.mp-s7-trend { font-weight: 800; font-size: 1rem; text-align: center; }
.mp-s7-trend-up { color: var(--success, #2d8c3c); }
.mp-s7-trend-flat { color: var(--ink-mute); }
.mp-s7-trend-down { color: var(--heritage-red); }
.mp-s7-table { border-collapse: collapse; width: 100%; font-size: 0.86rem; margin-bottom: 10px; }
.mp-s7-table th, .mp-s7-table td { border: 1px solid var(--rule); padding: 6px 10px; text-align: left; vertical-align: middle; }
.mp-s7-table th { background: rgba(212, 168, 67, 0.10); width: 190px; white-space: nowrap; }
.mp-s7-sent {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(107, 101, 96, 0.12);
  max-width: 260px;
  margin-bottom: 4px;
}
.mp-s7-sent-seg { display: block; height: 100%; }
.mp-s7-sent-seg.pos { background: var(--success, #2d8c3c); }
.mp-s7-sent-seg.neu { background: var(--heritage-gold); }
.mp-s7-sent-seg.neg { background: var(--heritage-red); }


.mp-s7-sent-legend { font-size: 0.76rem; display: block; }
.mp-s7-confidence { font-size: 0.8rem; font-style: italic; margin: 10px 0 0; }

/* ── Stage 7 v2: Campaign Executive Brief (Costa #47) ───────────── */
.mp-s7-hero {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--heritage-red);
  border-radius: 8px;
  background: linear-gradient(120deg, rgba(204, 0, 0, 0.05), rgba(212, 168, 67, 0.07));
  padding: 14px 16px;
  margin: 10px 0 4px;
}
.mp-s7-hero-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--heritage-red);
  margin-bottom: 4px;
}
.mp-s7-hero-title {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.25;
}
.mp-s7-hero-meta { font-size: 0.82rem; margin-top: 3px; }
.mp-s7-keymsg {
  margin: 10px 0 2px;
  padding: 6px 12px;
  border-left: 3px solid var(--heritage-gold);
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink);
}
.mp-s7-summary { font-size: 0.9rem; line-height: 1.55; margin: 0 0 6px; }
.mp-s7-forecast-note { font-size: 0.76rem; font-style: italic; margin: -2px 0 8px; }
.mp-s7-reasons { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.mp-s7-reason {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--heritage-gold);
  border-radius: 6px;
  background: var(--surface, #fffdf8);
  padding: 10px 12px;
}
.mp-s7-reason-competitive { border-left-color: var(--heritage-red); }
.mp-s7-reason-roi { border-left-color: var(--heritage-gold); }
.mp-s7-reason-risk { border-left-color: var(--heritage-purple, #5b2c8a); }
.mp-s7-reason-audience { border-left-color: var(--success, #2d8c3c); }
.mp-s7-reason-timing { border-left-color: var(--ink-mute); }
.mp-s7-reason-num {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heritage-gold-dark, #a07830);
  min-width: 18px;
  line-height: 1.3;
}
.mp-s7-reason-body { min-width: 0; flex: 1; }
.mp-s7-reason-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mp-s7-reason-title { font-weight: 700; font-size: 0.9rem; }
.mp-s7-kind {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 9px;
  color: #fff;
  background: var(--heritage-gold-dark, #a07830);
  white-space: nowrap;
}
.mp-s7-kind-competitive { background: var(--heritage-red); }
.mp-s7-kind-roi { background: var(--heritage-gold-dark, #a07830); }
.mp-s7-kind-risk { background: var(--heritage-purple, #5b2c8a); }
.mp-s7-kind-audience { background: var(--success, #2d8c3c); }
.mp-s7-kind-timing { background: var(--ink-mute); }
.mp-s7-reason-detail { font-size: 0.84rem; line-height: 1.5; margin: 4px 0 0; }
.mp-s7-forecast { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.mp-s7-fc-row {
  display: grid;
  grid-template-columns: 110px 1fr 84px 64px;
  align-items: center;
  gap: 10px;
}
.mp-s7-track {
  position: relative;
  display: block;
  height: 10px;
  border-radius: 5px;
  background: rgba(107, 101, 96, 0.12);
  overflow: hidden;
}
.mp-s7-track-base {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 5px 0 0 5px;
  background: rgba(212, 168, 67, 0.45);
}
.mp-s7-track-delta { position: absolute; top: 0; bottom: 0; }
.mp-s7-track-delta.gain { background: var(--success, #2d8c3c); }
.mp-s7-track-delta.loss { background: var(--heritage-red); }
.mp-s7-track-mark {
  position: absolute;
  top: -1px; bottom: -1px;
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
}
.mp-s7-fc-vals { font-size: 0.84rem; text-align: right; white-space: nowrap; }
.mp-s7-fc-vals strong { font-size: 0.9rem; }
.mp-s7-delta { font-weight: 700; font-size: 0.8rem; text-align: right; white-space: nowrap; }
.mp-s7-delta-gain { color: var(--success, #2d8c3c); }
.mp-s7-delta-loss { color: var(--heritage-red); }
.mp-s7-delta-flat { color: var(--ink-mute); }
.mp-s7-sent2 { margin-bottom: 12px; }
.mp-s7-sent-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.mp-s7-sent-row .mp-s7-sent { max-width: none; margin-bottom: 0; }
.mp-s7-sent-name { font-size: 0.78rem; font-weight: 600; color: var(--ink-mute); }
.mp-s7-sent-narrative { font-size: 0.84rem; line-height: 1.5; margin: 8px 0 0; }
.mp-s7-ms-kpis { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.mp-s7-kpi-chip {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 11px;
  background: rgba(212, 168, 67, 0.16);
  border: 1px solid rgba(160, 120, 48, 0.25);
}
.mp-s7-ms-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.8rem; }
.mp-s7-actions { margin-top: 12px; display: flex; justify-content: flex-end; }

/* ── Stage 5/6/7 mobile ──────────────────────────────────────── */
@media (max-width: 720px) {
  .mp-s5-grid, .mp-s6-kpis, .mp-s6-bench-grid { grid-template-columns: 1fr; }
  .mp-s7-score-row { grid-template-columns: 90px 1fr 32px 18px; gap: 6px; }
  .mp-s7-table th { width: auto; white-space: normal; }
  .mp-s7-fc-row { grid-template-columns: 84px 1fr; gap: 6px; }
  .mp-s7-fc-vals, .mp-s7-delta { grid-column: 2; text-align: left; }
  .mp-s7-sent-row { grid-template-columns: 64px 1fr; gap: 6px; }
}

/* ── Stage 5/6/7 dark mode ───────────────────────────────────── */
[data-theme="dark"] .mp-s5-card,
[data-theme="dark"] .mp-s6-kpi { background: var(--surface-2, #1e1c1a); }
[data-theme="dark"] .mp-s5-tagline { background: rgba(204, 0, 0, 0.12); }
[data-theme="dark"] .mp-s5-chip { background: rgba(200, 195, 190, 0.12); }
[data-theme="dark"] .mp-s5-chip-comp { background: rgba(204, 0, 0, 0.18); color: #ff9b9b; }
[data-theme="dark"] .mp-s5-reg li { color: #ff9b9b; }
[data-theme="dark"] .mp-s6-source { background: rgba(200, 195, 190, 0.10); }
[data-theme="dark"] .mp-s6-bench-row { border-bottom-color: rgba(200, 195, 190, 0.18); }
[data-theme="dark"] .mp-s7-bar,
[data-theme="dark"] .mp-s7-sent { background: rgba(200, 195, 190, 0.14); }
[data-theme="dark"] .mp-s7-table th { background: rgba(212, 168, 67, 0.14); }
[data-theme="dark"] .mp-s7-hero { background: linear-gradient(120deg, rgba(204, 0, 0, 0.14), rgba(212, 168, 67, 0.10)); }
[data-theme="dark"] .mp-s7-reason { background: var(--surface-2, #1e1c1a); }
[data-theme="dark"] .mp-s7-track { background: rgba(200, 195, 190, 0.14); }
[data-theme="dark"] .mp-s7-track-mark { background: var(--ink, #eee); }
[data-theme="dark"] .mp-s7-kpi-chip { background: rgba(212, 168, 67, 0.18); }
[data-theme="dark"] .mp-s7-trend-down,
[data-theme="dark"] .mp-s7-confidence { color: inherit; }
[data-theme="dark"] .mp-s7-trend-down { color: #ff9b9b; }

/* ── Channel track (PASS B B2) ────────────────────────────────── */
.mp-track-chip {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--rule);
  background: rgba(212, 168, 67, 0.10);
  color: var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  margin-right: 8px;
}

/* ── H-1 (Pass C): seed chip ───────────────────────────────────── */
.mp-seed-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  /* House warm-gray tint — avoid undefined --surface-2 (audit L1) */
  background: rgba(107, 101, 96, 0.10);
  color: var(--ink-mute, #6B6560);
  border: 1px solid rgba(107, 101, 96, 0.18);
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 6px;
  white-space: nowrap;
}
/* Dark: [data-theme="dark"] in 90-dark-mode.css (was prefers-color-scheme). */
.mp-seed-slot { margin-bottom: 12px; }
.mp-seed-note { font-size: 0.82rem; margin: 4px 0 12px; }

/* ── H-4 (Pass C): act-now trend chips ─────────────────────────── */
.mp-actnow-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.mp-actnow-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary, #475569);
}
.mp-actnow-chip {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 6px;
  white-space: nowrap;
}
/* Dark: [data-theme="dark"] in 90-dark-mode.css (was prefers-color-scheme). */

/* ── Stage 4: budget lever picker (feedback #20 PR-B) ───────── */
.mp-s4-budget {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm, 8px);
  padding: 12px 14px;
  margin-bottom: 12px;
  /* Same surface as .mp-s6-kpi — reads as a sibling of the concept picker. */
  background: var(--surface, #fff);
}
.mp-s4-budget-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  margin-bottom: 2px;
}
.mp-s4-budget-help { margin: 0 0 8px; font-size: 0.82rem; }
.mp-s4-budget-tiers { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.mp-s4-budget-tier {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px; /* touch target */
  padding: 4px 14px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.mp-s4-budget-tier:hover { border-color: var(--heritage-gold); }
.mp-s4-budget-tier:has(input:checked) { border-color: var(--heritage-red); box-shadow: 0 0 0 1px var(--heritage-red); }
/* Keyboard focus — same treatment as .mp-run-row:focus-visible. */
.mp-s4-budget-tier:has(input:focus-visible),
.mp-s4-budget-row:has(input:focus-visible) { outline: 2px solid var(--heritage-gold); outline-offset: 2px; }
.mp-s4-budget-tier-static {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(212, 168, 67, 0.16);
  color: var(--heritage-gold-dark);
  margin-bottom: 8px;
}
.mp-s4-budget-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.mp-s4-budget-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.mp-s4-budget-row:hover { border-color: var(--heritage-gold); }
.mp-s4-budget-row:has(input:checked) { border-color: var(--heritage-red); box-shadow: 0 0 0 1px var(--heritage-red); }
.mp-s4-budget[data-interactive="0"] .mp-s4-budget-row { cursor: default; }
.mp-s4-budget-name { font-weight: 600; }
.mp-s4-budget-rec {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 8px;
  border-radius: 10px;
  background: rgba(212, 168, 67, 0.18);
  color: var(--heritage-gold-dark);
  white-space: nowrap;
}
.mp-s4-budget-role { flex: 1; min-width: 0; font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-s4-budget-range { font-size: 0.84rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mp-s4-budget-total {
  border-top: 1px dashed var(--rule);
  padding-top: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--heritage-gold-dark);
}
.mp-s4-budget-total-none { font-weight: 500; color: var(--ink-mute); }

/* ── Stage 7 provenance strip + results mirror (feedback #116 Option A) ──
   Upstream lineage chips (stages 4/5/6) + read-only Stage-6 KPI actuals, so
   the capstone brief visibly closes the pipeline loop. Results table reuses
   the .mp-s6-track* classes (no fork). */
.mp-s7-prov {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--heritage-gold, #D4A843);
  border-radius: 6px;
  background: var(--surface-2, rgba(0, 0, 0, 0.02));
}
.mp-s7-prov-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
}
.mp-s7-prov-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mp-s7-prov-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink);
  cursor: pointer;
}
.mp-s7-prov-chip:hover,
.mp-s7-prov-chip:focus-visible {
  border-color: var(--heritage-red, #CC0000);
  color: var(--heritage-red, #CC0000);
}
.mp-s7-prov-chip.done { border-color: var(--heritage-gold-dark, #A07830); }
.mp-s7-prov-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--heritage-gold, #D4A843);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}
.mp-s7-prov-name { font-weight: 600; }
.mp-s7-prov-tick { color: var(--success, #2d8c3c); font-weight: 700; }
.mp-s7-prov-note { font-size: 0.76rem; margin: 0; }
.mp-s7-results-note { font-size: 0.78rem; margin: 0 0 6px; }
.mp-s7-results-actions { margin-top: 8px; }
@media (max-width: 640px) {
  /* Chips stay full-width rows with 44px touch targets on phones. */
  .mp-s7-prov-chips { flex-direction: column; }
  .mp-s7-prov-chip { width: 100%; min-height: 44px; justify-content: flex-start; }
}

@media (max-width: 640px) {
  .mp-s4-budget { padding: 10px 12px; }
  /* Tiers: 3 equal columns, 44px touch targets, no clipped labels. */
  .mp-s4-budget-tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .mp-s4-budget-tier { justify-content: center; min-height: 44px; padding: 4px 8px; text-align: center; }
  /* Row: checkbox + name + rec + range on line 1 (range right-aligned),
     role wraps full-width below. Whole label = 44px hit area. */
  .mp-s4-budget-row { flex-wrap: wrap; row-gap: 4px; min-height: 44px; }
  .mp-s4-budget-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
  .mp-s4-budget-range { margin-left: auto; }
  .mp-s4-budget-role { flex-basis: 100%; order: 4; white-space: normal; }
}
/* Dark mode: explicit .mp-s4-budget* rules live in 90-dark-mode.css
   ("Stage 4 budget lever card" section, feedback #20 PR-D). Checked state
   intentionally keeps the heritage-red ring — parity with .mp-concept-option. */

/* ── COSTA #231: campaign goal + Stage-7 sell-in lead ───────────
   The goal is the thing the campaign is being funded to achieve, so it
   renders as a gold-railed callout at every point the marketer reviews:
   the launch form, the Stage-2 concept review, the run header, and the
   top of the Stage-7 executive brief. */
.mp-goal-field { margin-top: 12px; }
.mp-goal-input {
  width: 100%;
  resize: vertical;
  min-height: 56px;
  font-family: inherit;
  line-height: 1.45;
}
.mp-goal-hint { font-size: 0.76rem; margin: 4px 0 0; }

/* Stage-2 review banner + run-header line */
.mp-goal-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--heritage-gold);
  border-radius: 6px;
  background: var(--paper, var(--surface));
}
.mp-goal-banner-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  white-space: nowrap;
}
.mp-goal-banner-text { font-size: 0.88rem; line-height: 1.45; overflow-wrap: anywhere; }
.mp-run-goal {
  margin-top: 4px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--ink-mute);
  overflow-wrap: anywhere;
}

/* Stage-7 sell-in lead */
.mp-s7-sellin {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--heritage-gold);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 12px 0 14px;
  background: var(--paper, var(--surface));
}
.mp-s7-sellin .mp-s7-label:first-child { margin-top: 0; }
.mp-s7-goal {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.mp-s7-goal-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  white-space: nowrap;
}
.mp-s7-goal-text { font-size: 0.92rem; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.mp-s7-goal-fit {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--ink-mute);
  white-space: nowrap;
}
.mp-s7-goal-fit-direct { border-color: rgba(46, 125, 50, 0.45); color: #2e7d32; }
.mp-s7-goal-fit-partial { border-color: rgba(212, 168, 67, 0.55); color: #8a6d1f; }
.mp-s7-goal-fit-indirect { border-color: var(--rule); color: var(--ink-mute); }
.mp-s7-ask-note,
.mp-s7-basis { font-size: 0.76rem; font-style: italic; margin: 4px 0 0; line-height: 1.45; }

@media (max-width: 640px) {
  /* Stack the label above the value so long goals never squeeze to a
     one-word-per-line column on a phone. */
  .mp-goal-banner,
  .mp-s7-goal { flex-direction: column; align-items: flex-start; gap: 4px; }
  .mp-goal-input { min-height: 72px; }
}
/* ────────────────────────────────────────────────────────────
   Redemption Processing — Distributor free-goods claim workflow
   Heritage Red (#CC0000) for alerts/overclaim flags
   Heritage Gold (#D4A843) for verified/approved states
   ──────────────────────────────────────────────────────────── */

/* ── Reference data strip ───────────────────────────────── */

.rdm-ref-strip {
  padding: 10px 16px;
  margin-bottom: 12px;
}
.rdm-ref-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.rdm-ref-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-strong, #1a1a2e);
  white-space: nowrap;
}
.rdm-ref-badge {
  font-size: 0.82rem;
  color: var(--ink-soft, #6b7280);
  background: var(--surface-soft, #f8f8f8);
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid var(--rule, #e5e5e5);
}
.rdm-ref-badge strong {
  color: var(--ink-strong, #1a1a2e);
}
.rdm-ref-upload-btn {
  font-size: 0.82rem;
  margin-left: auto;
}
/* Xin #104: cost-list upload relocated here from the removed Price List card.
   Sits immediately after the master ref upload (no second margin-left:auto,
   or the two buttons would fight for the same right-hand slot). */
.rdm-ref-cost-upload-btn {
  font-size: 0.82rem;
}
.rdm-ref-loading {
  padding: 4px 0;
}

/* ── Toolbar ────────────────────────────────────────────── */

.rdm-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

/* ── Create form ────────────────────────────────────────── */

.rdm-create-card {
  padding: 20px;
  margin-bottom: 16px;
}
.rdm-create-title {
  margin: 0 0 14px;
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  font-size: 1rem;
}
.rdm-create-form {
  display: grid;
  gap: 14px;
}
.rdm-create-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.rdm-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ── Case table ─────────────────────────────────────────── */

.rdm-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rdm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.rdm-table th {
  text-align: left;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ink-soft, #6b7280);
  padding: 8px 10px;
  border-bottom: 2px solid var(--rule, #e5e5e5);
  white-space: nowrap;
}
.rdm-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule, #e5e5e5);
  vertical-align: middle;
}
.rdm-case-row {
  cursor: pointer;
  transition: background 120ms ease;
}
.rdm-case-row:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: -2px;
}

/* Zebra striping (totals row excluded — it has its own emphasis) */
.rdm-table tbody tr:nth-child(even):not(.rdm-totals-row) td {
  background: rgba(0, 0, 0, 0.015);
}
/* Row hover across all redemption tables */
.rdm-table tbody tr:not(.rdm-totals-row):hover td {
  background: rgba(204, 0, 0, 0.035);
}

.rdm-cell-money {
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.rdm-cell-num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.rdm-th-num {
  text-align: right !important;
}
.rdm-cell-mono {
  font-family: var(--font-mono, 'SF Mono', monospace);
  font-size: 0.82rem;
}
.rdm-cell-distributor {
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rdm-totals-row td {
  border-top: 2px solid var(--ink-soft, #6b7280);
  background: var(--surface-soft, #f8f8f8);
}

/* ── Status chips ───────────────────────────────────────── */

.rdm-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Case statuses */
.rdm-status-draft       { background: rgba(107,114,128,0.12); color: #4b5563; }
.rdm-status-extracting  { background: rgba(91,44,138,0.12);   color: var(--heritage-purple, #5B2C8A); }
.rdm-status-extracted   { background: rgba(59,130,246,0.12);  color: #2563eb; }
.rdm-status-verified    { background: rgba(212,168,67,0.12);  color: var(--heritage-gold-dark, #B58C2E); }
.rdm-status-pending     { background: rgba(204,0,0,0.10);     color: var(--heritage-red, #CC0000); }
.rdm-status-approved    { background: rgba(45,140,60,0.12);   color: var(--success-deep, #2d8c3c); }

/* Line verify statuses */
.rdm-line-purchase  { background: rgba(107,114,128,0.12); color: #4b5563; }
.rdm-line-ok        { background: rgba(45,140,60,0.12);   color: var(--success-deep, #2d8c3c); }
.rdm-line-overclaim { background: rgba(204,0,0,0.12);     color: var(--heritage-red, #CC0000); }
.rdm-line-nodeal    { background: rgba(204,0,0,0.10);     color: #b91c1c; }
.rdm-line-noprice   { background: rgba(212,168,67,0.14);  color: var(--heritage-gold-dark, #B58C2E); }
.rdm-line-nomapping { background: rgba(212,168,67,0.14);  color: #92400e; }
.rdm-line-pending   { background: rgba(107,114,128,0.10); color: #4b5563; }

/* Upload status chip for failed */
.rdm-upload-failed-chip { background: rgba(204,0,0,0.12); color: var(--heritage-red, #CC0000); }

/* ── FG badge ───────────────────────────────────────────── */

.rdm-fg-badge {
  display: inline-block;
  font-size: 0.70rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(91,44,138,0.12);
  color: var(--heritage-purple, #5B2C8A);
}

/* ── Back row ───────────────────────────────────────────── */

.rdm-back-row {
  margin-bottom: 12px;
}
.rdm-back-btn {
  font-size: 0.88rem;
}

/* ── Case header ────────────────────────────────────────── */

.rdm-header {
  padding: 20px;
  margin-bottom: 16px;
}
.rdm-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.rdm-header-title {
  margin: 0;
  font-family: var(--font-serif, Georgia, serif);
  font-size: 1.2rem;
}
.rdm-header-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.86rem;
  color: var(--ink-soft, #6b7280);
  margin-bottom: 12px;
}
.rdm-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Section titles ─────────────────────────────────────── */

.rdm-section-title {
  margin: 0 0 12px;
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  font-size: 1rem;
}

/* ── Upload zone ────────────────────────────────────────── */

.rdm-upload-section {
  padding: 20px;
  margin-bottom: 16px;
}
.rdm-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 24px;
  background: rgba(204, 0, 0, 0.02);
  border: 2px dashed rgba(204, 0, 0, 0.18);
  border-radius: 8px;
  cursor: pointer;
  transition: background 160ms ease, border 160ms ease;
}
.rdm-dropzone.drag-over,
.rdm-dropzone:hover {
  background: rgba(204, 0, 0, 0.06);
  border-color: var(--heritage-red, #CC0000);
}
.rdm-dropzone.drag-over {
  transform: scale(1.005);
  box-shadow: 0 0 0 4px rgba(204, 0, 0, 0.08);
}
.rdm-dropzone:focus-visible {
  outline: none;
  border-color: var(--heritage-red, #CC0000);
  box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.16);
}
.rdm-dropzone.rdm-uploading {
  pointer-events: none;
  opacity: 0.72;
  border-style: solid;
}
.rdm-dropzone-icon {
  font-size: 2rem;
  margin-bottom: 6px;
}
.rdm-dropzone-text {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 4px;
}
.rdm-dropzone-sub {
  font-size: 0.82rem;
  color: var(--ink-soft, #6b7280);
  margin-bottom: 10px;
}

/* ── Uploads list ───────────────────────────────────────── */

.rdm-uploads-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rdm-upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-soft, #f8f8f8);
  border-radius: 6px;
  font-size: 0.86rem;
  flex-wrap: wrap;
}
.rdm-upload-item.rdm-upload-failed {
  background: rgba(204,0,0,0.04);
}
/* #612: a failed upload a later upload replaced. Folded by default; greyed when shown. */
.rdm-upload-item.rdm-upload-superseded { opacity: 0.6; }
.rdm-upload-item.rdm-upload-superseded-hidden { display: none; }
.rdm-upload-superseded-label { font-size: 0.78rem; color: var(--text-mute, #666); font-style: italic; }
.rdm-upload-superseded-note { font-size: 0.8rem; color: var(--text-mute, #666); display: flex; align-items: center; gap: 6px; }
.rdm-upload-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.rdm-upload-progress {
  font-size: 0.78rem;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  color: var(--heritage-purple, #5B2C8A);
}
.rdm-upload-error {
  font-size: 0.78rem;
  color: var(--heritage-red, #CC0000);
}
.rdm-upload-bar {
  flex-basis: 100%;
  height: 3px;
  background: rgba(91, 44, 138, 0.14);
  border-radius: 2px;
  overflow: hidden;
}
.rdm-upload-bar-fill {
  display: block;
  height: 100%;
  background: var(--heritage-purple, #5B2C8A);
  border-radius: 2px;
  transition: width 400ms ease;
}

/* ── Flags ───────────────────────────────────────────────── */

.rdm-flags-section {
  padding: 20px;
  margin-bottom: 16px;
}
.rdm-flags-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rdm-flag {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.88rem;
  line-height: 1.5;
}
.rdm-flag-red {
  background: rgba(204,0,0,0.06);
  border-left: 3px solid var(--heritage-red, #CC0000);
}
.rdm-flag-amber {
  background: rgba(212,168,67,0.08);
  border-left: 3px solid var(--heritage-gold, #D4A843);
}
.rdm-flag-icon {
  flex-shrink: 0;
}
.rdm-flag-msg {
  flex: 1;
  min-width: 0;
}

/* ── Summary + Lines sections ───────────────────────────── */

.rdm-summary-section,
.rdm-lines-section {
  padding: 20px;
  margin-bottom: 16px;
}

/* Clean note + inline empty states */

.rdm-clean-note {
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--success-deep, #2d8c3c);
  background: rgba(45, 140, 60, 0.05);
  border-left: 3px solid var(--success-deep, #2d8c3c);
}
.rdm-empty-inline {
  padding: 32px 20px;
  margin-bottom: 16px;
  text-align: center;
  color: var(--ink-soft, #6b7280);
  font-size: 0.88rem;
}

/* Micro-interactions */

.rdm-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: rdm-spin 650ms linear infinite;
}
@keyframes rdm-spin {
  to { transform: rotate(360deg); }
}

@keyframes rdm-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
#rdm-list > .card,
#rdm-detail > .card {
  animation: rdm-fade-in 180ms ease-out;
}

.rdm-edit-line-btn:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  #rdm-list > .card,
  #rdm-detail > .card,
  .rdm-dropzone.drag-over {
    animation: none;
    transform: none;
  }
  .rdm-case-row,
  .rdm-dropzone,
  .rdm-upload-bar-fill {
    transition: none;
  }
}

/* ── Dark mode ──────────────────────────────────────────── */

[data-theme="dark"] .rdm-ref-strip,
[data-theme="dark"] .rdm-header,
[data-theme="dark"] .rdm-upload-section,
[data-theme="dark"] .rdm-flags-section,
[data-theme="dark"] .rdm-summary-section,
[data-theme="dark"] .rdm-lines-section {
  background: var(--surface, #1E2130);
  border-color: var(--border-light, #2D3044);
}
[data-theme="dark"] .rdm-ref-badge {
  background: var(--surface-alt, #252838);
  border-color: var(--border-light, #2D3044);
  color: var(--text-secondary, #9CA3AF);
}
[data-theme="dark"] .rdm-ref-badge strong {
  color: var(--text-primary, #E5E7EB);
}
[data-theme="dark"] .rdm-table th {
  color: var(--text-muted, #6B7280);
  border-color: var(--border-medium, #3B3F54);
}
[data-theme="dark"] .rdm-table td {
  border-color: var(--border-light, #2D3044);
  color: var(--text-primary, #E5E7EB);
}
[data-theme="dark"] .rdm-table tbody tr:nth-child(even):not(.rdm-totals-row) td {
  background: rgba(255, 255, 255, 0.02);
}
[data-theme="dark"] .rdm-table tbody tr:not(.rdm-totals-row):hover td {
  background: rgba(204, 0, 0, 0.09);
}
[data-theme="dark"] .rdm-totals-row td {
  background: var(--surface-alt, #252838);
  border-color: var(--border-medium, #3B3F54);
}
[data-theme="dark"] .rdm-dropzone {
  background: rgba(204, 0, 0, 0.04);
  border-color: rgba(204, 0, 0, 0.25);
}
[data-theme="dark"] .rdm-dropzone.drag-over,
[data-theme="dark"] .rdm-dropzone:hover {
  background: rgba(204, 0, 0, 0.08);
}
[data-theme="dark"] .rdm-upload-item {
  background: var(--surface-alt, #252838);
}
[data-theme="dark"] .rdm-upload-item.rdm-upload-failed {
  background: rgba(204, 0, 0, 0.08);
}
[data-theme="dark"] .rdm-flag-red {
  background: rgba(204, 0, 0, 0.10);
}
[data-theme="dark"] .rdm-flag-amber {
  background: rgba(212, 168, 67, 0.10);
}
[data-theme="dark"] .rdm-header-title {
  color: var(--text-primary, #E5E7EB);
}
[data-theme="dark"] .rdm-header-meta {
  color: var(--text-secondary, #9CA3AF);
}
[data-theme="dark"] .rdm-create-card {
  background: var(--surface, #1E2130);
  border-color: var(--border-light, #2D3044);
}

/* Dark-mode chip legibility — brighten foregrounds against dark surfaces */
[data-theme="dark"] .rdm-status-draft,
[data-theme="dark"] .rdm-line-purchase,
[data-theme="dark"] .rdm-line-pending {
  background: rgba(156, 163, 175, 0.16);
  color: #9CA3AF;
}
[data-theme="dark"] .rdm-status-extracting {
  background: rgba(167, 139, 250, 0.16);
  color: #A78BFA;
}
[data-theme="dark"] .rdm-status-extracted {
  background: rgba(96, 165, 250, 0.16);
  color: #60A5FA;
}
[data-theme="dark"] .rdm-status-verified,
[data-theme="dark"] .rdm-line-noprice {
  background: rgba(212, 168, 67, 0.18);
  color: #D4A843;
}
[data-theme="dark"] .rdm-status-pending,
[data-theme="dark"] .rdm-upload-failed-chip,
[data-theme="dark"] .rdm-line-overclaim,
[data-theme="dark"] .rdm-line-nodeal {
  background: rgba(248, 113, 113, 0.16);
  color: #F87171;
}
[data-theme="dark"] .rdm-status-approved,
[data-theme="dark"] .rdm-line-ok {
  background: rgba(74, 222, 128, 0.14);
  color: #4ADE80;
}
[data-theme="dark"] .rdm-line-nomapping {
  background: rgba(251, 191, 36, 0.14);
  color: #FBBF24;
}
[data-theme="dark"] .rdm-fg-badge {
  background: rgba(167, 139, 250, 0.16);
  color: #A78BFA;
}
[data-theme="dark"] .rdm-clean-note {
  background: rgba(74, 222, 128, 0.07);
  color: #4ADE80;
  border-left-color: #4ADE80;
}
[data-theme="dark"] .rdm-empty-inline {
  color: var(--text-secondary, #9CA3AF);
}
[data-theme="dark"] .rdm-upload-bar {
  background: rgba(167, 139, 250, 0.18);
}
[data-theme="dark"] .rdm-upload-bar-fill {
  background: #A78BFA;
}
[data-theme="dark"] .rdm-upload-progress {
  color: #A78BFA;
}
[data-theme="dark"] .rdm-section-title,
[data-theme="dark"] .rdm-create-title {
  color: var(--text-primary, #E5E7EB);
}
[data-theme="dark"] .rdm-ref-label {
  color: var(--text-primary, #E5E7EB);
}
[data-theme="dark"] .rdm-dropzone-text {
  color: var(--text-primary, #E5E7EB);
}
[data-theme="dark"] .rdm-dropzone-sub {
  color: var(--text-secondary, #9CA3AF);
}

/* ── Mobile / responsive ────────────────────────────────── */

@media (max-width: 640px) {
  .rdm-header-top {
    flex-direction: column;
    gap: 8px;
  }
  .rdm-header-meta {
    flex-direction: column;
    gap: 4px;
  }
  .rdm-header-actions {
    flex-direction: column;
  }
  .rdm-header-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .rdm-create-row {
    grid-template-columns: 1fr;
  }
  .rdm-ref-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .rdm-ref-upload-btn {
    margin-left: 0;
  }
  .rdm-upload-name {
    max-width: 160px;
  }
  .rdm-table {
    font-size: 0.82rem;
  }
  .rdm-table th,
  .rdm-table td {
    padding: 6px 6px;
  }
  /* Touch targets ≥ 44px */
  .rdm-case-row td {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .rdm-toolbar .btn,
  .rdm-header-actions .btn,
  .rdm-create-actions .btn,
  .rdm-ref-upload-btn {
    min-height: 44px;
  }
  .rdm-edit-line-btn {
    min-width: 44px;
    min-height: 44px;
  }
  .rdm-dropzone {
    min-height: 120px;
    padding: 18px;
  }
}

@media (max-width: 390px) {
  .rdm-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .rdm-header-title {
    font-size: 1.05rem;
  }
  .rdm-upload-name {
    max-width: 120px;
  }
}

/* ── Phase 2 (Eliza spec 2026-07-09): reference panel, exceptions, compliance ── */

/* Reference Data panel + tabs */
.rdm-ref-panel {
  padding: 16px;
  margin-bottom: 14px;
}
.rdm-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border-soft, #e5ded2);
  margin-bottom: 14px;
}
.rdm-tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-soft, #6b6257);
  cursor: pointer;
  margin-bottom: -2px;
}
.rdm-tab.active {
  color: var(--heritage-red, #CC0000);
  border-bottom-color: var(--heritage-red, #CC0000);
}
.rdm-tab:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: 2px;
}
.rdm-ref-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.rdm-ref-table {
  font-size: 0.84rem;
}
.rdm-deal-special {
  background: rgba(204, 0, 0, 0.10);
  color: var(--heritage-red, #CC0000);
}
.rdm-deal-regular {
  background: rgba(107, 98, 87, 0.10);
  color: var(--ink-soft, #6b6257);
}
/* Jade #276: the per-row control is now a WORD, not a ghost ✕.
   It stays visually quiet (ghost button, no fill) so a 200-row table is not a
   wall of red — but it is legible, and the column above it is labelled. The
   whole reason #146 went unnoticed is that a bare glyph under a blank header
   reads as decoration. */
.rdm-deal-del-btn {
  min-width: 34px;
  color: var(--heritage-red, #CC0000);
  font-size: 0.8rem;
  padding: 2px 8px;
  white-space: nowrap;
}
.rdm-deal-remove-col {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft, #6b6257);
  text-align: left;
}

/* Jade #276 — "Recent uploads" (the batch undo surface). Sits directly under
   the deal dropzone: undo belongs next to do. */
.rdm-deal-batches {
  margin-top: 14px;
}
.rdm-deal-batches-title {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 600;
}
.rdm-deal-batches-empty {
  margin-top: 12px;
  font-size: 0.84rem;
}
.rdm-deal-batch-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rdm-deal-batch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line, rgba(107, 98, 87, 0.18));
  border-radius: 6px;
  background: var(--surface-soft, rgba(255, 255, 255, 0.5));
}
.rdm-deal-batch-main {
  min-width: 0;
}
.rdm-deal-batch-file {
  font-weight: 600;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}
.rdm-deal-batch-meta {
  font-size: 0.78rem;
  margin-top: 2px;
}
.rdm-deal-batch-remove {
  flex: 0 0 auto;
  color: var(--heritage-red, #CC0000);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Batch-remove modal. Reuses the #145 .rdm-batchdel frame; these are the
   deal-specific additions (soft-delete note, blocker list, row list). */
.rdm-deal-batch-soft {
  font-size: 0.84rem;
  color: var(--ink-soft, #6b6257);
}
.rdm-deal-batch-blockers {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 0.8rem;
}
.rdm-deal-batch-rows {
  max-height: 260px;
  overflow-y: auto;
}
.rdm-deal-batch-row {
  display: grid;
  grid-template-columns: 90px 130px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 3px 0;
  font-size: 0.8rem;
}
.rdm-deal-batch-sap {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-weight: 600;
}
.rdm-deal-batch-term {
  overflow-wrap: anywhere;
}
.rdm-deal-batch-desc {
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .rdm-deal-batch {
    flex-direction: column;
    align-items: stretch;
  }
  .rdm-deal-batch-remove {
    align-self: flex-start;
  }
  .rdm-deal-batch-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
.rdm-price-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.rdm-price-add-form .form-input {
  max-width: 180px;
}
.rdm-cost-input {
  max-width: 110px;
  text-align: right;
  padding: 4px 8px;
  font-size: 0.84rem;
}
.rdm-cost-saved {
  border-color: #2e8b57 !important;
  box-shadow: 0 0 0 2px rgba(46, 139, 87, 0.18);
}

/* Compliance chips (Phase 2.3) */
.rdm-comp-met      { background: rgba(46, 139, 87, 0.12);  color: #2e7d4f; }
.rdm-comp-notmet   { background: rgba(204, 0, 0, 0.10);    color: var(--heritage-red, #CC0000); }
.rdm-comp-na       { background: rgba(212, 168, 67, 0.16); color: var(--heritage-gold-dark, #B58C2E); }
.rdm-exc-pending   { background: rgba(212, 168, 67, 0.16); color: var(--heritage-gold-dark, #B58C2E); }
/* #56 partial approve (Jade 2026-07-27): entitled banked, excess rejected.
   Amber-on-gold — deliberately NOT the green MET chip, because part of the
   claim was refused. `rdm-exc-excess-chip` marks the rejected remainder. */
.rdm-exc-partial   { background: rgba(212, 168, 67, 0.22); color: var(--heritage-gold-dark, #B58C2E); }
.rdm-exc-excess-chip {
  background: rgba(204, 0, 0, 0.10);
  color: var(--heritage-red, #CC0000);
  font-size: 0.72rem;
  margin-left: 4px;
}

/* Exceptions section (Phase 3) */
.rdm-exc-section .rdm-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rdm-exc-hint {
  font-size: 0.82rem;
  margin: 2px 0 12px;
}
.rdm-exc-table .rdm-exc-reason {
  font-size: 0.78rem;
  max-width: 340px;
  color: var(--ink-soft, #6b6257);
}
.rdm-exc-actions {
  display: inline-flex;
  gap: 6px;
}
.rdm-exc-approve { color: #2e7d4f; }
.rdm-exc-reject  { color: var(--heritage-red, #CC0000); }

/* Pending Review search + invoice basket (Jade 2026-07-27) */
.rdm-exc-toolbar {
  margin: 4px 0 12px;
}
.rdm-exc-search {
  max-width: 340px;
}

/* Lei #64: reviewed rows hidden by default + audit-trail reveal toggle. */
.rdm-exc-showreviewed {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
}
.rdm-exc-reviewed-note {
  font-size: 0.78rem;
  margin: 0 0 10px;
}
.rdm-exc-scope {
  font-size: 0.78rem;
  margin: 0 0 10px;
}
.rdm-exc-purchased {
  white-space: nowrap;
}
.rdm-exc-pool-mark {
  font-size: 0.68rem;
  color: var(--heritage-gold-dark, #B58C2E);
  letter-spacing: 0.02em;
}
/* Xin #179 — "Also on N invoice(s)": the purchase exists on a sibling invoice.
   Advisory chip only; entitlement is still computed per invoice (engine C01),
   so this is deliberately neutral/informational, NOT a success state. */
.rdm-exc-alsoon {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid var(--heritage-gold, #D4A843);
  border-radius: 10px;
  background: rgba(212, 168, 67, 0.10);
  color: var(--heritage-gold-dark, #B58C2E);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: help;
  vertical-align: middle;
}
/* Combined qty would have met the deal minimum — the actionable case Xin is
   asking about. Slightly stronger, still not a "credited" green. */
.rdm-exc-alsoon-covered {
  border-color: var(--heritage-red, #CC0000);
  background: rgba(204, 0, 0, 0.07);
  color: var(--heritage-red, #CC0000);
}
.rdm-exc-basket {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--heritage-gold, #D4A843);
  background: rgba(212, 168, 67, 0.06);
}
.rdm-exc-basket-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.rdm-exc-basket-title {
  font-weight: 600;
  font-size: 0.88rem;
}
.rdm-exc-basket-inv {
  font-size: 0.88rem;
}
.rdm-exc-basket-totals {
  font-size: 0.78rem;
}
.rdm-exc-basket-table {
  font-size: 0.82rem;
}
.rdm-exc-basket-flagged {
  background: rgba(212, 168, 67, 0.10);
}
.rdm-exc-basket-chip {
  font-size: 0.68rem;
}
[data-theme="dark"] .rdm-exc-basket {
  background: rgba(212, 168, 67, 0.10);
  border-color: rgba(255, 255, 255, 0.08);
  border-left-color: var(--heritage-gold, #D4A843);
}

/* Dark mode */
[data-theme="dark"] .rdm-ref-panel,
[data-theme="dark"] .rdm-exc-section {
  background: var(--card-bg, #1e1c19);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .rdm-tabs {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .rdm-tab {
  color: rgba(255, 255, 255, 0.65);
}
[data-theme="dark"] .rdm-tab.active {
  color: #ff6b6b;
  border-bottom-color: #ff6b6b;
}
[data-theme="dark"] .rdm-deal-regular {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
}
[data-theme="dark"] .rdm-deal-special {
  background: rgba(255, 107, 107, 0.15);
  color: #ff8a8a;
}
[data-theme="dark"] .rdm-comp-met    { background: rgba(76, 175, 120, 0.18); color: #7fd6a4; }
[data-theme="dark"] .rdm-comp-notmet { background: rgba(255, 107, 107, 0.15); color: #ff8a8a; }
[data-theme="dark"] .rdm-comp-na,
[data-theme="dark"] .rdm-exc-pending { background: rgba(212, 168, 67, 0.18); color: #e3c06a; }
[data-theme="dark"] .rdm-exc-partial { background: rgba(212, 168, 67, 0.24); color: #e3c06a; }
[data-theme="dark"] .rdm-exc-excess-chip { background: rgba(255, 107, 107, 0.15); color: #ff8a8a; }
[data-theme="dark"] .rdm-exc-table .rdm-exc-reason { color: rgba(255, 255, 255, 0.6); }
[data-theme="dark"] .rdm-exc-approve { color: #7fd6a4; }
[data-theme="dark"] .rdm-exc-reject  { color: #ff8a8a; }

/* Mobile */
@media (max-width: 720px) {
  .rdm-ref-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .rdm-price-add-form {
    flex-direction: column;
    align-items: stretch;
  }
  .rdm-price-add-form .form-input {
    max-width: none;
  }
  .rdm-tab {
    padding: 10px 12px;
    min-height: 44px;
  }
  .rdm-exc-actions .btn {
    min-height: 44px;
  }
  .rdm-exc-table .rdm-exc-reason {
    max-width: 180px;
  }
}

/* ═══════════════════════════════════════════════════════════
   Deal Library — top-level tabs + library sections (2026-07-09)
   ═══════════════════════════════════════════════════════════ */

/* W1 S6 — module-level shared retailer context strip.
   Sits above the tab bar: the retailer scope belongs to the module, not to
   whichever pane happens to be open. Hidden entirely for single-retailer
   teams (JS sets [hidden]) so it never becomes noise. */
.rdm-retailer-context {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px solid var(--rule, #e5e5e5);
  border-left: 3px solid var(--brand, #cc0000);
  border-radius: 6px;
  background: var(--surface-2, #faf9f7);
  font-size: 0.85rem;
}
/* Must beat the display:flex above — the JS hides the strip with [hidden]. */
.rdm-retailer-context[hidden] { display: none; }
.rdm-retailer-context .rdm-retailer-context-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rdm-retailer-context .rdm-retailer-context-name {
  font-size: 0.95rem;
  color: var(--ink, #1a1a1a);
}
.rdm-retailer-context .rdm-retailer-context-hint { font-size: 0.78rem; }
[data-theme="dark"] .rdm-retailer-context {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .rdm-retailer-context .rdm-retailer-context-name { color: #f4f4f4; }
@media (max-width: 640px) {
  .rdm-retailer-context { padding: 7px 10px; }
  .rdm-retailer-context .rdm-retailer-context-hint { width: 100%; }
}

/* Main tab bar (Cases | Deal Library) — mm-tabs pattern */
.rdm-main-tabs {
  display: flex;
  gap: 4px;
  margin: 4px 0 20px;
  border-bottom: 1px solid var(--rule, #e5e5e5);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.rdm-main-tabs::-webkit-scrollbar { display: none; }

.rdm-main-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-mute, #6b7280);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.rdm-main-tab:hover { color: var(--ink-soft, #374151); }
.rdm-main-tab .rdm-tab-emoji { font-size: 16px; line-height: 1; }
.rdm-main-tab.is-active {
  color: var(--heritage-red, #CC0000);
  border-bottom-color: var(--heritage-red, #CC0000);
}
.rdm-main-tab:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: 2px;
}
.rdm-main-pane[hidden] { display: none !important; }

/* Library sections */
.rdm-lib-section {
  padding: 18px;
  margin-bottom: 16px;
}
/* Xin #106: plain-language explanation of what an item mapping is. Slightly
   inset + smaller than the section hint so it reads as a teach-in, not chrome. */
.rdm-xref-explain {
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 4px 0 10px;
  padding-left: 10px;
  border-left: 2px solid var(--rule, #e5e5e5);
}

.rdm-lib-hint {
  margin: -4px 0 12px;
  font-size: 0.84rem;
}
.rdm-lib-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.rdm-deal-search {
  max-width: 320px;
}
.rdm-lib-empty {
  padding: 32px 16px;
  text-align: center;
}
/* Xin #139: an empty Deal Library table must explain WHY it is empty (past
   quarter hidden / retailer scope) instead of reading as data loss next to a
   strip that says "Deals: 290". */
.rdm-lib-empty-why {
  margin-top: 8px;
  font-size: 0.85rem;
  line-height: 1.45;
  max-width: 46ch;
  margin-left: auto;
  margin-right: auto;
  color: var(--text-mute, #6b6b6b);
}
.rdm-lib-empty-action {
  margin-top: 10px;
}
/* The past-quarter notice in the meta strip is a DEFAULT, not a lockout — make
   it legible enough that a short list is never mistaken for missing rows. */
.rdm-lib-past-flag {
  color: var(--warning, #C68A1F);
}

/* Deal status chips */
.rdm-deal-status-active {
  background: #e7f5ec;
  color: #1c7c43;
}
.rdm-deal-status-expired {
  background: #ececec;
  color: #6b6b6b;
}

/* Sortable table headers */
.rdm-sort-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.rdm-sort-btn:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: 2px;
}
.rdm-sort-arrow {
  font-size: 0.7em;
  opacity: 0.45;
}
.rdm-sort-btn.is-sorted .rdm-sort-arrow {
  opacity: 1;
  color: var(--heritage-red, #CC0000);
}

/* Deal sheet dropzone (reuses .rdm-dropzone base) */
.rdm-deal-dropzone {
  cursor: pointer;
}

/* Import confirm modal */
.rdm-import-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft, #e5ded2);
  border-radius: 10px;
  margin-bottom: 12px;
}
.rdm-import-icon { font-size: 1.6rem; }
.rdm-import-name {
  font-weight: 600;
  word-break: break-all;
}

/* No-deal helper note in case detail */
.rdm-nodeal-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  margin-bottom: 14px;
  border-left: 4px solid var(--lkk-gold, #D4A843);
  font-size: 0.9rem;
}
.rdm-nodeal-link {
  font-weight: 700;
  color: var(--heritage-red, #CC0000);
  text-decoration: none;
  white-space: nowrap;
}
.rdm-nodeal-link:hover { text-decoration: underline; }

/* Dark mode */
[data-theme="dark"] .rdm-main-tabs { border-bottom-color: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .rdm-main-tab { color: rgba(255, 255, 255, 0.55); }
[data-theme="dark"] .rdm-main-tab:hover { color: rgba(255, 255, 255, 0.8); }
[data-theme="dark"] .rdm-main-tab.is-active {
  color: #ff6b6b;
  border-bottom-color: #ff6b6b;
}
/* Deal import history (feedback #9 — failed uploads must not vanish) */
.rdm-deal-import-history { margin-top: 14px; }
.rdm-deal-history-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-mute, #6b7280);
  margin-bottom: 6px;
}
.rdm-deal-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rdm-deal-history-item {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  background: var(--surface, #fff);
}
.rdm-deal-history-item.rdm-deal-history-ok { border-left: 3px solid #2ea05c; }
.rdm-deal-history-item.rdm-deal-history-warn { border-left: 3px solid #d4a017; }
.rdm-deal-history-item.rdm-deal-history-fail { border-left: 3px solid #c81e1e; }
.rdm-deal-history-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.rdm-deal-history-name {
  font-weight: 600;
  word-break: break-all;
}
.rdm-deal-history-status { white-space: nowrap; color: var(--text-mute, #6b7280); }
.rdm-deal-history-error {
  margin-top: 4px;
  color: #b42318;
  font-size: 0.8rem;
  line-height: 1.35;
}
.rdm-deal-history-cols { margin-top: 2px; font-size: 0.75rem; }
[data-theme="dark"] .rdm-deal-history-item {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .rdm-deal-history-error { color: #ff8b8b; }

[data-theme="dark"] .rdm-deal-status-active {
  background: rgba(46, 160, 92, 0.18);
  color: #7fd6a4;
}
[data-theme="dark"] .rdm-deal-status-expired {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.55);
}
[data-theme="dark"] .rdm-sort-btn.is-sorted .rdm-sort-arrow { color: #ff6b6b; }
[data-theme="dark"] .rdm-import-file { border-color: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] .rdm-nodeal-note { border-left-color: #e3c06a; }
[data-theme="dark"] .rdm-nodeal-link { color: #ff6b6b; }

/* ── Cross-Reference & Item Map (PR-3 / #13) ───────────── */
.rdm-xref-section { }
.rdm-xref-lookup-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 12px;
}
.rdm-xref-input { flex: 1 1 220px; min-width: 160px; max-width: 420px; }
.rdm-xref-result { margin-bottom: 14px; }
.rdm-xref-hit {
  border: 1px solid var(--rule, #e5e5e5);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface-soft, #fafafa);
}
.rdm-xref-hit-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--ink-strong, #1a1a2e);
}
.rdm-xref-hit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 14px;
  font-size: 0.88rem;
}
.rdm-xref-deals { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.rdm-xref-miss {
  border-left: 3px solid var(--heritage-red, #CC0000);
  padding: 10px 12px;
  background: rgba(204, 0, 0, 0.04);
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
}
.rdm-xref-empty-hint { margin-top: 4px; font-size: 0.82rem; }

/* ── #107b-B: UPC↔SAP dictionary ─────────────────────────────────────────
   Reuses the xref card/hit/miss vocabulary; only the ambiguity affordance and
   the dry-run preview box are new. The ambiguous state is deliberately styled
   as a CAUTION (gold), not an error — a barcode with two packaging variants is
   valid LKK data awaiting a human, not a failure. */
.rdm-upcsap-statline { font-size: 0.85rem; margin-bottom: 10px; }
.rdm-upcsap-preview-box {
  border: 1px solid var(--rule, #e5e5e5);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface-soft, #fafafa);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
  margin-top: 10px;
}
.rdm-upcsap-preview-box .btn { align-self: flex-start; }
.rdm-upcsap-noprice { font-size: 0.82rem; }
.rdm-upcsap-ambiguous {
  border-left: 3px solid var(--lkk-gold, #D4A843);
  background: rgba(212, 168, 67, 0.06);
}
.rdm-upcsap-candidates {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 0.86rem;
  line-height: 1.6;
}
[data-theme="dark"] .rdm-upcsap-ambiguous { background: rgba(212, 168, 67, 0.12); }
.rdm-xref-subtitle {
  font-size: 0.92rem;
  font-weight: 650;
  margin: 12px 0 8px;
  color: var(--ink-strong, #1a1a2e);
}
.rdm-xref-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.rdm-xref-form .form-input { flex: 1 1 140px; min-width: 120px; max-width: 220px; }
.rdm-xref-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.rdm-xref-map-actions { display: flex; gap: 8px; }
.rdm-itemmap-table { margin-top: 6px; }
.rdm-itemmap-del { color: var(--heritage-red, #CC0000); }

/* ── Details restructure: invoice search + invoice grouping (45.10/12/13) ── */
.rdm-lines-toolbar {
  margin: 4px 0 12px;
}
.rdm-invoice-search {
  max-width: 260px;
}
.rdm-lines-empty {
  padding: 16px;
  font-size: 0.88rem;
}
.rdm-line-row-merged .rdm-line-edit-cell {
  display: flex;
  gap: 4px;
}

/* ── Grouped Extracted Lines (#15b) ───────────────────── */
.rdm-lines-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.rdm-lines-header .rdm-section-title { margin: 0; }
.rdm-line-group {
  border: 1px solid var(--rule, #e5e5e5);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--surface, #fff);
}
.rdm-line-group-unmapped {
  border-color: rgba(204, 0, 0, 0.35);
}
.rdm-line-group-header {
  padding: 10px 12px;
  background: var(--surface-soft, #f8f8f8);
  border-bottom: 1px solid var(--rule, #e5e5e5);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rdm-line-group-codes {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
}
.rdm-line-group-desc { font-size: 0.9rem; }
.rdm-line-group-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  font-size: 0.84rem;
}
.rdm-line-group-members { padding: 0; }
.rdm-line-group-members .rdm-table { margin: 0; }
.rdm-upload-delete {
  margin-left: auto;
  color: var(--heritage-red, #CC0000);
  font-size: 0.9rem;
  min-width: 36px;
  min-height: 36px;
}

[data-theme="dark"] .rdm-xref-hit {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .rdm-xref-miss {
  background: rgba(255, 80, 80, 0.08);
}
[data-theme="dark"] .rdm-line-group {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .rdm-line-group-header {
  background: rgba(255, 255, 255, 0.05);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Mobile */
@media (max-width: 720px) {
  .rdm-main-tabs { gap: 0; }
  .rdm-main-tab {
    flex: 1 0 auto;
    justify-content: center;
    padding: 11px 14px;
    font-size: 13px;
    min-height: 44px;
  }
  .rdm-lib-section { padding: 14px; }
  .rdm-deal-search { max-width: none; width: 100%; }
  .rdm-lib-toolbar { flex-direction: column; align-items: stretch; }
  /* #67: filter bar stacks on mobile — four side-by-side controls overflow. */
  .rdm-deal-filterbar { flex-direction: column; align-items: stretch; }
  .rdm-deal-filter-field { min-width: 0; width: 100%; }
  .rdm-deal-filter-clear { width: 100%; }
  .rdm-deal-dropzone { padding: 20px 12px; }
  .rdm-nodeal-note { flex-direction: column; align-items: flex-start; }
  .rdm-xref-lookup-row { flex-direction: column; align-items: stretch; }
  .rdm-xref-input { max-width: none; width: 100%; }
  .rdm-xref-form { flex-direction: column; align-items: stretch; }
  .rdm-xref-form .form-input { max-width: none; width: 100%; }
  .rdm-lines-header { flex-direction: column; align-items: flex-start; }
}

/* ── #26 B2: excluded / non-claim noise subgroup ─────────────────────
   Legacy mapping-sheet lines (no SAP, qty-0, money-0, sheet-* invoice)
   render muted + collapsed below real unmapped claims. */
.rdm-excluded-group { margin-top: 12px; }
.rdm-excluded-summary {
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--ink-soft, #777);
  padding: 8px 4px;
  user-select: none;
}
.rdm-excluded-summary:hover { color: var(--ink, #333); }
.rdm-line-group-noise {
  opacity: 0.65;
  border-color: var(--rule, #e5e5e5);
  margin-top: 10px;
}
.rdm-chip.rdm-line-excluded {
  background: rgba(120, 120, 120, 0.14);
  color: var(--ink-soft, #666);
}
[data-theme="dark"] .rdm-chip.rdm-line-excluded {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink-soft, #aaa);
}

/* #26 B3: friendly mapping-workbook upload error deep-link */
.rdm-upload-error-link { margin-left: 6px; white-space: nowrap; }

/* ── Xin #97: actionable upload-failure panel ─────────────────────────
   A rejected workbook used to show only the raw column trace in small red
   text. The rejection is correct (an unpriced pivot sheet must never mint
   credit) but it gave Xin nothing to do. Now: what is required, a template
   link, and the trace collapsed behind a disclosure for whoever debugs it. */
.rdm-upload-error-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-basis: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  border: 1px solid var(--err-line, #f0c2c2);
  border-left: 3px solid var(--heritage-red, #CC0000);
  border-radius: 0 5px 5px 0;
  background: var(--err-bg, #fdf4f4);
}
.rdm-upload-error-head {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--heritage-red, #CC0000);
}
.rdm-upload-error-req {
  font-size: 0.78rem;
  color: var(--ink, #2b2b2b);
}
.rdm-upload-error-actions { margin-top: 2px; }
.rdm-upload-error-details {
  margin-top: 2px;
  font-size: 0.74rem;
  color: var(--ink-mute, #6b6b6b);
}
.rdm-upload-error-details summary { cursor: pointer; }
.rdm-upload-error-trace {
  display: block;
  margin-top: 4px;
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 0.7rem;
  line-height: 1.45;
  word-break: break-word;
  color: var(--ink-mute, #6b6b6b);
}
/* Template prompt under the dropzone — available before the first failure. */
.rdm-upload-template-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--ink-mute, #6b6b6b);
}
.rdm-upload-template-link { white-space: nowrap; }


/* ── Collapsible case sections (#31) ───────────────────── */
.rdm-collapsible {
  border: none;
  margin: 0;
  padding: 0;
}
.rdm-collapsible-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  margin: 0 0 10px;
}
.rdm-collapsible-summary::-webkit-details-marker { display: none; }
.rdm-collapsible-summary::marker { content: ''; }
.rdm-collapsible-chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--ink-mute, #888);
  border-bottom: 2px solid var(--ink-mute, #888);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: 0 0 auto;
  margin-top: -2px;
}
.rdm-collapsible[open] > .rdm-collapsible-summary .rdm-collapsible-chevron {
  transform: rotate(45deg);
  margin-top: 0;
}
.rdm-collapsible-title {
  margin: 0 !important;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rdm-collapsible-summary .rdm-lines-view-toggle {
  margin-left: auto;
  flex: 0 0 auto;
}

/* #42.4 Credit Summary bands (Lei 2026-07-22): pending + unmatched rows are
   visible but muted and explicitly "not counted". */
.rdm-summary-table tr.rdm-row-muted td {
  opacity: 0.62;
  font-style: italic;
}
.rdm-summary-table tr.rdm-summary-unmatched td {
  background: rgba(220, 130, 0, 0.06);
}
.rdm-summary-table tr.rdm-summary-pending td {
  background: rgba(120, 120, 120, 0.05);
}
/* Lei #66 (2026-07-27): a REJECTED group is a closed decision, not pending.
   Tinted red, and the rejected units render struck-through so the original
   claim stays auditable without reading as payable. */
.rdm-summary-table tr.rdm-summary-rejected td {
  background: rgba(200, 40, 40, 0.06);
}
.rdm-qty-rejected {
  text-decoration: line-through;
  color: #b3261e;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .rdm-qty-rejected { color: #f2837c; }
.rdm-muted { color: var(--text-muted, #888); }
.rdm-chip-warn {
  background: rgba(220, 130, 0, 0.14);
  color: #a35b00;
  border: 1px solid rgba(220, 130, 0, 0.3);
}
[data-theme="dark"] .rdm-chip-warn { color: #f0a94b; }
/* Xin #163: NEUTRAL/INFO chip for `pending` ("not priced yet"). Deliberately
   NOT the warn palette — a line awaiting Verify is an unfinished step, not an
   exception. Warn styling here is what made 338 pending TF lines read as "no
   mapping" and produced a ticket for master data that already existed. */
.rdm-chip-info {
  background: rgba(47, 111, 159, 0.12);
  color: #24506f;
  border: 1px solid rgba(47, 111, 159, 0.28);
}
[data-theme="dark"] .rdm-chip-info { color: #bcd9ef; }
.rdm-chip-danger {
  background: rgba(200, 40, 40, 0.14);
  color: #b3261e;
  border: 1px solid rgba(200, 40, 40, 0.3);
}
[data-theme="dark"] .rdm-chip-danger { color: #f2837c; }
.rdm-pending-note-row td.rdm-pending-note {
  font-size: 0.82rem;
  color: var(--text-muted, #888);
  padding: 6px 10px;
  text-align: right;
  font-style: italic;
  background: rgba(120, 120, 120, 0.04);
}

/* ── Lei #42 residual pack (F2/F3/F4) ─────────────────────────────── */
/* Pack-size chip shown inline in deal/master description cells */
.rdm-pack-chip {
  background: rgba(80, 80, 80, 0.08);
  color: var(--text-muted, #666);
  border: 1px solid rgba(80, 80, 80, 0.18);
  font-size: 0.72rem;
  margin-left: 6px;
  white-space: nowrap;
}
[data-theme="dark"] .rdm-pack-chip { color: #bbb; }

/* Jade #270: which deal BOOK credited this line on a stacked e-commerce
   ladder (Weee Q3 / Yamibuy Q3 / July Special). Two rungs can print the same
   term and mean different money, so the book name is the disambiguator.
   Quiet by design — provenance, not a status. */
.rdm-deal-book-chip {
  background: rgba(80, 80, 80, 0.08);
  color: var(--text-muted, #666);
  border: 1px solid rgba(80, 80, 80, 0.18);
  font-size: 0.72rem;
  margin-left: 6px;
  white-space: nowrap;
}
[data-theme="dark"] .rdm-deal-book-chip { color: #bbb; }

/* F3 Deal Library split subsections */
.rdm-deal-subtitle {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 4px 0 2px;
  color: var(--ink, #222);
}
.rdm-deal-split { margin-top: 6px; }

/* F4 Why chip in Pending Review */
.rdm-why-chip { white-space: nowrap; font-size: 0.74rem; }

/* Lei #71 honesty UX — explain an ABSENT review action.
   Deliberately LOW-CONTRAST: this is an explanation, not an alert. It must
   read as "here is why", never compete with the real status chips, and never
   imply a new action exists. Display only — no money path. */
.rdm-exc-why-chip {
  white-space: nowrap;
  font-size: 0.72rem;
  font-style: italic;
  cursor: help;
}
.rdm-chip-muted {
  background: var(--surface-2, #f1f1f0);
  color: var(--ink-mute, #6b6b6b);
  border: 1px solid var(--line, #e2e2e0);
}
/* Section-level banner when the WHOLE Pending Review section is inert. */
.rdm-exc-blocked-note {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 3px solid var(--gold, #d4a843);
  background: var(--surface-2, #f7f6f3);
  color: var(--ink-mute, #6b6b6b);
  font-size: 0.82rem;
  border-radius: 0 4px 4px 0;
}

/* ── Lei #93: DONE state for Pending Review ──────────────────────────
   Lei filed "Approve/Reject still not work" twice on a case where all 15
   exceptions were already dispositioned by her. The queue was FINISHED, but a
   finished queue rendered as an empty table with a muted note underneath —
   visually indistinguishable from a broken one.

   So the done state gets real weight: full-width, green (success, not the gold
   "blocked" treatment — this is an accomplishment, not an obstruction), above
   the toolbar, with the disposition breakdown stated. Deliberately louder than
   .rdm-exc-blocked-note because it is the ANSWER to her question. */
.rdm-exc-done-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 12px;
  padding: 11px 14px;
  border: 1px solid var(--ok-line, #b7dfc2);
  border-left: 4px solid var(--ok, #1e874b);
  background: var(--ok-bg, #f1faf4);
  border-radius: 0 6px 6px 0;
}
.rdm-exc-done-icon {
  flex: 0 0 auto;
  font-size: 1rem;
  line-height: 1.35;
  color: var(--ok, #1e874b);
  font-weight: 700;
}
.rdm-exc-done-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rdm-exc-done-head {
  color: var(--ok-ink, #14603a);
  font-size: 0.9rem;
}
.rdm-exc-done-breakdown {
  color: var(--ink, #2b2b2b);
  font-size: 0.82rem;
}
.rdm-exc-done-hint {
  color: var(--ink-mute, #6b6b6b);
  font-size: 0.78rem;
}
@media (max-width: 640px) {
  .rdm-exc-done-banner { padding: 10px 12px; }
  .rdm-exc-done-head { font-size: 0.86rem; }
}
/* #93: when the reviewed rows ARE shown, make the why-chip load-bearing
   instead of muted-at-the-far-right (RESULT §1 recommendation 2). The reason a
   row has no buttons is the primary information on a done-state row. */
.rdm-exc-table .rdm-exc-why-chip {
  background: var(--surface-2, #f1f1f0);
  color: var(--ink, #2b2b2b);
  border: 1px solid var(--line, #d8d8d4);
  font-weight: 500;
  white-space: nowrap;
}

/* F2 Master List writable surface */
.rdm-ml-add-form { align-items: flex-end; }
.rdm-ml-actions-cell { white-space: nowrap; }
.rdm-ml-actions-cell .btn { padding: 2px 8px; }
/* #560: read-only UPC column. One barcode per line keeps a SAP with two
   UPCs narrow; the table wrap already scrolls sideways on phones. */
.rdm-ml-upc-cell { white-space: nowrap; }
.rdm-ml-upc { display: block; }
.rdm-ml-upc + .rdm-ml-upc { margin-top: 2px; }
.rdm-ml-dropzone {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin: 6px 0 12px;
  border: 1.5px dashed var(--border, #ccc);
  border-radius: 10px;
  background: rgba(120, 120, 120, 0.03);
}
.rdm-ml-dropzone.drag-over {
  border-color: var(--heritage-red, #cc0000);
  background: rgba(204, 0, 0, 0.04);
}
.rdm-ml-dropzone .rdm-dropzone-icon { font-size: 1.2rem; }
.rdm-ml-retailer-field .form-input { min-width: 140px; }

/* ── Lei #60 C1: vendor / uploader isolation banner ─────────────────────
   Shown on the case list when the server scoped the response to the user's
   OWN uploads (data.scope === 'own'), so an isolated vendor coordinator
   never mistakes isolation for data loss. */
.rdm-scope-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  margin: 0 0 12px;
  font-size: 0.86rem;
  line-height: 1.45;
  border-left: 3px solid var(--heritage-red, #cc0000);
  background: rgba(204, 0, 0, 0.035);
}
[data-theme="dark"] .rdm-scope-banner { background: rgba(204, 0, 0, 0.1); }

/* ── #565: named backup coordinator ────────────────────────────────────────
   Chip on a case row reached only as someone's backup, the matching notice
   on the case page, and the manager Setup panel on the Cases tab. */
.rdm-backup-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.74rem;
  white-space: nowrap;
  border: 1px solid var(--border, #d6d6d6);
  background: var(--surface-2, #f5f5f5);
}
.rdm-backup-setup { margin: 0 0 12px; padding: 10px 14px; }
.rdm-backup-setup summary { cursor: pointer; }
.rdm-backup-setup .rdm-backup-select { min-width: 180px; }

/* ── Lei #60 C3/C4: quarter filter + past-quarter soft-hide ─────────────
   The quarter column is back on the quarterly table (quarter only — the
   #45.3 clutter columns stay gone). Past quarters are hidden by default and
   revealed with the toggle; nothing is ever deleted. */
.rdm-deal-quarter-filter { max-width: 200px; }
.rdm-deal-showpast {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
}
.rdm-deal-showpast input:disabled + span { opacity: 0.5; cursor: not-allowed; }
.rdm-deal-quarter-meta {
  margin: -6px 0 12px;
  font-size: 0.8rem;
}
.rdm-deal-past-chip {
  background: #ececec;
  color: #6b6b6b;
}
[data-theme="dark"] .rdm-deal-past-chip { background: #333; color: #bbb; }

/* Jade #525: UPC and Period on the quarterly/special Deal Library table. A
   barcode or "Q4 / 2026" must not break mid-token on a phone; the "No UPC
   yet" hint sits quietly under the SAP code it stands in for. */
.rdm-lib-table .rdm-deal-upc,
.rdm-lib-table .rdm-deal-period { white-space: nowrap; }
.rdm-lib-table .rdm-deal-noupc {
  display: block;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
}

/* Lei #95: a quarterly deal with no quarter AND no period is UNTAGGED data,
   not an evergreen term. It used to render the muted "Evergreen" label, which
   asserted the deal was intentionally timeless — the false claim Lei reported.
   Amber = needs attention (fixable via the row's Edit → Quarter), distinct from
   both the neutral past-quarter grey and any error red. */

/* Lei/Xin #94: retailer scope selector on the Deal Library toolbar. Matches the
   #67 filter-field shape so the toolbar stays visually coherent. Hidden via the
   [hidden] attribute when the team has only one retailer. */
.rdm-deal-retailer-field {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 0 0 auto;
}
.rdm-deal-retailer-field[hidden] { display: none; }
.rdm-deal-retailer { min-width: 150px; }
@media (max-width: 640px) {
  .rdm-deal-retailer-field { width: 100%; }
  .rdm-deal-retailer { flex: 1 1 auto; min-width: 0; }
}

.rdm-deal-untagged-chip {
  background: var(--warn-bg, #fdf4e3);
  color: var(--warn-ink, #8a5a00);
  border: 1px solid var(--warn-line, #e8c67a);
  cursor: help;
}
[data-theme="dark"] .rdm-deal-untagged-chip {
  background: #3a2f16;
  color: #e5c47c;
  border-color: #6b5525;
}

/* ── Lei #67 P0: Deal Library multi-filter bar ──────────────────────────
   Four AND-ed constraints (year / period / item / deal) applied across the
   monthly AND quarterly-special sub-tables at once, so "June monthly + Q2
   quarterly for one item" reads as one filtered library view. Client-side
   over already-loaded rows — the #60 past-quarter hide stays server-side. */
.rdm-deal-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin: 10px 0 6px;
  padding: 10px 12px;
  border: 1px solid var(--rule, #e5e5e5);
  border-radius: 6px;
  background: var(--surface-soft, #f8f8f8);
}
.rdm-deal-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
  flex: 1 1 150px;
}
.rdm-deal-filter-label {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft, #6b7280);
}
.rdm-deal-filterbar .form-input {
  width: 100%;
}
.rdm-deal-filter-clear {
  flex: 0 0 auto;
  white-space: nowrap;
}
.rdm-deal-filter-clear[hidden] { display: none; }
.rdm-deal-filter-summary {
  font-size: 0.78rem;
  margin: 0 0 10px;
}
[data-theme="dark"] .rdm-deal-filterbar {
  background: rgba(255, 255, 255, 0.03);
  border-color: #3a3a3a;
}

/* ── Lei #60 C2: monthly vs quarterly picker in the deal import modal ─── */
.rdm-import-source {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}
.rdm-import-source .form-input { max-width: 260px; }
.rdm-import-source #rdm-import-month-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.rdm-import-source #rdm-import-month-row[hidden] { display: none; }

@media (max-width: 640px) {
  .rdm-deal-quarter-filter { max-width: 100%; }
  .rdm-import-source .form-input { max-width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Lei #67 P1 — DEAL HISTORY (promotion performance over time)
   Sub-tab under Deal Library: Library | History. Read-only BI surface.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Library | History sub-tabs (lighter weight than the main tabs) ──── */
.rdm-sub-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 16px;
  padding: 3px;
  background: var(--paper, #FBF6EC);
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.rdm-sub-tabs::-webkit-scrollbar { display: none; }

.rdm-sub-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-mute, #6B6560);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.rdm-sub-tab:hover { color: var(--ink-soft, #4A4038); }
.rdm-sub-tab.is-active {
  background: var(--warm-white, #FFFDF8);
  color: var(--heritage-red, #CC0000);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.rdm-sub-tab:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: 2px;
}
.rdm-sub-pane[hidden] { display: none !important; }

/* ── KPI strip ───────────────────────────────────────────────────────── */
.rdm-dh-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}
.rdm-dh-kpi {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  background: var(--paper, #FBF6EC);
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 10px;
  min-width: 0;
}
.rdm-dh-kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute, #6B6560);
}
.rdm-dh-kpi-value {
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--ink, #2C2520);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.rdm-dh-kpi-hint {
  font-size: 0.7rem;
  color: var(--ink-mute, #6B6560);
}

/* ── term + trend tables ─────────────────────────────────────────────── */
.rdm-dh-table-wrap { margin-bottom: 8px; }
.rdm-dh-table .num,
.rdm-dh-trend-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rdm-dh-table tr.is-selected {
  background: rgba(204, 0, 0, 0.05);
}
/* A promo that was offered but never redeemed is the most actionable row in
   the table — muted, not hidden, so it reads as a finding not an error. */
.rdm-dh-table tr.rdm-dh-row-dead th[scope="row"],
.rdm-dh-table tr.rdm-dh-row-dead td {
  color: var(--ink-mute, #6B6560);
}
.rdm-dh-reject {
  color: var(--danger, #C0392B);
  font-weight: 600;
}
.rdm-dh-subrate {
  display: block;
  font-size: 0.7rem;
  color: var(--ink-mute, #6B6560);
}
.rdm-chip-mm,
.rdm-chip-special {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
}
.rdm-chip-mm {
  background: rgba(212, 168, 67, 0.16);
  color: var(--heritage-gold-dark, #8B6914);
}
.rdm-chip-special {
  background: rgba(107, 114, 128, 0.14);
  color: var(--ink-soft, #4A4038);
}

/* Inline share bar — pure CSS, no chart dependency. */
.rdm-dh-bar {
  display: block;
  height: 8px;
  min-width: 2px;
  width: var(--dh-bar, 0%);
  border-radius: 4px;
  background: linear-gradient(90deg, var(--heritage-red, #CC0000), var(--heritage-gold, #D4A843));
}

.rdm-dh-trend { margin-top: 18px; }
.rdm-dh-footnote {
  margin-top: 14px;
  font-size: 0.74rem;
  line-height: 1.5;
}
.rdm-dh-special { white-space: nowrap; }

/* ── dark mode ───────────────────────────────────────────────────────── */
[data-theme="dark"] .rdm-sub-tabs {
  background: rgba(255, 255, 255, 0.04);
  border-color: #3a3a3a;
}
[data-theme="dark"] .rdm-sub-tab.is-active {
  background: rgba(255, 255, 255, 0.09);
  box-shadow: none;
}
[data-theme="dark"] .rdm-dh-kpi {
  background: rgba(255, 255, 255, 0.03);
  border-color: #3a3a3a;
}
[data-theme="dark"] .rdm-dh-table tr.is-selected {
  background: rgba(204, 0, 0, 0.14);
}
[data-theme="dark"] .rdm-chip-mm { background: rgba(212, 168, 67, 0.2); color: #e0bd6a; }
[data-theme="dark"] .rdm-chip-special { background: rgba(255, 255, 255, 0.09); }

/* ── mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .rdm-sub-tabs { width: 100%; }
  .rdm-sub-tab { flex: 1 1 0; text-align: center; padding: 8px 10px; }
  .rdm-dh-kpis { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
  .rdm-dh-kpi-value { font-size: 1.12rem; }
  .rdm-dh-table-wrap,
  .rdm-dh-trend .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* #127 D2 — case has no period → verify is blocked (money path).
   Deals are matched by period; a null period would price every invoice
   against every period's deals, so we warn in the case header instead of
   letting the coordinator click Verify and get a rejection.
   Mirrors .rdm-exc-done-banner's shape, warn palette instead of ok. */
.rdm-period-warn {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0 0;
  padding: 11px 14px;
  border: 1px solid var(--warn-line, #e8c67a);
  border-left: 4px solid var(--warn, #c98a00);
  background: var(--warn-bg, #fdf4e3);
  color: var(--warn-ink, #8a5a00);
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
}
.rdm-period-warn-icon { flex: 0 0 auto; }
@media (max-width: 640px) {
  .rdm-period-warn { padding: 10px 12px; }
}

/* ── Lei #134: retailer/label mismatch banner (ADVISORY, never auto-repin) ──
   Deliberately INFO-toned, not warning-toned: the case is not necessarily
   wrong, the two facts simply disagree and only a human can say which is
   right. A red alarm would push coordinators to "fix" it by re-pinning, and
   re-pinning changes which deals apply, i.e. the credit total. */
.rdm-retailer-mismatch {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0 0;
  padding: 11px 14px;
  border: 1px solid var(--info-line, #b9d4ea);
  border-left: 4px solid var(--info, #2f6f9f);
  background: var(--info-bg, #eef6fc);
  color: var(--info-ink, #24506f);
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
}
.rdm-retailer-mismatch-icon { flex: 0 0 auto; }
/* Xin #153: the banner now carries the re-pin CTA. It stays INFO-toned and the
   button is the only emphasis — the point is to give the operator a door, not
   to imply the pin is definitely wrong. */
.rdm-retailer-mismatch-actions {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
/* Sizing comes from the shared `.btn-sm` (04-components.css) so the mobile
   min-height rules in 97-mobile-optimize.css keep applying. No override here. */
[data-theme="dark"] .rdm-retailer-mismatch {
  background: rgba(47, 111, 159, 0.14);
  color: #bcd9ef;
  border-color: rgba(47, 111, 159, 0.5);
}

/* ── Xin #163 (2026-08-04): EXTRACT DONE, NOT PRICED YET ─────────────────
   Extraction succeeded and every line carries an item code, but SAP + unit
   price are blank because Verify has not run. Same INFO shape as the #134
   retailer banner (this is a next-step prompt, not a fault), with the Verify
   CTA inside it so the operator does not have to hunt the header for the
   action that fills the columns they are looking at.
   `.rdm-extract-verify--blocked` switches to the warn palette for the one case
   where the next step is NOT one click (no period set / credit note already
   exported), because then it really is a blocker. */
.rdm-extract-verify {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0 0;
  padding: 11px 14px;
  border: 1px solid var(--info-line, #b9d4ea);
  border-left: 4px solid var(--info, #2f6f9f);
  background: var(--info-bg, #eef6fc);
  color: var(--info-ink, #24506f);
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
}
.rdm-extract-verify-icon { flex: 0 0 auto; }
.rdm-extract-verify-counts {
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.rdm-extract-verify-actions {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.rdm-extract-verify--blocked {
  border-color: var(--warn-line, #e8c67a);
  border-left-color: var(--warn, #c98a00);
  background: var(--warn-bg, #fdf4e3);
  color: var(--warn-ink, #8a5a00);
}
[data-theme="dark"] .rdm-extract-verify {
  background: rgba(47, 111, 159, 0.14);
  color: #bcd9ef;
  border-color: rgba(47, 111, 159, 0.5);
}
[data-theme="dark"] .rdm-extract-verify--blocked {
  background: rgba(201, 138, 0, 0.16);
  color: #f0cf90;
  border-color: rgba(201, 138, 0, 0.5);
}
@media (max-width: 640px) {
  .rdm-extract-verify { padding: 10px 12px; }
}

/* ── Lei #134: "why no deal" explainability panel ─────────────────────────
   Sits directly under the existing no-deal helper note. Diagnostic only —
   never rendered on the credit note. */
.rdm-nodeal-reasons {
  padding: 14px 18px;
  margin-bottom: 14px;
  border-left: 4px solid var(--info, #2f6f9f);
  font-size: 0.9rem;
}
.rdm-nodeal-reasons-title {
  font-weight: 700;
  margin-bottom: 8px;
}
.rdm-nodeal-reason {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 0;
}
.rdm-nodeal-reason + .rdm-nodeal-reason {
  border-top: 1px solid var(--line, #e6e6e6);
}
.rdm-nodeal-reason-chip {
  flex: 0 0 auto;
  min-width: 1.9em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.rdm-nodeal-reason-text { line-height: 1.45; }
.rdm-nodeal-reason-saps {
  font-size: 0.8rem;
  margin-top: 2px;
  word-break: break-word;
}
[data-theme="dark"] .rdm-nodeal-reasons { border-left-color: #6fa8d0; }
/* Allocation containment (2026-09-17): same panel shape as the no-deal
   reasons, danger accent — this one says the stored total is NOT fresh. */
.rdm-nodeal-reasons.rdm-alloc-review { border-left-color: var(--danger, #c0392b); }
[data-theme="dark"] .rdm-nodeal-reasons.rdm-alloc-review { border-left-color: #e07b6f; }
[data-theme="dark"] .rdm-nodeal-reason + .rdm-nodeal-reason { border-top-color: #333; }
@media (max-width: 640px) {
  .rdm-retailer-mismatch { padding: 10px 12px; }
  .rdm-nodeal-reasons { padding: 12px 14px; }
}

/* ── Jade #134 T3 (2026-08-01): EARNED BUT UNPRICED ──────────────────────
   Jade read a correct 10+1 match with a $0 credit as "the deal was not
   applied". It was applied — the credit was blocked on a missing redeem price.
   These styles make that distinction visible instead of leaving it to be
   inferred from a blank cell.

   Deliberately RED (not the gold used for ordinary no_price / pending):
   entitled-but-unpriced is money the distributor has EARNED and we are not
   paying. That is a stronger signal than "needs review". */
.rdm-awaiting-price-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 14px;
  border-left: 4px solid var(--heritage-red, #CC0000);
  font-size: 0.9rem;
}
.rdm-awaiting-price-icon { font-size: 1.15rem; line-height: 1.3; }
.rdm-awaiting-price-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.rdm-awaiting-price-head { font-weight: 700; }
.rdm-awaiting-price-hint {
  color: var(--text-muted, #888);
  line-height: 1.45;
}
.rdm-awaiting-price-link {
  font-weight: 700;
  color: var(--heritage-red, #CC0000);
  text-decoration: none;
  white-space: nowrap;
  align-self: flex-start;
}
.rdm-awaiting-price-link:hover { text-decoration: underline; }

/* Row-level chip on the Credit Summary description cell. */
.rdm-awaiting-price-chip {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Money cells that must NOT read as zero.
   `$0.00` asserts a value; these assert the absence of one. Italic + muted so
   the eye separates them from real figures while scanning a money column, and
   `cursor: help` advertises the tooltip that explains why. */
.rdm-money-unpriced,
.rdm-price-missing {
  font-style: italic;
  color: var(--text-muted, #888);
  cursor: help;
}
/* The "N earned, unpriced" variant of the Pending Review why-chip. */
.rdm-why-noprice-earned { white-space: nowrap; }

/* Jade #292: the billed SAP under the deal SAP in the Credit Summary.
   The DEAL code leads (it is the one she can find in her uploaded files) and
   the BILLED code sits beneath it, smaller and muted, because it is still the
   code the credit was priced on and the code that reconciles to the invoice.
   Secondary weight, never hidden — suppressing it would trade one missing
   truth for another. `cursor: help` advertises the tooltip that names both. */
.rdm-sap-remap {
  font-size: 0.78em;
  font-weight: 400;
  line-height: 1.3;
  margin-top: 2px;
  cursor: help;
}
[data-theme="dark"] .rdm-sap-remap { color: rgba(255, 255, 255, 0.55); }

[data-theme="dark"] .rdm-awaiting-price-note { border-left-color: #ff6b6b; }
[data-theme="dark"] .rdm-awaiting-price-link { color: #ff6b6b; }
[data-theme="dark"] .rdm-awaiting-price-hint { color: rgba(255, 255, 255, 0.6); }
[data-theme="dark"] .rdm-money-unpriced,
[data-theme="dark"] .rdm-price-missing { color: rgba(255, 255, 255, 0.55); }

@media (max-width: 640px) {
  .rdm-awaiting-price-note {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 14px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   Eliza #155 — Manual credit notes (damages / short-ship)
   ═══════════════════════════════════════════════════════════════════ */

/* The intake form is a dense identifier grid (gold's Table 0), so it wants two
   columns on desktop and one on mobile. Reuses the shared .form-* tokens; only
   the grid geometry and the line-editor sizing live here. */
.rdm-mcn-form .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
.rdm-mcn-form .form-field { display: block; }
.rdm-mcn-form .form-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.35;
}
.rdm-mcn-form .form-error {
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid var(--heritage-red, #CC0000);
  background: rgba(204, 0, 0, 0.06);
  color: var(--heritage-red, #CC0000);
  font-size: 0.86rem;
}

/* Line editor: inputs sit flush inside table cells so the grid reads as a
   spreadsheet rather than a stack of form controls. */
.rdm-mcn-lines-table td { padding: 4px 6px; vertical-align: middle; }
.rdm-mcn-lines-table .form-input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .rdm-mcn-form .form-grid { grid-template-columns: minmax(0, 1fr); }
  /* Horizontal scroll beats squeezing six numeric columns into a phone width —
     the wrapper already scrolls, so the cells just need a floor. */
  .rdm-mcn-lines-table { min-width: 640px; }
}

[data-theme="dark"] .rdm-mcn-form .form-error {
  background: rgba(255, 107, 107, 0.10);
  border-left-color: #ff6b6b;
  color: #ff9d9d;
}

/* ════════════════════════════════════════════════════════════
   DISTRIBUTOR PROGRAMS (Track V, 2026-08-04) — `dp` tab.
   Additive block. Matches the redemption density above; deliberately
   NOT a visual redesign. All classes are `dp-` prefixed so nothing here
   can reach into the money-path panes.
   ──────────────────────────────────────────────────────────── */

.dp-wrap { display: flex; flex-direction: column; gap: 14px; }

.dp-intro { display: flex; flex-direction: column; gap: 2px; }
.dp-h3 { font-size: 1.05rem; font-weight: 700; color: var(--ink-strong, #1a1a2e); margin: 0; }
.dp-h4 { font-size: 0.98rem; font-weight: 700; color: var(--ink-strong, #1a1a2e); margin: 0; }
.dp-h5 { font-size: 0.9rem; font-weight: 700; color: var(--ink-strong, #1a1a2e); margin: 0 0 4px; }
.dp-sub, .dp-meta { font-size: 0.85rem; color: var(--ink-soft, #6b7280); margin: 0; }
.dp-hint { font-size: 0.8rem; color: var(--ink-soft, #6b7280); margin: 0 0 8px; }
.dp-hint.dp-inline { display: inline-block; margin: 0 0 0 10px; }
.dp-empty-inline { font-style: italic; }

/* The scope note is load-bearing UX: it states in the interface that this
   section cannot create money, so nobody reads a variance as an approval. */
.dp-scope-note {
  font-size: 0.8rem;
  color: var(--ink-soft, #6b7280);
  background: var(--surface-soft, #f8f8f8);
  border-left: 3px solid var(--heritage-gold, #D4A843);
  border-radius: 4px;
  padding: 8px 12px;
}

.dp-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Tables ─────────────────────────────────────────────── */
.dp-table-wrap { overflow-x: auto; border: 1px solid var(--rule-soft, #eee); border-radius: 6px; }
.dp-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.dp-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft, #6b7280);
  background: var(--surface-soft, #f8f8f8);
  padding: 8px 10px;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule-soft, #eee);
}
.dp-table td { padding: 8px 10px; border-bottom: 1px solid var(--rule-soft, #f2f2f2); vertical-align: middle; }
.dp-table tbody tr:last-child td { border-bottom: none; }
.dp-table-sm { font-size: 0.82rem; }
.dp-strong { font-weight: 600; color: var(--ink-strong, #1a1a2e); }
.dp-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  background: var(--surface-soft, #f8f8f8);
  padding: 1px 5px;
  border-radius: 3px;
}
.dp-row { cursor: pointer; }
.dp-row:hover, .dp-row:focus-visible { background: var(--eggshell-shade, #faf7f2); outline: none; }
.dp-detail-cell { color: var(--ink-soft, #6b7280); font-size: 0.8rem; }

/* "not set" must LOOK unset — an invented number styled like a real one is
   the exact failure mode LOCKS.md L3 exists to prevent. */
.dp-notset { color: var(--ink-faint, #9ca3af); font-style: italic; }

/* ── Status + exception chips ───────────────────────────── */
.dp-status {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-soft, #f1f1f1);
  color: var(--ink-soft, #6b7280);
}
.dp-status-live, .dp-status-complete { background: rgba(212, 168, 67, 0.16); color: #8a6d1f; }
.dp-status-reviewed { background: rgba(34, 139, 87, 0.14); color: var(--success-deep, #1c6b45); }
.dp-status-closed { background: rgba(107, 114, 128, 0.14); color: #4b5563; }

.dp-exc {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.dp-exc-ok { background: rgba(34, 139, 87, 0.12); color: var(--success-deep, #1c6b45); }
/* Over-claim is the money-losing direction → Heritage Red. */
.dp-exc-critical { background: rgba(204, 0, 0, 0.10); color: var(--heritage-red, #CC0000); }
.dp-exc-warn { background: rgba(212, 168, 67, 0.18); color: #8a6d1f; }
.dp-exc-info { background: rgba(107, 114, 128, 0.12); color: #4b5563; }

.dp-row-exc { background: rgba(255, 250, 235, 0.55); }
.dp-var-over { color: var(--heritage-red, #CC0000); font-weight: 700; }
.dp-var-under { color: var(--ink-soft, #6b7280); }
.dp-skipped { color: #8a6d1f; font-weight: 600; }

/* ── Detail panel ───────────────────────────────────────── */
.dp-detail {
  border: 1px solid var(--rule-soft, #eee);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--paper, #fff);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dp-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.dp-section { display: flex; flex-direction: column; gap: 6px; }
.dp-run-detail { border-top: 1px solid var(--rule-soft, #eee); padding-top: 12px; }
.dp-run-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.dp-run-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dp-reviewed { font-size: 0.8rem; color: var(--success-deep, #1c6b45); font-weight: 600; }

.dp-warn-banner {
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(212, 168, 67, 0.12);
  border-left: 3px solid var(--heritage-gold, #D4A843);
  border-radius: 4px;
  padding: 9px 12px;
  font-size: 0.83rem;
  color: var(--ink, #333);
}

/* Informational counterpart to dp-warn-banner (e.g. "deals switched off"):
   a fact Ops must see, but not a problem. */
.dp-note-banner {
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(107, 114, 128, 0.08);
  border-left: 3px solid var(--ink-faint, #9ca3af);
  border-radius: 4px;
  padding: 9px 12px;
  font-size: 0.83rem;
  color: var(--ink, #333);
}

/* ── Mechanics (N deals per program, Xin lock 2026-08-05) ── */
.dp-mech-table td { vertical-align: middle; }
/* A switched-off deal must LOOK switched off at a glance, but stay legible —
   it is still on file and still named in the report. */
.dp-mech-off { opacity: 0.55; }
.dp-mech-off code { text-decoration: line-through; }
.dp-mech-basis {
  font-size: 0.7rem;
  color: var(--ink-soft, #6b7280);
  margin-left: 4px;
}
.dp-mech-add { margin-top: 10px; }
.dp-mech-add > summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--heritage-red, #CC0000);
  padding: 4px 0;
}
.dp-mech-form {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 12px;
  margin-top: 8px;
  border: 1px solid var(--rule-soft, #eee);
  border-radius: 6px;
  background: var(--surface-soft, #fafafa);
}

/* The enable/disable switch — Xin's "enable/disable analysis" control. */
.dp-switch { display: inline-flex; align-items: center; cursor: pointer; }
.dp-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.dp-switch span {
  position: relative;
  display: inline-block;
  width: 34px; height: 18px;
  background: var(--rule, #d1d5db);
  border-radius: 9px;
  transition: background 0.15s ease;
}
.dp-switch span::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}
.dp-switch input:checked + span { background: var(--success-deep, #1c6b45); }
.dp-switch input:checked + span::after { transform: translateX(16px); }
.dp-switch input:focus-visible + span { outline: 2px solid var(--heritage-red, #CC0000); outline-offset: 2px; }

/* ── Stat cards (UNITS only — there is no money tile by design) ── */
.dp-cards { display: flex; gap: 10px; flex-wrap: wrap; }
.dp-card {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 116px;
  padding: 8px 12px;
  border: 1px solid var(--rule-soft, #eee);
  border-radius: 6px;
  background: var(--surface-soft, #fafafa);
}
.dp-card-alert { border-color: rgba(204, 0, 0, 0.35); background: rgba(204, 0, 0, 0.05); }
.dp-card-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft, #6b7280); }
.dp-card-value { font-size: 1.05rem; font-weight: 700; color: var(--ink-strong, #1a1a2e); }
.dp-card-note { font-size: 0.68rem; color: var(--ink-faint, #9ca3af); font-style: italic; }

/* L6: the incentive badge is not decoration — it is the guard that stops a
   display field being read as a payable. */
.dp-badge-display {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(107, 114, 128, 0.14);
  color: #4b5563;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Forms ──────────────────────────────────────────────── */
.dp-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.dp-field { display: flex; flex-direction: column; gap: 3px; font-size: 0.8rem; color: var(--ink-soft, #6b7280); }
.dp-input, .dp-select, .dp-textarea {
  font: inherit;
  font-size: 0.85rem;
  padding: 6px 9px;
  border: 1px solid var(--rule, #ddd);
  border-radius: 5px;
  background: var(--paper, #fff);
  color: var(--ink-strong, #1a1a2e);
  width: 100%;
  box-sizing: border-box;
}
.dp-textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; resize: vertical; }
.dp-form-actions, .dp-excl-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dp-upload-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dp-upload-row .dp-select { width: auto; min-width: 170px; }
.dp-file { font-size: 0.82rem; }
.dp-upload-status { font-size: 0.82rem; min-height: 18px; }
.dp-ok { color: var(--success-deep, #1c6b45); font-weight: 600; }
.dp-err { color: var(--heritage-red, #CC0000); font-weight: 600; }

.dp-filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dp-filter-label { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft, #6b7280); }
.dp-filter-row .dp-select { width: auto; min-width: 200px; }

/* ── Run chips ──────────────────────────────────────────── */
.dp-run-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.dp-run-chip {
  display: flex; align-items: center; gap: 8px;
  font: inherit; font-size: 0.8rem;
  padding: 6px 10px;
  border: 1px solid var(--rule, #ddd);
  border-radius: 999px;
  background: var(--paper, #fff);
  cursor: pointer;
}
.dp-run-chip:hover { background: var(--eggshell-shade, #faf7f2); border-color: var(--heritage-gold, #D4A843); }
.dp-run-date { font-weight: 600; color: var(--ink-strong, #1a1a2e); }
.dp-run-stat { color: var(--ink-soft, #6b7280); }
.dp-run-stat.dp-run-exc { color: var(--heritage-red, #CC0000); font-weight: 600; }

@media (max-width: 720px) {
  .dp-form-grid { grid-template-columns: minmax(0, 1fr); }
  /* Horizontal scroll beats crushing eight numeric columns onto a phone. */
  .dp-results-table { min-width: 700px; }
  .dp-toolbar .btn { flex: 1 1 auto; }
}

[data-theme="dark"] .dp-detail,
[data-theme="dark"] .dp-run-chip,
[data-theme="dark"] .dp-input,
[data-theme="dark"] .dp-select,
[data-theme="dark"] .dp-textarea { background: rgba(255, 255, 255, 0.04); color: #e8e8ea; }
[data-theme="dark"] .dp-card { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .dp-table th { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .dp-row:hover { background: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .dp-row-exc { background: rgba(212, 168, 67, 0.08); }
[data-theme="dark"] .dp-var-over, [data-theme="dark"] .dp-err { color: #ff9d9d; }

/* ══ FB-282 — archive / restore / delete a program ══════════════════════════
   Xin: "Could we delete a program?"

   The destructive control is styled LOCALLY rather than through a generic
   .btn-danger, because the platform only defines .btn-danger as a .btn-link
   modifier (04-components.css) — a bare `btn btn-danger` would render as an
   ordinary secondary button and the most dangerous control on the page would
   be the least visually distinct. #276 solved it the same way. */

/* The archived toggle sits above the table, always reachable even when the
   list it controls is empty. */
.dp-archive-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 0 0 10px;
}
.dp-archive-toggle[aria-pressed="true"] {
  border-color: var(--heritage-gold, #D4A843);
  font-weight: 600;
}

/* An archived row stays LEGIBLE — it is still real data, just not in play.
   Same reasoning as .dp-mech-off. */
.dp-row-archived { opacity: 0.62; }

.dp-archived-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: middle;
  background: rgba(107, 114, 128, 0.16);
  color: var(--ink-soft, #55504a);
}

.dp-archived-banner {
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(107, 114, 128, 0.10);
  border-left: 3px solid var(--ink-faint, #9ca3af);
  border-radius: 4px;
  padding: 9px 12px;
  font-size: 0.83rem;
  color: var(--ink, #333);
}

/* The danger zone is visually separated from the working sections above it so
   nobody arrives at it by accident while scrolling through terms. */
.dp-danger-zone {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rule-soft, #eee);
}
.dp-danger-actions {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 4px;
}

/* A REFUSAL, not a warning: the program has reviewed runs and will not be
   deleted. Reads as information, not as an error the operator caused. */
.dp-danger-blocked {
  display: flex; flex-direction: column; gap: 3px;
  background: rgba(192, 57, 43, 0.07);
  border-left: 3px solid var(--danger, #c0392b);
  border-radius: 4px;
  padding: 9px 12px;
  font-size: 0.83rem;
  color: var(--ink, #333);
  margin-bottom: 8px;
}

/* The softer "archive it first" nudge — a next step, not a refusal. */
.dp-danger-hint {
  display: flex; flex-direction: column; gap: 3px;
  background: rgba(107, 114, 128, 0.08);
  border-left: 3px solid var(--ink-faint, #9ca3af);
  border-radius: 4px;
  padding: 9px 12px;
  font-size: 0.83rem;
  color: var(--ink, #333);
  margin-bottom: 8px;
}

.dp-danger-footprint {
  font-size: 0.83rem;
  color: var(--ink, #333);
  background: rgba(192, 57, 43, 0.06);
  border-radius: 4px;
  padding: 8px 10px;
  margin: 8px 0;
}

.dp-modal-body { display: flex; flex-direction: column; gap: 8px; }
.dp-modal-body p { margin: 0; font-size: 0.88rem; line-height: 1.45; }
.dp-modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Destructive button. Explicit colours (not a token-only rule) so it stays
   unmistakable even where --danger is undefined. */
.dp-danger-actions .btn-danger,
.dp-modal-actions .btn-danger {
  background: var(--danger, #c0392b);
  border: 1px solid var(--danger, #c0392b);
  color: #fff;
}
.dp-danger-actions .btn-danger:hover:not(:disabled),
.dp-modal-actions .btn-danger:hover:not(:disabled) {
  background: #a93226;
  border-color: #a93226;
}
.dp-danger-actions .btn-danger:disabled,
.dp-modal-actions .btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

[data-theme="dark"] .dp-archived-badge {
  background: rgba(255, 255, 255, 0.10);
  color: #cfcac2;
}
[data-theme="dark"] .dp-archived-banner,
[data-theme="dark"] .dp-danger-hint { color: #e8e8ea; }
[data-theme="dark"] .dp-danger-blocked { color: #e8e8ea; }
[data-theme="dark"] .dp-danger-footprint {
  color: #e8e8ea;
  background: rgba(192, 57, 43, 0.16);
}

@media (max-width: 640px) {
  /* Full-width targets on a phone — a mis-tap here is not recoverable. */
  .dp-danger-actions { flex-direction: column; align-items: stretch; }
  .dp-danger-actions .btn { width: 100%; }
  .dp-modal-actions { flex-direction: column-reverse; align-items: stretch; }
  .dp-modal-actions .btn { width: 100%; }
}

/* XIN-NAME-1 - customer/store bill_to on line details */
.rdm-cell-customer {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9em;
}
.rdm-invoice-customer {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.85rem;
  color: var(--text-mute, #666);
  max-width: 36rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── #198 Jade — Customer/Store column show/hide ───────────────────────
   The line review table is too wide to approve/reject comfortably, and bill_to
   is the widest column she does not need on every row. Hiding is done in CSS
   on purpose: the <td>/<th> stay in the DOM, so thead/tbody column counts stay
   in parity, and the store name is still reachable by browser find, copy/paste,
   and every export path. This is a VIEW fold, not a data removal. */
.rdm-customer-hidden .rdm-col-customer { display: none; }

/* The toggle itself — mirrors .rdm-exc-showreviewed so the two checkboxes that
   can share a toolbar read as one control family. */
.rdm-customer-col-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-mute, #666);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.rdm-customer-col-toggle input { cursor: pointer; }

/* ── #145 Slice A — Master List upload-batch provenance (read-only) ──────
   Jade cannot tell her Walong rows from the 127 that arrived in two mis-filed
   uploads. This strip surfaces who/when/what-file/how-many per upload batch.
   Uses existing custom properties only, so 90-dark-mode.css inherits it. */
.rdm-ml-batches { margin: 10px 0 14px; }
.rdm-ml-batches-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 6px 0;
}
.rdm-ml-batches-hint { font-size: 0.78rem; }
.rdm-ml-batch-list {
  display: flex; flex-direction: column; gap: 8px;
  list-style: none; margin: 0; padding: 0;
}
.rdm-ml-batch-card {
  border: 1px solid var(--border, #ddd); border-radius: 8px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
}
.rdm-ml-batch-card.is-active { border-color: var(--brand-red, #c00); }
.rdm-ml-batch-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rdm-ml-batch-shape {
  font-size: 0.72rem; padding: 1px 6px; border-radius: 10px;
  background: var(--chip-bg, #f1f1f1);
}
.rdm-ml-batch-meta, .rdm-ml-batch-also {
  font-size: 0.8rem; color: var(--text-mute, #666);
}
/* Colour never carries meaning alone — the glyph and the text say it too. */
.rdm-ml-batch-impact-ok { font-size: 0.8rem; color: var(--ok, #2e7d32); }
.rdm-ml-batch-impact-warn { font-size: 0.8rem; color: var(--warn, #b26a00); }
.rdm-ml-batch-actions { display: flex; gap: 8px; margin-top: 4px; }
.rdm-ml-batch-filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 6px 10px; margin: 0 0 8px; border-radius: 6px;
  background: var(--chip-bg, #f1f1f1); font-size: 0.82rem;
}
.rdm-ml-secondary-filters {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 0 0 8px;
}
.rdm-ml-secondary-filters label {
  display: flex; align-items: center; gap: 6px; font-size: 0.8rem;
}
.rdm-ml-secondary-filters select { min-width: 8rem; }
.rdm-ml-prov-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 0.82rem; color: var(--text-mute, #666);
  text-decoration: underline dotted;
}
.rdm-ml-prov-btn:hover { color: var(--brand-red, #c00); }

@media (max-width: 720px) {
  .rdm-ml-batch-actions { flex-direction: column; align-items: stretch; }
  .rdm-ml-secondary-filters { flex-direction: column; align-items: stretch; }
  .rdm-ml-batch-filter-bar { flex-wrap: wrap; }
}

/* ── Xin #107c: UPC→SAP confirm dialog + monthly upload CTA ──────────────
   The confirm table can carry a dozen ambiguous barcodes, so it scrolls
   inside the modal rather than pushing the action buttons off-screen — a
   footer the operator cannot reach is the same dead end this ticket exists
   to remove. */
.rdm-upc-confirm-wrap {
  max-height: 46vh;
  overflow-y: auto;
  margin: 12px 0;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
}
.rdm-upc-confirm-table { width: 100%; margin: 0; }
.rdm-upc-confirm-table th,
.rdm-upc-confirm-table td { padding: 8px 10px; vertical-align: top; text-align: left; }
.rdm-upc-confirm-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.rdm-upc-confirm-upc code { font-size: 0.9rem; white-space: nowrap; }
.rdm-upc-confirm-desc { font-size: 0.78rem; margin-top: 2px; }
.rdm-upc-confirm-pick { min-width: 260px; max-width: 100%; }
.rdm-upc-confirm-status { margin-top: 8px; font-size: 0.85rem; }

/* The empty-state CTA scrolls the dropzone into view; the flash tells the
   user WHERE it landed, so the jump does not feel like a page change. */
.rdm-dropzone-flash {
  animation: rdm-dropzone-flash-kf 1.6s ease-out 1;
}
@keyframes rdm-dropzone-flash-kf {
  0%, 100% { box-shadow: 0 0 0 0 rgba(204, 0, 0, 0); }
  20%      { box-shadow: 0 0 0 4px rgba(204, 0, 0, 0.28); }
  60%      { box-shadow: 0 0 0 4px rgba(204, 0, 0, 0.14); }
}
@media (prefers-reduced-motion: reduce) {
  .rdm-dropzone-flash { animation: none; outline: 2px solid rgba(204, 0, 0, 0.5); }
}
.rdm-deal-sap-answer { line-height: 1.5; }

@media (max-width: 720px) {
  .rdm-upc-confirm-wrap { max-height: 52vh; }
  .rdm-upc-confirm-pick { min-width: 0; width: 100%; }
  .rdm-upc-confirm-table th,
  .rdm-upc-confirm-table td { padding: 6px 8px; }
}

/* #145 Slice B — guided batch-delete modal.
   Custom properties only, so 90-dark-mode.css inherits it unchanged. */
.rdm-batchdel { display: flex; flex-direction: column; gap: 10px; }
.rdm-batchdel-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.rdm-batchdel-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 42vh; overflow-y: auto;
  border: 1px solid var(--border, #ddd); border-radius: 8px;
}
.rdm-batchdel-row { border-bottom: 1px solid var(--border, #eee); }
.rdm-batchdel-row:last-child { border-bottom: 0; }
.rdm-batchdel-row label {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 7px 10px; cursor: pointer; font-size: 0.84rem;
}
/* In-use rows are tinted AND carry the ⚠ glyph + text — colour never alone. */
.rdm-batchdel-row.is-inuse { background: var(--warn-bg, rgba(178, 106, 0, 0.08)); }
.rdm-batchdel-inuse { font-size: 0.78rem; color: var(--warn, #b26a00); }
.rdm-batchdel-warn {
  font-size: 0.82rem; color: var(--warn, #b26a00);
  border-left: 3px solid var(--warn, #b26a00);
  padding: 6px 10px; background: var(--warn-bg, rgba(178, 106, 0, 0.08));
  border-radius: 4px;
}
.rdm-batchdel-final { font-size: 0.82rem; color: var(--text-mute, #666); margin: 0; }
.rdm-batchdel-reason, .rdm-batchdel-confirm {
  display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem;
}
.rdm-batchdel-reason input, .rdm-batchdel-confirm input {
  padding: 7px 9px; border: 1px solid var(--border, #ddd);
  border-radius: 6px; font: inherit; min-height: 38px;
}

@media (max-width: 720px) {
  .rdm-batchdel-tools { flex-direction: column; align-items: stretch; }
  .rdm-batchdel-list { max-height: 38vh; }
  .rdm-batchdel-row label { font-size: 0.8rem; }
}

/* Feedback 195 — multi-batch sweep modal. Same token vocabulary as .rdm-batchdel
   so it inherits dark mode for free and reads as the same family of action.
   (Issue number written without a leading hash on purpose: the CSS guard in
   redemption-145b-batch-delete-ui.test.js scans this block for hardcoded hex
   colours, and a bare hash-195 would read as one.) */
.rdm-sweep { display: flex; flex-direction: column; gap: 10px; }
.rdm-sweep-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 38vh; overflow-y: auto;
  border: 1px solid var(--border, #ddd); border-radius: 8px;
}
.rdm-sweep-row { border-bottom: 1px solid var(--border, #eee); }
.rdm-sweep-row:last-child { border-bottom: 0; }
.rdm-sweep-row label {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 7px 10px; cursor: pointer; font-size: 0.84rem;
}
/* In-use batches are tinted AND carry the ⚠ glyph + text — colour never alone. */
.rdm-sweep-row.is-inuse { background: var(--warn-bg, rgba(178, 106, 0, 0.08)); }
.rdm-sweep-inuse-tag { font-size: 0.78rem; color: var(--warn, #b26a00); }
.rdm-sweep-warn {
  font-size: 0.82rem; color: var(--warn, #b26a00);
  border-left: 3px solid var(--warn, #b26a00);
  padding: 6px 10px; background: var(--warn-bg, rgba(178, 106, 0, 0.08));
  border-radius: 4px;
}
.rdm-sweep-final { font-size: 0.82rem; color: var(--text-mute, #666); margin: 0; }
.rdm-sweep-inuse { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.rdm-sweep-reason, .rdm-sweep-confirm {
  display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem;
}
.rdm-sweep-reason input, .rdm-sweep-confirm input {
  padding: 7px 9px; border: 1px solid var(--border, #ddd);
  border-radius: 6px; font: inherit; min-height: 38px;
}
.rdm-sweep-status { font-size: 0.8rem; color: var(--text-mute, #666); min-height: 1em; }
.rdm-ml-sweep-btn { margin-left: auto; font-size: 0.8rem; }

@media (max-width: 720px) {
  .rdm-sweep-list { max-height: 34vh; }
  .rdm-sweep-row label { font-size: 0.8rem; }
  .rdm-ml-sweep-btn { margin-left: 0; width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Eliza feedback 204, Slice 1 — Store (supermarket) Coverage sub-tab.
   Mirrors the #67 Deal History chrome so the third sub-pane reads as part
   of the same surface rather than a bolted-on view.

   NOTE: do not write a bare "hash-204" token in this file. The design-token
   guards in redemption-145b / redemption-195 slice this stylesheet to EOF and
   treat any #xxx as a hardcoded colour, so a feedback id in a comment reads
   as a hex literal and fails an unrelated test.
   ═══════════════════════════════════════════════════════════════════════ */
.rdm-sc-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}
.rdm-sc-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rdm-sc-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute, #6B6560);
}
.rdm-sc-check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; }

.rdm-sc-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0 12px;
}
.rdm-sc-kpi {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  background: var(--paper, #FBF6EC);
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 10px;
  min-width: 0;
}
.rdm-sc-kpi-val {
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--ink, #2C2520);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.rdm-sc-kpi-lbl {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute, #6B6560);
}

/* The unknown-coverage disclosure. Deliberately visible, not a subtle hint:
   "—" instead of a number is only honest if we say why. */
.rdm-sc-notice { margin-bottom: 14px; }
.rdm-sc-warn {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  background: rgba(212, 168, 67, 0.16);
  border: 1px solid rgba(212, 168, 67, 0.45);
  color: var(--ink, #2C2520);
  margin-bottom: 6px;
}
.rdm-sc-hint { font-size: 0.78rem; }
.rdm-sc-unknown { color: var(--ink-mute, #6B6560); cursor: help; }

/* #211 (Jade) — product grain + the Q4 refusal box. */
.rdm-sc-prodtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.rdm-sc-prodtabs .btn { font-size: 0.8rem; padding: 5px 12px; }
.rdm-sc-prodtabs .btn.is-active {
  background: var(--heritage-red, #CC0000);
  border-color: var(--heritage-red, #CC0000);
  color: #fff;
}
.rdm-sc-prod-code { font-variant-numeric: tabular-nums; font-weight: 600; }

/* The Q4 disclosure is deliberately calm, not alarming: it is a scope note,
   not an error. It must remain visible (never collapsed behind a toggle). */
.rdm-sc-q4 { margin-top: 16px; }
.rdm-sc-q4-box {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--rule, #E4DED5);
  border-left: 3px solid var(--gold, #D4A843);
  background: rgba(212, 168, 67, 0.07);
  font-size: 0.82rem;
}
.rdm-sc-q4-box strong { display: block; margin-bottom: 3px; color: var(--ink, #2C2520); }
.rdm-sc-q4-box p { margin: 0; color: var(--ink-mute, #6B6560); line-height: 1.5; }

.rdm-sc-subtitle {
  margin: 18px 0 8px;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--ink, #2C2520);
}
.rdm-sc-table-wrap { margin-bottom: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rdm-sc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rdm-sc-matrix th, .rdm-sc-matrix td { white-space: nowrap; }

[data-theme="dark"] .rdm-sc-kpi {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--rule, #3a3a3a);
}
[data-theme="dark"] .rdm-sc-q4-box {
  background: rgba(212, 168, 67, 0.06);
  border-color: var(--rule, #3a3a3a);
  border-left-color: rgba(212, 168, 67, 0.6);
}
[data-theme="dark"] .rdm-sc-warn {
  background: rgba(212, 168, 67, 0.12);
  border-color: rgba(212, 168, 67, 0.35);
  color: var(--ink, #e8e2da);
}

@media (max-width: 640px) {
  .rdm-sc-kpis { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
  .rdm-sc-kpi-val { font-size: 1.12rem; }
  .rdm-sc-field, .rdm-sc-field .input { width: 100%; }
  .rdm-sc-filterbar { gap: 8px; }
}

/* ═══════════════════════════════════════════════════════════════════
   Eliza feedback 220 — FINAL OUTCOME panel (approved cases only)
   (Issue number written WITHOUT a leading hash on purpose: the redemption CSS
   token guards scan this file for bare hex colours, and a hash followed by
   three digits reads to that regex as a hardcoded colour.)
   ═══════════════════════════════════════════════════════════════════
   Two money numbers on one card is the hazard this styling has to manage.
   The calculated figure and the final credited figure are given EQUAL visual
   weight on purpose — making either one dominant would imply a precedence the
   product does not claim. The delta is the only coloured number, because the
   delta is the thing a human has to react to. */

.rdm-fo-card { border-left: 3px solid var(--gold, #D4A843); }

/* Jade #305 — the locked note that stands in for the card before verify.
   Deliberately NOT gold: gold is the live money card, and a locked note that
   looks identical to it would read as a card that failed to load. Muted grey
   border says "this is a placeholder for something not available yet", which is
   exactly what it is. No hover, no pointer, no affordance styling — the only
   interactive element inside it is a real button. */
.rdm-fo-locked { border-left: 3px solid var(--border, #d6d3cd); }
.rdm-fo-locked-body {
  margin: 4px 0 0; font-size: 0.84rem; line-height: 1.55;
}
.rdm-fo-locked-cta { margin-top: 12px; }

.rdm-fo-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.rdm-fo-intro { margin: 4px 0 14px; font-size: 0.84rem; line-height: 1.5; }

.rdm-fo-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.rdm-fo-figure {
  padding: 10px 12px;
  border: 1px solid var(--rule, #e5e0d8);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.015);
}
.rdm-fo-figure-final { border-color: rgba(212, 168, 67, 0.55); background: rgba(212, 168, 67, 0.07); }
.rdm-fo-figure-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-mute, #7a7168); margin-bottom: 4px;
}
.rdm-fo-figure-value {
  font-size: 1.18rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink, #2C2520);
}

.rdm-fo-delta { font-variant-numeric: tabular-nums; font-weight: 700; }
.rdm-fo-delta-up   { color: var(--success, #1c7c4a); }
.rdm-fo-delta-down { color: var(--heritage-red, #CC0000); }
.rdm-fo-delta-zero { color: var(--ink-mute, #7a7168); }

.rdm-fo-current { display: grid; gap: 6px; margin-bottom: 12px; }
.rdm-fo-meta { font-size: 0.84rem; }
.rdm-fo-meta-label { color: var(--ink-mute, #7a7168); margin-right: 6px; }
.rdm-fo-note {
  font-size: 0.86rem; line-height: 1.5;
  padding: 8px 10px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.025);
  white-space: pre-wrap; word-break: break-word;
}
.rdm-fo-file {
  font-size: 0.84rem; text-decoration: none;
  color: var(--heritage-red, #CC0000); word-break: break-all;
}
.rdm-fo-file:hover { text-decoration: underline; }
.rdm-fo-by { font-size: 0.78rem; }
.rdm-fo-empty { font-size: 0.86rem; padding: 8px 0 12px; }

/* The honesty line. Deliberately quiet but always present — it is the only
   thing on screen telling the operator that nothing they type here reaches
   Finance or changes an exported document. */
.rdm-fo-boundary {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 0.78rem; line-height: 1.45;
  padding: 8px 10px; border-radius: 6px;
  background: rgba(212, 168, 67, 0.10);
  border: 1px solid rgba(212, 168, 67, 0.30);
  color: var(--ink, #2C2520);
}

/* ── Jade #332 — FINAL RESULT, the completed-case main view ─────────

   A finished case used to render as Verify/Submit controls and flag lists with
   the recorded figure hidden in a modal, so it LOOKED unfinished. This card is
   the answer: it leads the case, states Completed, and carries the uploaded
   final summary's own qty / amount / total / item lines.

   Heritage red on the left edge, not gold. Gold is the Final Outcome working
   card; the Final Result is the settled record above it, and the two must not
   read as the same object. */
.rdm-final-result {
  border-left: 3px solid var(--heritage-red, #CC0000);
  margin-bottom: 14px;
}
.rdm-fr-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
/* "Completed" — the one word Eliza is looking for when she opens the case. */
.rdm-fr-status-pill {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(28, 124, 74, 0.12);
  border: 1px solid rgba(28, 124, 74, 0.35);
  color: var(--success, #1c7c4a);
}
.rdm-fr-sub { margin: 4px 0 14px; font-size: 0.84rem; line-height: 1.5; }

.rdm-fr-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.rdm-fr-figure {
  padding: 10px 12px;
  border: 1px solid var(--rule, #e5e0d8);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.015);
}
/* The credited amount is the headline figure on the whole screen. */
.rdm-fr-figure-amount {
  border-color: rgba(204, 0, 0, 0.45);
  background: rgba(204, 0, 0, 0.05);
}
.rdm-fr-figure-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-mute, #7a7168); margin-bottom: 4px;
}
.rdm-fr-figure-value {
  font-size: 1.18rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink, #2C2520);
}

/* Her TOTAL row disagreeing with the sum of her own item lines is a fact about
   the workbook, surfaced rather than reconciled. Amber: worth reading, not an
   error in AIOP. */
.rdm-fr-warn {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 0.8rem; line-height: 1.45;
  padding: 8px 10px; border-radius: 6px; margin-bottom: 12px;
  background: rgba(212, 168, 67, 0.12);
  border: 1px solid rgba(212, 168, 67, 0.40);
}

.rdm-fr-lines { margin-bottom: 12px; }
.rdm-fr-lines-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 6px;
}
.rdm-fr-lines-title { margin: 0; font-size: 0.92rem; }
.rdm-fr-lines-src { font-size: 0.76rem; word-break: break-all; }
.rdm-fr-lines-empty {
  font-size: 0.86rem; line-height: 1.5;
  padding: 10px 12px; border-radius: 6px; margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.025);
  border: 1px dashed var(--rule, #e5e0d8);
}
.rdm-fr-meta { font-size: 0.78rem; margin-bottom: 10px; }
.rdm-fr-boundary {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 0.78rem; line-height: 1.45;
  padding: 8px 10px; border-radius: 6px;
  background: rgba(212, 168, 67, 0.10);
  border: 1px solid rgba(212, 168, 67, 0.30);
  color: var(--ink, #2C2520);
}

/* The working card, once a Final Result exists above it. Muted so the page has
   one obvious headline — but NOT hidden: every figure still renders. */
.rdm-fo-card-secondary { opacity: 0.92; }

/* Original vs final — collapsed by default. It is a reconciliation tool. */
.rdm-fo-compare { margin-bottom: 14px; }
.rdm-fo-compare-summary {
  cursor: pointer; font-weight: 600; font-size: 0.92rem;
}
.rdm-fo-compare-sub { margin: 8px 0 12px; font-size: 0.82rem; line-height: 1.5; }
.rdm-fo-compare-totals {
  display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px;
  font-size: 0.86rem; font-variant-numeric: tabular-nums;
}
.rdm-fo-compare-gaps { font-size: 0.8rem; margin: 0 0 10px; }
/* A SKU present on only one side. Never zero-filled — the dash IS the data. */
.rdm-cmp-only td { background: rgba(212, 168, 67, 0.06); }
.rdm-cmp-only-tag {
  display: inline-block; margin-left: 6px;
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 999px;
  background: rgba(212, 168, 67, 0.18);
  color: var(--ink-mute, #7a7168);
}

/* The "Working records" divider. A HEADING, not a collapse: everything below
   it stays fully rendered and scrollable. Demoting these sections is about
   telling the reader what they are looking at, not about hiding audit data. */
.rdm-working-heading {
  margin: 18px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--rule, #e5e0d8);
}
.rdm-working-heading .rdm-section-title { margin-bottom: 2px; }
.rdm-working-sub { font-size: 0.8rem; line-height: 1.5; margin: 0; }
/* The upload dropzone on a completed case. Still present and still usable —
   a case can legitimately be re-opened — just no longer the loudest thing. */
.rdm-working-record { opacity: 0.92; }

/* Jade #332 — the credit-note-number-is-not-the-amount warning. Advisory, so
   it is amber and never red: nothing was rejected and the save still works. */
.rdm-fo-cn-warn { display: none; }
.rdm-fo-cn-warn-on {
  display: block;
  color: var(--ink, #2C2520);
  background: rgba(212, 168, 67, 0.12);
  border: 1px solid rgba(212, 168, 67, 0.40);
  border-radius: 6px; padding: 6px 8px; line-height: 1.45;
}

[data-theme="dark"] .rdm-fr-figure { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .rdm-fr-figure-amount { background: rgba(204, 0, 0, 0.14); border-color: rgba(204, 0, 0, 0.45); }
[data-theme="dark"] .rdm-fr-lines-empty { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .rdm-fr-boundary,
[data-theme="dark"] .rdm-fr-warn,
[data-theme="dark"] .rdm-fo-cn-warn-on {
  background: rgba(212, 168, 67, 0.10);
  border-color: rgba(212, 168, 67, 0.30);
  color: var(--ink, #e8e2da);
}
[data-theme="dark"] .rdm-cmp-only td { background: rgba(212, 168, 67, 0.08); }

@media (max-width: 640px) {
  .rdm-fr-figures { grid-template-columns: 1fr 1fr; }
}

/* Eliza ticket 326 — the export bar above the case list. */
.rdm-list-exports {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-bottom: 10px; flex-wrap: wrap;
}
@media (max-width: 640px) {
  .rdm-list-exports { justify-content: stretch; }
  .rdm-list-exports > .btn { flex: 1 1 auto; }
}

/* Eliza ticket 325 — the prefill note under the Final Outcome file box.

   This class was toggled in JS but never had a rule, so a genuine problem and a
   perfectly normal message looked identical: unstyled grey text. Two states now
   read differently at a glance.

   `rdm-fo-prefill-warn` is the ACTIONABLE state: AIOP could not read a total, or
   the amount is still missing while a file is waiting. Amber, not red: nothing
   has failed and nothing has been lost, she just has to type the number.

   The neutral states (a PDF that simply is not readable for a total, an amount
   she already typed) stay quiet, because marking those as warnings is what told
   her the file had been rejected when it had been accepted. */
.rdm-fo-prefill-note { line-height: 1.45; }
.rdm-fo-prefill-warn {
  color: var(--ink, #2C2520);
  background: rgba(212, 168, 67, 0.12);
  border-left: 2px solid var(--gold, #D4A843);
  padding: 6px 8px; border-radius: 4px;
}

.rdm-fo-history { margin-top: 12px; }
.rdm-fo-history > summary {
  cursor: pointer; font-size: 0.84rem; font-weight: 600;
  color: var(--ink-mute, #7a7168); padding: 4px 0;
}
.rdm-fo-history-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.rdm-fo-history-item {
  padding: 10px 12px; border-radius: 8px;
  border: 1px dashed var(--rule, #e5e0d8);
  background: rgba(0, 0, 0, 0.015);
  display: grid; gap: 5px;
}
.rdm-fo-history-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rdm-fo-history-amount {
  font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--ink-mute, #7a7168); text-decoration: line-through;
}
.rdm-fo-superseded-tag {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.06); color: var(--ink-mute, #7a7168);
}

.rdm-fo-modal-calc {
  padding: 8px 10px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.03); font-size: 0.88rem;
}
.rdm-fo-confirm-rows { display: grid; gap: 6px; margin: 12px 0; }
.rdm-fo-confirm-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 7px 10px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.025); font-size: 0.9rem;
}
.rdm-fo-confirm-row strong { font-variant-numeric: tabular-nums; }
.rdm-fo-confirm-delta {
  background: rgba(204, 0, 0, 0.07);
  border: 1px solid rgba(204, 0, 0, 0.20);
}

[data-theme="dark"] .rdm-fo-figure { background: rgba(255,255,255,0.03); border-color: var(--rule, #3a3a3a); }
[data-theme="dark"] .rdm-fo-figure-final { background: rgba(212,168,67,0.08); border-color: rgba(212,168,67,0.45); }
[data-theme="dark"] .rdm-fo-note,
[data-theme="dark"] .rdm-fo-modal-calc,
[data-theme="dark"] .rdm-fo-confirm-row { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .rdm-fo-history-item { background: rgba(255,255,255,0.03); border-color: var(--rule, #3a3a3a); }
[data-theme="dark"] .rdm-fo-boundary { background: rgba(212,168,67,0.10); border-color: rgba(212,168,67,0.30); color: var(--ink, #e8e2da); }
[data-theme="dark"] .rdm-fo-prefill-warn { background: rgba(212,168,67,0.14); color: var(--ink, #e8e2da); }
[data-theme="dark"] .rdm-fo-delta-up { color: var(--success, #4ec27f); }

@media (max-width: 640px) {
  .rdm-fo-figures { grid-template-columns: 1fr 1fr; }
  .rdm-fo-figure-delta { grid-column: 1 / -1; }
  .rdm-fo-figure-value { font-size: 1.05rem; }
  .rdm-fo-head { align-items: stretch; }
  .rdm-fo-head .btn { width: 100%; }
}

/* ── Jade FB-262: retailer rename (Master List) ──────────────────────────
   Label-only edit next to "+ Add retailer". Ghost-weight on purpose: it is a
   correction affordance, not a primary action, and it must never read louder
   than the create button that opens a genuinely new namespace. */
.rdm-ml-rename-retailer { white-space: nowrap; }

/* Honesty line in the rename dialog (brief section 8): a rename is NOT a merge.
   Gold rule, not red — this is a caveat to read, not an error. */
.rdm-rename-honest {
  padding: 8px 10px;
  border-left: 3px solid var(--gold, #d4a843);
  background: rgba(212, 168, 67, 0.08);
  border-radius: 0 4px 4px 0;
  color: var(--ink-soft, #55504a);
  line-height: 1.45;
}

[data-theme="dark"] .rdm-rename-honest {
  background: rgba(212, 168, 67, 0.10);
  color: var(--ink, #e8e2da);
}

@media (max-width: 640px) {
  .rdm-ml-rename-retailer { width: 100%; }
}

/* ── Jade ticket no. 264 (2026-08-19): Other-MCN form ─────────────────────────────

   Two visual jobs, both of them honesty jobs.

   1. A DERIVED CELL MUST NOT LOOK TYPABLE. Net unit amount and total become
      read-only mirrors of the server's arithmetic the moment a price is
      entered, and the operator has to be able to SEE that without clicking
      into them — otherwise the form looks broken rather than calculated.
   2. A FILLED DESCRIPTION MUST NAME ITS SOURCE. Same promise as ticket no. 185 Bill-To badge: nothing is ever autofilled without saying where it came
      from, and no label says SAP.                                          */

/* Derived money cells: recessed, not disabled-grey. Read-only inputs still
   submit (which is what lets the server check our arithmetic), so this must
   read as "computed for you", never as "switched off". */
.rdm-mcn-lines-table .form-input.rdm-mcn-derived {
  background: rgba(212, 168, 67, 0.10);
  border-color: rgba(212, 168, 67, 0.45);
  color: var(--ink, #2b2724);
  font-variant-numeric: tabular-nums;
  cursor: default;
}

.rdm-mcn-lines-table .form-input.rdm-mcn-derived:focus {
  outline: 2px solid rgba(212, 168, 67, 0.55);
  outline-offset: -2px;
}

[data-theme="dark"] .rdm-mcn-lines-table .form-input.rdm-mcn-derived {
  background: rgba(212, 168, 67, 0.14);
  color: var(--ink, #e8e2da);
}

/* Material-lookup provenance badge, under the description input. Mirrors the
   ticket no. 185 Bill-To source badge deliberately — one visual language for "AIOP filled
   this and here is the book it came from". */
.rdm-mcn-material-source {
  display: block;
  margin-top: 3px;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--ink-soft, #55504a);
}

.rdm-mcn-material-source[hidden] { display: none; }

[data-theme="dark"] .rdm-mcn-material-source { color: var(--ink-mute, #9a938a); }

/* Finance-coding disclosure. Collapsing hides the CELL, never the input's
   value: the inputs stay in the DOM and still submit, so Xin's line G/L and
   Eliza's category survive a save Jade makes without opening the block. */
.rdm-mcn-lines-table [data-mcn-coding-col][hidden] { display: none; }

@media (max-width: 720px) {
  /* Two more numeric columns than ticket no. 155 shipped with, so the floor rises. The
     wrapper already scrolls horizontally — the cells just need room to stay
     legible rather than being squeezed into unreadable slivers. */
  .rdm-mcn-lines-table { min-width: 820px; }
}

/* ══════════════════════════════════════════════════════════════════
   Eliza tickets 312, 313, 314, 315 - redeemed price + approved free qty
   ══════════════════════════════════════════════════════════════════
   A money-editing surface, so it reads as a form and not as a report:
   the two editable columns are visibly inputs, and a row carrying a
   special approval is tinted so it cannot be mistaken for engine math. */
.rdm-sa-intro {
  font-size: 0.82rem;
  margin: 0 0 10px;
  max-width: 78ch;
  line-height: 1.5;
}
.rdm-sa-frozen {
  font-size: 0.82rem;
  margin: 0 0 10px;
}
.rdm-sa-table .rdm-sa-qty,
.rdm-sa-table .rdm-sa-price {
  width: 100%;
  min-width: 84px;
  max-width: 120px;
  text-align: right;
  padding: 4px 8px;
  font-size: 0.85rem;
}
.rdm-sa-row-approved {
  background: color-mix(in srgb, var(--lkk-gold, #d4a843) 12%, transparent);
}
.rdm-sa-row-approved .rdm-sa-engine-qty {
  text-decoration: line-through;
  opacity: 0.6;
}
.rdm-sa-chip {
  white-space: nowrap;
}
@media (max-width: 720px) {
  .rdm-sa-table .rdm-sa-qty,
  .rdm-sa-table .rdm-sa-price {
    min-width: 64px;
  }
}
/* Ticket 313: a price a person typed reads differently from a list price. */
.rdm-sa-table .rdm-sa-price-edited {
  border-color: var(--lkk-gold, #d4a843);
  font-weight: 600;
}

/* Jade tickets 342 / 343 / 344a (2026-09-02): totals footer + band chip.
   The footer row carries .rdm-totals-row, so it inherits the Credit Summary
   totals treatment (light + dark) and the two tables read alike. The credit
   scope note sits under the amount so the figure is never read without its
   qualifier. A grey-on-Credit-Summary row keeps its inputs fully legible here
   (no opacity/italic, unlike the summary): it is the row she is meant to
   edit. An approved row keeps its gold tint over the grey. */
.rdm-sa-table tfoot .rdm-sa-totals-row td {
  font-variant-numeric: tabular-nums;
}
.rdm-sa-total-scope {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.3;
  cursor: help;
}
.rdm-sa-table tr.rdm-sa-row-grey:not(.rdm-sa-row-approved) td {
  background: rgba(120, 120, 120, 0.05);
}
.rdm-sa-band-chip {
  white-space: nowrap;
}

/* Jade ticket 347 (2026-09-02): a No Mapping row is now listed here so she can supply
   the SAP during final review. It keeps the grey not-counted treatment above
   and adds a leading marker, so a row that cannot pay yet is never mistaken
   for one that can. */
.rdm-sa-table tr.rdm-sa-row-unmapped td:first-child {
  box-shadow: inset 3px 0 0 var(--rdm-warn, #d4a843);
}
.rdm-sa-table tr.rdm-sa-row-unmapped .rdm-sa-sap {
  min-width: 11ch;
  font-variant-numeric: tabular-nums;
}

/* ── Jade ticket 330 / ticket 331 (2026-08-31) ───────────────────────────────────── */

/* Ticket 330: the flags card is now a collapsible. The card supplied its own 20px
   padding around a flat <h3>; with the #31 chrome inside it that padding would
   double up on the summary row, so the card padding is handed to the
   collapsible and the counts sit on the summary line itself. */
.rdm-flags-section > .rdm-collapsible > .rdm-collapsible-summary {
  padding: 0;
}
.rdm-flags-section .rdm-collapsible-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
/* The counts are the part that must survive the fold, so they are legible in
   the summary row at both states and never wrap away from the title. */
.rdm-flags-count {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.rdm-flags-section .rdm-collapsible-body .rdm-flags-list {
  margin-top: 12px;
}

/* Ticket 331: facet filters live in the existing Pending Review toolbar. */
.rdm-exc-facets {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.rdm-exc-facet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
}
.rdm-exc-facet-label {
  color: var(--text-mute, #6b7280);
}
.rdm-exc-facet-select {
  max-width: 200px;
  padding: 4px 8px;
  font-size: 0.85rem;
}
.rdm-exc-facet-clear {
  font-size: 0.8rem;
  padding: 4px 10px;
}

/* Ticket 331: sortable column headers. The button carries the click so the header is
   keyboard reachable and the click cannot fall through to the #31 fold. */
.rdm-exc-sortable {
  padding: 0;
}
.rdm-exc-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  background: none;
  border: 0;
  padding: 8px 10px;
  font: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
}
.rdm-th-num .rdm-exc-sort-btn {
  justify-content: flex-end;
}
.rdm-exc-sort-btn:hover,
.rdm-exc-sort-btn:focus-visible {
  color: var(--heritage-red, #cc0000);
}
/* Idle arrow is a hint, not a claim: muted until the column is the active sort,
   so a table with no sort applied does not look like it has eleven of them. */
.rdm-exc-sort-arrow {
  font-size: 0.7rem;
  opacity: 0.35;
}
.rdm-exc-sort-active {
  color: var(--heritage-red, #cc0000);
  font-weight: 700;
}
.rdm-exc-sort-active .rdm-exc-sort-arrow {
  opacity: 1;
}

@media (max-width: 720px) {
  .rdm-exc-facet-select { max-width: 140px; }
  .rdm-exc-facets { gap: 6px; }
}

/* Ticket 590: Credit Summary sort + Deal/Status filters. Same look as the Ticket 331
   Pending Review controls; own select class so clearing one table's filters
   never resets the other table's dropdowns. */
.rdm-sum-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.rdm-sum-facet-select {
  max-width: 220px;
  padding: 4px 8px;
  font-size: 0.85rem;
}
.rdm-sum-showing-row td.rdm-sum-showing,
.rdm-sum-empty-row td.rdm-sum-empty {
  font-size: 0.82rem;
  color: var(--text-muted, #888);
  padding: 6px 10px;
  text-align: right;
  font-style: italic;
  background: rgba(204, 0, 0, 0.04);
}
.rdm-sum-empty-row td.rdm-sum-empty { text-align: center; }
@media (max-width: 720px) {
  .rdm-sum-facet-select { max-width: 140px; }
}

/* FB-399: the row a save just landed on, so success is visible, not a toast. */
.dp-row-saved td { background: rgba(28, 107, 69, 0.08); }
.dp-saved-banner { border-left-color: var(--success-deep, #1c6b45); margin: 8px 0; }
.dp-conflict-list { margin: 6px 0; padding-left: 18px; }

/* Jade feedback 411: in-cell "Edit" for the deal row's item code. Quiet like
   the Remove word (feedback 276), but legible and inside the cell she reads. */
.rdm-deal-itemcode-edit {
  font-size: 0.76rem;
  padding: 1px 6px;
  margin-left: 4px;
  white-space: nowrap;
}
.rdm-deal-itemcode-ro {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 0.85rem;
}
.rdm-deal-itemcode-ro dt { color: var(--text-mute, #666); }
.rdm-deal-itemcode-ro dd { margin: 0; }

/* ────────────────────────────────────────────────────────────
   TRUCK ADS (Jade FB-413, 2026-10-09) — `ads` tab.
   Additive, `ads-` prefixed; reuses the dp- table/field styles.
   ──────────────────────────────────────────────────────────── */
.ads-subtabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--rule-soft, #eee); }
.ads-subtab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 8px 12px; font-size: 0.88rem; font-weight: 600; cursor: pointer;
  color: var(--ink-soft, #6b7280);
}
.ads-subtab.is-active { color: var(--heritage-red, #CC0000); border-bottom-color: var(--heritage-red, #CC0000); }
.ads-pending {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline;
  font-size: 0.82rem; background: var(--warn-soft, #fff8e6); border: 1px solid var(--warn-border, #f1d58a);
  border-left: 3px solid var(--heritage-gold, #D4A843); border-radius: 4px; padding: 8px 12px;
}
.ads-pending-tag {
  display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; padding: 1px 6px; border-radius: 8px; background: var(--warn-chip, #fde8b0); color: var(--warn-ink, #7a5a00);
}
.ads-year-bar { align-items: flex-end; }
.ads-inline-field { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; }
.ads-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.ads-kpi { border: 1px solid var(--rule-soft, #eee); border-radius: 6px; padding: 10px 12px; background: var(--surface, #fff); }
.ads-kpi-v { font-size: 1.15rem; font-weight: 700; color: var(--ink-strong, #1a1a2e); }
.ads-kpi-l { font-size: 0.75rem; color: var(--ink-soft, #6b7280); }
.ads-batch { display: flex; flex-direction: column; gap: 6px; }
.ads-num { text-align: right; white-space: nowrap; }
.ads-plates { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; white-space: nowrap; }
.ads-st {
  display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 10px;
  background: var(--surface-soft, #f1f1f1); color: var(--ink-soft, #6b7280); white-space: nowrap;
}
.ads-st-open { background: rgba(204, 0, 0, 0.08); color: var(--danger-ink, #9b1c1c); }
.ads-st-partial { background: rgba(212, 168, 67, 0.18); color: var(--gold-ink, #8a6d1f); }
.ads-st-done { background: rgba(34, 139, 87, 0.14); color: var(--success-deep, #1c6b45); }
.ads-st-warn { background: var(--warn-chip, #fde8b0); color: var(--warn-ink, #7a5a00); }
.ads-st-skip { background: rgba(107, 114, 128, 0.14); color: var(--ink-muted, #4b5563); }
.ads-flag { font-size: 0.75rem; color: var(--ink-soft, #6b7280); }
.ads-flag-warn { color: var(--warn-strong, #b45309); font-weight: 700; }
.ads-dialog { border: 1px solid var(--heritage-gold, #D4A843); }
.ads-setting {
  display: grid; grid-template-columns: minmax(220px, 1fr) minmax(200px, 1fr); gap: 12px; align-items: start;
  padding: 10px 0; border-bottom: 1px solid var(--rule-soft, #f2f2f2);
}
.ads-months { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.ads-month { font-size: 0.85rem; display: inline-flex; gap: 4px; align-items: center; }
.ads-state-in { width: 4.5em; text-transform: uppercase; }
.ads-cases-in { width: 7em; }
.ads-wide { grid-column: 1 / -1; }
.ads-row-error td { background: var(--danger-soft, #fdecec); }
.ads-voided td { color: var(--ink-faint, #9ca3af); text-decoration: line-through; }
@media (max-width: 640px) { .ads-setting { grid-template-columns: 1fr; } }

/* ── Incentive estimate (Xin 10/07; L6 rewritten [KEVIN 2026-10-17]) ── (hygiene-allow: identity; owner citation required by the L6 change)
   The card holds a SERVER-computed estimate string. It is styled apart from
   the unit tiles so it is never mistaken for a quantity, and it always sits
   above the Eliza approval note. */
.dp-incentive-est { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.dp-card-est { border-color: rgba(28, 107, 69, 0.35); background: rgba(28, 107, 69, 0.05); }
.dp-est-table { max-width: 860px; }
.dp-eliza-note { font-size: 0.8rem; }
.dp-mech-rate { white-space: nowrap; }
.dp-input-sm { width: 84px; padding: 2px 6px; }
.dp-select-sm { padding: 2px 4px; font-size: 0.8rem; }
/* Review M2: cross-program overlap flag on the distributor estimate. */
.dp-overlap-warning { border-left: 4px solid var(--color-warning, #b45309); font-size: 0.85rem; }
.dp-overlap-warning ul { margin: 0.25rem 0 0.25rem 1.1rem; padding: 0; }
/* PR 470 follow-up: the Redeem Price held-cases toast names each held case
   with a link (no dialog); a close button and a short capped list. */
.toast.rdm-held-notice { position: relative; padding-right: 48px; }
.rdm-held-notice-cases { margin: 6px 0 0 1.1rem; padding: 0; max-height: 40vh; overflow-y: auto; }
.rdm-held-notice-cases li { margin: 2px 0; }
.rdm-held-notice-cases a { color: inherit; text-decoration: underline; }
.rdm-held-notice-more { list-style: none; margin-left: -1.1rem; color: var(--ink-mute, inherit); }
.rdm-held-notice-close { position: absolute; top: 2px; right: 2px; min-width: 44px; min-height: 44px; background: none; border: 0; font-size: 1.25rem; line-height: 1; color: var(--ink); cursor: pointer; }

/* View team (2026-11-16) — read-grant holders pick another team to view
   read-only. Hidden for everyone without a Redemption read grant. */
.rdm-view-team {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 0.85rem;
}
.rdm-view-team[hidden] { display: none; }
.rdm-view-team .rdm-view-team-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rdm-view-team .rdm-view-team-banner {
  flex-basis: 100%;
  padding: 8px 12px;
  border: 1px solid var(--rule, #e5e5e5);
  border-left: 3px solid var(--warning, #b7791f);
  border-radius: 6px;
  background: var(--surface-2, #faf9f7);
}
.rdm-view-team .rdm-view-team-banner[hidden] { display: none; }

/* View team (2026-11-17): while viewing another team every tab is read only.
   Hide the create / save / edit / upload / verify / delete controls. The
   server refuses any write that carries the view anyway (403
   view_team_read_only); this keeps the screen honest. Truck Ads hides its own
   controls (canWrite() is false while viewing). */
.rdm-readonly-view #rdm-new-btn,
.rdm-readonly-view #rdm-create-form,
.rdm-readonly-view #rdm-mcn-new-btn,
.rdm-readonly-view #rdm-mcn-empty-cta,
.rdm-readonly-view #dp-new-program,
.rdm-readonly-view #dp-new-distributor,
.rdm-readonly-view #dp-rate-save,
.rdm-readonly-view #dpm-save,
.rdm-readonly-view #dp-upload-btn,
.rdm-readonly-view #dp-map-btn,
.rdm-readonly-view #dp-file,
.rdm-readonly-view #dp-leg,
.rdm-readonly-view #dp-verify-btn,
.rdm-readonly-view #dp-archive-btn,
.rdm-readonly-view #dp-restore-btn,
.rdm-readonly-view #dp-delete-btn,
.rdm-readonly-view #dp-excl-save,
.rdm-readonly-view #dp-map-from-error,
.rdm-readonly-view #dp-map-clear,
.rdm-readonly-view #dp-review-btn,
.rdm-readonly-view #dpd-list-new,
.rdm-readonly-view #dpd-create-anyway,
.rdm-readonly-view [data-dp-mech-rate-save],
.rdm-readonly-view [data-dp-mech-del],
.rdm-readonly-view [data-dpd-edit],
.rdm-readonly-view [data-dpd-del],
.rdm-readonly-view [data-review-audit] { display: none !important; }
.rdm-readonly-view [data-dp-mech-toggle],
.rdm-readonly-view [data-dp-mech-rate],
.rdm-readonly-view [data-dp-mech-basis],
.rdm-readonly-view #dp-rate-input,
.rdm-readonly-view #dp-rate-basis,
.rdm-readonly-view #dp-excl-text { pointer-events: none; opacity: 0.6; }
/* View team, review SHOULD-1 (2026-11-17): case detail, MCN row and
   reference-page write controls are hidden too while viewing. Downloads and
   "view lines" stay. */
.rdm-readonly-view #rdm-verify-btn,
.rdm-readonly-view #rdm-approve-btn,
.rdm-readonly-view #rdm-submit-btn,
.rdm-readonly-view #rdm-delete-btn,
.rdm-readonly-view #rdm-sendback-btn,
.rdm-readonly-view #rdm-repin-btn,
.rdm-readonly-view #rdm-repin-banner-btn,
.rdm-readonly-view #rdm-set-period-btn,
.rdm-readonly-view #rdm-extract-period-btn,
.rdm-readonly-view #rdm-extract-verify-btn,
.rdm-readonly-view #rdm-final-outcome-btn,
.rdm-readonly-view #rdm-flags-upload-btn,
.rdm-readonly-view #rdm-browse-btn,
.rdm-readonly-view #rdm-ml-add-btn,
.rdm-readonly-view #rdm-ref-upload-btn,
.rdm-readonly-view #rdm-itemmap-upload-btn,
.rdm-readonly-view #rdm-upcsap-upload-btn,
.rdm-readonly-view #rdm-cost-upload-btn,
.rdm-readonly-view #rdm-mcn-import-btn,
.rdm-readonly-view #rdm-mcn-cust-import-btn,
.rdm-readonly-view [data-mcn-edit],
.rdm-readonly-view [data-mcn-void],
.rdm-readonly-view [data-mcn-post],
.rdm-readonly-view [data-mcn-unpost],
.rdm-readonly-view [data-mcn-copy] { display: none !important; }
/* View team, delta review SHOULD-1 (2026-11-17): the remaining write surfaces.
   Whole containers, not single buttons, so Enter in a form or a drop on a zone
   cannot reach a write either. The JS write gates (canReviewException() etc.)
   also answer false while viewing; this list covers what no gate guards. */
.rdm-readonly-view #rdm-upload-zone,
.rdm-readonly-view #rdm-dropzone,
.rdm-readonly-view .rdm-upload-delete,
.rdm-readonly-view .rdm-edit-line-btn,
.rdm-readonly-view #rdm-ml-write,
.rdm-readonly-view #rdm-ml-add,
.rdm-readonly-view #rdm-ml-dropzone,
.rdm-readonly-view #rdm-ml-sweep,
.rdm-readonly-view #rdm-ml-add-retailer,
.rdm-readonly-view #rdm-ml-rename-retailer,
.rdm-readonly-view #rdm-ml-request-retailer,
.rdm-readonly-view .rdm-ml-edit,
.rdm-readonly-view .rdm-ml-del,
.rdm-readonly-view .rdm-ml-batch-remove,
.rdm-readonly-view [data-rrq-approve],
.rdm-readonly-view [data-rrq-reject],
.rdm-readonly-view [data-rrq-withdraw],
.rdm-readonly-view #rdm-empty-cta,
.rdm-readonly-view #rdm-fo-locked-verify,
.rdm-readonly-view .rdm-adopt-ml-btn,
.rdm-readonly-view #rdm-deal-dropzone,
.rdm-readonly-view #rdm-special-section,
.rdm-readonly-view #rdm-deal-create,
.rdm-readonly-view .rdm-deal-del-btn,
.rdm-readonly-view .rdm-deal-batch-remove,
.rdm-readonly-view .rdm-deal-itemcode-edit,
.rdm-readonly-view #rdm-xref-add,
.rdm-readonly-view .rdm-itemmap-del,
.rdm-readonly-view #rdm-upcsap-apply,
.rdm-readonly-view .rdm-exc-approve,
.rdm-readonly-view .rdm-exc-approve-requested,
.rdm-readonly-view .rdm-exc-approve-entitled,
.rdm-readonly-view .rdm-exc-reject,
.rdm-readonly-view .dp-mech-add { display: none !important; }
/* ============================================================
   45-recipe-workbench.css
   Recipe Workbench — toolbar, filter tabs, card grid,
   ingredient table + editor rows, status pills
   ============================================================ */

.rwb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.rwb-filter-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.rwb-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
  font-family: inherit;
}

.rwb-tab:hover {
  border-color: var(--heritage-gold);
  color: var(--ink-strong);
}

.rwb-tab.is-active {
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: var(--warm-white);
  border-color: var(--heritage-red-dark);
}

.rwb-tab.is-active .rwb-tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: var(--warm-white);
}

.rwb-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(91, 44, 138, 0.10);
  color: var(--heritage-purple-dark, #4a2374);
  font-size: 0.74rem;
  font-weight: 700;
}

.rwb-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rwb-search {
  min-width: 260px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.rwb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.rwb-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  border: 1px solid var(--rule);
}

/* Hover lift only on real pointers — janky on touch (P6.1) */
@media (hover: hover) {
  .rwb-card:hover {
    transform: translateY(-2px);
    border-color: var(--heritage-gold);
    box-shadow: 0 6px 18px rgba(204, 0, 0, 0.10);
  }
}

.rwb-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.rwb-card-name {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink-strong);
  line-height: 1.3;
}

.rwb-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.rwb-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(212, 168, 67, 0.14);
  border: 1px solid rgba(212, 168, 67, 0.35);
  color: var(--heritage-gold-dark, #B58C2E);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}

.rwb-card-foot {
  font-size: 0.78rem;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}

/* Status pills — draft (purple), official (green), archived (muted). */
.rwb-status-draft    { background: rgba(91, 44, 138, 0.10); color: var(--heritage-purple); border-color: rgba(91, 44, 138, 0.22); }
.rwb-status-official { background: rgba(45, 140, 60, 0.12); color: var(--success-deep, #2d8c3c); border-color: rgba(45, 140, 60, 0.30); }
.rwb-status-archived { background: rgba(90, 79, 69, 0.10); color: var(--ink-soft); border-color: rgba(90, 79, 69, 0.20); }

/* Detail modal — ingredient table + method list */
.rwb-ing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.rwb-ing-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.rwb-ing-qty {
  white-space: nowrap;
  font-feature-settings: 'tnum';
  font-weight: 600;
  width: 110px;
  color: var(--ink-strong);
}

.rwb-method {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
  font-size: 0.92rem;
}

.rwb-method li {
  margin-bottom: 4px;
}

/* Editor — dynamic ingredient rows (P3 adds SKU + sub-recipe pickers;
   H1/M2 add group label + optional checkbox) */
.rwb-ing-row {
  display: grid;
  grid-template-columns: 70px 80px 1.2fr 0.9fr 0.7fr 0.9fr 0.7fr auto 34px;
  gap: 6px;
  margin-bottom: 6px;
  align-items: center;
}

.rwb-ing-opt {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.74rem;
  color: var(--ink-soft);
  white-space: nowrap;
  cursor: pointer;
}

.rwb-ing-remove {
  padding: 4px 8px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* L1: group header rows (Sauce / Garnish / …) in detail, scaled + print tables */
.rwb-ing-table .rwb-group-row td {
  padding-top: 10px;
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

/* Mobile responsiveness — chefs use tablets/phones in kitchens */
@media (max-width: 720px) {
  .rwb-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .rwb-toolbar-right {
    width: 100%;
    justify-content: space-between;
  }
  .rwb-search {
    flex: 1;
    min-width: 0;
  }
  .rwb-grid {
    grid-template-columns: 1fr;
  }
  /* P6.1 audit M1: carded edit rows from ≤720 (not only ≤480) —
     qty | unit | ✕ on line 1, name full row, secondary fields full-span */
  .rwb-ing-row {
    grid-template-columns: 88px 1fr 44px;
    row-gap: 8px;
    padding: 10px;
    border: 1px solid var(--rule);
    border-radius: 10px;
    margin-bottom: 10px;
    align-items: center;
  }
  .rwb-ing-row [name="ing_qty"]  { grid-column: 1; grid-row: 1; }
  .rwb-ing-row [name="ing_unit"] { grid-column: 2; grid-row: 1; }
  .rwb-ing-remove {
    grid-column: 3;
    grid-row: 1;
    min-height: 44px;
    min-width: 44px;
  }
  .rwb-ing-row [name="ing_name"] { grid-column: 1 / -1; }
  .rwb-ing-row [name="ing_prep"],
  .rwb-ing-row [name="ing_sku"],
  .rwb-ing-row [name="ing_sub"],
  .rwb-ing-row [name="ing_group"],
  .rwb-ing-row .rwb-ing-opt {
    grid-column: 1 / -1;
  }
  .rwb-ing-row .rwb-ing-opt { min-height: 44px; }
  .rwb-ing-row .form-input { min-height: 44px; }
  /* L3: datalist must not participate in grid layout if a browser boxes it */
  .rwb-ing-row > datalist {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
  }
  .rwb-cat-chips {
    order: 2;
    width: 100%;
  }
}

/* ── P2: scale bar (view-only convert/scale on recipe detail) ── */
.rwb-scalebar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--paper-warm, var(--paper));
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.rwb-scalebar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rwb-scalebar-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.rwb-scalebar-sublabel {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.rwb-scale-chips {
  display: inline-flex;
  gap: 4px;
}

.rwb-scale-chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 140ms ease;
  font-family: inherit;
}

.rwb-scale-chip:hover {
  border-color: var(--heritage-gold);
}

.rwb-scale-chip.is-active {
  background: var(--heritage-red, #CC0000);
  border-color: var(--heritage-red, #CC0000);
  color: #fff;
}

.rwb-scale-input {
  width: 84px;
  padding: 5px 8px;
  font-size: 0.85rem;
}

.rwb-scale-select {
  width: auto;
  padding: 5px 26px 5px 8px;
  font-size: 0.85rem;
}

.rwb-scale-servings {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Large-base hint (S ≥ 100): steer chefs toward target servings */
.rwb-scale-largehint {
  flex-basis: 100%;
  font-size: 0.74rem;
  color: var(--ink-soft);
}

.rwb-scale-largehint::before {
  content: '◴ ';
  color: var(--heritage-gold, #D4A843);
}

.rwb-scale-viewonly {
  flex-basis: 100%;
  font-size: 0.74rem;
  font-style: italic;
}

.rwb-est-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(212, 168, 67, 0.16);
  color: #8a6d1f;
  border: 1px solid rgba(212, 168, 67, 0.45);
  vertical-align: 1px;
}

.rwb-scale-warnings {
  margin-bottom: 10px;
  display: grid;
  gap: 4px;
}

.rwb-scale-warning {
  font-size: 0.8rem;
  color: #8a6d1f;
  background: rgba(212, 168, 67, 0.10);
  border: 1px solid rgba(212, 168, 67, 0.35);
  border-radius: 8px;
  padding: 6px 10px;
}

/* Scale bar at 390px — stack groups, keep controls tappable */
@media (max-width: 480px) {
  .rwb-scalebar {
    gap: 8px 12px;
  }
  .rwb-scalebar-group {
    width: 100%;
  }
  .rwb-scale-input {
    width: 72px;
  }
}

/* ── P3: category filter chips ── */
.rwb-cat-chips {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.rwb-cat-chip {
  border: 1px solid var(--rule);
  background: var(--surface, #fff);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s ease;
}

.rwb-cat-chip:hover {
  border-color: var(--heritage-red);
  color: var(--heritage-red);
}

.rwb-cat-chip.is-active {
  background: var(--heritage-red);
  border-color: var(--heritage-red);
  color: #fff;
}

/* ── P3: sub-recipe chip on ingredient lines ── */
.rwb-sub-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--rule);
  background: var(--surface-soft, #f7f5f1);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--heritage-purple, #5B2C8A);
  cursor: pointer;
  vertical-align: middle;
}

.rwb-sub-chip:hover {
  border-color: var(--heritage-purple, #5B2C8A);
}

/* ── P3: versions drawer ── */
.rwb-version-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rwb-version-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.rwb-version-title {
  font-weight: 700;
  font-size: 0.92rem;
}

.rwb-version-note {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-style: italic;
}

/* ── P3: print kitchen sheet (view-only) ── */
.rwb-print-sheet {
  display: none;
}

@media print {
  body.rwb-printing > *:not(.rwb-print-sheet) {
    display: none !important;
  }
  body.rwb-printing .rwb-print-sheet {
    display: block !important;
    padding: 24px;
    font-size: 12pt;
    color: #000;
  }
  /* Branded masthead — Heritage Red brand, gold hairline, serif title */
  .rwb-print-sheet .rwb-print-brand {
    font-size: 11pt;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #CC0000;
    padding-bottom: 6px;
    border-bottom: 1.5pt solid #D4A843;
    margin-bottom: 10px;
  }
  .rwb-print-sheet h1 {
    margin: 4px 0 2px;
    font-size: 22pt;
    font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-weight: 700;
  }
  .rwb-print-sheet .rwb-print-subline {
    font-size: 9pt;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 2px;
  }
  .rwb-print-sheet .rwb-print-meta {
    font-size: 9.5pt;
    color: #444;
    margin-bottom: 14px;
  }
  .rwb-print-sheet .rwb-print-foot {
    font-size: 8.5pt;
    color: #555;
    margin-top: 12px;
    padding-top: 6px;
    border-top: 0.75pt solid #D4A843;
  }
  /* Troy legal NOTICE (CHRIS-8/27). Small but never hidden: this block is
     required copy, so it must survive a page break intact rather than being
     orphaned onto a trailing sheet. */
  .rwb-print-sheet .rwb-print-legal {
    font-size: 7pt;
    line-height: 1.35;
    color: #555;
    margin-top: 10px;
    padding-top: 6px;
    border-top: 0.5pt solid #bbb;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .rwb-print-sheet .rwb-print-legal-title {
    font-weight: 700;
    font-size: 7.5pt;
    letter-spacing: 0.04em;
    color: #444;
    margin-bottom: 3px;
  }
  .rwb-print-sheet .rwb-print-legal p {
    margin: 0 0 4px;
  }
  .rwb-print-sheet h2 {
    font-size: 12pt;
    margin: 14px 0 6px;
    border-bottom: 1px solid #999;
    padding-bottom: 2px;
  }
  .rwb-print-sheet .rwb-ing-table {
    width: 100%;
    border-collapse: collapse;
  }
  .rwb-print-sheet .rwb-ing-table td {
    padding: 3px 8px 3px 0;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
  }
  .rwb-print-sheet .rwb-ing-table th {
    text-align: left;
    font-size: 8.5pt;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
    padding: 0 8px 3px 0;
    border-bottom: 1px solid #999;
  }
  .rwb-print-sheet .rwb-print-sku {
    white-space: nowrap;
    width: 120px;
    font-size: 9.5pt;
  }
  .rwb-print-sheet .rwb-ing-qty {
    white-space: nowrap;
    font-weight: 600;
    width: 110px;
  }
  .rwb-print-sheet .rwb-sub-chip,
  .rwb-print-sheet .rwb-est-badge {
    border: none;
    background: none;
    padding: 0;
    font-size: 9.5pt;
    color: #555;
  }
  .rwb-print-sheet ol.rwb-method {
    margin: 0;
    padding-left: 20px;
  }
  .rwb-print-sheet ol.rwb-method li {
    margin-bottom: 6px;
  }
}

/* ── P4 doc ingest ─────────────────────────────────────────────── */
.rwb-ingest-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--heritage-red, #CC0000) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--heritage-red, #CC0000) 30%, transparent);
  color: var(--heritage-red, #CC0000);
  font-size: 0.85rem;
  word-break: break-word;
}
.rwb-ingest-review {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 18px;
  align-items: start;
}
.rwb-ingest-warnings { grid-column: 1 / -1; }
/* #603: the form column must never grow past its track. Its children could
   not shrink (min-width:auto), so wide ingredient rows ran out of the form
   and under the extracted-text pane next to it. */
.rwb-ingest-form,
.rwb-ingest-form > *,
.rwb-ingest-form .form-field { min-width: 0; }
.rwb-ingest-form .form-input { max-width: 100%; }
/* Row fields fill their cell and never size it: a long unmapped unit
   ("large russet potatoes — unmapped") must not push the row wider. */
.rwb-ingest-form .rwb-ing-row > .form-input { width: 100%; min-width: 0; }
@media (max-width: 720px) {
  .rwb-ingest-form .rwb-ing-row { grid-template-columns: 22px 88px minmax(0, 1fr) 44px; }
}
/* #603: the editor's one-line ingredient row (11 columns, ~1000px) does not
   fit the review form (~510px beside the extracted text, ~870px stacked).
   Above the phone breakpoint the review uses a two-line row instead:
     drag | qty | unit | name ............ | ✕
     prep ............ | SKU | sub-recipe | optional
   Phones (≤720px) keep the existing carded rows. */
@media (min-width: 721px) {
  .rwb-ingest-form .rwb-ing-row {
    grid-template-columns: 22px 72px 96px minmax(0, 1fr) minmax(0, 1fr) auto;
    row-gap: 6px;
    padding: 8px;
    border: 1px solid var(--rule);
    border-radius: 8px;
    margin-bottom: 8px;
  }
  .rwb-ingest-form .rwb-ing-row .rwb-ing-drag     { grid-column: 1; grid-row: 1; }
  .rwb-ingest-form .rwb-ing-row [name="ing_qty"]  { grid-column: 2; grid-row: 1; }
  .rwb-ingest-form .rwb-ing-row [name="ing_unit"] { grid-column: 3; grid-row: 1; }
  .rwb-ingest-form .rwb-ing-row [name="ing_name"] { grid-column: 4 / 6; grid-row: 1; }
  .rwb-ingest-form .rwb-ing-row .rwb-ing-remove   { grid-column: 6; grid-row: 1; justify-self: end; }
  .rwb-ingest-form .rwb-ing-row [name="ing_prep"] { grid-column: 1 / 4; grid-row: 2; }
  .rwb-ingest-form .rwb-ing-row [name="ing_sku"]  { grid-column: 4; grid-row: 2; }
  .rwb-ingest-form .rwb-ing-row [name="ing_sub"]  { grid-column: 5; grid-row: 2; }
  .rwb-ingest-form .rwb-ing-row .rwb-ing-opt      { grid-column: 6; grid-row: 2; }
  .rwb-ingest-form .rwb-ing-row .rwb-unit-flag,
  .rwb-ingest-form .rwb-ing-row .rwb-density-dot  { grid-column: 1 / -1; justify-self: start; }
}
.rwb-ingest-flag {
  display: inline-block;
  padding: 3px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 6px;
  font-size: 0.78rem;
  background: color-mix(in srgb, #b45309 12%, transparent);
  border: 1px solid color-mix(in srgb, #b45309 35%, transparent);
  color: #92400e;
}
.rwb-ingest-raw-pane { min-width: 0; }
.rwb-ingest-raw {
  max-height: 480px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-sunken, #f6f4ef);
  border: 1px solid var(--border-soft, #e5e1d8);
  font-size: 0.76rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
@media (max-width: 860px) {
  .rwb-ingest-review { grid-template-columns: 1fr; }
  .rwb-ingest-warnings { grid-column: auto; }
  .rwb-ingest-raw { max-height: 220px; }
}

/* ── P5: directional allergens + library/densities admin ── */

.rwb-allergen-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--heritage-red, #CC0000) 8%, transparent);
  color: var(--heritage-red, #CC0000);
  border: 1px solid color-mix(in srgb, var(--heritage-red, #CC0000) 25%, transparent);
  margin: 2px 2px 2px 0;
  cursor: default;
}
.rwb-allergen-chip-sm {
  font-size: 0.7rem;
  padding: 1px 8px;
}
.rwb-allergen-disclaimer {
  font-size: 0.76rem;
  margin-top: 6px;
  line-height: 1.45;
  max-width: 640px;
}
/* P7 — directional nutrition panel (recipe detail + print) */
.rwb-nutrition-table {
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 260px;
}
.rwb-nutrition-table th,
.rwb-nutrition-table td {
  padding: 3px 14px 3px 0;
  text-align: left;
  white-space: nowrap;
}
.rwb-nutrition-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-mute, #888);
  font-weight: 600;
}
/* a11y (W3 FIX): the nutrient-name cell is a real <th scope="row"> so screen
   readers announce "Protein — 4 g" instead of a bare number. It must keep
   looking like the muted body cell it was as a <td>, so undo the UA <th>
   bold. (thead th styling above is thead-scoped and does not apply here.) */
.rwb-nutrition-label {
  color: var(--text-mute, #666);
  font-weight: 400;
}
.rwb-print-nutrition {
  font-size: 0.82rem;
  line-height: 1.5;
}
@media (max-width: 480px) {
  .rwb-nutrition-table {
    min-width: 0;
    width: 100%;
  }
  .rwb-nutrition-table th,
  .rwb-nutrition-table td {
    padding-right: 8px;
    white-space: normal;
  }
}

.rwb-allergen-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.rwb-allergen-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  cursor: pointer;
}
.rwb-lib-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.rwb-lib-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft, #6b7280);
  padding: 6px 10px;
  border-bottom: 1px solid var(--rule, #e5e7eb);
}
.rwb-lib-row { cursor: pointer; }
.rwb-lib-row:hover td { background: color-mix(in srgb, var(--heritage-gold, #D4A843) 7%, transparent); }
.rwb-den-row { cursor: pointer; }
.rwb-den-row:hover td { background: color-mix(in srgb, var(--heritage-gold, #D4A843) 7%, transparent); }
.rwb-usda-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--rule, #e5e7eb);
}

/* ════════════════════════════════════════════════════════════════
   P6 — chef-grade modal polish, approvers panel, AI density assist
   ════════════════════════════════════════════════════════════════ */

/* Detail modal — one sticky stack (head + scalebar). Avoids hard-coded
   top offsets that break when the official stamp / chips wrap (F1/F6). */
.rwb-detail-sticky {
  position: sticky;
  top: 0;
  z-index: 3;
  margin-bottom: 8px;
  background: var(--surface, var(--paper));
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
}

.rwb-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 0 8px;
}

/* Gold Official Seal — eggshell fill, thin Heritage Gold ring (Red Bridge restraint) */
.rwb-official-seal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--heritage-gold, #D4A843);
  background: color-mix(in srgb, var(--heritage-gold, #D4A843) 9%, var(--paper, #fffdf7));
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-strong, #2b2b2b);
}

.rwb-official-seal-star {
  color: var(--heritage-gold-dark, #8B6914);
  font-size: 0.9em;
}

/* Scale bar lives inside the sticky stack — no fixed top offset */
.rwb-detail-sticky .rwb-scalebar {
  position: relative;
  top: auto;
  z-index: 1;
  margin-bottom: 0;
}

.rwb-detail-section {
  margin-bottom: 14px;
}

.rwb-detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 22px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper-warm, var(--paper));
}

.rwb-section-label {
  margin: 14px 0 6px;
}

.rwb-detail-empty {
  padding: 18px 14px;
  border: 1px dashed var(--rule);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  text-align: center;
}

.rwb-detail-provenance {
  font-size: 0.78rem;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

/* Shared modal footer — action groups; stacks cleanly at 390px */
.rwb-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.rwb-footer-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Edit modal — section headers + official-demote banner */
.rwb-form-section-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--heritage-red, #CC0000);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
  margin-top: 4px;
}

.rwb-demote-banner {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.45;
  background: color-mix(in srgb, #b45309 10%, transparent);
  border: 1px solid color-mix(in srgb, #b45309 35%, transparent);
  color: var(--ink-strong);
}

/* List cards — clearer hierarchy + keyboard focus */
.rwb-card:focus-visible {
  outline: 2px solid var(--heritage-gold);
  outline-offset: 2px;
}

/* ── Keyboard focus (a11y, W3 FIX) ─────────────────────────────────────────
   Before this block only .rwb-card had a focus ring; every filter tab, chip,
   scale preset, sub-recipe chip and row-delete button communicated state via
   :hover only, so a keyboard/switch user (chef on a kitchen tablet, gloves
   on, or anyone tabbing) could not see where focus was. Matches the existing
   gold-outline convention used by .rwb-card and other modules.
   :focus-visible (not :focus) so mouse clicks don't paint a ring. */
.rwb-tab:focus-visible,
.rwb-cat-chip:focus-visible,
.rwb-scale-chip:focus-visible,
.rwb-sub-chip:focus-visible,
.rwb-ing-remove:focus-visible,
.rwb-lib-del:focus-visible,
.rwb-den-del:focus-visible,
.rwb-multi-review:focus-visible,
.rwb-multi-skip:focus-visible {
  outline: 2px solid var(--heritage-gold, #D4A843);
  outline-offset: 2px;
}

/* Clickable table rows: outline on a <tr> is unreliable across engines, so
   tint the cells (same affordance the :hover rule already uses) and keep a
   visible outline as a progressive extra. */
.rwb-lib-row:focus-visible,
.rwb-den-row:focus-visible {
  outline: 2px solid var(--heritage-gold, #D4A843);
  outline-offset: -2px;
}
.rwb-lib-row:focus-visible td,
.rwb-den-row:focus-visible td {
  background: color-mix(in srgb, var(--heritage-gold, #D4A843) 12%, transparent);
}

/* Form inputs inside the workbench: the shared .form-input focus style is
   subtle on the eggshell modal background — strengthen it here only. */
.rwb-ing-row .form-input:focus-visible,
.rwb-search:focus-visible,
.rwb-lib-search:focus-visible {
  outline: 2px solid var(--heritage-gold, #D4A843);
  outline-offset: 1px;
}

/* Windows High Contrast / forced-colors: color-mix tints are dropped, so
   fall back to the system highlight so focus never disappears entirely. */
@media (forced-colors: active) {
  .rwb-tab:focus-visible,
  .rwb-cat-chip:focus-visible,
  .rwb-scale-chip:focus-visible,
  .rwb-sub-chip:focus-visible,
  .rwb-card:focus-visible,
  .rwb-lib-row:focus-visible,
  .rwb-den-row:focus-visible {
    outline: 3px solid Highlight;
  }
}

.rwb-card.rwb-card-official {
  border-color: var(--heritage-gold, #D4A843);
  border-top-width: 3px;
  border-left: 3px solid var(--heritage-gold, #D4A843);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--heritage-gold, #D4A843) 25%, transparent);
}

/* AI density assist */
.rwb-ai-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--heritage-purple, #5B2C8A) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--heritage-purple, #5B2C8A) 30%, transparent);
  color: var(--heritage-purple, #5B2C8A);
  vertical-align: 1px;
}

.rwb-den-ai-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px dashed var(--rule);
}

/* Approvers panel */
.rwb-approvers p {
  margin: 0 0 10px;
  line-height: 1.55;
  font-size: 0.92rem;
}

.rwb-approvers-list {
  margin: 0 0 10px;
  padding-left: 20px;
  line-height: 1.6;
  font-size: 0.88rem;
}

.rwb-approvers-note {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--paper-warm, var(--paper));
  border: 1px solid var(--rule);
  font-size: 0.84rem;
  line-height: 1.5;
}

/* Mobile 390px — single-column meta, wrapping chips, stacked footers,
   44px touch targets on the scale controls */
@media (max-width: 480px) {
  .rwb-detail-meta {
    grid-template-columns: 1fr;
  }
  .rwb-detail-sticky {
    /* stay sticky on phones — compact chrome, no fixed-offset hacks */
    padding-bottom: 6px;
  }
  .rwb-detail-head {
    padding-bottom: 4px;
  }
  .rwb-scale-chip {
    min-height: 44px;
    min-width: 44px;
  }
  .rwb-scale-input,
  .rwb-scale-select {
    min-height: 44px;
  }
  .rwb-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .rwb-footer-group {
    justify-content: stretch;
  }
  .rwb-footer-group .btn {
    flex: 1;
    min-height: 44px;
  }
  .rwb-toolbar-right .btn {
    min-height: 44px;
  }
}

/* ════════════════════════════════════════════════════════════════
   P6.1 — mobile polish pass (390px primary target / 360px floor)
   List toolbar scroll rows, sticky-scalebar-only detail chrome,
   readable ingredient tables, carded edit rows, 44px targets.
   ════════════════════════════════════════════════════════════════ */

/* Footers converted from inline styles (versions / snapshot / edit /
   library / USDA / densities / approvers) */
.rwb-footer-end {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rwb-footer-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* L2: button cluster inside split footers (replaces nested inline flex) */
.rwb-footer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Form rows converted from inline grid styles (edit / ingest / library /
   density modals). --fit auto-collapses 3-or-4 numeric columns. */
.rwb-form-row { display: grid; gap: 14px; }
.rwb-cols-name { grid-template-columns: 2fr 1fr; }
.rwb-cols-half { grid-template-columns: 1fr 1fr; }
.rwb-cols-fit  { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* Library / densities search (was inline max-width) */
.rwb-lib-search { max-width: 240px; }

/* Long meta values (yield / tags) wrap instead of overflowing */
.rwb-detail-meta > div { min-width: 0; overflow-wrap: anywhere; }

/* ── ≤720px: toolbar — horizontal scroll rows instead of tall wrap ── */
@media (max-width: 720px) {
  .rwb-filter-tabs,
  .rwb-cat-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px;
    margin: -2px;
  }
  .rwb-filter-tabs::-webkit-scrollbar,
  .rwb-cat-chips::-webkit-scrollbar { display: none; }
  .rwb-tab,
  .rwb-cat-chip { flex: 0 0 auto; min-height: 44px; }
  .rwb-tab-count { flex-shrink: 0; }

  /* Row order: search (full width) → category chips → action buttons */
  .rwb-toolbar-right { row-gap: 8px; }
  .rwb-search { order: 1; flex-basis: 100%; min-height: 44px; }
  .rwb-cat-chips { order: 2; }
  .rwb-toolbar-right .btn { order: 3; min-height: 44px; }
}

/* ── ≤640px: keep detail/snapshot ingredient tables as real tables
   (2-col qty/name reads fine at 390) — the platform block-scroll
   fallback in 97-mobile-optimize stays for library/density admin
   tables, which are genuinely wide. ── */
@media (max-width: 640px) {
  .modal-body .rwb-ing-table:not(.rwb-lib-table) {
    display: table;
    overflow-x: visible;
    width: 100%;
  }
  .rwb-ing-table:not(.rwb-lib-table) td { overflow-wrap: anywhere; }

  .rwb-footer-end,
  .rwb-footer-split { width: 100%; }
  .rwb-footer-end .btn,
  .rwb-footer-split .btn { min-height: 44px; }
  .rwb-footer-split > div { display: flex; gap: 8px; flex: 1 1 auto; }
  .rwb-footer-split > div .btn { flex: 1 1 auto; }
}

/* ── ≤480px: phone polish ── */
@media (max-width: 480px) {
  /* A. toolbar action buttons — 2-up grid, primary (New Recipe) full row */
  .rwb-toolbar-right .btn { flex: 1 1 calc(50% - 5px); }
  .rwb-toolbar-right .btn-primary { flex-basis: 100%; }

  /* B. detail modal — only the scale bar stays sticky; the head strip
     (pills / stamp) scrolls away so body content stays reachable (M2) */
  .rwb-detail-sticky {
    position: static;
    border-bottom: none;
    padding-bottom: 0;
  }
  /* B. detail modal — only the scale bar stays sticky; the head strip
     (pills / stamp) scrolls away so body content stays reachable (M2).
     Compact chrome + hard height cap so ≥~45% viewport remains for body. */
  .rwb-detail-sticky .rwb-scalebar {
    position: sticky;
    top: 0;
    z-index: 3;
    margin-bottom: 8px;
    padding: 6px 10px;
    /* L1: if scrollport ever edge-to-edge under notch, keep readable */
    padding-top: max(6px, env(safe-area-inset-top, 0px));
    gap: 6px 8px;
    max-height: min(36dvh, 260px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--paper-warm, var(--paper));
    box-shadow: 0 1px 0 var(--rule);
  }
  .rwb-scalebar-group { gap: 6px; }
  .rwb-scale-chips { flex-wrap: wrap; }
  .rwb-scale-select { flex: 1 1 auto; min-width: 0; }
  .rwb-official-seal { flex-basis: 100%; line-height: 1.35; }

  /* Ingredient table readability — fluid qty column, larger tap rows */
  .rwb-ing-table:not(.rwb-lib-table) td {
    padding: 8px 8px 8px 0;
    font-size: 0.95rem;
  }
  .rwb-ing-table:not(.rwb-lib-table) .rwb-ing-qty {
    width: auto;
    min-width: 72px;
    max-width: 132px;
    white-space: normal;
    padding-right: 12px;
  }

  /* Detail footer — primary workflow actions 2-up (base 480 block already
     stacks groups + sets flex/min-height on .rwb-footer-group .btn) */
  .rwb-footer-primary .btn { flex: 1 1 calc(50% - 8px); }

  /* 44px inputs across remaining RWB forms (ing-row already set at ≤720) */
  .rwb-edit-form .form-input,
  .rwb-ingest-form .form-input,
  #rwb-lib-form .form-input,
  #rwb-den-form .form-input { min-height: 44px; }

  /* Form rows collapse: labeled/text fields 1-col, numeric fields 2-up */
  .rwb-cols-name,
  .rwb-cols-half { grid-template-columns: 1fr; }
  .rwb-cols-fit  { grid-template-columns: 1fr 1fr; }

  /* D. secondary modals — versions stack, admin toolbars stack,
     footer buttons full-width */
  .rwb-version-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .rwb-version-row .btn { min-height: 44px; }
  .rwb-lib-toolbar { flex-direction: column; align-items: stretch; }
  .rwb-lib-search { max-width: none; width: 100%; min-height: 44px; }
  .rwb-footer-end .btn,
  .rwb-footer-split .btn { flex: 1 1 auto; }
  .rwb-footer-split > span { flex-basis: 100%; }
  .rwb-footer-actions {
    display: flex;
    gap: 8px;
    flex: 1 1 auto;
  }
  .rwb-footer-actions .btn { flex: 1 1 auto; min-height: 44px; }
}

/* ════════════════════════════════════════════════════════════════
   P8 — chef-grade detail modal + content typography
   Heritage paper, gold hairlines, red restraint. Detail modal only
   (scoped to .rwb-detail / .modal:has(.rwb-detail)) — snapshot,
   edit, library and print paths untouched.
   ════════════════════════════════════════════════════════════════ */

/* ── Modal chrome: warm paper body, gold hairlines top + bottom ── */
.modal:has(.rwb-detail) .modal-header {
  background: linear-gradient(180deg, var(--eggshell-bright, #FFF5E6) 0%, var(--paper, #FBF6EC) 100%);
  border-bottom: 1px solid var(--rule-gold, rgba(212, 168, 67, 0.5));
}

.modal:has(.rwb-detail) .modal-title {
  font-size: 1.6rem;
}

.modal:has(.rwb-detail) .modal-body {
  background: var(--paper, #FBF6EC);
}

.modal:has(.rwb-detail) .modal-footer {
  background: var(--paper-warm, var(--paper));
  border-top: 1px solid var(--rule-gold, rgba(212, 168, 67, 0.5));
}

/* Sticky stack matches the repainted body; gold hairline underneath */
.rwb-detail-sticky {
  background: var(--paper, #FBF6EC);
  border-bottom: 1px solid var(--rule-gold, rgba(212, 168, 67, 0.5));
  padding-bottom: 10px;
}

/* ── Meta mini-grid: eggshell card, thin gold top rule ── */
.rwb-detail-meta {
  background: linear-gradient(180deg, var(--eggshell-bright, #FFF5E6) 0%, var(--paper-warm, var(--paper)) 100%);
  border-top: 2px solid var(--heritage-gold, #D4A843);
  border-radius: 0 0 10px 10px;
  padding: 12px 16px;
}

.rwb-detail-meta .uppercase-label {
  color: var(--heritage-gold-dark, #8B6914);
  font-size: 0.68rem;
  margin-bottom: 3px;
}

.rwb-detail-meta > div > div:last-child {
  font-size: 0.95rem;
  color: var(--ink-strong);
}

/* ── Chef section headers: red tick + fading gold hairline ── */
.rwb-section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 10px;
  color: var(--ink-strong);
  font-size: 0.78rem;
  letter-spacing: 0.15em;
}

.rwb-section-label::before {
  content: '';
  flex: 0 0 auto;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--heritage-red, #CC0000);
}

.rwb-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--rule-gold, rgba(212, 168, 67, 0.5)), transparent);
}

/* Sub-heads (allergens / nutrition) — quieter than section heads */
.rwb-subhead {
  margin: 14px 0 6px;
}

/* ── Ingredients: paper ledger panel ── */
.rwb-detail .rwb-ing-table:not(.rwb-lib-table) {
  border-collapse: separate;
  border-spacing: 0;
  background: var(--paper-warm, var(--paper));
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
}

.rwb-detail .rwb-ing-table:not(.rwb-lib-table) td {
  padding: 8px 12px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--rule-soft, var(--rule));
}

.rwb-detail .rwb-ing-table:not(.rwb-lib-table) tr:last-child td {
  border-bottom: none;
}

/* Qty column: chef-scannable — bolder, tabular, ledger hairline */
.rwb-detail .rwb-ing-table:not(.rwb-lib-table) .rwb-ing-qty {
  font-size: 0.96rem;
  font-weight: 700;
  border-right: 1px solid var(--rule-soft, var(--rule));
}

/* Prep notes read quieter than the ingredient name */
.rwb-detail .rwb-ing-table:not(.rwb-lib-table) td .text-mute {
  font-size: 0.88em;
}

/* Group rows (Sauce / Garnish / …): eggshell band + gold hairline */
.rwb-detail .rwb-ing-table .rwb-group-row td {
  background: color-mix(in srgb, var(--heritage-gold, #D4A843) 9%, var(--paper, #FBF6EC));
  border-bottom: 1px solid var(--rule-gold, rgba(212, 168, 67, 0.5));
  color: var(--heritage-gold-dark, #8B6914);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  padding: 7px 12px 5px;
}

/* Sub-recipe chips: gold product presence instead of grey badge */
.rwb-detail .rwb-sub-chip {
  background: color-mix(in srgb, var(--heritage-gold, #D4A843) 12%, var(--paper, #FBF6EC));
  border-color: color-mix(in srgb, var(--heritage-gold, #D4A843) 45%, transparent);
  color: var(--heritage-gold-dark, #8B6914);
}

.rwb-detail .rwb-sub-chip:hover {
  border-color: var(--heritage-gold-dark, #8B6914);
}

/* ── Method: numbered gold step markers, arm's-length readable ── */
.rwb-detail .rwb-method {
  list-style: none;
  counter-reset: rwb-step;
  padding-left: 0;
}

.rwb-detail .rwb-method li {
  counter-increment: rwb-step;
  position: relative;
  padding-left: 40px;
  margin-bottom: 12px;
  line-height: 1.62;
  font-size: 0.95rem;
}

.rwb-detail .rwb-method li::before {
  content: counter(rwb-step);
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  font-feature-settings: 'tnum';
  color: var(--heritage-red, #CC0000);
  background: color-mix(in srgb, var(--heritage-gold, #D4A843) 14%, var(--paper, #FBF6EC));
  border: 1px solid color-mix(in srgb, var(--heritage-gold, #D4A843) 55%, transparent);
}

/* ── Nutrition: framed directional card, muted gold border ── */
.rwb-nutrition-card {
  display: inline-block;
  max-width: 100%;
  padding: 12px 16px 10px;
  border: 1px solid color-mix(in srgb, var(--heritage-gold, #D4A843) 40%, transparent);
  border-radius: 10px;
  background: var(--paper-warm, var(--paper));
}

/* Allergen chips sit on a small breathing row */
.rwb-allergen-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 2px;
  align-items: center;
}

/* ── Notes: paper quote-panel ── */
.rwb-detail-notes {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 0.93rem;
  padding: 12px 16px;
  background: var(--paper-warm, var(--paper));
  border-left: 3px solid var(--heritage-gold, #D4A843);
  border-radius: 0 10px 10px 0;
}

/* ── Portioning: same ledger language as ingredients, gold accent ── */
.rwb-portioning {
  padding: 4px 0 2px;
}
.rwb-portioning-spec {
  font-size: 0.86rem;
  margin: 0 0 10px;
  letter-spacing: 0.01em;
}
.rwb-portioning-table {
  width: 100%;
  border-collapse: collapse;
}
.rwb-portioning-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-mute, #6b6458);
  padding: 0 8px 6px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--heritage-gold, #D4A843) 35%, transparent);
}
.rwb-portioning-table td {
  padding: 8px 8px 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border, #e8e0d0) 80%, transparent);
  vertical-align: top;
  font-size: 0.94rem;
}
.rwb-portioning-table tr:last-child td { border-bottom: none; }
.rwb-portioning-table .rwb-ing-qty {
  width: 7.5rem;
  white-space: nowrap;
  font-feature-settings: "tnum";
  font-weight: 600;
  color: var(--heritage-red, #CC0000);
}
@media print {
  .rwb-print-sheet .rwb-portioning-table .rwb-ing-qty { color: #000; }
}

/* ── Provenance: quieter, more air ── */
.rwb-detail-provenance {
  margin-top: 24px;
  padding-top: 10px;
  border-top: 1px solid var(--rule-soft, var(--rule));
  font-size: 0.76rem;
}

/* ── Mobile (≤480): keep panel padding inside rounded borders,
   full-width nutrition card, slightly tighter step markers ── */
@media (max-width: 480px) {
  /* Re-assert P6.1 mobile chrome (head strip scrolls away; only the
     scale bar stays sticky) — the P8 base rule above must not win here */
  .rwb-detail-sticky {
    border-bottom: none;
    padding-bottom: 0;
  }
  .rwb-detail .rwb-ing-table:not(.rwb-lib-table) td {
    padding: 8px 10px;
  }
  .rwb-nutrition-card {
    display: block;
    width: 100%;
  }
  .rwb-detail .rwb-method li {
    padding-left: 36px;
  }
  .rwb-detail .rwb-method li::before {
    width: 24px;
    height: 24px;
  }
}
/* ═══════════════════════════════════════════════════════════════════
   Recipe Workbench v2 — chef-surface additions
   Loaded AFTER 45-recipe-workbench.css so every rule here is an override
   or a pure addition. Nothing in 45 was edited.

   Covers: Print/Export panel (replaces the deleted preset chip row),
   drag-reorder handle, unmapped-unit + density-gap amber signals,
   computed total-yield readout, autosave status, draft-restore bar,
   tag/sub-recipe filter chips, author + last-editor chips.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Print / Export panel ─────────────────────────────────────────── */
.rwb-printpanel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper-2, rgba(0, 0, 0, 0.015));
}

/* The base line is the honesty line. It must read as LOCKED, not editable. */
.rwb-printpanel-base {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--rule);
}
.rwb-printpanel-baselabel {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.rwb-printpanel-baseval {
  font-weight: 600;
  font-size: 0.92rem;
}
.rwb-printpanel-lock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  white-space: nowrap;
}

.rwb-printpanel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.rwb-printpanel-rowlabel {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-right: 2px;
}
.rwb-printpanel-sep,
.rwb-printpanel-or {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.rwb-printpanel-or { margin-left: 8px; }

.rwb-print-num  { width: 78px; }
.rwb-print-unit { width: 92px; }

.rwb-printpanel-opts { gap: 8px; }
.rwb-printpanel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.rwb-printpanel-readout {
  font-size: 0.82rem;
  font-weight: 600;
}

/* Inline ⓘ affordance for Kitchen vs Exact — Nathaniel's "what does
   rounding exact / kitchen do?" was a LABELLING failure, not a feature gap. */
.rwb-help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.72rem;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  cursor: help;
}
.rwb-help-dot:focus-visible {
  outline: 2px solid var(--heritage-red);
  outline-offset: 2px;
}

/* ── Editor: computed total yield ─────────────────────────────────── */
.rwb-yield-computed { min-width: 140px; }
.rwb-yield-out {
  display: block;
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink-soft);
  font-weight: 600;
  cursor: default;
}
.rwb-yield-hint {
  font-size: 0.72rem;
  margin-top: 3px;
}

/* ── Editor: ingredient row v2 ────────────────────────────────────── */
/* Grid gains a leading drag handle + two signal slots; the group input is
   now hidden (display:none) so it no longer consumes a column. */
.rwb-ing-row {
  grid-template-columns: 22px 70px 80px auto auto 1.2fr 0.9fr 0.7fr 0.9fr auto 34px;
}
.rwb-ing-row > input[type="hidden"] { display: none; }

.rwb-ing-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1;
  letter-spacing: -2px;
  user-select: none;
  border-radius: 4px;
  min-height: 24px;
}
.rwb-ing-drag:active { cursor: grabbing; }
.rwb-ing-drag:focus-visible {
  outline: 2px solid var(--heritage-red);
  outline-offset: 1px;
}
.rwb-ing-row.is-dragging {
  opacity: 0.55;
  outline: 2px dashed var(--rule);
}

/* Amber signals. Both are DELIBERATELY visible rather than silent —
   §10 invariant 7: a density gap must never resolve into a confident
   475 mL of green onions without the chef seeing it. */
.rwb-unit-flag {
  font-size: 0.66rem;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(198, 138, 31, 0.14);
  color: var(--warning, #C68A1F);
  border: 1px solid rgba(198, 138, 31, 0.34);
}
.rwb-density-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  font-size: 0.7rem;
  color: var(--warning, #C68A1F);
  cursor: help;
}
.rwb-unit-flag.is-hidden,
.rwb-density-dot.is-hidden { display: none; }

.rwb-ing-density-gap .rwb-ing-qty-in,
.rwb-ing-density-gap .rwb-unit-input {
  border-color: rgba(198, 138, 31, 0.5);
}

.rwb-sku-unverified { border-color: rgba(198, 138, 31, 0.5); }

.rwb-ing-keyhint {
  font-size: 0.72rem;
  margin-top: 4px;
}

/* ── Autosave + draft restore ─────────────────────────────────────── */
.rwb-autosave-status {
  font-size: 0.76rem;
  margin-right: auto;
  white-space: nowrap;
}
.rwb-draft-restore {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.84rem;
  background: rgba(198, 138, 31, 0.10);
  border: 1px solid rgba(198, 138, 31, 0.32);
}

/* ── List: tag + sub-recipe filter bar ────────────────────────────── */
.rwb-tagbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 10px 0 14px;
}
.rwb-tagbar-label {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-right: 2px;
}
.rwb-tagbar-label:not(:first-child) { margin-left: 10px; }
.rwb-tag-chip {
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.rwb-tag-chip:hover { border-color: var(--ink-soft); }
.rwb-tag-chip.is-active {
  background: rgba(204, 0, 0, 0.08);
  border-color: var(--heritage-red);
  color: var(--heritage-red);
  font-weight: 600;
}
.rwb-tag-chip:focus-visible {
  outline: 2px solid var(--heritage-red);
  outline-offset: 2px;
}
.rwb-tag-chip-sub { margin-left: auto; }

.rwb-sub-badge {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--rule);
}

/* ── Detail: author + last editor ─────────────────────────────────── */
.rwb-detail-people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 6px;
}
.rwb-person-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.84rem;
}

/* ── Print sheet additions ────────────────────────────────────────── */
@media print {
  .rwb-print-sheet .rwb-print-baseline {
    margin-top: 6px;
    font-size: 10pt;
    font-style: italic;
  }
  .rwb-print-sheet .rwb-print-estnote {
    margin-top: 4px;
    font-size: 9.5pt;
  }
  /* The panel is screen chrome. It must never reach paper. */
  .rwb-printpanel,
  .rwb-tagbar,
  .rwb-autosave-status,
  .rwb-draft-restore { display: none !important; }
}

/* ── Mobile ───────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .rwb-ing-row {
    grid-template-columns: 22px 88px 1fr 44px;
  }
  .rwb-ing-row .rwb-ing-drag  { grid-column: 1; grid-row: 1; min-height: 44px; }
  .rwb-ing-row [name="ing_qty"]  { grid-column: 2; grid-row: 1; }
  .rwb-ing-row [name="ing_unit"] { grid-column: 3; grid-row: 1; }
  .rwb-ing-row .rwb-ing-remove   { grid-column: 4; grid-row: 1; }
  .rwb-ing-row .rwb-unit-flag,
  .rwb-ing-row .rwb-density-dot  { grid-column: 1 / -1; justify-self: start; }
  .rwb-printpanel-actions { margin-left: 0; width: 100%; }
  .rwb-print-num  { width: 68px; }
  .rwb-print-unit { width: 84px; }
  .rwb-tag-chip-sub { margin-left: 0; }
}
/* ══════════════════════════════════════════════════════════════════════
   46-system-status.css — Platform-wide System Status banner + admin page
   Severity tones: info | maintenance | degraded | outage.
   Brand-tokened: Heritage Red #CC0000, Gold #D4A843, eggshell paper.

   Mobile / PWA notes (2026-07-13 polish):
   - Banner owns env(safe-area-inset-top) when active so Dynamic Island /
     notch / status bar never cover the message (viewport-fit=cover).
   - Banner is sticky at top; topbar sticks below it via --ssb-height.
   - Horizontal safe-area on left/right; 44px dismiss hit target.
   ══════════════════════════════════════════════════════════════════════ */

/* ── Root host (sticky only when a banner is rendered) ── */
#system-status-banner-root:not(:empty) {
  position: sticky;
  top: 0;
  z-index: 61; /* above .topbar (60) so island-safe strip stays visible */
  flex: 0 0 auto;
}

/* ── The banner ── */
.system-status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  /* Top safe-area: Dynamic Island / notch / status bar on iOS PWA */
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  padding-bottom: 10px;
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
  font-size: 13.5px;
  line-height: 1.45;
  border-bottom: 1px solid transparent;
  box-sizing: border-box;
  width: 100%;
}

.ssb-icon { flex: 0 0 auto; font-size: 15px; line-height: 1; }

.ssb-severity {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.ssb-body {
  flex: 1 1 auto;
  min-width: 0;
  display: inline;
}
.ssb-title { margin-right: 6px; word-break: break-word; }
.ssb-message { opacity: 0.92; word-break: break-word; }

.ssb-link {
  margin-left: 8px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: inherit;
  white-space: nowrap;
}
.ssb-link:hover { opacity: 0.8; }

.ssb-updated {
  flex: 0 0 auto;
  font-size: 11.5px;
  opacity: 0.75;
  white-space: nowrap;
}

.ssb-dismiss {
  flex: 0 0 auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  /* 44×44 touch target (Apple HIG) without blowing layout */
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: inherit;
  opacity: 0.7;
  margin: -8px -6px -8px 0; /* keep visual weight tight */
}
.ssb-dismiss:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }
.ssb-dismiss:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  opacity: 1;
}

/* When banner is live, topbar must NOT also pad safe-area-top (banner owns it)
   and must stick below the measured banner height. */
html.has-system-status .topbar {
  top: var(--ssb-height, 0px);
  /* Drop the safe-area top padding/height — island already cleared by banner */
  padding-top: 6px;
  height: calc(var(--header-h) + 6px);
}

/* Severity tones — light mode */
.ssb-info {
  background: #fdf7e6;
  color: #6b5518;
  border-bottom-color: #e8d9a8;
}
.ssb-info .ssb-severity { background: #f0e3b8; color: #6b5518; }

.ssb-maintenance {
  background: #fdf1dc;
  color: #7a4f0e;
  border-bottom-color: #ecd3a2;
}
.ssb-maintenance .ssb-severity { background: #D4A843; color: #fff; }

.ssb-degraded {
  background: #fcebdd;
  color: #8a4210;
  border-bottom-color: #efc9a6;
}
.ssb-degraded .ssb-severity { background: #d97a1f; color: #fff; }

.ssb-outage {
  background: #CC0000;
  color: #fff;
  border-bottom-color: #a30000;
}
.ssb-outage .ssb-severity { background: rgba(255, 255, 255, 0.22); color: #fff; }
.ssb-outage .ssb-dismiss:hover { background: rgba(255, 255, 255, 0.15); }

/* ── Admin page (#/admin-system-status) ── */
.ssb-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.ssb-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ssb-field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft, #5a5a5a);
}
.ssb-field input,
.ssb-field select,
.ssb-field textarea {
  font: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
  border: 1px solid var(--rule, #ddd4c2);
  border-radius: 8px;
  background: var(--paper, #fffdf7);
  color: inherit;
  min-width: 0;
}
.ssb-field textarea { resize: vertical; }
.ssb-field input:focus,
.ssb-field select:focus,
.ssb-field textarea:focus {
  outline: 2px solid rgba(204, 0, 0, 0.25);
  border-color: #CC0000;
}

.ssb-field-wide { grid-column: span 1; }
.ssb-field-full { grid-column: 1 / -1; }

.ssb-btn-danger { color: #CC0000; border-color: rgba(204, 0, 0, 0.4); }
.ssb-btn-danger:hover:not(:disabled) { background: rgba(204, 0, 0, 0.06); }

/* Severity chips (admin current card + history table) */
.ssb-chip {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.ssb-chip-info        { background: #f0e3b8; color: #6b5518; }
.ssb-chip-maintenance { background: #D4A843; color: #fff; }
.ssb-chip-degraded    { background: #d97a1f; color: #fff; }
.ssb-chip-outage      { background: #CC0000; color: #fff; }

/* Translation coverage chips (admin System Status, 2026-08-09).
   Deliberately LOWER-CONTRAST than the severity chips above: coverage is
   informational, and `missing` is a normal lazy-generation state, not an
   error. Only a genuine translation failure gets a warning tone. */
.ssb-lang-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.ssb-lang-source  { background: rgba(204, 0, 0, 0.08);    color: #8a1414; border-color: rgba(204, 0, 0, 0.22); }
.ssb-lang-ready   { background: rgba(46, 125, 50, 0.12);  color: #2e7d32; border-color: rgba(46, 125, 50, 0.28); }
.ssb-lang-missing { background: rgba(0, 0, 0, 0.04);      color: #7a7268; border-color: rgba(0, 0, 0, 0.10); }
.ssb-lang-failed  { background: rgba(217, 122, 31, 0.14); color: #a35a10; border-color: rgba(217, 122, 31, 0.30); }

.ssb-live-pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(46, 125, 50, 0.14);
  color: #2e7d32;
}

.ssb-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ssb-history-table { width: 100%; }

/* ── Mobile polish ── */
@media (max-width: 640px) {
  .system-status-banner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "icon severity dismiss"
      "body body body";
    align-items: center;
    column-gap: 8px;
    row-gap: 6px;
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    padding-bottom: 10px;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(8px, env(safe-area-inset-right, 0px));
    font-size: 13px;
    line-height: 1.4;
  }

  .ssb-icon     { grid-area: icon; }
  .ssb-severity { grid-area: severity; justify-self: start; }
  .ssb-body     { grid-area: body; display: block; }
  .ssb-dismiss  {
    grid-area: dismiss;
    justify-self: end;
    margin: 0;
  }

  /* Title on its own line; message wraps under it */
  .ssb-title {
    display: block;
    margin-right: 0;
    margin-bottom: 2px;
    font-size: 13.5px;
  }
  .ssb-message {
    display: block;
    font-size: 12.5px;
    opacity: 0.9;
  }
  .ssb-link {
    display: inline-block;
    margin-left: 0;
    margin-top: 4px;
    white-space: normal;
  }

  .ssb-updated { display: none; }

  .ssb-form-grid { grid-template-columns: 1fr; }

  /* Admin form: comfortable mobile inputs */
  .ssb-field input,
  .ssb-field select,
  .ssb-field textarea {
    font-size: 16px; /* prevent iOS zoom on focus */
    padding: 10px 12px;
  }
}

/* Very narrow phones */
@media (max-width: 380px) {
  .system-status-banner {
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(6px, env(safe-area-inset-right, 0px));
  }
  .ssb-severity {
    font-size: 10px;
    padding: 2px 6px;
  }
}

/* ── Dark mode ── */
[data-theme="dark"] .ssb-info {
  background: #2e2a1a;
  color: #e8d9a8;
  border-bottom-color: #4a4228;
}
[data-theme="dark"] .ssb-info .ssb-severity { background: #4a4228; color: #e8d9a8; }

[data-theme="dark"] .ssb-maintenance {
  background: #322816;
  color: #ecc98a;
  border-bottom-color: #52401f;
}

[data-theme="dark"] .ssb-degraded {
  background: #362413;
  color: #f0b183;
  border-bottom-color: #5a3a1c;
}

[data-theme="dark"] .ssb-outage {
  background: #8f0000;
  color: #fff;
  border-bottom-color: #6e0000;
}

[data-theme="dark"] .ssb-dismiss:hover { background: rgba(255, 255, 255, 0.1); }

[data-theme="dark"] .ssb-field input,
[data-theme="dark"] .ssb-field select,
[data-theme="dark"] .ssb-field textarea {
  background: #26231d;
  border-color: #3f3a30;
  color: #eae5d9;
}

[data-theme="dark"] .ssb-chip-info { background: #4a4228; color: #e8d9a8; }
[data-theme="dark"] .ssb-lang-source  { background: rgba(204, 0, 0, 0.20);     color: #f3a3a3; border-color: rgba(204, 0, 0, 0.38); }
[data-theme="dark"] .ssb-lang-ready   { background: rgba(102, 187, 106, 0.18); color: #81c784; border-color: rgba(102, 187, 106, 0.34); }
[data-theme="dark"] .ssb-lang-missing { background: rgba(255, 255, 255, 0.06); color: #9c948a; border-color: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .ssb-lang-failed  { background: rgba(217, 122, 31, 0.22);  color: #e0a262; border-color: rgba(217, 122, 31, 0.40); }
[data-theme="dark"] .ssb-live-pill { background: rgba(102, 187, 106, 0.18); color: #81c784; }
/* Gallery-shelf width: modal() never creates a .modal-dialog element, so
   the width MUST land on the .modal element itself (.dam-modal.modal).
   Two-class specificity overrides .modal-wide's 920px max-width. */
.dam-modal.modal,
.dam-modal.modal-wide,
.modal.modal-wide.dam-modal {
  width: min(1200px, 96vw);
  max-width: 1200px;
}
/* ============================================================
   47-dam-picker.css
   Shared Lee Kum Kee Brand Library picker (DAM S4).
   Native modal picker: collection rail, debounced search,
   preview card grid, honest rights badges, resolve-gated footer.
   Brand lock: Heritage Red / Gold / eggshell / ink ONLY.

   SCROLL CONTRACT
   ───────────────
   Header + footer are ALWAYS outside the scroll surface and
   never overlap cards (screenshot 2026-07-21: footer was
   hard-clipping the bottom product row).

   Desktop (≥769): definite modal height + nested flex chain.
   .dam-grid is the only vertical scroller.

   Mobile (≤768): single-scroller sheet. .modal-body scrolls;
   .dam-grid is content-sized (overflow:visible). Nested
   scroll + overflow:hidden ancestors is what produced the
   "footer covers half cards, nothing pans" failure on iOS.
   ============================================================ */

/* Definite height (not just max-height) so flex children can
   resolve remaining space. Inline style from modal() still applies
   as a ceiling; we pin both height and max-height. */
.dam-modal.modal,
.dam-modal.modal-wide {
  display: flex;
  flex-direction: column;
  height: min(92vh, 900px);
  height: min(92dvh, 900px);
  max-height: min(92vh, 900px);
  max-height: min(92dvh, 900px);
  overflow: hidden;
}
.dam-modal .modal-header,
.dam-modal .modal-footer {
  flex: 0 0 auto;
  position: relative;
  z-index: 3;                /* above any peeking grid paint */
  background: var(--warm-white, var(--paper));
}
.dam-modal .modal-footer {
  /* solid bar — cards must never show through the honesty/actions strip */
  background: var(--paper);
  box-shadow: 0 -1px 0 var(--rule);
}
.dam-modal .modal-body {
  /* Desktop: body is a flex frame; grid scrolls inside. */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  padding-bottom: 8px;
}

.dam-picker {
  display: flex;
  gap: 18px;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  min-width: 0;
}

.dam-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Collection rail ── */
.dam-rail {
  width: 184px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 14px;
  border-right: 1px solid var(--rule);
}
.dam-rail-btn {
  text-align: left;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid transparent;
  background: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.dam-rail-btn:hover { background: var(--eggshell-bright); color: var(--ink); }
.dam-rail-btn:focus-visible {
  outline: none;
  border-color: var(--heritage-gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.22);
}
.dam-rail-btn.is-active {
  background: var(--eggshell-bright);
  border-color: var(--rule-gold);
  color: var(--heritage-red);
  box-shadow: inset 3px 0 0 var(--heritage-gold);
}

/* ── Main column ── */
.dam-main {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;             /* CRITICAL: grid scroll parent (desktop) */
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;          /* desktop: contain scroll to .dam-grid */
}
.dam-search {
  position: relative;
  flex-shrink: 0;
}
.dam-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-mute);
  display: flex;
  pointer-events: none;
}
.dam-search-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px 10px 38px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm, 4px);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.92rem;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.dam-search-input::placeholder { color: var(--ink-faint); }
.dam-search-input:focus {
  outline: none;
  border-color: var(--heritage-gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.18);
}

/* ── Curated shelf chips (single-root facets; hidden on "All") ── */
.dam-shelf-bar {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x;
}
.dam-shelf-bar::-webkit-scrollbar { display: none; }
.dam-shelf-bar[hidden] { display: none !important; }
.dam-shelf-chip {
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.dam-shelf-chip:hover {
  border-color: var(--heritage-gold);
  color: var(--heritage-red);
  background: var(--eggshell-bright);
}
.dam-shelf-chip:focus-visible {
  outline: none;
  border-color: var(--heritage-gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.22);
}
.dam-shelf-chip.is-active {
  background: var(--eggshell-bright);
  border-color: var(--rule-gold);
  color: var(--heritage-red);
  box-shadow: inset 0 -2px 0 var(--heritage-gold);
}

/* ── Filter bar (type / access / sort) ── */
.dam-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  flex-shrink: 0;
  align-items: center;
}
.dam-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.dam-filter-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
  white-space: nowrap;
}
.dam-filter select {
  min-height: 34px;
  padding: 5px 26px 5px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm, 4px);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.dam-filter select:hover { border-color: var(--heritage-gold); }
.dam-filter select:focus-visible {
  outline: none;
  border-color: var(--heritage-gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.18);
}

/* ── Card grid (desktop scroll container) ── */
.dam-grid {
  display: grid;
  /* Product-stage: 3–4 generous columns on a wide modal, never micro-tiles */
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  align-content: start;
  /* Chrome: aspect-ratio children of a definite-height (flex-resolved) grid
     collapse to min-content (~28px bars) once content overflows the
     scrollport. max-content keeps ratio-derived row heights. Repro 2026-07-21:
     1 card 209x261 OK, 18 cards 209x28 collapsed; this line → 209x261. */
  grid-auto-rows: max-content;
  /* Desktop: flex child that actually scrolls. flex-basis:0 lets this
     claim only the leftover height under search/load-more. */
  flex: 1 1 0;
  min-height: 160px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* No large max-height trap — flex parent height is the ceiling.
     (A 58/62dvh max-height taller than leftover space was clipping
     the scrollport itself behind the footer.) */
  padding: 2px 2px 16px;
  scrollbar-gutter: stable;
  touch-action: pan-y;
}

.dam-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius, 8px);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.dam-card:hover {
  border-color: var(--heritage-gold);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.dam-card:hover .dam-thumb-img { transform: scale(1.02); }
.dam-card:focus-visible {
  outline: none;
  border-color: var(--heritage-gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.28);
}
.dam-card.is-selected {
  border-color: var(--heritage-red);
  box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.16), var(--shadow-sm);
}
.dam-card.is-blocked { opacity: 0.55; cursor: not-allowed; }
.dam-card.is-blocked:hover {
  border-color: var(--rule);
  box-shadow: var(--shadow-sm);
  transform: none;
}
.dam-card.is-blocked:hover .dam-thumb-img { transform: none; }

.dam-tick {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--heritage-red);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  animation: dam-tick-in 160ms ease;
}
.dam-card.is-selected .dam-tick { display: flex; }
@keyframes dam-tick-in {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Product stage: portrait 4/5 plate for LKK packshots (bottles/pouches),
   flex-centered contain with breathing room — never cover, never stretch,
   never a pure-white void. Padding keeps hover scale fully inside the crop. */
.dam-thumb {
  aspect-ratio: 4 / 5;
  background:
    linear-gradient(180deg, var(--eggshell-bright) 0%, var(--eggshell-shade, #f3ebe0) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 14px;
  box-shadow: inset 0 0 0 1px var(--rule-soft), inset 0 -14px 22px -18px rgba(43, 31, 20, 0.18);
}
.dam-thumb-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  margin: auto;
  /* contain keeps packshots/logos fully visible; brand library is visual-first */
  object-fit: contain;
  object-position: center;
  display: block;
  transition: transform 180ms ease;
  filter: drop-shadow(0 4px 10px rgba(43, 31, 20, 0.10));
}
.dam-thumb-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--ink-faint);
  padding: 8px;
}
.dam-thumb-fallback[hidden] { display: none; }
.dam-thumb-fallback-label { font-size: 0.68rem; color: var(--ink-mute); }

/* Failed preview: stage keeps full 4:5 geometry, dashed-gold treatment,
   visible icon + "No preview" label. Never a silent blank void. */
.dam-card.is-preview-failed .dam-thumb {
  box-shadow: inset 0 0 0 1px var(--rule-gold);
  background-image:
    repeating-linear-gradient(-45deg, transparent 0 10px, rgba(212, 168, 67, 0.05) 10px 20px),
    linear-gradient(180deg, var(--eggshell-bright) 0%, var(--eggshell-shade, #f3ebe0) 100%);
}
.dam-card.is-preview-failed .dam-thumb-fallback { color: var(--ink-mute); }

/* Selected stage tint — selection readable at a glance across a long shelf. */
.dam-card.is-selected .dam-thumb {
  box-shadow: inset 0 0 0 2px rgba(204, 0, 0, 0.22), inset 0 -14px 22px -18px rgba(43, 31, 20, 0.18);
}

.dam-meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.dam-name {
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  min-height: 2.3em;
}
.dam-format {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.dam-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.dam-badge {
  font-size: 0.64rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--eggshell-bright);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  white-space: nowrap;
}
.dam-badge--design {
  border-color: var(--rule-gold);
  color: var(--heritage-gold-dark);
}
.dam-badge--restricted {
  background: rgba(204, 0, 0, 0.06);
  border-color: rgba(204, 0, 0, 0.3);
  color: var(--heritage-red);
}

/* ── Skeletons (stage inherits 4/5 aspect — no square flash) ── */
.dam-skel { pointer-events: none; box-shadow: none; }
.dam-skel .dam-thumb { box-shadow: none; }
.dam-skel .dam-thumb,
.dam-skel-line {
  background: linear-gradient(90deg, var(--eggshell-shade) 25%, var(--eggshell-bright) 50%, var(--eggshell-shade) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.dam-skel-line { height: 10px; border-radius: 4px; margin-top: 4px; }
.dam-skel-line.short { width: 55%; }

/* ── States (empty / error / disabled / unmapped) ── */
.dam-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 20px;
  text-align: center;
}
.dam-state-icon {
  color: var(--ink-faint);
  display: flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--eggshell-bright);
  border: 1px solid var(--rule-soft);
}
.dam-state-heading {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.dam-state-body { font-size: 0.85rem; color: var(--ink-mute); margin: 0; max-width: 380px; }
.dam-state .btn { margin-top: 4px; }

/* Load more is OUTSIDE the card grid (sibling under .dam-main) so it can
   never collapse into a tiny auto-fill cell and shrink the whole gallery. */
.dam-more-bar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 14px 0 18px;
  flex-shrink: 0;
  position: relative;
  z-index: 5; /* above sticky footer paint on short sheets */
  pointer-events: auto;
}
.dam-more-bar .dam-load-more {
  position: relative;
  z-index: 6;
  pointer-events: auto;
  /* fat finger target — whole pill is tappable */
  min-height: 48px;
  touch-action: manipulation;
}
.dam-more-bar[hidden] { display: none !important; }
.dam-more-bar .dam-load-more {
  min-height: 42px;
  min-width: 160px;
  padding: 10px 22px;
  font-weight: 600;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
}
.dam-more-bar .dam-load-more:hover {
  border-color: var(--heritage-gold);
  color: var(--heritage-red);
}
.dam-more-bar .dam-load-more:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* Progress caption — pagination instrumentation, not a leap of faith. */
.dam-progress {
  font-size: 0.75rem;
  color: var(--ink-mute);
}

/* Terminal state — gold hairline full stop when the library is exhausted. */
.dam-end {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  color: var(--ink-mute);
  font-size: 0.78rem;
  text-align: center;
}
.dam-end::before,
.dam-end::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule-gold);
}

/* ── Footer ── */
.dam-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-width: 0;
}
.dam-footer .dam-use { min-width: 140px; }
.dam-honesty {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--ink-mute);
  margin-right: auto;
  line-height: 1.35;
  max-width: 46ch;
}
.dam-honesty-icon { display: inline-flex; flex-shrink: 0; margin-top: 1px; color: var(--heritage-gold-dark); }
.dam-count { font-size: 0.82rem; font-weight: 600; color: var(--heritage-red); white-space: nowrap; }

/* ── Mobile ≤768: bottom sheet, SINGLE body scroller ── */
@media (max-width: 768px) {
  .dam-modal.modal,
  .dam-modal.modal-wide {
    /* Definite sheet height — fills phone below top scrim. */
    height: calc(100dvh - env(safe-area-inset-top, 0px) - 8px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 8px);
    border-radius: 16px 16px 0 0;
  }
  .dam-modal .modal-header {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--warm-white, var(--paper));
  }
  .dam-modal .modal-footer {
    flex: 0 0 auto;
    z-index: 4;
    background: var(--paper);
    /* Keep actions clear of home indicator; never overlay cards. */
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  }
  .dam-modal .modal-body {
    /* THE mobile scroller. One surface. No nested overflow:hidden. */
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-bottom: 24px;    /* last card clears above footer */
  }
  .dam-picker {
    /* Content-sized column — body scrolls the whole stack. */
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    min-height: auto;
    height: auto;
    gap: 10px;
    overflow: visible;
  }
  .dam-rail {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 8px;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    touch-action: pan-x;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--warm-white, var(--paper));
  }
  .dam-rail::-webkit-scrollbar { display: none; }
  .dam-rail-btn {
    white-space: nowrap;
    flex-shrink: 0;
    scroll-snap-align: start;
    border-radius: 999px;
    min-height: 44px;
    padding: 10px 16px;
  }
  .dam-rail-btn.is-active { box-shadow: none; }
  .dam-search {
    position: sticky;
    top: 52px;               /* under sticky rail chips */
    z-index: 2;
    background: var(--warm-white, var(--paper));
    padding-bottom: 4px;
  }
  .dam-search-input { min-height: 44px; font-size: 16px; /* no iOS zoom on focus */ }
  .dam-main {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    min-height: auto;
    height: auto;
    overflow: visible;       /* do NOT clip children on mobile */
    gap: 10px;
  }
  .dam-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    /* Content-sized. Body scrolls. Never a nested scrollport on iOS. */
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    height: auto;
    overflow: visible;
    padding-bottom: 8px;
    touch-action: manipulation;
  }
  .dam-thumb { padding: 10px; }
  .dam-more-bar {
    flex: 0 0 auto;
    padding: 18px 0 28px; /* clear sticky action footer on iOS */
    margin-bottom: 8px;
  }
  .dam-more-bar .dam-load-more { min-height: 44px; width: 100%; max-width: 280px; }
  .dam-footer { flex-wrap: wrap; }
  .dam-honesty { flex-basis: 100%; margin-right: 0; }
  .dam-shelf-chip { min-height: 44px; padding: 10px 16px; }
  .dam-filter select { min-height: 44px; font-size: 16px; /* no iOS zoom on focus */ }
  .dam-filter-bar { gap: 8px 12px; }
}

@media (max-width: 480px) {
  .dam-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dam-name { font-size: 0.82rem; }
  .dam-thumb { padding: 8px; }
}

/* ── Dark mode: token remap is global (90-dark-mode.css); scoped
   tweaks only for hardcoded translucents + badge contrast. ── */
[data-theme="dark"] .dam-badge {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--rule);
  color: var(--ink-soft);
}
[data-theme="dark"] .dam-badge--design {
  background: rgba(212, 168, 67, 0.12);
  border-color: rgba(212, 168, 67, 0.4);
  color: var(--heritage-gold-light);
}
[data-theme="dark"] .dam-badge--restricted {
  background: rgba(204, 0, 0, 0.14);
  border-color: rgba(255, 107, 107, 0.4);
  color: #ff6b6b;
}
[data-theme="dark"] .dam-card.is-selected {
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.35), var(--shadow-sm);
}
[data-theme="dark"] .dam-honesty-icon { color: var(--heritage-gold-light); }
[data-theme="dark"] .dam-count { color: #ff6b6b; }
[data-theme="dark"] .dam-shelf-chip.is-active {
  background: rgba(212, 168, 67, 0.12);
  border-color: rgba(212, 168, 67, 0.4);
  color: var(--heritage-gold-light);
}
/* ============================================================
   48-ui-atoms.css
   Canonical UI atoms + motion foundation (Lane A, P0 2026-07-23).
   Warm, heritage-tinted primitives so every module shares ONE
   empty/skeleton/error/chip/lift/focus vocabulary instead of each
   sub-agent reinventing a worse version.

   Pairs with: public/js/ui/ui-atoms.js (helpers render these classes).
   Tokens: all colors/radii/shadows come from :root in 00-reset.css.
   DO NOT EDIT main.css directly — this is concatenated by build-css.sh.
   ============================================================ */

/* ──────────────────────────────────────────────────────────────
   Shared timing tokens (scoped here; small, not a second system)
   ────────────────────────────────────────────────────────────── */
:root {
  --ui-ease:        cubic-bezier(0.22, 0.61, 0.36, 1);
  --ui-dur-fast:    120ms;
  --ui-dur:         180ms;
  --ui-lift:        -2px;
  --ui-shimmer-dur: 1.4s;
}

/* ──────────────────────────────────────────────────────────────
   .ui-empty — canonical empty state
   Structure: icon slot + title + description + optional action.
   ────────────────────────────────────────────────────────────── */
.ui-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 48px 28px;
  border: 1px dashed var(--rule);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 168, 67, 0.05), transparent 60%),
    var(--warm-white);
  color: var(--ink-soft);
}

.ui-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(212, 168, 67, 0.12);
  color: var(--heritage-gold-dark);
  margin-bottom: 2px;
}

.ui-empty-icon svg { width: 22px; height: 22px; opacity: 0.9; }

.ui-empty-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 0;
  letter-spacing: -0.01em;
}

.ui-empty-desc {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 46ch;
  line-height: 1.5;
}

.ui-empty-action { margin-top: 6px; display: inline-flex; gap: 8px; }

/* ──────────────────────────────────────────────────────────────
   .ui-skeleton — warm cream shimmer (heritage-tinted, NOT grey).
   Use for placeholder blocks while data loads.
   ────────────────────────────────────────────────────────────── */
.ui-skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--eggshell-shade);
  background-image: linear-gradient(
    90deg,
    var(--eggshell-shade) 0%,
    var(--eggshell-bright) 45%,
    #FFFFFF 50%,
    var(--eggshell-bright) 55%,
    var(--eggshell-shade) 100%
  );
  background-size: 220% 100%;
  animation: ui-shimmer var(--ui-shimmer-dur) var(--ui-ease) infinite;
}

/* A single skeleton line — default row inside skeletonBlock() */
.ui-skeleton-row {
  height: 14px;
  margin: 0 0 10px;
}
.ui-skeleton-row:last-child { margin-bottom: 0; }
.ui-skeleton-row.is-short { width: 60%; }
.ui-skeleton-row.is-mid   { width: 80%; }

.ui-skeleton-block { padding: 4px 0; }

@keyframes ui-shimmer {
  0%   { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

/* ──────────────────────────────────────────────────────────────
   .ui-error — canonical error state
   ────────────────────────────────────────────────────────────── */
.ui-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 40px 28px;
  border: 1px solid rgba(192, 57, 43, 0.28);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 0%, rgba(192, 57, 43, 0.06), transparent 60%),
    var(--warm-white);
  color: var(--ink-soft);
}

.ui-error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(192, 57, 43, 0.12);
  color: var(--danger);
  font-size: 1.3rem;
  font-weight: 800;
}

.ui-error-icon svg { width: 20px; height: 20px; }

.ui-error-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--heritage-red-dark);
  margin: 0;
}

.ui-error-desc {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 46ch;
  line-height: 1.5;
}

.ui-error-action { margin-top: 6px; display: inline-flex; gap: 8px; }

/* ──────────────────────────────────────────────────────────────
   .ui-chip — compact status pill.
   Neutral by default; tone modifiers reuse the page-hero palette.
   ────────────────────────────────────────────────────────────── */
.ui-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  color: var(--ink-strong);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ui-chip svg { width: 12px; height: 12px; opacity: 0.85; }

.ui-chip::before {
  /* Optional status dot — hidden unless .has-dot is present */
  content: none;
}
.ui-chip.has-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.ui-chip.urgent {
  background: rgba(204, 0, 0, 0.08);
  border-color: rgba(204, 0, 0, 0.28);
  color: var(--heritage-red-dark);
}
.ui-chip.important {
  background: rgba(212, 168, 67, 0.14);
  border-color: rgba(212, 168, 67, 0.45);
  color: var(--heritage-gold-dark);
}
.ui-chip.success {
  background: rgba(45, 140, 60, 0.10);
  border-color: rgba(45, 140, 60, 0.30);
  color: var(--success-deep);
}
.ui-chip.info {
  background: rgba(91, 44, 138, 0.08);
  border-color: rgba(91, 44, 138, 0.25);
  color: var(--heritage-purple-dark);
}
.ui-chip.neutral { background: var(--paper); color: var(--ink); }

/* ──────────────────────────────────────────────────────────────
   .ui-card-lift — hover lift 1–2px, short ease.
   Add to any card-like surface that is clickable/interactive.
   ────────────────────────────────────────────────────────────── */
.ui-card-lift {
  transition:
    transform var(--ui-dur) var(--ui-ease),
    box-shadow var(--ui-dur) var(--ui-ease);
  will-change: transform;
}
.ui-card-lift:hover {
  transform: translateY(var(--ui-lift));
  box-shadow: var(--shadow);
}
.ui-card-lift:active { transform: translateY(-1px); }

/* ──────────────────────────────────────────────────────────────
   Gold focus ring utility.
   .ui-focus-gold applies an explicit ring; the :focus-visible block
   gives keyboard users a consistent gold ring on common interactive
   controls inside main content WITHOUT breaking native text inputs.
   ────────────────────────────────────────────────────────────── */
.ui-focus-gold:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--rule-gold, rgba(212, 168, 67, 0.35));
  border-radius: var(--radius-sm);
}

/* Scoped, gentle global ring for keyboard focus on buttons/links/atoms
   in main content. Inputs/textareas/selects are intentionally excluded
   so we don't fight their native focus styling. */
.main-content a:focus-visible,
.main-content button:focus-visible,
.main-content [role="button"]:focus-visible,
.main-content .ui-chip:focus-visible,
.main-content .ui-card-lift:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--rule-gold, rgba(212, 168, 67, 0.35));
  border-radius: var(--radius-sm);
}

/* ──────────────────────────────────────────────────────────────
   Motion hygiene — honor prefers-reduced-motion.
   Kill shimmer + neutralize lift/long transitions for the atoms.
   ────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ui-skeleton {
    animation: none;
    background-image: none;
    background: var(--eggshell-shade);
  }
  .ui-card-lift {
    transition: none;
  }
  .ui-card-lift:hover,
  .ui-card-lift:active {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
}
/* ============================================================
   49-design-system.css — Gallery LAYOUT ONLY (Lane B, 2026-07-23)

   The #/design-system page is a living reference for the Lane A atoms.
   Atom appearance lives in 48-ui-atoms.css and page-hero styling in
   05-page-hero.css — this file only arranges the gallery: section
   scaffolding, sample canvases, and demo grids. No new visual atoms,
   no brand tokens redefined. Dark mode inherits from 90-dark-mode.css
   because every surface here reuses existing brand vars.
   ============================================================ */

.ds-gallery {
  max-width: 960px;
  margin: 0 auto;
  padding: 4px 0 48px;
}

.ds-note {
  margin: 4px 0 24px;
  padding: 12px 16px;
  border-left: 3px solid var(--gold, #D4A843);
  background: var(--eggshell-shade, rgba(212, 168, 67, 0.08));
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-mute, #6b6257);
  line-height: 1.5;
}

/* ── section scaffold ── */
.ds-section {
  margin: 0 0 36px;
  padding: 0 0 28px;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
}
.ds-section:last-child { border-bottom: none; }

.ds-section-head { margin-bottom: 14px; }

.ds-section-title {
  margin: 0;
  font-family: 'ABC Arizona Flare', 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 20px;
  color: var(--heritage-red, #CC0000);
}

.ds-section-desc {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-mute, #6b6257);
  line-height: 1.5;
}

/* Canvas that holds one atom sample — warm paper card. */
.ds-canvas {
  padding: 20px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: 10px;
}

.ds-inline-note {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-mute, #6b6257);
}

/* ── hero preview (scale down slightly so it reads as a sample) ── */
.ds-hero-preview .page-hero { margin: 0; }

/* ── badges row ── */
.ds-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── chips ── */
.ds-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.ds-chip-row-sep {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border, rgba(0, 0, 0, 0.08));
}

/* ── skeleton grid ── */
.ds-skel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.ds-skel-media {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.ds-skel-avatar { border-radius: 50%; flex: 0 0 auto; }
.ds-skel-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  padding-top: 4px;
}

/* ── card-lift grid ── */
.ds-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.ds-lift-card {
  padding: 16px;
  cursor: pointer;
}
.ds-card-title {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--text, #2b2b2b);
}
.ds-card-body {
  margin: 0;
  font-size: 13px;
  color: var(--text-mute, #6b6257);
  line-height: 1.5;
}

/* ── focus / motion rows ── */
.ds-focus-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ── mobile ── */
@media (max-width: 720px) {
  .ds-skel-grid { grid-template-columns: 1fr; }
  .ds-card-grid { grid-template-columns: 1fr; }
  .ds-section-title { font-size: 18px; }
  .ds-canvas { padding: 16px; }
}
/* ══════════════════════════════════════════════════════════════════
   Ask AIOP → Feedback Hub — proposal confirmation card (S3)
   ──────────────────────────────────────────────────────────────────
   Rendered by public/js/ui/agent-feedback-card.js as a SIBLING of the
   assistant bubble in both the Ask AIOP drawer and (S5) the Workspace
   chat. Visually distinct from a chat bubble on purpose: this is a
   form that writes to the backlog, not a message.

   MUST live in public/css/src/ — appending to main.css directly gets
   overwritten by scripts/build-css.sh on every build.

   Two rules here carry real weight:
     · `white-space: pre-wrap` on .agent-fb-title/.agent-fb-details is
       how draft line breaks survive. The JS escapes with escapeHtml
       ONLY and never emits <br> or markdown (DESIGN §5.8 S2) — this
       declaration is the other half of that contract.
     · Every tap target is ≥44px on touch viewports.
   ══════════════════════════════════════════════════════════════════ */

.agent-fb-card {
  /* Left accent rule + Heritage-neutral surface: reads as a form, not a
     chat bubble (DESIGN §2.2). */
  border: 1px solid var(--rule);
  border-left: 3px solid var(--heritage-red);
  border-radius: var(--radius);
  background: var(--eggshell-bright);
  padding: 12px 14px;
  margin: 10px 0 4px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(26, 20, 16, 0.06);
  /* Never let a long unbroken token (URL, id) blow out the drawer. */
  overflow-wrap: anywhere;
}

.agent-fb-card.is-filing { opacity: 0.85; }

/* ── Header ─────────────────────────────────────────────────────── */
.agent-fb-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-soft);
}
.agent-fb-head-icon { font-size: 0.95rem; line-height: 1; }
.agent-fb-head-title {
  font-weight: 650;
  font-size: 0.85rem;
  color: var(--ink-strong);
  letter-spacing: 0.01em;
}

/* ── Chips (type + module) ──────────────────────────────────────── */
.agent-fb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}
.agent-fb-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}
.agent-fb-chip-type { color: var(--ink-strong); }
.agent-fb-chip-type[data-fb-type="bug"] {
  border-color: rgba(204, 0, 0, 0.35);
  background: rgba(204, 0, 0, 0.06);
}
.agent-fb-chip-type[data-fb-type="suggestion"] {
  border-color: var(--rule-gold);
  background: rgba(212, 168, 67, 0.1);
}
.agent-fb-chip-type[data-fb-type="capability_request"] {
  border-color: rgba(91, 44, 138, 0.3);
  background: rgba(91, 44, 138, 0.07);
}
.agent-fb-chip-warn {
  border-color: var(--heritage-gold-dark);
  background: rgba(212, 168, 67, 0.16);
  color: var(--heritage-gold-dark);
}

/* ── Draft text (read state) ───────────────────────────────────── */
.agent-fb-title {
  font-weight: 650;
  color: var(--ink-strong);
  margin-bottom: 6px;
  /* Draft text is plain text — newlines are preserved by CSS, never <br>. */
  white-space: pre-wrap;
}
.agent-fb-details {
  color: var(--ink-soft);
  white-space: pre-wrap;
  font-size: 0.85rem;
}

.agent-fb-more,
.agent-fb-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 0;
  margin-top: 4px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--heritage-red);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.agent-fb-more:hover,
.agent-fb-link:hover { color: var(--heritage-red-dark); }
.agent-fb-more:focus-visible,
.agent-fb-link:focus-visible {
  outline: 2px solid var(--heritage-red);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Dedupe hint ───────────────────────────────────────────────── */
.agent-fb-dupe {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: rgba(212, 168, 67, 0.13);
  border: 1px solid var(--rule-gold);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.agent-fb-dupe .agent-fb-link { margin-top: 0; }

/* ── Edit state ────────────────────────────────────────────────── */
.agent-fb-edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.agent-fb-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.agent-fb-label {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.agent-fb-input,
.agent-fb-select,
.agent-fb-textarea {
  width: 100%;
  box-sizing: border-box;
  /* 44px min: these are the primary touch targets in the edit panel. */
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-strong);
  /* ≥16px prevents iOS Safari from zooming the viewport on focus, which
     would fight the drawer's visualViewport sizing. */
  font-size: 16px;
  font-family: inherit;
  line-height: 1.4;
}
.agent-fb-textarea {
  min-height: 96px;
  resize: vertical;
  white-space: pre-wrap;
}
.agent-fb-input:focus,
.agent-fb-select:focus,
.agent-fb-textarea:focus {
  outline: none;
  border-color: var(--heritage-red);
  box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.12);
}
.agent-fb-counter {
  align-self: flex-end;
  font-size: 0.72rem;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.agent-fb-check {
  display: flex;
  align-items: center;
  gap: 9px;
  /* 44px row so the label text itself is a comfortable touch target. */
  min-height: 44px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.agent-fb-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  accent-color: var(--heritage-red);
  cursor: pointer;
}

.agent-fb-escalate {
  align-self: flex-start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ── Actions ───────────────────────────────────────────────────── */
.agent-fb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.agent-fb-btn {
  appearance: none;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-strong);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.agent-fb-btn:hover:not(:disabled) {
  background: var(--eggshell-shade);
  border-color: var(--ink-faint);
}
.agent-fb-btn:focus-visible {
  outline: 2px solid var(--heritage-red);
  outline-offset: 2px;
}
.agent-fb-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.agent-fb-btn-primary {
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-deep));
  border-color: var(--heritage-red-deep);
  color: #fff;
}
.agent-fb-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--heritage-red-deep), var(--heritage-red-dark));
  border-color: var(--heritage-red-dark);
}
.agent-fb-btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-mute);
}
.agent-fb-btn-quiet:hover:not(:disabled) {
  background: var(--eggshell-shade);
  color: var(--ink-strong);
}

.agent-fb-spinner {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: agent-fb-spin 0.7s linear infinite;
}
@keyframes agent-fb-spin { to { transform: rotate(360deg); } }

/* ── Footer (destination is always explicit) ───────────────────── */
.agent-fb-foot {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--rule-soft);
  font-size: 0.74rem;
  color: var(--ink-mute);
  line-height: 1.4;
}

/* ── Error ─────────────────────────────────────────────────────── */
.agent-fb-error {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(204, 0, 0, 0.35);
  background: rgba(204, 0, 0, 0.06);
  font-size: 0.81rem;
}
.agent-fb-error-title {
  font-weight: 650;
  color: var(--heritage-red-dark);
  margin-bottom: 3px;
}
.agent-fb-error-msg { color: var(--ink); }
.agent-fb-error-note {
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--ink-mute);
}

/* ── Filed (terminal + inert receipt) ──────────────────────────── */
.agent-fb-card.agent-fb-filed {
  border-left-color: #2E7D32;
  background: rgba(46, 125, 50, 0.06);
  padding: 11px 13px;
}
.agent-fb-filed-line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 650;
  color: var(--ink-strong);
}
.agent-fb-filed-meta {
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--ink-mute);
}
.agent-fb-filed .agent-fb-link {
  /* Only control on a filed card, and it navigates — it cannot re-file. */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ── Narrow phones: full-width primary action ──────────────────── */
@media (max-width: 420px) {
  .agent-fb-card { padding: 11px 12px; margin: 9px 0 4px; }
  .agent-fb-actions { gap: 7px; }
  .agent-fb-btn-primary {
    /* Primary goes full-width and first; secondaries share the next row. */
    flex: 1 0 100%;
    order: -1;
  }
  .agent-fb-btn { flex: 1 1 auto; }
}

/* Coarse pointers: enforce the 44px floor even where a rule above is
   tighter (e.g. inline text links inside the dedupe hint). */
@media (hover: none) and (pointer: coarse) {
  .agent-fb-link,
  .agent-fb-more {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-fb-spinner { animation-duration: 2s; }
  .agent-fb-btn { transition: none; }
}
/* ==========================================================================
   51-feedback-attach.css — the shared feedback attachment picker (slice A3)
   Component: public/js/ui/feedback-attach.js  (createAttachPicker)
   ==========================================================================

   Mounted by the feedback surfaces (FAB modal, Ask AIOP proposal card,
   Feedback Hub create, workspace chat; #/request-module retired 2026-10-22,
   its asks now go through the FAB "Request something new" pill), so this file must
   stay SURFACE-AGNOSTIC: no positioning that assumes a modal, no fixed widths,
   no z-index above a host overlay. The host owns layout; we own the control.

   ⚠ CHIP STYLING IS DELIBERATELY NOT HERE. Chips reuse
   `.agent-attachment-chip*` from 27-agent-drawer.css so the control looks
   IDENTICAL on every surface (ATTACHMENTS.md §5.0). Do not fork those rules —
   if a chip needs to change, change it there and all five surfaces follow.

   Mobile: every target ≥44px, chips go full-width under 420px (§5.0).
   ========================================================================== */

.fb-attach {
  position: relative;          /* anchor for .fb-attach-drop */
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── labels ─────────────────────────────────────────────────────────────── */

.fb-attach-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-strong);
  letter-spacing: 0.01em;
}

.fb-attach-hint {
  font-size: 0.74rem;
  color: var(--ink-mute);
  line-height: 1.35;
}

/* ── controls row ───────────────────────────────────────────────────────── */

.fb-attach-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.fb-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* 44px min target — thumb-reachable on a phone (§5.0). */
  min-height: 44px;
  padding: 8px 14px;
  background: var(--surface, #fff);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md, 8px);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-strong);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.fb-attach-btn:hover:not(:disabled) {
  background: var(--eggshell-shade);
  border-color: var(--heritage-red);
  color: var(--heritage-red);
}

.fb-attach-btn:focus-visible {
  outline: 2px solid var(--heritage-red);
  outline-offset: 2px;
}

.fb-attach-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fb-attach-count {
  font-size: 0.74rem;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

/* ── chips ──────────────────────────────────────────────────────────────── */

.fb-attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* The JS toggles this row with the `hidden` ATTRIBUTE (renderChips()), and an
   author `display` beats the UA's `[hidden] { display: none }` — so without
   this rule an empty chip row stays in the layout. Same bug class as the busy
   row below; see that comment for the full story. */
.fb-attach-chips[hidden] { display: none !important; }

/* Only the max-width override is ours; everything else is inherited from
   .agent-attachment-chip so the five surfaces stay pixel-identical. */
.fb-attach-chip .agent-attachment-chip-name {
  max-width: 200px;
}

/* ── error + busy ───────────────────────────────────────────────────────── */

.fb-attach-error {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--heritage-red);
  background: rgba(204, 0, 0, 0.06);
  border-left: 3px solid var(--heritage-red);
  border-radius: 0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0;
  padding: 6px 10px;
}

.fb-attach-busy {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--ink-mute);
}

/* ⚠ LOAD-BEARING — do not delete (fixes the false "Reading files…" spinner).

   The picker ships the busy row with the `hidden` attribute and JS drives it
   via `busyEl.hidden = busy === 0`, so it is hidden on EVERY idle mount. But
   `hidden` is only a UA-stylesheet rule (`[hidden] { display: none }`), and
   ANY author `display` outranks the UA sheet regardless of specificity. The
   `display: flex` above therefore un-hid the row, and all five surfaces of the
   time (FAB modal, Ask AIOP card, Feedback Hub, #/request-module [since
   retired], workspace chat) showed a spinning "Reading files…" with zero files attached.

   Mirrors the established convention for every `hidden`-toggled block that
   sets a display — e.g. `.feedback-shot-progress[hidden]` in 32-feedback.css.
   RULE: if you give any `.fb-attach-*` element a `display`, add its
   `[hidden]` kill in the same commit. */
.fb-attach-busy[hidden] { display: none !important; }

.fb-attach-spinner {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border: 2px solid var(--rule);
  border-top-color: var(--heritage-red);
  border-radius: 50%;
  animation: fb-attach-spin 720ms linear infinite;
}

@keyframes fb-attach-spin {
  to { transform: rotate(360deg); }
}

/* ── drag-and-drop overlay ──────────────────────────────────────────────────
   Mirrors .agent-drop-overlay (27-agent-drawer.css) so the drop affordance
   reads the same in the drawer and in a feedback form. `pointer-events:none`
   is load-bearing: without it the overlay swallows the drop event it exists to
   advertise. Activated by the JS class `.is-active`. */

.fb-attach-drop {
  position: absolute;
  inset: -6px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(204, 0, 0, 0.06);
  border: 2px dashed var(--heritage-red);
  border-radius: var(--radius-lg, 12px);
  pointer-events: none;
  z-index: 3;
  animation: fb-attach-drop-in 140ms ease;
}

.fb-attach-drop.is-active { display: flex; }

.fb-attach-drop-inner {
  text-align: center;
  padding: 12px 20px;
  color: var(--heritage-red);
  font-weight: 600;
  pointer-events: none;
}

.fb-attach-drop-icon {
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 4px;
}

.fb-attach-drop-text {
  font-size: 0.88rem;
  letter-spacing: 0.01em;
}

@keyframes fb-attach-drop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── compact mode (Ask AIOP proposal card, A5) ──────────────────────────────
   Chips + a small paperclip only. No label, no hint — the card is tight and
   the section header already says what it is. */

.fb-attach--compact {
  gap: 6px;
}

.fb-attach--compact .fb-attach-btn {
  /* Still 44px tall for the thumb, but visually lighter than inline mode. */
  min-height: 44px;
  padding: 6px 10px;
  font-size: 0.78rem;
  background: transparent;
}

.fb-attach--compact .fb-attach-drop-icon { display: none; }

.fb-attach--compact .fb-attach-drop-text { font-size: 0.8rem; }

/* ── mobile ─────────────────────────────────────────────────────────────── */

@media (max-width: 420px) {
  /* Full-width chips: a wrapped 2-per-row layout truncates real filenames
     ("distributor-chargeback-Q3-2026.xlsx") into uselessness (§5.0). */
  .fb-attach-chips { flex-direction: column; }

  .fb-attach-chip { max-width: 100%; }

  .fb-attach-chip .agent-attachment-chip-name { max-width: none; }

  .fb-attach-btn { width: 100%; justify-content: center; }

  .fb-attach-controls { gap: 6px; }

  /* Dragging files is a desktop gesture; nothing to advertise on a phone. */
  .fb-attach-drop { display: none !important; }
}

/* ── reduced motion ─────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .fb-attach-spinner { animation-duration: 2s; }
  .fb-attach-drop { animation: none; }
}

/* ══ A4 · FAB modal host ═══════════════════════════════════════════════════ */

/* Sits directly under .feedback-shot-section, which already carries the
   separator. Matching its rhythm keeps capture + picker reading as one
   "evidence" area rather than two unrelated widgets. */
.feedback-attach-host {
  margin-top: 12px;
}

.feedback-attach-host[hidden] { display: none; }

/* Over the server's 5-file ceiling (picked files + the screenshot). Submit is
   already blocked with a translated reason in .feedback-helper; this is the
   visual pairing so the eye lands on the control that has to change. */
.feedback-attach-host.is-over-cap .fb-attach {
  border-color: var(--lkk-red, #cc0000);
  background: rgba(204, 0, 0, 0.04);
}

.feedback-attach-host.is-over-cap .fb-attach-count {
  color: var(--lkk-red, #cc0000);
  font-weight: 600;
}

/* ══ A5 · proposal-card attach area + turn carryover ═══════════════════════ */

.agent-fb-attach-wrap {
  margin-top: 10px;
}

.agent-fb-attach-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #6b6b6b);
  margin-bottom: 6px;
}

/* ≥44px tap target — T14 applies to every control on this card, and the card
   test measures the stylesheet, not just the controls S3 shipped. */
.agent-fb-turnfiles {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 13px;
  color: var(--text-primary, #2b2b2b);
  cursor: pointer;
}

.agent-fb-turnfiles input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  cursor: pointer;
}

.agent-fb-attach-hint {
  font-size: 12px;
  color: var(--text-secondary, #6b6b6b);
  margin-top: 4px;
}

.agent-fb-attach-skipped {
  font-size: 12px;
  color: var(--lkk-red, #cc0000);
  margin-top: 4px;
}

/* ── A5 · transient picker modal (drawer-hosted) ─────────────────────────── */

/* The proposal card cannot host a live picker: the drawer re-renders its whole
   message list on every token batch. The picker therefore lives in this
   short-lived overlay and hands bytes back to the card. z-index sits above the
   drawer (1000) but below toasts so errors stay readable. */
.agent-fb-attach-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}

.agent-fb-attach-modal-box {
  width: 100%;
  max-width: 460px;
  max-height: 86vh;
  overflow-y: auto;
  padding: 16px;
  border-radius: 12px;
  background: var(--surface, #fffdfa);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.agent-fb-attach-modal-head {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #2b2b2b);
  margin-bottom: 10px;
}

.agent-fb-attach-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 420px) {
  /* Full-width actions, matching the card's own T14 behavior. */
  .agent-fb-attach-modal-actions { flex-direction: column-reverse; }
  .agent-fb-attach-modal-actions .agent-fb-btn { width: 100%; min-height: 44px; }
}
/* ══════════════════════════════════════════════════════════════════════════
   52-feedback-attachment-view.css — A6 Hub attachment gallery (2026-07-24)

   Owner: public/js/ui/feedback-attachment-view.js (+ the Hub's mount points).

   Its own file, NOT appended to 32-feedback.css, for the same reason A3 took
   51-: 32-feedback.css is A4/A5's active file this cycle and concatenation
   order (cat public/css/src/*.css) makes a separate numbered file free.
   Sits after 51-feedback-attach.css (the WRITE-side picker); this is the
   READ side. Deliberately no shared class prefix with `fb-attach-*` so the
   two cannot cascade into each other.

   Mobile: every control is ≥44px tall (T14 / the pilot is phone-heavy).
   Dark mode lives in 90-dark-mode.css.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── block shell ───────────────────────────────────────────────────────── */
.fbatt-block {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e6e0d8);
  border-radius: 10px;
  background: rgba(0, 0, 0, .015);
}
.fbatt-block.is-empty {
  padding: 8px 12px;
  background: none;
  border-style: dashed;
}
.fbatt-none {
  font-size: .85em;
  color: var(--text-mute, #7a726a);
}
.fbatt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.fbatt-title {
  font-size: .82em;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text-mute, #7a726a);
}
.fbatt-dl-all {
  appearance: none;
  background: none;
  border: none;
  padding: 6px 2px;
  min-height: 44px;
  cursor: pointer;
  font-size: .84em;
  font-weight: 600;
  color: var(--accent, #cc0000);
}
.fbatt-dl-all:hover { text-decoration: underline; }

/* ── list variant (Hub "My" — the submitter's own files) ───────────────── */
.fbatt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fbatt-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fbatt-row .fbatt-meta { flex: 1 1 auto; min-width: 0; }
.fbatt-row .fbatt-thumb { flex: 0 0 auto; }

/* ── grid variant (Hub Backlog — admin gallery) ────────────────────────── */
.fbatt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}
.fbatt-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border, #e6e0d8);
  border-radius: 10px;
  background: var(--card-bg, #fff);
}
.fbatt-tile .fbatt-thumb { width: 100%; }
.fbatt-tile .fbatt-actions { margin-top: auto; }

/* ── thumbs ────────────────────────────────────────────────────────────── */
.fbatt-thumb-img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border, #e6e0d8);
  background: rgba(0, 0, 0, .04);
}
.fbatt-tile .fbatt-thumb-img { height: 88px; width: 100%; }
.fbatt-thumb-doc {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 1px solid var(--border, #e6e0d8);
  background: rgba(0, 0, 0, .04);
  font-size: 1.5em;
  line-height: 1;
}
.fbatt-tile .fbatt-thumb-doc { height: 88px; width: 100%; font-size: 1.9em; }

/* ── meta ──────────────────────────────────────────────────────────────── */
.fbatt-meta { min-width: 0; }
.fbatt-name {
  font-size: .86em;
  font-weight: 600;
  /* Long filenames are the norm (distributor-XYZ-chargeback-Q3.xlsx). Wrap
     rather than ellipsis in the grid so the extension stays visible — the
     extension is what tells the operator what they're about to open. */
  overflow-wrap: anywhere;
  word-break: break-word;
}
.fbatt-sub {
  margin-top: 2px;
  font-size: .78em;
  color: var(--text-mute, #7a726a);
}

/* ── purged (§5.6 — SHOWN, never hidden) ───────────────────────────────── */
.fbatt-item.is-purged { opacity: .68; }
.fbatt-item.is-purged .fbatt-thumb-doc {
  background: rgba(0, 0, 0, .06);
  border-style: dashed;
}
.fbatt-purged-note {
  margin-top: 3px;
  font-size: .76em;
  font-style: italic;
  color: var(--text-mute, #7a726a);
}

/* ── actions ───────────────────────────────────────────────────────────── */
.fbatt-actions { display: flex; align-items: center; }
.fbatt-actions .btn,
.fbatt-view,
.fbatt-dl {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* ── Hub mount points ──────────────────────────────────────────────────── */
.fbhub-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: .78em;
  font-weight: 600;
  background: rgba(0, 0, 0, .05);
  color: var(--text-mute, #7a726a);
  white-space: nowrap;
}
.fbhub-card-foot { margin-top: 8px; }
.fbhub-files-toggle {
  appearance: none;
  background: none;
  border: none;
  padding: 6px 0;
  min-height: 44px;
  cursor: pointer;
  font-size: .84em;
  font-weight: 600;
  color: var(--accent, #cc0000);
}
.fbhub-files-toggle:hover { text-decoration: underline; }
.fbhub-files-toggle[aria-expanded="true"]::after { content: ' ▴'; }
.fbhub-files-toggle[aria-expanded="false"]::after { content: ' ▾'; }
.fbhub-card-files { margin-top: 2px; }
.fbhub-detail-atts { margin: 10px 0 4px; }

/* ── lightbox ──────────────────────────────────────────────────────────── */
.fbatt-lightbox {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* Safe-area: the PWA runs fullscreen on iOS, so a bare `padding` would put
     the close button under the notch. */
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, .78);
}
.fbatt-lightbox-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  max-height: 100%;
}
.fbatt-lightbox-img {
  max-width: 100%;
  /* 132px reserves room for the caption + download link below the image. */
  max-height: calc(100vh - 132px);
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}
.fbatt-lightbox-cap {
  font-size: .85em;
  color: #f2ede7;
  text-align: center;
  overflow-wrap: anywhere;
  max-width: 90vw;
}
.fbatt-lightbox-dl {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: .86em;
  font-weight: 600;
  text-decoration: none;
}
.fbatt-lightbox-dl:hover { background: rgba(255, 255, 255, .24); }
.fbatt-lightbox-close {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 1;
  appearance: none;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 1.5em;
  line-height: 1;
}

@media (max-width: 480px) {
  .fbatt-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
  .fbatt-lightbox { padding-left: 10px; padding-right: 10px; }
  .fbatt-lightbox-close { top: 2px; right: 2px; }
}
/* ============================================================
   PLATFORM WORKSPACES (Train 1, 2026-07-24)
   Picker (full-screen chooser) · topbar switcher · workspace home.

   NOTE: 33-workspace.css is Creative Studio's deck workspace — a different
   feature. Everything here is namespaced `ws-` to keep them apart.

   Each card/menu row sets its own `--ws-accent` inline from the workspaces
   table, so a new BU workspace is styled correctly with zero CSS changes.
   ============================================================ */

/* ---------- Full-screen picker ---------- */
.ws-picker {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(circle at 15% 10%, rgba(212, 168, 67, 0.10), transparent 55%),
    radial-gradient(circle at 85% 90%, rgba(204, 0, 0, 0.06), transparent 55%),
    var(--eggshell-bright);
}

.ws-picker-inner {
  width: 100%;
  max-width: 940px;
  text-align: center;
}

/* IN-SHELL variant (#/workspaces). The picker is normally a full-screen
   takeover rendered INSTEAD of the app chrome; at this route it renders inside
   the content column, where 100dvh + centering produced a huge empty gradient
   band with the cards pushed below the fold. Lay it out as a page section. */
.ws-picker-inline {
  min-height: 0;
  padding: 0 0 24px;
  background: none;
  display: block;
}

.ws-picker-inline .ws-picker-inner {
  max-width: none;
  text-align: left;
}

.ws-picker-inline .ws-picker-sub { margin-left: 0; }
.ws-picker-inline .ws-picker-title { font-size: clamp(24px, 3.4vw, 32px); }

.ws-picker-eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--heritage-gold-dark);
}

.ws-picker-title {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.15;
  color: var(--ink-strong);
}

.ws-picker-sub {
  margin: 0 auto 34px;
  max-width: 560px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* auto-fit => N cards without any per-count CSS. Two cards centre nicely,
   three-plus wrap into a grid on their own. */
.ws-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  text-align: left;
}

.ws-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0 0 20px;
  min-height: 210px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--warm-white);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  overflow: hidden;
  font: inherit;
  color: inherit;
  text-align: left;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.ws-card:hover:not(:disabled),
.ws-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--ws-accent);
  outline: none;
}

.ws-card:focus-visible { box-shadow: var(--shadow-lg), 0 0 0 3px color-mix(in srgb, var(--ws-accent) 35%, transparent); }

.ws-card:disabled { opacity: 0.55; cursor: default; }

.ws-card-bar {
  display: block;
  height: 5px;
  background: var(--ws-accent);
}

.ws-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 22px 0;
  flex: 1;
}

.ws-card-kind {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ws-accent);
}

.ws-card-name {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.2;
  color: var(--ink-strong);
}

.ws-card-tagline {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-mute);
}

.ws-card-cta {
  padding: 0 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ws-accent);
}

.ws-card.is-loading .ws-card-cta { opacity: 0.5; }

.ws-picker-foot {
  margin: 28px 0 0;
  font-size: 12.5px;
  color: var(--ink-mute);
}

/* ---------- "No workspace yet" (Option A: floors are invite-only) ----------
   This is a NORMAL state, not an error: someone logged in before an admin
   granted them a floor. Styled calm — no red, no alarm iconography — with one
   concrete next step and a way out. */
.ws-picker-none .ws-picker-inner { max-width: 520px; }

.ws-picker-none-who {
  margin: 18px 0 0;
  font-size: 12.5px;
  color: var(--ink-mute);
}

.ws-picker-none-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 24px;
}

/* ---------- Topbar switcher ---------- */
.ws-switch { position: relative; flex: 0 0 auto; }

.ws-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--warm-white);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ws-switch-btn:hover { border-color: var(--ws-accent); }
.ws-switch-btn:focus-visible {
  outline: none;
  border-color: var(--ws-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ws-accent) 30%, transparent);
}

.ws-switch-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ws-accent);
}

.ws-switch-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-switch-caret { flex: 0 0 auto; opacity: 0.6; }

.ws-switch-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 268px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--warm-white);
  box-shadow: var(--shadow-lg);
}

.ws-switch-menu-head {
  padding: 8px 10px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.ws-switch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ws-switch-item:hover { background: var(--eggshell-shade); }
.ws-switch-item:focus-visible { outline: 2px solid var(--ws-accent); outline-offset: -2px; }
.ws-switch-item.is-active { background: var(--eggshell-bright); }
.ws-switch-item.is-loading { opacity: 0.55; cursor: default; }

.ws-switch-item-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }

.ws-switch-item-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-switch-item-kind {
  font-size: 11px;
  color: var(--ink-mute);
}

.ws-switch-check { color: var(--ws-accent); font-weight: 700; }

.ws-switch-item[disabled] { opacity: 0.5; cursor: default; }

/* In-flight switch: the chip itself shows the work, because the menu closes on
   success and the shell rebuild is the only other feedback. */
.ws-switch-btn.is-loading { opacity: 0.65; cursor: progress; }
.ws-switch-btn.is-loading .ws-switch-dot { animation: ws-pulse 0.9s ease-in-out infinite; }

@keyframes ws-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.82); }
}

/* Mobile: the switcher is the primary orientation cue — keep it, shrink it. */
@media (max-width: 640px) {
  .ws-switch-btn { max-width: 132px; padding: 5px 8px; font-size: 12px; }
  /* Anchor to the RIGHT EDGE OF THE VIEWPORT, not the button. The button sits
     mid-topbar on a phone, so a right:-4px menu overflowed the screen and the
     last row was unreachable (Kevin hit this). position:fixed also escapes any
     overflow:hidden ancestor in the topbar. */
  .ws-switch-menu {
    position: fixed;
    /* Sits just under the sticky topbar, which is
       header-h + safe-area + 2px tall (02-layout.css / 03-shell.css). */
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 8px);
    right: 12px;
    left: auto;
    min-width: 0;
    width: min(300px, calc(100vw - 24px));
    max-height: min(60vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Comfortable tap targets (44px Apple HIG minimum). */
  .ws-switch-item { padding: 12px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-switch-btn.is-loading .ws-switch-dot { animation: none; }
}

/* ---------- Workspace home (non-ops doorway) ---------- */
.ws-home { max-width: 1080px; }

.ws-home-hero {
  padding: 26px 0 22px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 28px;
}

.ws-home-eyebrow {
  margin: 0 0 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ws-accent);
}

.ws-home-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(26px, 4.4vw, 36px);
  line-height: 1.15;
  color: var(--ink-strong);
}

.ws-home-tagline {
  margin: 0;
  max-width: 640px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.ws-home-section { margin-bottom: 34px; }

.ws-home-h2 {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.ws-home-modules,
.ws-home-next {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.ws-home-module {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ws-accent);
  border-radius: var(--radius);
  background: var(--warm-white);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ws-home-module:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.ws-home-module-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-strong);
}

.ws-home-module-desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-mute);
}

/* Train 1 shipped these as non-interactive "coming next" placeholders (no dead
   links). Train 2 made the award LIVE, so they are now real <a> shortcuts —
   solid border + hover, and they are removed entirely by workspace-home.js when
   the active workspace does not enable the module. */
.ws-home-next-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: transparent;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

a.ws-home-next-card:hover {
  border-color: var(--heritage-gold, #D4A843);
  background: rgba(212, 168, 67, 0.05);
}

@media (prefers-reduced-motion: reduce) {
  .ws-home-next-card { transition: none; }
}

.ws-home-next-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

.ws-home-next-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-mute);
}

@media (prefers-reduced-motion: reduce) {
  .ws-card,
  .ws-home-module { transition: none; }
  .ws-card:hover:not(:disabled),
  .ws-home-module:hover { transform: none; }
}
/* ============================================================
   AI EXCELLENCE AWARD (Train 2, 2026-07-24)
   Submit → BU review → Group publish → gallery.

   Namespaced `aix-` (NOT `ws-`, which is the Train 1 workspace shell, and NOT
   `workspace-`, which is Creative Studio's deck workspace). Three neighbouring
   namespaces, kept deliberately apart.

   Uses the shared design tokens only — no new colors — so the award pages
   inherit brand + dark mode for free.
   ============================================================ */

.aix {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 4px 48px;
}

/* ---------- Hero ---------- */
.aix-hero {
  padding: 28px 0 18px;
}

.aix-eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--heritage-gold-dark);
}

.aix-title {
  margin: 0 0 8px;
  font-family: var(--font-display, 'ABC Arizona Flare', 'Playfair Display', Georgia, serif);
  font-size: 30px;
  line-height: 1.15;
  color: var(--text-primary);
}

.aix-tagline {
  margin: 0;
  max-width: 62ch;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ---------- Tabs ---------- */
.aix-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
  margin-bottom: 22px;
}

.aix-tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.aix-tab:hover { color: var(--text-primary); }

.aix-tab.active {
  color: var(--heritage-red, #CC0000);
  border-bottom-color: var(--heritage-red, #CC0000);
}

/* ---------- Sections ---------- */
.aix-section { margin-bottom: 30px; }

.aix-h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.aix-muted {
  color: var(--text-secondary);
  font-size: 13px;
}

.aix-error {
  color: var(--heritage-red, #CC0000);
  font-size: 13px;
  margin: 8px 0 0;
}

.aix-notice {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface-subtle, rgba(0, 0, 0, 0.03));
  border-left: 3px solid var(--heritage-gold, #D4A843);
  font-size: 13px;
  color: var(--text-secondary);
}

.aix-notice-warn {
  border-left-color: var(--heritage-red, #CC0000);
  color: var(--text-primary);
}

/* ---------- Home cards ---------- */
.aix-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.aix-card {
  padding: 20px;
  border-radius: 12px;
  background: var(--surface-card, #fff);
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}

.aix-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--text-primary);
}

.aix-card p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.aix-cycles {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-primary);
}

.aix-cycles li { margin-bottom: 4px; }

/* ---------- Form ---------- */
.aix-form {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.aix-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.aix-field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.aix-field input,
.aix-field select,
.aix-field textarea {
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface-input, #fff);
  border: 1px solid var(--border-input, rgba(0, 0, 0, 0.16));
  border-radius: 8px;
}

.aix-field textarea { resize: vertical; }

.aix-field input:focus,
.aix-field select:focus,
.aix-field textarea:focus {
  outline: 2px solid var(--heritage-gold, #D4A843);
  outline-offset: 1px;
  border-color: var(--heritage-gold, #D4A843);
}

.aix-form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Lists (my submissions / queue / admin) ---------- */
.aix-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-card, #fff);
}

.aix-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
}

.aix-row:last-child { border-bottom: none; }

.aix-row-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.aix-row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.aix-row-sub {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aix-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 12px;
}

.aix-attach {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---------- Gallery ---------- */
.aix-gallery-head {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 13px;
}

.aix-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.aix-gallery-more {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.aix-gallery-more button[hidden] { display: none; }

.aix-gcard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border-radius: 12px;
  background: var(--surface-card, #fff);
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.aix-gcard:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}

.aix-gcard h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text-primary);
}

.aix-gcard p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.aix-gcard footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  .aix-gcard { transition: none; }
  .aix-gcard:hover { transform: none; }
}

/* ---------- Case detail ---------- */
.aix-detail {
  max-width: 760px;
  padding: 22px;
  border-radius: 12px;
  background: var(--surface-card, #fff);
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}

.aix-detail > header { margin-bottom: 18px; }

.aix-detail h2 {
  margin: 0 0 10px;
  font-size: 21px;
  color: var(--text-primary);
}

.aix-detail-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
}

.aix-detail section { margin-bottom: 18px; }

.aix-detail section h3 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.aix-detail section p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;   /* author line breaks are content, not markup */
}

.aix-attachments {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.aix-attachments li {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

/* ---------- Links ---------- */
.aix-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.aix-links a {
  /* A long URL must not blow out the card on mobile. */
  overflow-wrap: anywhere;
}

.aix-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  white-space: pre-line;
}

/* ---------- Actions ---------- */
.aix-actions {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aix-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Timeline ---------- */
.aix-timeline ol {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-primary);
}

.aix-timeline li { margin-bottom: 8px; }

/* ---------- Grant admin form (T3) ---------- */
.aix-grant-form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}

.aix-h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.aix-grant-grid {
  display: grid;
  /* auto-fit so the four fields sit on one row on desktop and stack on
     narrow screens without a second media query. */
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 12px 0 14px;
}

/* `hidden` must win over the grid/flex display of a field. */
.aix-grant-form [hidden] { display: none !important; }

.aix-msg { margin-top: 10px; font-size: 13px; min-height: 1em; }

/* ---------- Cycle admin (Slice 1) ---------- */
/* The expandable panel is a THIRD child of a flex .aix-row, so the row must be
   allowed to wrap or the panel would be squeezed onto the same line as the
   title and the status chips. */
.aix-cycle-row { flex-wrap: wrap; }

.aix-cycle-panel {
  /* Force a full-width new line inside the wrapping flex row. */
  flex: 0 0 100%;
  width: 100%;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
  border-radius: 10px;
  background: var(--surface-subtle, rgba(0, 0, 0, 0.02));
}

/* `hidden` must beat the flex/block display above, same reason as the grant
   form: a plain [hidden] loses to an explicit display rule. */
.aix-cycle-panel[hidden] { display: none !important; }

.aix-cycle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.aix-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary, #555);
  margin-bottom: 12px;
}

.aix-check input { margin: 0; }

.aix-cycle-actions { display: flex; gap: 8px; margin-bottom: 6px; }

.aix-cycle-cats {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}

.aix-cat-list { margin: 8px 0; }

.aix-cat-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.aix-cat-add input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border-default, rgba(0, 0, 0, 0.14));
  border-radius: 8px;
  font: inherit;
}

.aix-cycle-form {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}

/* ---------- Author edit (Slice 2) ---------- */
.aix-edit-wrap {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}

/* Keep the remove button from crowding the filename + size on one line. */
.aix-attachments li {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .aix-title { font-size: 24px; }
  .aix-row { flex-direction: column; align-items: flex-start; }
  .aix-row-meta { width: 100%; }
  .aix-detail { padding: 16px; }
  .aix-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .aix-tab { white-space: nowrap; }
  .aix-grant-grid { grid-template-columns: 1fr; }
  .aix-cycle-grid { grid-template-columns: 1fr; }
  /* The manage button must not stretch full-width like the other row meta. */
  .aix-cycle-row .aix-row-meta { flex-wrap: wrap; }
  .aix-cat-add { flex-direction: column; align-items: stretch; }
}
/* ─────────────────────────────────────────────────────────────────────
   BOL Intake (Wave 2) — Order Intelligence → BOL Intake tab.

   Design intent: the attribution column is the honesty surface. An
   unresolved customer must be VISIBLY unresolved (red, labelled
   "Unknown"), never a blank cell that reads as "fine". Confidence chips
   are colour + text, never colour alone (accessibility + print).
   ───────────────────────────────────────────────────────────────────── */

.oi-tabs { margin-bottom: 4px; }

.bol-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bol-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.bol-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-mute, #6b6b6b);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #e3ded4);
  white-space: nowrap;
}

.bol-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-soft, #f0ece4);
  vertical-align: top;
}

.bol-table tbody tr:hover { background: var(--surface-hover, #faf7f1); }
.bol-table tbody tr.is-active { background: var(--surface-active, #f5efe3); }

.bol-pages {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-mute, #6b6b6b);
}

.bol-cust { min-width: 180px; }

/* The unresolved-customer treatment. Loud on purpose. */
.bol-unknown {
  color: var(--danger, #b3261e);
  font-weight: 600;
}

.bol-raw {
  font-size: 0.78rem;
  color: var(--text-mute, #6b6b6b);
  font-style: italic;
  margin-top: 2px;
  max-width: 240px;
  overflow-wrap: anywhere;
}

.bol-attr { margin-top: 4px; }

.bol-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.bol-chip-ok      { background: #e6f4ea; color: #1e6b34; }
.bol-chip-warn    { background: #fdf3d7; color: #8a6100; }
.bol-chip-bad     { background: #fce8e6; color: #b3261e; }
.bol-chip-neutral { background: var(--surface-alt, #f2ede4); color: var(--text-mute, #6b6b6b); }

.bol-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.bol-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  white-space: nowrap;
}

.bol-actions .btn-sm {
  padding: 4px 9px;
  font-size: 0.8rem;
}

.bol-assign {
  padding: 4px 8px;
  font-size: 0.8rem;
  border: 1px solid var(--border, #d8d2c6);
  border-radius: 6px;
  background: var(--surface, #fff);
  max-width: 130px;
}

/* A disabled Draft button must read as "blocked by policy", not "broken". */
.bol-actions .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.bol-progress {
  padding: 10px 0;
  color: var(--text-mute, #6b6b6b);
  font-size: 0.9rem;
}

/* Mobile: the table degrades to stacked cards (W5 refines this). */
/* ─────────────────────────────────────────────────────────────────────
   #307 — the page filmstrip.

   This is the primary desk for regrouping. Simin picks pages by LOOKING at
   them, so the thumbnail has to be big enough to tell one consignee from
   another at a glance (page 7 FERCO vs page 17 FRESH FOOD) while still
   fitting a 33-page scan on screen without endless scrolling.

   Selection is never colour alone: a selected tile gets a border, a lifted
   shadow AND a ✓ badge, and the button carries aria-pressed.
   ───────────────────────────────────────────────────────────────────── */

.bol-film {
  border: 1px solid var(--border, #e3e0d8);
  border-radius: 12px;
  padding: 12px;
  margin: 0 0 16px;
  background: var(--surface-2, #fbfaf7);
}

.bol-film-head { margin-bottom: 10px; }

.bol-film-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.bol-film-help {
  font-size: 0.82rem;
  color: var(--text-mute, #6b6b6b);
  margin-top: 2px;
  line-height: 1.45;
}

.bol-film-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding: 4px;
}

.bol-film-tile {
  position: relative;
  display: block;
  padding: 0;
  border: 2px solid var(--border, #e3e0d8);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.bol-film-tile:hover { border-color: var(--accent, #cc0000); }

.bol-film-tile:focus-visible {
  outline: 3px solid var(--focus, #005fcc);
  outline-offset: 2px;
}

.bol-film-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 17 / 22;
  object-fit: cover;
  object-position: top center;
  background: #f4f2ec;
}

.bol-film-num {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  min-width: 20px;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
  background: rgba(30, 30, 30, 0.78);
}

.bol-film-group {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 2px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-align: center;
  color: #fff;
  background: rgba(30, 30, 30, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Selected: border + shadow + ✓ badge, never colour alone. */
.bol-film-tile.is-selected {
  border-color: var(--accent, #cc0000);
  box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.18);
  transform: translateY(-1px);
}

.bol-film-check {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
  width: 20px;
  height: 20px;
  line-height: 20px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
  background: var(--accent, #cc0000);
}

/* Existing shipment groups. A coloured top rule per group so adjacent pages
   that belong to DIFFERENT shipments are visibly different, which is exactly
   the boundary the automatic splitter got wrong. */
.bol-film-g1 { border-top-color: #2d6cdf; }
.bol-film-g2 { border-top-color: #17916b; }
.bol-film-g3 { border-top-color: #b8860b; }
.bol-film-g4 { border-top-color: #8250c4; }
.bol-film-g5 { border-top-color: #c25a1f; }
.bol-film-g6 { border-top-color: #0f7d8c; }
.bol-film-g1, .bol-film-g2, .bol-film-g3,
.bol-film-g4, .bol-film-g5, .bol-film-g6 { border-top-width: 4px; }

.bol-film-bar {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #e3e0d8);
}

.bol-film-bar.is-empty {
  color: var(--text-mute, #6b6b6b);
  font-size: 0.85rem;
}

.bol-film-sel {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.bol-film-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bol-film-preview {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #e3e0d8);
  background: #fff;
  font-size: 0.86rem;
  line-height: 1.5;
}

.bol-film-preview-title { font-weight: 600; margin-bottom: 6px; }

.bol-film-preview-list {
  margin: 0 0 6px;
  padding-left: 18px;
}

.bol-film-preview-count {
  color: var(--text-mute, #6b6b6b);
  font-size: 0.82rem;
}

.bol-film-warn {
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #7a4a00;
  background: #fdf3e0;
  border: 1px solid #f0d9a8;
}

@media (max-width: 720px) {
  .bol-table thead { display: none; }
  .bol-table, .bol-table tbody, .bol-table tr, .bol-table td { display: block; width: 100%; }
  .bol-table tr {
    border: 1px solid var(--border, #e3ded4);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 6px 4px;
  }
  .bol-table td { border-bottom: none; padding: 5px 10px; }
  .bol-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-mute, #6b6b6b);
  }
  .bol-actions { justify-content: flex-start; padding-top: 6px; }
  .bol-assign { max-width: none; flex: 1; }

  /* Smaller tiles on a phone, but still a grid — the whole value is seeing
     several pages at once to spot where one shipment ends. */
  .bol-film-strip {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    max-height: 360px;
    gap: 8px;
  }
  .bol-film-actions { flex-direction: column; align-items: stretch; }
  .bol-film-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .bol-table tbody tr { transition: none; }
  .bol-film-tile { transition: none; }
  .bol-film-tile.is-selected { transform: none; }
}
/* Foodservice poster maker (2026-11-24): the "Make poster" editor on an FSV
   promotion (public/js/ui/fs-poster.js). The poster itself is styled by its
   own template (src/services/sell-sheet/fs-poster-template.js). */
.fsp-make { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 12px; }
.fsp-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.fsp-form { min-width: 0; }
.fsp-sec, .fsp-block { border: 1px solid var(--rule, #ddd); border-radius: 10px; padding: 10px 12px 12px; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px 12px; }
.fsp-sec > legend, .fsp-block > legend { font-weight: 700; padding: 0 4px; }
.fsp-block { background: var(--surface-2, #fafafa); }
.fsp-row { display: flex; flex-wrap: wrap; gap: 8px 12px; width: 100%; }
.fsp-field { display: flex; flex-direction: column; gap: 3px; font-size: 0.85rem; min-width: 0; }
/* Review #685 NIT-2: boxes of a language the poster does not print. */
.fsp-field[hidden] { display: none; }
.fsp-field input, .fsp-field select, .fsp-field textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--rule, #ccc); border-radius: 6px; min-height: 38px; background: #fff; }
.fsp-field .fsp-qty, .fsp-field input.fsp-qty { width: 5.5em; }
.fsp-wide { flex: 1 1 100%; }
.fsp-grow { flex: 1 1 220px; }
.fsp-leg { width: 100%; }
.fsp-leg > h5 { margin: 6px 0; font-size: 0.9rem; }
.fsp-line { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 10px; padding: 6px 0; border-top: 1px dashed var(--rule, #ddd); }
.fsp-photo { display: flex; align-items: center; gap: 8px; }
.fsp-photo img { width: 48px; height: 48px; object-fit: contain; background: #fff; border: 1px solid var(--rule, #ddd); border-radius: 4px; }
.fsp-notes:empty { display: none; }
.fsp-note { margin: 0 0 6px; padding: 6px 10px; border-radius: 6px; background: #fff6e0; color: #6b4600; font-size: 0.88rem; }
.fsp-preview { position: sticky; top: 0; }
.fsp-preview h4 { margin: 0 0 6px; }
/* The poster is 18 x 24 in (1728 x 2304 CSS px); shown at a fifth of that. */
.fsp-frame { width: 346px; height: 461px; overflow: hidden; border: 1px solid var(--rule, #ccc); border-radius: 6px; background: #eee; }
.fsp-frame iframe { width: 1728px; height: 2304px; border: 0; transform: scale(0.2); transform-origin: top left; background: #fff; }
.fsp-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 860px) {
  .fsp-grid { grid-template-columns: 1fr; }
  .fsp-preview { position: static; }
}
/* ============================================================================
   56-sell-sheet.css — Sell Sheet module (#149)
   ----------------------------------------------------------------------------
   Two-column workspace: the form on the left, a live PDF-accurate preview
   pinned on the right. Brand tokens only (MODULE-UI-CONTRACT: no hardcoded
   hex outside the artifact itself — the PRINTED sheet's colours live in
   src/services/sell-sheet/template.js, which is a separate document with its
   own print palette and is deliberately not themed by this file).
   ========================================================================= */

.ss-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: 28px;
  align-items: start;
}

.ss-form-col { min-width: 0; }

/* Author display rules (e.g. .btn) must not reveal controls hidden by mode. */
.ss-layout [hidden] { display: none !important; }

/* ── Groups ──────────────────────────────────────────────────────────── */

.ss-group {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.ss-group-title {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  color: var(--ink-strong);
  margin: 0 0 4px;
}

.ss-group-note {
  font-size: 0.82rem;
  color: var(--ink-mute);
  margin: 0 0 14px;
  line-height: 1.45;
}

.ss-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

/* ── Fields ──────────────────────────────────────────────────────────── */

.ss-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ss-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}

.ss-field-hint {
  font-size: 0.72rem;
  color: var(--ink-mute);
}

.ss-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--warm-white);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ss-input:focus {
  outline: none;
  border-color: var(--heritage-gold);
  box-shadow: 0 0 0 3px var(--rule-gold);
}

/* Ghost text must READ as ghost text (#308 adjacent, 2026-08-30).
   .ss-input never carried a ::placeholder rule, so the example values inherited
   near-body-colour and an EMPTY field looked filled. On Eliza's Orange Sauce
   form the French example copy ("Sauce aux huitres...") and the Chinese Mala
   tagline example read as though the previous product's identity had followed
   her to a new sheet. The fields were empty the whole time; only the contrast
   was wrong. Same token every other module's placeholder uses. */
.ss-input::placeholder { color: var(--ink-mute); opacity: 1; }

.ss-input-mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.ss-input.is-valid { border-color: var(--success); }
.ss-input.is-invalid { border-color: var(--danger); }

.ss-upc-status {
  font-size: 0.74rem;
  line-height: 1.35;
}
.ss-upc-status.is-ok { color: var(--success-deep); }
.ss-upc-status.is-bad { color: var(--danger); font-weight: 600; }

/* ── Image slots ─────────────────────────────────────────────────────── */

.ss-image-slot {
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 92px;
  justify-content: center;
}

.ss-image-slot.has-image { border-style: solid; background: var(--warm-white); }

.ss-image-thumb {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.ss-file { font-size: 0.8rem; color: var(--ink-soft); max-width: 100%; }

/* ── Actions ─────────────────────────────────────────────────────────── */

.ss-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.ss-actions-note {
  font-size: 0.8rem;
  color: var(--ink-mute);
}

/* ── Notices ─────────────────────────────────────────────────────────── */

.ss-warning {
  border-left: 3px solid var(--warning);
  background: var(--eggshell-bright);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--ink);
}

.ss-warning.is-error {
  border-left-color: var(--danger);
}

.ss-warning strong { display: block; margin-bottom: 4px; color: var(--ink-strong); }
.ss-warning ul { margin: 6px 0 0; padding-left: 18px; }
.ss-warning li { margin-bottom: 3px; }

/* ── Preview ─────────────────────────────────────────────────────────── */

.ss-preview-col {
  position: sticky;
  top: 16px;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-width: 0;
}

.ss-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ss-lang-toggle {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ss-lang-btn {
  padding: 5px 14px;
  border: 0;
  background: var(--warm-white);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.ss-lang-btn + .ss-lang-btn { border-left: 1px solid var(--rule); }
.ss-lang-btn.is-active { background: var(--heritage-red); color: #fff; }

.ss-preview-body {
  /* US Letter aspect ratio (8.5 x 11) so the preview is proportionally exact. */
  aspect-ratio: 8.5 / 11;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}

/* The preview iframe hosts a FIXED-SIZE document (the template is authored at
   8.5in x 11in). We render it at its true pixel size and scale the whole frame
   down to fit the column, so the preview is geometrically identical to the PDF
   rather than a reflowed approximation.
   `zoom` is used deliberately over `transform: scale()`: transform would leave
   the un-scaled 850x1100 box in layout flow and blow out the grid column,
   requiring a wrapper with negative margins. zoom scales the layout box too and
   is supported in every Chromium/WebKit/Firefox build the PWA targets. */
.ss-preview-frame {
  width: 850px;                 /* 8.5in @ 100dpi — the template's design width */
  height: 1100px;               /* 11in @ 100dpi */
  border: 0;
  display: block;
  zoom: 0.42;
}

.ss-preview-note {
  margin: 10px 0 0;
  font-size: 0.75rem;
}

/* ── Recent ──────────────────────────────────────────────────────────── */

.ss-recent-list { list-style: none; margin: 0; padding: 0; }

.ss-recent-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 0.85rem;
}

.ss-recent-list li:last-child { border-bottom: 0; }
.ss-recent-name { color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-recent-item { color: var(--ink-mute); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
/* ── #309 / #310 Creations library ─────────────────────────────────────── */
/* The list was a flat name log. Each row is now product + item + when + who,
   plus the two actions that make the row useful (Open, Download again), so a
   sheet she can SEE is a sheet she can retrieve and amend. */

.ss-recent-note {
  color: var(--ink-mute);
  font-size: 0.8rem;
  margin: 0 0 10px;
}

/* A library row: identity left, timestamp beside it, actions pinned right.
   Wraps rather than truncating the buttons out of reach. */
.ss-recent-row {
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 0;
}

.ss-recent-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 14rem;
}

.ss-recent-meta {
  display: flex;
  gap: 8px;
  flex: 0 1 auto;
  color: var(--ink-mute);
  font-size: 0.78rem;
  white-space: nowrap;
}

.ss-recent-who {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-recent-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  align-items: center;
}

/* Her own rows sort to the top; this chip is what makes that ordering legible
   instead of mysterious. */
.ss-recent-mine {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--heritage-red);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 1px 7px;
}

/* #335 — a saved-but-never-rendered sheet. Deliberately NOT heritage red: a
   draft is a neutral state, not an alert, and colouring it like the "mine"
   chip would make the two read as the same kind of fact. Muted + filled so it
   is legible at a glance without competing with the product name. */
.ss-recent-draft {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft, #6b6b6b);
  background: var(--paper-tint, #f0efec);
  border: 1px solid var(--rule, #d9d6d0);
  border-radius: 999px;
  padding: 1px 7px;
}

/* A faint tint so the mine-first block reads as one group at a glance. */
/* Derived from the brand token rather than a literal, per the no-hardcoded-hex
   note at the top of this file. */
.ss-recent-row.is-mine { background: color-mix(in srgb, var(--heritage-red) 4%, transparent); }

/* Pre-#308 rows: listed for the audit trail, but with no saved form to reopen.
   The row says why, instead of offering a button that cannot work. */
.ss-recent-locked {
  color: var(--ink-mute);
  font-size: 0.75rem;
  max-width: 22rem;
  text-align: right;
}

@media (max-width: 640px) {
  .ss-recent-row { gap: 6px; }
  .ss-recent-actions { width: 100%; }
  .ss-recent-locked { text-align: left; max-width: none; }
}


.ss-muted { color: var(--ink-mute); font-size: 0.85rem; margin: 0; }

/* ── #182 Creative Studio dish slot ──────────────────────────────────── */
/* The "or create one" affordance under the dish file input, and the
   Replace/Remove pair once a shot is in the slot. */

.ss-image-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.ss-image-or {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.ss-image-or-text {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
}

.ss-image-or .ss-field-hint { text-align: center; }

/* ── #183 Download choice ────────────────────────────────────────────── */
/* "can we have a sell sheet with option of Chinese, English or bi-lingual?"
   Rendered as a radiogroup directly above Generate so the choice is made
   BEFORE the expensive action, not discovered after it. */

.ss-download-choice {
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 14px 20px 16px;
  margin: 0 0 18px;
}

.ss-download-choice > .ss-field-label {
  padding: 0;
  margin-bottom: 10px;
}

.ss-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ss-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  /* 44px touch target on mobile without inflating the desktop chip. */
  min-height: 38px;
}

.ss-choice:hover { border-color: var(--heritage-red); }

.ss-choice.is-active {
  border-color: var(--heritage-red);
  background: var(--warm-white);
  color: var(--ink-strong);
  font-weight: 600;
}

/* The native radio stays in the DOM (keyboard + a11y + form semantics) and
   is visible — hiding it would strip the arrow-key affordance that makes a
   radiogroup a radiogroup. */
.ss-choice input[type="radio"] { margin: 0; flex: 0 0 auto; }

.ss-choice-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--ink-mute);
  line-height: 1.45;
}

/* ── French / Quebec note (Sharon, 2026-08-14) ──────────────────────────
   Shown ONLY while a French artifact is selected, and it carries a fact the
   operator has to act on rather than decoration:
     sell sheet — blank FR fields print the ENGLISH wording, not a translation
     poster     — EN+FR is TWO files, never two languages on one red field
   The gold rule marks it as a conditional advisory distinct from the always-on
   note directly above it; without the rule the two notes read as one paragraph. */
.ss-choice-note-fr {
  margin-top: 6px;
  padding-left: 9px;
  border-left: 2px solid var(--heritage-gold, #d4a843);
  color: var(--ink-strong);
}

/* ── #183 Post-create download panel ─────────────────────────────────── */
/* "once the sell sheet is created, here to download?" — the artifact list
   persists until the next submit so a silent browser save is still findable. */

.ss-artifacts {
  background: var(--warm-white);
  border: 1px solid var(--heritage-red);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.ss-artifact-list { list-style: none; margin: 0; padding: 0; }

.ss-artifact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-soft);
}

.ss-artifact:last-child { border-bottom: 0; }

.ss-artifact-lang {
  flex: 0 0 auto;
  min-width: 72px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--heritage-red);
}

.ss-artifact-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  color: var(--ink);
}

.ss-artifact-size {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.ss-artifact .btn { flex: 0 0 auto; }

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  .ss-layout { grid-template-columns: minmax(0, 1fr); }
  .ss-preview-col { position: static; order: -1; }
  .ss-preview-frame { zoom: 0.55; }
}

@media (max-width: 640px) {
  .ss-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .ss-group { padding: 14px; }
  .ss-preview-frame { zoom: 0.34; }
  .ss-actions { flex-direction: column; align-items: stretch; }
  .ss-actions .btn { width: 100%; }

  /* Choice chips go full-width so each is a comfortable tap target. */
  .ss-download-choice { padding: 14px; }
  .ss-choice-row { flex-direction: column; }
  .ss-choice { width: 100%; min-height: 44px; }

  /* The artifact row reflows to two lines: name over meta+button. */
  .ss-artifacts { padding: 14px; }
  .ss-artifact {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .ss-artifact-name { flex: 1 1 100%; order: -1; white-space: normal; word-break: break-all; }
  .ss-artifact .btn { margin-left: auto; min-height: 44px; }

  .ss-image-actions .btn { min-height: 44px; }
}

/* Reduced motion: the only transitions here are colour/shadow on focus,
   which are already sub-200ms and non-vestibular. Nothing to disable, but
   respect the preference explicitly rather than leaving it implicit. */
@media (prefers-reduced-motion: reduce) {
  .ss-input, .ss-lang-btn, .ss-choice { transition: none; }
}

/* ═══ #237 — PROMOTION POSTER MODE ══════════════════════════════════════════
   Eliza: "in addition to sell sheet , can we do a poster for a promotion?"

   The poster shares this page's furniture (form column, preview column,
   download panel) and adds three things of its own: the artifact mode switch,
   the offer cards, and the "still needed" preview placeholder. Brand tokens
   only — no raw hex — so the poster form inherits every theme and dark-mode
   rule the rest of the module already obeys.
   ═════════════════════════════════════════════════════════════════════════ */

/* ── Mode switch: Sell sheet | Poster ─────────────────────────────────────
   A segmented control, not a nav item. #237 is a second ARTIFACT of the same
   module, so it must not read as a second place to go. */
.ss-mode-switch {
  display: inline-flex;
  margin: 0 0 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--warm-white);
}
.ss-mode-btn {
  padding: 9px 22px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ss-mode-btn + .ss-mode-btn { border-left: 1px solid var(--rule); }
.ss-mode-btn.is-active { background: var(--heritage-red); color: #fff; }
.ss-mode-btn:focus-visible {
  outline: 2px solid var(--heritage-gold);
  outline-offset: -2px;
}

/* ── Offer card ──────────────────────────────────────────────────────────
   Each offer is a bordered block so "offer 1" and "offer 2" read as two
   distinct deals rather than eight loose inputs — the same separation the
   printed poster's dotted divider gives them. */
.po-offer {
  border-left: 3px solid var(--heritage-gold);
}
.po-offer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.po-offer-head .ss-group-title { margin: 0; }

/* ── #240: a leg is a LIST of SKUs ───────────────────────────────────────
   Eliza's promotions give away more than one product at a time:
     "Buy product A and get product B and C free"
     "buy A and and B and get Product C and D free"
   So each offer has a BUY block and a GET block, and each block holds one or
   more lines. The two blocks are visually separated because mixing "what they
   pay for" and "what they receive" in one flat list of inputs is exactly how an
   operator ends up typing a free SKU into a purchase field. */
.po-leg-block {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border, #e3ded3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}
.po-leg-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--heritage-red, #cc0000);
}
.po-leg-note {
  margin: 3px 0 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted, #6b6459);
}

/* One SKU: its quantity, its name, and its own product shot. The left rule
   ties the three controls together so a two-line leg reads as two products
   rather than four unrelated fields. */
.po-line-row {
  padding: 10px 0 10px 12px;
  border-left: 2px solid var(--heritage-gold, #d4a843);
}
.po-line-row + .po-line-row { margin-top: 2px; }
.po-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.po-line-index {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted, #6b6459);
}

/* The connector that makes it AND, not OR — mirrored from the printed poster
   so the form previews its own semantics. An operator who sees "AND" between
   two gift rows knows the shopper receives both. */
.po-leg-and {
  display: block;
  margin: 2px 0;
  padding-left: 12px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--heritage-red, #cc0000);
}

.po-add-line { margin-top: 8px; }

/* ── Preview placeholder ─────────────────────────────────────────────────
   A poster preview 400s until the required fields exist, which is the NORMAL
   state of an empty form. So it is styled as quiet guidance, never as an
   error — the loud red treatment is reserved for the legal gate, which is the
   one refusal the operator must actually read. */
.ss-preview-pending {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: 22px;
  gap: 8px;
  text-align: left;
}
.ss-preview-pending ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.82rem;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .ss-mode-switch { display: flex; width: 100%; }
  .ss-mode-btn { flex: 1 1 0; min-height: 44px; }
  .po-offer-head { flex-wrap: wrap; }
  /* #240 — reclaim the horizontal padding a phone cannot spare, but keep the
     left rules: they are what distinguishes one SKU from the next. */
  .po-leg-block { padding: 10px; }
  .po-line-row { padding-left: 8px; }
  .po-line-head { flex-wrap: wrap; }
}

/* ── #322.3 — the two image slots are visibly two different jobs ───────────
   Eliza: "pls separate the layout as product shot and dish shot or application
   shots." They were already separate elements; what they lacked was a caption
   saying WHICH photo belongs in which frame. The role line sits above the
   label so the answer is on screen before she opens a file picker, not after
   she sees the PDF. */

.ss-slot-role {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* The product slot is upload only (#321). A solid left rule marks it as the
   slot with a rule attached, so it does not read like the dish slot minus a
   button. */
.ss-slot-packshot .ss-image-slot {
  border-left: 3px solid var(--heritage-red, #cc0000);
}

/* ── #323 — SAP metric to imperial ────────────────────────────────────── */

.ss-units {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 0 0 12px;
  background: var(--paper);
}

.ss-units-legend {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0 4px;
}

.ss-units-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.ss-units-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  background: var(--warm-white);
}

.ss-units-opt.is-on {
  border-color: var(--heritage-red, #cc0000);
  color: var(--heritage-red, #cc0000);
  font-weight: 600;
}

.ss-units-note {
  margin: 8px 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--ink-mute);
}

/* ── #322.4 — you are editing a saved sheet ───────────────────────────────
   Generate behaves differently while this is on screen (it updates instead of
   inserting), so the banner is a persistent state marker rather than a toast.
   A toast would be gone by the time she pressed the button it describes. */

.ss-amend-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--heritage-red, #cc0000);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--warm-white);
}

.ss-amend-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ss-amend-text strong {
  font-size: 0.82rem;
  color: var(--ink-strong);
}

.ss-amend-text span {
  font-size: 0.74rem;
  color: var(--ink-mute);
}

@media (max-width: 720px) {
  .ss-amend-banner { align-items: flex-start; }
  .ss-units-opt { flex: 1 1 auto; justify-content: center; min-height: 40px; }
}

/* #382: use the existing field grid/input styling for section type controls. */
.ss-type-controls { margin-bottom: 12px; }
.ss-type-controls select { width: 100%; min-height: 40px; }

/* #522/#523: monthly promotion sheet form. Reuses the ss-* field/grid styling. */
.pm-deal-card {
  border: 1px solid var(--rule);
  border-left: 4px solid #4f8a46;
  border-radius: var(--radius);
  background: var(--warm-white);
  padding: 10px 12px;
  margin: 0 0 12px;
}
.pm-deal-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.pm-deal-text { flex: 0 0 110px; margin: 0; }
.pm-mm { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; min-height: 40px; }
.pm-deal-head .btn { margin-left: auto; }
.pm-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px dashed var(--rule);
}
.pm-row-photo { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pm-row-thumb { width: 64px; height: 64px; object-fit: contain; background: #fff; border: 1px solid var(--rule); border-radius: 6px; }
.pm-row-upload {
  width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; text-align: center;
  border: 1px dashed var(--rule); border-radius: 6px; font-size: 0.72rem; color: var(--ink-mute); cursor: pointer; background: #fff;
}
.pm-row-fields { min-width: 0; }
.pm-row-fields .ss-field { margin-bottom: 6px; }
.pm-search { position: relative; }
.pm-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: 100%;
  background: #fff; border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); max-height: 320px; overflow: auto;
}
.pm-results .ss-muted { padding: 8px 10px; margin: 0; }
.pm-hit {
  display: flex; gap: 8px; align-items: center; width: 100%; text-align: left;
  padding: 6px 10px; border: 0; border-bottom: 1px solid var(--rule); background: #fff; cursor: pointer; font: inherit;
}
.pm-hit:hover, .pm-hit:focus-visible { background: var(--warm-white); }
.pm-hit img, .pm-hit-nophoto { width: 36px; height: 36px; object-fit: contain; flex: 0 0 36px; border-radius: 4px; background: #f3efe6; }
.pm-hit span { display: flex; flex-direction: column; min-width: 0; }
.pm-hit small { color: var(--ink-mute); font-size: 0.74rem; }
.pm-paste { margin-top: 10px; }
.pm-recent-list { list-style: none; padding: 0; margin: 0; }
.pm-recent-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--rule); }
.pm-recent-list li span:first-child { flex: 1 1 auto; min-width: 0; }
@media (max-width: 720px) {
  .pm-row { grid-template-columns: 64px 1fr; }
  .pm-row-remove { grid-column: 2; justify-self: end; }
  .pm-deal-text { flex: 1 1 100%; }
}

/* Monthly promotion: plan upload, missing list, saved by month. */
.pm-plan { border-left: 4px solid var(--accent, #3f7a3a); }
.pm-plan-upload { display: inline-flex; align-items: center; cursor: pointer; }
.pm-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pm-plan-summary { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 10px; color: var(--ink-mute); font-size: 0.9rem; }
.pm-plan-summary strong { color: var(--ink-strong); font-size: 1.15rem; margin-right: 2px; }
.pm-plan-sheets { list-style: none; padding: 0; margin: 0 0 8px; }
.pm-plan-sheet { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px 10px;
  padding: 8px 6px; border-top: 1px solid var(--rule); }
.pm-plan-sheet.is-showing { background: var(--warm-white); }
.pm-plan-pick { display: flex; align-items: flex-start; gap: 8px; min-width: 0; cursor: pointer; }
.pm-plan-pick span { display: flex; flex-direction: column; min-width: 0; }
.pm-plan-pick small { color: var(--ink-mute); font-size: 0.78rem; }
.pm-plan-note { grid-column: 1 / -1; margin: 0 0 0 26px; font-size: 0.78rem; color: var(--ink-mute); }
.pm-plan-note.is-attention { color: #8a4b00; font-weight: 600; }
.pm-badge { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: #eef3ea; color: #2f5f2c; white-space: nowrap; }
.pm-badge.is-update, .pm-badge.is-draft { background: #fff4d6; color: #7a5600; }
.pm-badge.is-made { background: #e8eef7; color: #1f4a7a; }
.pm-badge.is-edited { background: #e6f4ea; color: #1e6b34; }
.pm-plan-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.pm-plan-limits p { margin: 0; }
.pm-plan-limits p + p { margin-top: 6px; }
.pm-chip { display: inline-block; font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; background: #f3efe6; color: var(--ink-mute); }
.pm-chip.is-warn { background: #fdecea; color: #a3141c; }
.pm-missing, .pm-unparsed { margin-top: 12px; }
.pm-missing > summary, .pm-unparsed > summary { font-weight: 700; cursor: pointer; padding: 4px 0; }
.pm-miss-list { list-style: none; padding: 0; margin: 0; }
.pm-miss { padding: 8px 0; border-top: 1px solid var(--rule); }
.pm-miss-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pm-miss-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.pm-miss-upc { width: 11.5em; }
.pm-miss-alt img { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; margin-right: 4px; }
.pm-miss-where { margin-top: 4px; font-size: 0.76rem; }
.pm-plan-allset { margin: 10px 0 0; color: #2f5f2c; font-weight: 600; }
/* Saved drafts not in this file: folded away, quiet, optional. */
.pm-leftover { margin-top: 12px; }
.pm-leftover > summary { font-weight: 600; cursor: pointer; padding: 4px 0; color: var(--ink-mute); }
.pm-leftover-list { list-style: none; padding: 0; margin: 0; }
.pm-leftover-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-top: 1px solid var(--rule); font-size: 0.85rem; }
.pm-unparsed ul { list-style: none; padding: 0; margin: 0; }
.pm-unparsed li { display: grid; grid-template-columns: 5em 1fr auto; gap: 8px; padding: 4px 0; border-top: 1px solid var(--rule); font-size: 0.85rem; }
.pm-row-no { color: var(--ink-mute); }
.pm-months { max-height: 420px; overflow: auto; }
.pm-month + .pm-month { margin-top: 10px; }
.pm-month-title { margin: 0 0 2px; font-size: 0.95rem; }
.pm-month-region { margin: 4px 0 0; font-size: 0.78rem; font-weight: 700; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .04em; }
.pm-deal-note { margin: 0 0 6px; }
@media (max-width: 640px) {
  .pm-plan-sheet { grid-template-columns: 1fr auto; }
  .pm-plan-sheet .btn { grid-column: 2; }
  .pm-unparsed li { grid-template-columns: 4em 1fr; }
  .pm-unparsed li .ss-muted { grid-column: 2; }
}
.pm-miss-search { display: inline-block; position: relative; }
.pm-miss-search .pm-results { min-width: 18em; z-index: 5; }
.pm-miss-upc { width: 15em; }

/* Monthly promotion plan: Deal Library check (read only, Deal Library readers only). */
.pm-dl-line { color: var(--ink-mute); }
.pm-dl-line-label { font-weight: 700; }
.pm-dl-line.is-attention { color: #8a4b00; }
.pm-dl { margin-top: 12px; }
.pm-dl > summary { font-weight: 700; cursor: pointer; padding: 4px 0; }
.pm-dl-total { margin-left: 8px; font-weight: 600; font-size: 0.85rem; color: #2f5f2c; }
.pm-dl-total.is-attention { color: #8a4b00; }
.pm-dl-sec { border-top: 1px solid var(--rule); padding: 8px 0 4px; }
.pm-dl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.pm-dl-sum { color: var(--ink-mute); font-size: 0.85rem; }
.pm-dl-open { margin-left: auto; font-size: 0.85rem; white-space: nowrap; }
.pm-dl-note, .pm-dl-allin { margin: 4px 0 0; font-size: 0.82rem; color: var(--ink-mute); }
.pm-dl-allin { color: #2f5f2c; font-weight: 600; }
.pm-dl-list { list-style: none; padding: 0; margin: 6px 0 0; }
.pm-dl-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; gap: 2px 10px;
  padding: 6px 0; border-top: 1px dashed var(--rule); font-size: 0.86rem; }
.pm-dl-row:first-child { border-top: 0; }
.pm-dl-icon { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 800; background: #f3efe6; color: var(--ink-mute); margin-top: 1px; }
.pm-dl-row.is-match .pm-dl-icon { background: #e6f4ea; color: #1e6b34; }
.pm-dl-row.is-different .pm-dl-icon { background: #fff1db; color: #8a4b00; }
.pm-dl-row.is-missing .pm-dl-icon { background: #fdecea; color: #a3141c; }
.pm-dl-prod, .pm-dl-state { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.pm-dl-prod strong { overflow-wrap: anywhere; }
.pm-dl-prod small, .pm-dl-state small { color: var(--ink-mute); font-size: 0.76rem; overflow-wrap: anywhere; }
.pm-dl-pill { align-self: flex-start; font-size: 0.78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: #f3efe6; color: var(--ink-mute); overflow-wrap: anywhere; }
.pm-dl-pill.is-match { background: #e6f4ea; color: #1e6b34; }
.pm-dl-pill.is-different { background: #fff1db; color: #8a4b00; }
.pm-dl-pill.is-missing { background: #fdecea; color: #a3141c; }
.pm-dl-ok { margin-top: 4px; }
.pm-dl-ok > summary { cursor: pointer; font-size: 0.82rem; color: #2f5f2c; padding: 2px 0; }
@media (max-width: 640px) {
  .pm-dl-row { grid-template-columns: 22px minmax(0, 1fr); }
  .pm-dl-state { grid-column: 2; }
  .pm-dl-open { margin-left: 0; }
}

/* Pallet Deal flyer (2026-11-23): Product data (Code Master + catalog photos), banner, tag. */
.pm-data > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.pm-data-sum { font-weight: 400; font-size: 0.85rem; }
.pm-data-block { border-top: 1px solid var(--rule); padding: 10px 0 4px; }
.pm-data-title { margin: 0 0 4px; font-size: 0.95rem; }
.pm-data-status { margin: 0 0 6px; }
.pm-data-problems { margin-top: 6px; font-size: 0.82rem; }
.pm-data-problems ul { margin: 4px 0 0; padding-left: 18px; }
.pm-cat-list { list-style: none; padding: 0; margin: 8px 0 0; max-height: 640px; overflow-y: auto; }
.pm-cat-row { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--rule); }
.pm-cat-row.is-done { opacity: 0.6; }
.pm-cat-photo { width: 72px; height: 96px; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--rule); border-radius: 4px; }
.pm-cat-photo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pm-cat-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pm-cat-says { font-size: 0.78rem; }
.pm-cat-notes { display: flex; flex-wrap: wrap; gap: 4px; }
.pm-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.pm-banner .ss-field-hint { flex-basis: 100%; margin: 0; }
.pm-banner-thumb { height: 48px; max-width: 180px; object-fit: cover; border-radius: 4px; border: 1px solid var(--rule); }
.pm-deal-tag { max-width: 11em; }
.pm-cat-target { font-size: 0.8rem; }
/* Design v2 (2026-11-23): per-draft design controls. */
.pm-design > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.pm-style-sizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5em, 1fr)); gap: 6px 12px; margin-top: 6px; }
.pm-style-size .ss-input { max-width: 7em; }
@media (max-width: 640px) {
  .pm-cat-row { grid-template-columns: 56px 1fr; }
  .pm-cat-photo { width: 56px; height: 76px; }
}

/* Monthly promotion: brand library (Tezign) photo source + offer on a product row. */
.pm-tz { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 150px; text-align: center; }
.pm-tz-src { font-size: 0.72rem; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: #f1f1ef; color: var(--ink-mute); }
.pm-tz-src.is-tezign { background: #eef3ea; color: #2f5f2c; }
.pm-tz-src.is-none { background: #fff4d6; color: #7a5600; }
.pm-low-res { margin: 0.2rem 0 0; font-size: 0.72rem; color: #8a4b00; }
.pm-tz-offer { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px dashed var(--rule); border-radius: 6px; padding: 4px; }
.pm-tz-offer .ss-field-hint { font-size: 0.72rem; margin: 0; overflow-wrap: anywhere; }
.pm-tz-thumb { width: 56px; height: 56px; object-fit: contain; background: #fff; border-radius: 4px; }
/* ═══════════════════════════════════════════════════════════════════
   Dispute Desk (Lily W1) — `dsp-` namespace.

   The base module shipped its markup before any stylesheet existed, so this
   file covers BOTH the pre-existing structural classes (tabs, table, buckets,
   drawer) and the F1.19 alert banner added in S1.

   Design intent mirrors the module's ethic:
     - A missing deadline is the LOUDEST thing on screen (`dsp-bucket-alarm`).
     - A breached deadline reads as a statement, not a countdown.
     - A negative amount NEVER loses its sign (`dsp-neg`) — a credit must be
       visually distinguishable from a charge (A1.7 / G6).

   All colors go through existing design tokens so dark mode (90-dark-mode.css)
   and the polish layers inherit correctly.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tabs ────────────────────────────────────────────────────────── */
.dsp-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.dsp-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted, #6b7280);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.dsp-tab:hover { color: var(--text, #111827); }

.dsp-tab[aria-selected="true"] {
  color: var(--brand-red, #cc0000);
  border-bottom-color: var(--brand-red, #cc0000);
}

/* The queue tab's open-alert count. Decoration only — the accessible name
   lives in aria-label, because a bare number tells a screen reader nothing. */
.dsp-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--brand-red, #cc0000);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.dsp-tab-badge[hidden] { display: none; }

/* Pane visibility is driven by the `hidden` ATTRIBUTE, which is what
   wireTabs() in public/js/ui/dispute-desk.js actually toggles. Do NOT
   reintroduce an unconditional `.dsp-pane { display: none }` keyed on an
   `.is-active` class: the JS only puts `is-active` on the tab BUTTONS, so
   such a rule hides all three panes forever (the 2026-08-02 blank-tabs bug).
   This also matches the house pattern used by deductions / market-monitor /
   redemption. `!important` beats the UA sheet when a pane is display:flex. */
.dsp-pane { display: block; }
.dsp-pane[hidden] { display: none !important; }

/* ── Alerts (F1.19) ──────────────────────────────────────────────── */
/* Sits ABOVE the filters on purpose: a deadline reminder must not be
   something you scroll or filter to find. */
.dsp-alerts { margin-bottom: 1rem; }
.dsp-alerts[hidden] { display: none; }

.dsp-alert-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--warn-border, #fcd34d);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--warn-bg, #fffbeb);
}

.dsp-alert-icon { font-size: 1.1rem; line-height: 1; }

.dsp-alert-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.dsp-alert-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Severity tiers. `breach` is the only one that reads as failure rather than
   warning — the window is already closed, which is a different fact. */
.dsp-alert-breach {
  border-color: var(--danger-border, #fca5a5);
  background: var(--danger-bg, #fef2f2);
}

.dsp-alert-t1,
.dsp-alert-t3 {
  border-color: var(--warn-border, #fcd34d);
  background: var(--warn-bg, #fffbeb);
}

.dsp-alert-t7,
.dsp-alert-t14 {
  border-color: var(--info-border, #bfdbfe);
  background: var(--info-bg, #eff6ff);
}

.dsp-alert-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dsp-alert-group {
  border: 1px solid var(--border, #e5e7eb);
  border-left-width: 3px;
  border-radius: 6px;
  overflow: hidden;
}

.dsp-alert-group-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2, #f9fafb);
  font-size: 0.85rem;
}

.dsp-alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border, #e5e7eb);
}

.dsp-alert-row-main { min-width: 0; flex: 1; }

.dsp-alert-open {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link, #1d4ed8);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.dsp-alert-open:hover { text-decoration: underline; }

/* ── Filters ─────────────────────────────────────────────────────── */
.dsp-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.dsp-f-q { flex: 1 1 16rem; min-width: 0; }

/* ── Buckets ─────────────────────────────────────────────────────── */
.dsp-bucket { margin-bottom: 1.25rem; }

.dsp-bucket-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.dsp-bucket-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--surface-3, #e5e7eb);
  font-size: 0.75rem;
  font-weight: 700;
}

/* THE pinned bucket: a case with no known dispute window. Absence of a clock
   is the alarm, so this group is deliberately the loudest thing in the queue. */
.dsp-bucket-alarm {
  padding: 0.75rem;
  border: 1px solid var(--danger-border, #fca5a5);
  border-left: 4px solid var(--brand-red, #cc0000);
  border-radius: 8px;
  background: var(--danger-bg, #fef2f2);
}

.dsp-bucket-alarm .dsp-bucket-count {
  background: var(--brand-red, #cc0000);
  color: #fff;
}

.dsp-bucket-icon { font-size: 1rem; }

.dsp-bucket-note {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted, #6b7280);
}

/* ── Table ───────────────────────────────────────────────────────── */
.dsp-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface, #fff);
}

.dsp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.dsp-table th,
.dsp-table td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--border, #e5e7eb);
  vertical-align: top;
}

.dsp-table th {
  background: var(--surface-2, #f9fafb);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
}

.dsp-table tbody tr:last-child td { border-bottom: 0; }
.dsp-table tbody tr:hover { background: var(--surface-2, #f9fafb); }

.dsp-num { text-align: right; font-variant-numeric: tabular-nums; }

/* A negative amount is a CREDIT. It must never read as a charge — this is the
   visual half of the no-ABS() rule enforced by guard G6. */
.dsp-neg { color: var(--brand-red, #cc0000); font-weight: 600; }

.dsp-cust { font-weight: 600; }
.dsp-sub-sm { font-size: 0.78rem; color: var(--text-muted, #6b7280); }
.dsp-reason { max-width: 18rem; }
.dsp-h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.dsp-sub { margin: 0 0 1rem; font-size: 0.85rem; color: var(--text-muted, #6b7280); }

/* ── Badges + chips ──────────────────────────────────────────────── */
.dsp-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.dsp-badge-ok   { background: var(--ok-bg, #dcfce7);     color: var(--ok-text, #166534); }
.dsp-badge-fail { background: var(--danger-bg, #fee2e2); color: var(--danger-text, #991b1b); }
.dsp-badge-wait { background: var(--surface-3, #e5e7eb); color: var(--text-muted, #374151); }
.dsp-badge-info { background: var(--info-bg, #dbeafe);   color: var(--info-text, #1e40af); }

.dsp-chip {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.dsp-chip-warn { background: var(--warn-bg, #fef3c7); color: var(--warn-text, #92400e); }
.dsp-chip-info { background: var(--info-bg, #dbeafe);  color: var(--info-text, #1e40af); }
.dsp-chip-muted { background: var(--surface-3, #e5e7eb); color: var(--text-muted, #4b5563); }

/* `remit_by` is a PAYMENT term, not a dispute window. The italic disclaimer
   riding along is the whole point — that confusion is the bug this module
   exists to prevent (guard G4). */
.dsp-remit em {
  font-style: italic;
  opacity: 0.85;
}

/* ── Calendar ────────────────────────────────────────────────────── */
.dsp-cal-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.dsp-cal-month { font-weight: 700; }

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .dsp-alert-banner {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .dsp-alert-actions { width: 100%; }

  .dsp-alert-row {
    flex-direction: column;
    align-items: stretch;
  }

  .dsp-reason { max-width: none; }
}
/* ═══════════════════════════════════════════════════════════════════
   Zone Pulse — `hc-` namespace (legacy file name; UI is Zone Pulse).

   Design intent mirrors the module's ethic:
     - The ZONE is the primary axis. Zone chips read as a segmented control at
       the top of the page, not as a filter buried in a toolbar.
     - "No data" looks DIFFERENT from "zero" (`hc-tile-nodata` dims the tile and
       the value renders as an em dash). Leadership acts on that difference.
     - A missing/incomplete dataset gets a visible strip (`hc-coverage-warn`),
       never silence.
     - Numbers are tabular-aligned so a column of dollars can be scanned.

   Visual polish 2026-08-05:
     sticky control bar, 3×2 pulse grid on desktop, exception priority
     hierarchy, denser tables, brief as a readable leadership card.

   All colours go through existing design tokens so dark mode
   (90-dark-mode.css) and the polish layers inherit correctly.
   ═══════════════════════════════════════════════════════════════════ */

/* Visual-audit F1 (2026-08-05): bridge module-local aliases to house tokens.
   Without this, --surface/--border/--text-muted etc. fall back to cool greys
   on a warm-eggshell platform. Scoped so nothing outside Zone Pulse changes. */
.hc-page,
.hc-controls {
  --bg: var(--paper, #FBF6EC);
  --surface: var(--warm-white, #FFFDF8);
  --surface-alt: var(--eggshell-bright, #FFF5E6);
  --border: var(--rule, #E5D9C4);
  --text: var(--ink, #2C2520);
  --text-muted: var(--ink-mute, #6B6560);
  --brand: var(--heritage-red, #CC0000);
  --warning-bg: var(--eggshell-shade, #F0E0C8);
}

.hc-page {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  padding-bottom: 2rem;
}

/* ── Controls: zone chips + period/window ───────────────────────── */

.hc-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  position: sticky;
  /* F3: pin below app topbar (same pattern as .mm-tabs) */
  top: calc(var(--header-h, 72px) + env(safe-area-inset-top, 0px) + 6px);
  z-index: 4;
  margin: 0 -0.15rem;
  padding: 0.65rem 0.15rem 0.75rem;
  background: color-mix(in srgb, var(--bg, #f8f7f4) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
}

.hc-controls.hc-controls-scrolled {
  border-bottom-color: var(--border, #e5e7eb);
}

.hc-zone-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.15rem;
  border-radius: 999px;
  background: var(--surface-alt, #f3f4f6);
  border: 1px solid var(--border, #e5e7eb);
}

.hc-zone-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted, #6b7280);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.hc-zone-chip:hover {
  color: var(--text, #111827);
  background: color-mix(in srgb, var(--surface, #fff) 80%, transparent);
}

.hc-zone-chip-on {
  background: var(--brand, #cc0000);
  border-color: var(--brand, #cc0000);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.hc-zone-chip:focus-visible {
  outline: 2px solid var(--brand, #cc0000);
  outline-offset: 2px;
}

.hc-chip-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.8;
}

/* ── #266 dive-down: channel (LMS) chips ──────────────────────────────────
 *
 * DELIBERATELY SUBORDINATE TO THE ZONE ROW. A zone is a territory; a channel
 * is a slice inside it. If both rows looked identical the user would read them
 * as siblings and think "US ASIAN" was a fifth zone — the exact
 * misunderstanding the zone-map lock exists to prevent. So this row is
 * squarer (8px vs 999px), lighter-weight, smaller, unfilled, and carries a
 * leading text label. The hierarchy is visible before anything is clicked.
 */
.hc-lms-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.4rem;
  padding-left: 0.15rem;
}

.hc-lms-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #6b7280);
  margin-right: 0.15rem;
}

.hc-lms-chip {
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text-muted, #6b7280);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hc-lms-chip:hover {
  color: var(--text, #111827);
  border-color: var(--text-muted, #6b7280);
}

/* Selected state uses a TINT, not the solid brand fill the zone chips use:
 * same signal, lower rank. */
.hc-lms-chip-on {
  background: color-mix(in srgb, var(--brand, #cc0000) 12%, var(--surface, #fff));
  border-color: var(--brand, #cc0000);
  color: var(--brand, #cc0000);
  font-weight: 700;
}

.hc-lms-chip:focus-visible {
  outline: 2px solid var(--brand, #cc0000);
  outline-offset: 2px;
}

/* The scope banner above the tiles. Quiet but unmissable — it exists so a
 * screenshot of a filtered number cannot be mistaken for a zone total. */
.hc-lms-scope {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
  padding: 0.28rem 0.6rem;
  border-left: 3px solid var(--brand, #cc0000);
  border-radius: 0 6px 6px 0;
  background: color-mix(in srgb, var(--brand, #cc0000) 7%, var(--surface, #fff));
  color: var(--text, #111827);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ── #272 key market segment row · #273 category row ───────────────────────
 *
 * SAME SUBORDINATE RANK AS THE CHANNEL ROW, DELIBERATELY.
 * Zone (pill, filled) > channel / segment / category (square, tinted). Segments
 * are groups of sibling CHANNELS, so they must never out-rank the zone row or
 * a reader would infer a hierarchy that does not exist in the data. They sit at
 * the same visual rank as the channel row because they are the same KIND of
 * thing: a narrowing inside an already-chosen zone.
 *
 * The segment chips are visually distinguished from channel chips by a dotted
 * underline affordance on the multi-select group, because they behave
 * differently (toggle/accumulate vs replace) and a control that behaves
 * differently should not look identical.
 */
.hc-seg-chips,
.hc-cat-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.35rem;
  padding-left: 0.15rem;
}

.hc-seg-label,
.hc-cat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #6b7280);
  margin-right: 0.15rem;
}

.hc-seg-chip,
.hc-cat-chip {
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text-muted, #6b7280);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hc-seg-chip:hover:not(:disabled),
.hc-cat-chip:hover {
  color: var(--text, #111827);
  border-color: var(--text-muted, #6b7280);
}

.hc-seg-chip-on,
.hc-cat-chip-on {
  background: color-mix(in srgb, var(--brand, #cc0000) 12%, var(--surface, #fff));
  border-color: var(--brand, #cc0000);
  color: var(--brand, #cc0000);
  font-weight: 700;
}

/* A segment with no channels in this zone. Shown but DISABLED rather than
 * hidden: "Foodservice does not exist in Canada" is information, and silently
 * removing the chip would read as a rendering bug to someone who saw it in the
 * US view a moment ago. */
.hc-seg-chip:disabled,
.hc-seg-chip-off {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: line-through;
}

.hc-seg-chip:focus-visible,
.hc-cat-chip:focus-visible {
  outline: 2px solid var(--brand, #cc0000);
  outline-offset: 2px;
}

/* ── The explained empty (#272) ────────────────────────────────────────────
 *
 * Amber, not red: this is not an error. The combination is legitimately empty
 * and the panel exists to SAY SO, so it must read as an explanation rather than
 * a failure. Red would train users to treat a correct answer as a bug. */
.hc-seg-conflict {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-left: 3px solid var(--warn, #b45309);
  border-radius: 0 6px 6px 0;
  background: color-mix(in srgb, var(--warn, #b45309) 8%, var(--surface, #fff));
  color: var(--text, #111827);
}

.hc-seg-conflict strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.hc-seg-conflict p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted, #4b5563);
}

/* The escape hatch: which segments DO carry rows in this view. Sits between the
 * explanation and the actions so the user reads "here is what exists" before
 * "here is how to get there". */
.hc-seg-conflict-avail {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text, #111827);
}

.hc-seg-conflict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* THE RECONCILIATION FOOTNOTE (#272).
 *
 * Retail + Food Services + Industrial do not always tile the channel total:
 * rows lacking a category or a key segment never reach channel-key-cat-gp. This
 * note names that residual so three chips that visibly fail to add up read as a
 * disclosed fact rather than a broken sum.
 *
 * Deliberately NEUTRAL (not warn-coloured): the number is correct, the gap is
 * expected, and colouring it as a problem would train heads to escalate an
 * accurate figure — the same reasoning as .hc-seg-conflict above. */
.hc-seg-recon {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.7rem;
  border-left: 3px solid var(--border, #d1d5db);
  border-radius: 0 6px 6px 0;
  background: var(--surface-alt, #f9fafb);
  color: var(--text-muted, #4b5563);
  font-size: 0.78rem;
  line-height: 1.45;
}

.hc-btn-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand, #cc0000);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

.hc-btn-link:focus-visible {
  outline: 2px solid var(--brand, #cc0000);
  outline-offset: 2px;
}

/* ── #273 product family movers ────────────────────────────────────────────*/
.hc-fam {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--surface, #fff);
}

.hc-fam-title {
  margin: 0 0 0.3rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text, #111827);
}

/* The grain disclaimer. Deliberately NOT muted into invisibility — it is the
 * sentence that stops a family list being misread as a category breakdown. */
.hc-fam-grain {
  margin: 0 0 0.4rem;
  padding: 0.35rem 0.5rem;
  border-left: 2px solid var(--text-muted, #9ca3af);
  background: color-mix(in srgb, var(--text-muted, #6b7280) 6%, var(--surface, #fff));
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-muted, #4b5563);
}

.hc-fam-headline {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text, #111827);
}

@media (max-width: 640px) {
  /* Horizontal scroll rather than wrap: a zone with many channels must not
   * push the numbers below the fold on a phone. */
  .hc-lms-chips,
  .hc-seg-chips,
  .hc-cat-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .hc-lms-chips::-webkit-scrollbar,
  .hc-seg-chips::-webkit-scrollbar,
  .hc-cat-chips::-webkit-scrollbar { display: none; }

  .hc-lms-chip,
  .hc-seg-chip,
  .hc-cat-chip { flex: 0 0 auto; }
}

.hc-control-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.hc-field {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 7.5rem;
}

.hc-field-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #6b7280);
}

.hc-select {
  padding: 0.42rem 0.65rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text, #111827);
  font-size: 0.88rem;
  min-height: 36px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.hc-select:focus-visible {
  outline: 2px solid var(--brand, #cc0000);
  outline-offset: 1px;
}

/* ── Coverage warning strip ─────────────────────────────────────── */

.hc-coverage-warn {
  display: flex;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--warning, #d97706);
  border-radius: 8px;
  background: var(--warning-bg, #fffbeb);
  color: var(--text, #111827);
}

.hc-coverage-warn p {
  margin: 0.2rem 0 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

.hc-coverage-icon { flex: 0 0 auto; line-height: 1.3; }

.hc-coverage-figure {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hc-coverage-lms {
  font-size: 0.8rem !important;
  color: var(--text-muted, #6b7280);
  margin-top: 0.25rem !important;
}

/* ── Sections ───────────────────────────────────────────────────── */

.hc-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hc-section-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
}

/* ── Pulse tiles ────────────────────────────────────────────────── */

.hc-tiles {
  display: grid;
  /* Prefer a stable 3×2 leadership board on desktop; collapse gracefully. */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.hc-tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: var(--surface, #fff);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  min-height: 7.25rem;
}

.hc-tile-nodata {
  border-style: dashed;
  opacity: 0.7;
  box-shadow: none;
}

.hc-tile-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #6b7280);
}

.hc-tile-value {
  display: flex;
  align-items: baseline;
  gap: 0.28rem;
  margin-top: auto;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text, #111827);
}

.hc-tile-unit {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
}

.hc-tile-deltas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.hc-delta {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  font-weight: 600;
}

.hc-delta-key {
  font-weight: 600;
  color: var(--text-muted, #6b7280);
}

.hc-delta-pct { opacity: 0.88; }

.hc-delta-up    { color: var(--success, #047857); }
.hc-delta-down  { color: var(--danger,  #c81e1e); }
.hc-delta-flat,
.hc-delta-neutral { color: var(--text-muted, #6b7280); }

/* ── Honest-coverage notes + provenance ─────────────────────────── */

.hc-thin-notes {
  margin: 0;
  padding: 0.65rem 0.85rem 0.65rem 1.25rem;
  border-radius: 8px;
  background: var(--surface-alt, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
  color: var(--text-muted, #6b7280);
}

.hc-provenance {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted, #6b7280);
  line-height: 1.45;
}

/* ── Exceptions ─────────────────────────────────────────────────── */

.hc-exc-context {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted, #6b7280);
}

.hc-exc-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hc-exc-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Priority: problems first, wins de-emphasized */
.hc-exc-block[data-priority="primary"] .hc-exc-title {
  color: var(--text, #111827);
}

.hc-exc-block[data-priority="secondary"] .hc-table-wrap {
  border-style: dashed;
}

.hc-exc-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text, #111827);
}

.hc-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--surface-alt, #f3f4f6);
  color: var(--text-muted, #6b7280);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hc-exc-block[data-tone="down"] .hc-count {
  background: color-mix(in srgb, var(--danger, #c81e1e) 12%, var(--surface, #fff));
  color: var(--danger, #c81e1e);
}

.hc-exc-block[data-tone="up"] .hc-count {
  background: color-mix(in srgb, var(--success, #047857) 12%, var(--surface, #fff));
  color: var(--success, #047857);
}

.hc-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--surface, #fff);
  -webkit-overflow-scrolling: touch;
}

.hc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.hc-table th,
.hc-table td {
  padding: 0.48rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border, #e5e7eb);
  white-space: nowrap;
}

.hc-table thead th {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: var(--text-muted, #6b7280);
  background: var(--surface-alt, #f9fafb);
  position: sticky;
  top: 0;
  z-index: 1;
}

.hc-table tbody tr:last-child th,
.hc-table tbody tr:last-child td { border-bottom: 0; }

.hc-table tbody tr:hover { background: color-mix(in srgb, var(--surface-alt, #f9fafb) 80%, transparent); }

.hc-rowname {
  font-weight: 600;
  color: var(--text, #111827);
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hc-num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.hc-muted {
  color: var(--text-muted, #6b7280);
  font-size: 0.8rem;
}

.hc-threshold-note {
  margin: 0.15rem 0 0;
  font-size: 0.76rem;
  color: var(--text-muted, #6b7280);
}

/* ── Brief ──────────────────────────────────────────────────────── */

.hc-brief-card {
  padding: 1.15rem 1.25rem 1rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand, #cc0000) 4%, var(--surface, #fff)) 0%, var(--surface, #fff) 4.5rem);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.hc-brief-body p {
  margin: 0 0 0.55rem;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--text, #111827);
}

.hc-brief-body p:first-child {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.hc-brief-body p:last-of-type {
  color: var(--text-muted, #6b7280);
  font-size: 0.8rem;
  margin-bottom: 0;
}

.hc-brief-list {
  margin: 0.15rem 0 0.75rem;
  padding: 0.55rem 0.75rem 0.55rem 1.2rem;
  border-radius: 8px;
  background: var(--surface-alt, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hc-brief-list li {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text, #111827);
}

.hc-brief-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border, #e5e7eb);
}

.hc-btn {
  padding: 0.42rem 0.85rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text, #111827);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}

.hc-btn:hover {
  border-color: var(--brand, #cc0000);
  color: var(--brand, #cc0000);
}

.hc-btn:focus-visible {
  outline: 2px solid var(--brand, #cc0000);
  outline-offset: 2px;
}

.hc-copy-status {
  font-size: 0.8rem;
  color: var(--text-muted, #6b7280);
}

.hc-btn-primary {
  background: var(--brand, #cc0000);
  border-color: var(--brand, #cc0000);
  color: #fff;
}

.hc-btn-primary:hover {
  filter: brightness(1.06);
  color: #fff;
  border-color: var(--brand, #cc0000);
}

.hc-btn[disabled],
.hc-btn[disabled]:hover {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

/* Ask strip.
   Sits after the brief so pulse/exceptions stay first-scannable. Reads as the
   same leadership card as the brief (the two are the "in words" half of the
   page) rather than as a chat widget bolted onto a dashboard. */

.hc-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hc-ask-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: var(--surface, #fff);
  padding: 1rem 1.15rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.hc-ask-grounded {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted, #6b7280);
}

/* Context chips are READ-ONLY. They restate the zone/period/window the answer
   will be scoped to, so a head never has to wonder which zone they just asked
   about. Deliberately not interactive — the controls at the top own that. */
.hc-ask-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.hc-ask-context-label {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
  font-weight: 700;
}

.hc-ask-context-chip {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-alt, #f3f4f6);
  border: 1px solid var(--border, #e5e7eb);
  color: var(--text, #111827);
}

.hc-ask-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hc-ask-chip {
  font-size: 0.79rem;
  padding: 0.34rem 0.68rem;
  border-radius: 999px;
  border: 1px dashed var(--border, #e5e7eb);
  background: transparent;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.hc-ask-chip:hover {
  border-style: solid;
  border-color: var(--brand, #cc0000);
  color: var(--brand, #cc0000);
}

.hc-ask-chip:focus-visible {
  outline: 2px solid var(--brand, #cc0000);
  outline-offset: 2px;
}

.hc-ask-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hc-ask-input {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 4.5rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 9px;
  background: var(--bg, #fff);
  color: var(--text, #111827);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
}

.hc-ask-input:focus-visible {
  outline: 2px solid var(--brand, #cc0000);
  outline-offset: 1px;
  border-color: var(--brand, #cc0000);
}

.hc-ask-input[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.hc-ask-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hc-ask-hint {
  font-size: 0.76rem;
  color: var(--text-muted, #6b7280);
}

.hc-ask-output {
  margin-top: 0.15rem;
}

.hc-ask-empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted, #6b7280);
}

.hc-ask-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.hc-ask-item {
  border-top: 1px solid var(--border, #e5e7eb);
  padding-top: 0.75rem;
}

.hc-ask-item-pending { opacity: 0.75; }

.hc-ask-q {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text, #111827);
  line-height: 1.4;
}

.hc-ask-ctx {
  font-size: 0.72rem;
  color: var(--text-muted, #6b7280);
  margin-top: 0.1rem;
}

.hc-ask-a {
  margin-top: 0.45rem;
  font-size: 0.87rem;
  line-height: 1.62;
  color: var(--text, #111827);
}

.hc-ask-a p { margin: 0 0 0.5rem; }
.hc-ask-a p:last-child { margin-bottom: 0; }
.hc-ask-a ul {
  margin: 0.3rem 0 0.5rem;
  padding-left: 1.1rem;
}
.hc-ask-a li { margin-bottom: 0.28rem; }

.hc-ask-pending-text {
  color: var(--text-muted, #6b7280);
  font-style: italic;
}

/* The honesty label. When the assistant is unavailable the answer is still a
   real answer (brief + top movements), and it says so rather than pretending. */
.hc-ask-flag {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--warning-bg, rgba(217, 119, 6, 0.12));
  color: var(--text-muted, #6b7280);
}

.hc-ask-flag-pending { background: var(--surface-alt, #f3f4f6); }

/* ── Currency segmented control (USD | HKD) ─────────────────────── */

/* Deliberately rhymes with .hc-zone-chips at a smaller scale. The grammar:
   chips = WHAT I'm looking at, segments = HOW I'm looking at it. */

.hc-cur-seg {
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.15rem;
  border-radius: 8px;
  background: var(--surface-alt, #f3f4f6);
  border: 1px solid var(--border, #e5e7eb);
}

.hc-cur-opt {
  padding: 0.34rem 0.7rem;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted, #6b7280);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hc-cur-opt:hover {
  color: var(--text, #111827);
  background: color-mix(in srgb, var(--surface, #fff) 80%, transparent);
}

.hc-cur-opt-on {
  background: var(--brand, #cc0000);
  border-color: var(--brand, #cc0000);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.hc-cur-opt:focus-visible {
  outline: 2px solid var(--brand, #cc0000);
  outline-offset: 2px;
}

/* ── Rate disclosure chip ───────────────────────────────────────── */

/* The honesty artifact. Renders ONLY when a conversion is in effect, and is not
   dismissible: a converted number without its rate is unfalsifiable. Muted, but
   always present. */

.hc-rate-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  margin: -0.35rem 0 0;
  padding: 0.4rem 0.65rem;
  border: 1px dashed var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface-alt, #f9fafb);
  color: var(--text-muted, #6b7280);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: help;
}

.hc-rate-chip-icon {
  color: var(--brand, #cc0000);
  font-weight: 700;
}

.hc-rate-chip-note {
  font-weight: 500;
  font-style: italic;
  opacity: 0.85;
}

/* ── Budget-attainment bullet bar (P0 viz) ──────────────────────── */

/* A ratio of actual to budget, so it is FX-invariant: identical shape in USD
   and HKD. Renders only when a budget exists — an empty track would read as
   "0% of budget", which is missing data disguised as a number. */

.hc-bullet {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin: 0.15rem 0 0.35rem;
}

.hc-bullet-track {
  position: relative;
  display: flex;
  align-items: stretch;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-alt, #eef0f3);
  border: 1px solid var(--border, #e5e7eb);
  overflow: hidden;
}

.hc-bullet-fill {
  height: 100%;
  border-radius: 999px 0 0 999px;
  transition: width 0.25s ease;
}

.hc-bullet-up   { background: var(--success, #047857); }
.hc-bullet-down { background: var(--danger,  #c81e1e); }

/* Overshoot past 100%: a distinct capped mark rather than a longer bar, so the
   fill length stays comparable across tiles. */
.hc-bullet-over {
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    var(--success, #047857) 0 3px,
    color-mix(in srgb, var(--success, #047857) 55%, transparent) 3px 6px
  );
}

/* The 100% reference. Over/under becomes a CROSSING, not a length comparison. */
.hc-bullet-tick {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: calc(100% - 1.5px);
  width: 1.5px;
  background: var(--text-muted, #6b7280);
  opacity: 0.75;
}

.hc-bullet-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  font-variant-numeric: tabular-nums;
}

/* ── Period trend micro-chart (P2 viz) — monthly bars ─────────────── */

/* Replaced the original dual CY/LY polylines. Two squashed lines ~1px apart in
   a 62x22 box read as noise; discrete monthly bars with a last-year reference
   tick read as a comparison. No axes, no gridlines, no tooltip.

   GAP HONESTY IS STRUCTURAL HERE: a month with no data gets no <rect> at all.
   Bars never connect to each other, so unlike a line there is nothing that
   could be drawn across a hole. Missing months render as visible empty space,
   which is what missing data should look like. */

.hc-tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

/* Chart + end label travel together so the label can never wrap away from the
   picture it explains. */
.hc-spark-wrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  margin-top: 0.15rem;
}

.hc-spark {
  display: block;
  width: 64px;
  height: 24px;
  overflow: visible;
}

/* Current year. The most recent month is full-strength; earlier months step
   back, so "where are we now" is unambiguous without a separate marker. */
.hc-spark-bar {
  fill: var(--brand, #cc0000);
  opacity: 0.42;
}

.hc-spark-bar-last {
  opacity: 1;
}

/* A credit month hangs BELOW the zero line. Its length already states the
   magnitude; the colour states the direction, so the reader never has to infer
   sign from position alone. */
.hc-spark-bar-neg {
  fill: var(--danger, #b91c1c);
}

/* Last year, as a flat reference mark on the SAME slot as its bar. Bar top
   above the tick = grew. This is the bullet bar's grammar (a crossing, not a
   two-curve comparison) reused, so the tile teaches one idiom, not two. */
.hc-spark-lytick {
  stroke: var(--text-muted, #6b7280);
  stroke-width: 1.25;
  stroke-linecap: butt;
  opacity: 0.75;
  vector-effect: non-scaling-stroke;
}

/* The headline in words — a reader should not have to decode the picture to
   get the answer; the picture is there to give the answer context. */
.hc-spark-end {
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── YoY contribution waterfall (P1 viz) ────────────────────────── */

/* Bars are built from `exceptions.contribution`, which is unfiltered and
   untruncated with an explicit `other` bucket, so they sum EXACTLY to the zone
   delta. Never rebuild this from the TOP_N decliner arrays — those are
   materiality-filtered and the chart would visibly fail to add up. */

.hc-waterfall {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem 0.9rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: var(--surface, #fff);
}

.hc-wf-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.hc-wf-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #6b7280);
}

.hc-wf-total {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.hc-wf-total-key {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #6b7280);
}

.hc-wf-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 0.75rem;
  align-items: stretch;
}

/* HEIGHT IS SET IN PX BY THE JS, NOT DERIVED FROM THE viewBox.

   The original rule was `height: auto`, which — combined with
   preserveAspectRatio="none" — makes the browser take the SVG's intrinsic
   height from the viewBox aspect ratio. The viewBox is `0 0 100 rows*26`, so a
   6-row chart is 100x156 in user units and a 450px-wide grid column rendered it
   ~700px tall: the chart dwarfed the exception tables it exists to introduce.

   renderWaterfall() now emits an explicit `height` attribute plus an inline
   height (rows x 26px, clamped to 180). `max-height` here is the CSS backstop
   so the cap still holds if the inline style is ever stripped (CSP, sanitiser).
   The viewBox and every bar coordinate are unchanged — this is presentation
   only; the sum(bars) + other === delta_total reconciliation is untouched. */
.hc-wf-svg {
  width: 100%;
  max-height: 180px;
  min-height: 52px;
  overflow: visible;
}

.hc-wf-axis {
  stroke: var(--border, #e5e7eb);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.hc-wf-bar-up   { fill: var(--success, #047857); }
.hc-wf-bar-down { fill: var(--danger,  #c81e1e); }
.hc-wf-bar-other { opacity: 0.55; }

.hc-wf-legend {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hc-wf-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.8rem;
  line-height: 1.35;
}

.hc-wf-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text, #111827);
  font-weight: 600;
}

.hc-wf-name[data-other="1"] {
  font-weight: 500;
  font-style: italic;
  color: var(--text-muted, #6b7280);
}

.hc-wf-val {
  flex: 0 0 auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hc-wf-note {
  margin: 0.55rem 0 0;
  font-size: 0.73rem;
  font-style: italic;
  color: var(--text-muted, #6b7280);
}

/* ── Tablet ─────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .hc-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Mobile (~390px) ───────────────────────────────────────────── */

@media (max-width: 640px) {
  .hc-controls {
    position: static;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 0;
  }

  .hc-zone-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0.2rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .hc-zone-chips::-webkit-scrollbar { display: none; }

  .hc-zone-chip { flex: 0 0 auto; }

  .hc-control-right { gap: 0.5rem; }
  .hc-field { flex: 1 1 45%; min-width: 0; }
  .hc-select { width: 100%; }

  /* Currency sits inline with Period on one row; Compare wraps below. The
     segment is narrow enough that this reads as one control row. */
  .hc-cur-seg { width: 100%; }
  /* ≥44px tap target, per the mobile rule the ask chips already follow. */
  .hc-cur-opt { flex: 1 1 0; min-height: 44px; }

  .hc-rate-chip {
    margin-top: 0;
    font-size: 0.72rem;
  }

  .hc-tiles { grid-template-columns: 1fr; }

  /* Bullet bars get MORE valuable at 1-column: vertical scrolling destroys
     cross-tile comparison and a bar is self-contained. Keep, don't hide. */
  .hc-bullet-track { height: 9px; }

  /* The trend chart costs ~56px and is resolution-independent — keep it.
     Bars survive the shrink better than the old dual line did: fewer, wider
     marks instead of two near-coincident strokes. */
  .hc-spark { width: 56px; height: 21px; }
  .hc-spark-end { font-size: 0.64rem; }

  /* Waterfall degrades rather than disappears: the JS drops to 3 named bars +
     Other, and the chart stacks above its legend. */
  .hc-waterfall { padding: 0.75rem 0.85rem 0.8rem; }
  .hc-wf-body { grid-template-columns: 1fr; gap: 0.5rem; }
  /* Mobile drops to 3 named bars + Other, so the natural height is already
     under the desktop cap; this just tightens it further. */
  .hc-wf-svg { min-height: 46px; max-height: 132px; }
  .hc-wf-row { font-size: 0.78rem; }

  .hc-tile { min-height: 0; }
  .hc-tile-value { font-size: 1.45rem; }

  .hc-rowname { max-width: 14ch; }

  .hc-table th,
  .hc-table td { padding: 0.42rem 0.5rem; }

  .hc-brief-card { padding: 0.9rem 1rem; }

  .hc-ask-card { padding: 0.9rem 1rem 1rem; }
  /* Full-width tap targets: chips and submit are the two things a head touches
     on a phone, and a 44px row beats a precise 0.34rem pill. */
  .hc-ask-chip { width: 100%; }
  .hc-ask-actions { flex-direction: column; align-items: stretch; }
  .hc-ask-actions .hc-btn { width: 100%; min-height: 44px; }
  .hc-ask-hint { order: 2; }
}

/* ── Dark mode ──────────────────────────────────────────────────── */

/* F2: app theme is [data-theme="dark"] on <html>, not OS prefers-color-scheme
   (see shell.js + 19-seo-intelligence "OS-keyed anti-pattern" note). */
[data-theme="dark"] .hc-controls {
  background: color-mix(in srgb, var(--bg, #111) 88%, transparent);
}
[data-theme="dark"] .hc-coverage-warn {
  background: var(--warning-bg, rgba(198, 138, 31, 0.12));
}
[data-theme="dark"] .hc-zone-chip-on { color: #fff; }
[data-theme="dark"] .hc-cur-opt-on { color: #fff; }
[data-theme="dark"] .hc-rate-chip {
  background: color-mix(in srgb, var(--surface, #1a1a1a) 90%, transparent);
}
[data-theme="dark"] .hc-bullet-track {
  background: color-mix(in srgb, var(--surface, #1a1a1a) 70%, transparent);
}
[data-theme="dark"] .hc-waterfall {
  background: var(--surface, #1a1a1a);
}
/* On a dark surface the muted grey tick loses contrast against the brand bar,
   so it is lightened rather than faded — the reference mark has to stay
   readable or the "vs last year" crossing disappears. */
[data-theme="dark"] .hc-spark-lytick {
  stroke: var(--text-muted, #9ca3af);
  opacity: 0.85;
}

/* Earlier months step back a little less on dark, where low-opacity red goes
   muddy against the surface.

   The `-last` override MUST be repeated at this specificity. A bare
   `.hc-spark-bar-last { opacity: 1 }` (0,1,0) loses to
   `[data-theme="dark"] .hc-spark-bar` (0,2,0), which would dim the current
   month to 0.5 in dark mode and delete the entire "where are we now" cue — the
   one thing the emphasis exists to carry. */
[data-theme="dark"] .hc-spark-bar {
  opacity: 0.5;
}

[data-theme="dark"] .hc-spark-bar-last {
  opacity: 1;
}
[data-theme="dark"] .hc-ask-flag {
  background: var(--warning-bg, rgba(198, 138, 31, 0.12));
}
[data-theme="dark"] .hc-btn-primary { color: #fff; }
[data-theme="dark"] .hc-brief-card {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand, #cc0000) 10%, var(--surface, #1a1a1a)) 0%, var(--surface, #1a1a1a) 4.5rem);
}

@media (prefers-reduced-motion: reduce) {
  .hc-zone-chip { transition: none; }
  .hc-cur-opt { transition: none; }
  .hc-bullet-fill { transition: none; }
}
/* ============================================================================
   59-dish-shot-picker.css — Creative Studio dish shot picker (#182)
   ----------------------------------------------------------------------------
   Modal opened from the sell sheet's dish slot. Deliberately a SMALLER surface
   than the Brand Library picker (47-dam-picker.css): that one is a gallery over
   thousands of DAM assets and needs a collection rail + facets; this one has two
   tabs and at most a dozen tiles, so it borrows the scroll contract and nothing
   else.

   SCROLL CONTRACT (inherited from the dam-picker lesson, 2026-07-21)
   ─────────────────────────────────────────────────────────────────
   Header + footer are ALWAYS outside the scroll surface. Desktop: definite
   modal height, panels scroll. Mobile: single scroller on .modal-body, panels
   content-sized — nested scrollers with overflow:hidden ancestors are what
   produced the "footer covers half the cards" failure over there.

   Brand lock: Heritage Red / Gold / eggshell / ink tokens ONLY.
   ========================================================================= */

/* modal() never creates a .modal-dialog, so width lands on .modal itself.
   Two-class specificity beats .modal-wide's 920px. Narrower than the DAM
   picker (1200px) — a 12-tile grid does not need gallery width. */
.dsp-modal.modal,
.dsp-modal.modal-wide,
.modal.modal-wide.dsp-modal {
  width: min(860px, 96vw);
  max-width: 860px;
}

/* Definite height (not just max-height) so the flex children can resolve
   remaining space and the panel becomes the single scroller. */
.dsp-modal.modal,
.dsp-modal.modal-wide {
  display: flex;
  flex-direction: column;
  height: min(88vh, 760px);
  height: min(88dvh, 760px);
  max-height: min(88vh, 760px);
  max-height: min(88dvh, 760px);
  overflow: hidden;
}

.dsp-modal .modal-header,
.dsp-modal .modal-footer {
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  background: var(--warm-white, var(--paper));
}

.dsp-modal .modal-footer {
  background: var(--paper);
  box-shadow: 0 -1px 0 var(--rule);
}

.dsp-modal .modal-body {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}

.dsp-picker {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  min-width: 0;
}

/* ── Tabs ────────────────────────────────────────────────────────────── */

.dsp-tabs {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 16px;
}

.dsp-tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 14px;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink-mute);
  cursor: pointer;
  min-height: 40px;
}

.dsp-tab:hover { color: var(--ink); }

.dsp-tab.is-active {
  color: var(--heritage-red);
  border-bottom-color: var(--heritage-red);
  font-weight: 600;
}

/* ── Panels (the scrollers) ──────────────────────────────────────────── */

.dsp-panel {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.dsp-panel[hidden] { display: none; }

/* ── Brief form ──────────────────────────────────────────────────────── */

.dsp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
  min-width: 0;
}

.dsp-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}

.dsp-field-hint {
  font-size: 0.74rem;
  color: var(--ink-mute);
  line-height: 1.45;
}

.dsp-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  /* 16px floor on mobile prevents iOS Safari's zoom-on-focus. */
}

.dsp-input:focus {
  outline: none;
  border-color: var(--heritage-red);
  box-shadow: 0 0 0 3px var(--rule-gold);
}

textarea.dsp-input { resize: vertical; min-height: 60px; }

.dsp-cap {
  font-size: 0.76rem;
  color: var(--ink-mute);
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}

/* ── Notices ─────────────────────────────────────────────────────────── */

.dsp-warning {
  border: 1px solid var(--heritage-gold);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--warm-white);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink);
}

.dsp-warning.is-error { border-color: var(--heritage-red); }
.dsp-warning strong { display: block; margin-bottom: 2px; color: var(--ink-strong); }

/* ── Tile grid (shared by Create results + Recent) ───────────────────── */

.dsp-results:empty { display: none; }

.dsp-results,
.dsp-recent {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.dsp-tile {
  appearance: none;
  position: relative;
  padding: 0;
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dsp-tile:hover { border-color: var(--heritage-gold); }

.dsp-tile.is-selected {
  border-color: var(--heritage-red);
  box-shadow: 0 0 0 3px var(--rule-gold);
}

.dsp-tile img {
  width: 100%;
  /* 4:3 to match the requested generation aspect — no letterboxing surprise
     between what the tile shows and what lands in the sell sheet's dish band. */
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--warm-white);
}

.dsp-tile-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--heritage-red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dsp-tile-cap {
  padding: 6px 8px;
  font-size: 0.74rem;
  color: var(--ink-mute);
  text-align: left;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Empty / muted states ────────────────────────────────────────────── */

.dsp-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 16px;
  color: var(--ink-mute);
  text-align: center;
}

.dsp-empty p { margin: 0; font-size: 0.85rem; }
.dsp-empty-icon { color: var(--rule); }
.dsp-muted { color: var(--ink-mute); font-size: 0.85rem; margin: 0; }

/* ── Footer ──────────────────────────────────────────────────────────── */

.dsp-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.dsp-honesty {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--ink-mute);
  line-height: 1.4;
}

.dsp-honesty-icon { flex: 0 0 auto; margin-top: 1px; }

/* ── Mobile: single scroller ─────────────────────────────────────────── */

@media (max-width: 768px) {
  .dsp-modal.modal,
  .dsp-modal.modal-wide {
    height: auto;
    max-height: min(92dvh, 900px);
  }

  /* Body becomes the ONLY scroller; panels are content-sized. Nested
     scrollers here are exactly what broke the DAM picker on iOS. */
  .dsp-modal .modal-body { overflow-y: auto; display: block; }
  .dsp-picker { display: block; }
  .dsp-panel { overflow: visible; min-height: 0; flex: none; }

  .dsp-results,
  .dsp-recent { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

  /* 16px prevents iOS zoom-on-focus. */
  .dsp-input { font-size: 16px; }

  .dsp-footer .btn { min-height: 44px; flex: 1 1 auto; }
  .dsp-honesty { flex: 1 1 100%; }
  .dsp-tab { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .dsp-tile, .dsp-input, .dsp-tab { transition: none; }
}
/* ============================================================
   59-weee-oos.css
   Weee Vendor-OOS (#170) — tabs, upload zone, stat tiles, tables
   All colours come from the shared token set so dark mode and the
   heritage palette apply without a per-module override.
   ============================================================ */

.wo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.wo-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.wo-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
  font-family: inherit;
}

.wo-tab:hover {
  border-color: var(--heritage-gold);
  color: var(--ink-strong);
}

.wo-tab.is-active {
  background: var(--heritage-red, #CC0000);
  border-color: var(--heritage-red, #CC0000);
  color: #fff;
}

.wo-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Headings / helper text ─────────────────────────────── */

.wo-h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-strong);
}

.wo-sub {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 78ch;
}

.wo-fine { font-size: 0.78rem; }
.wo-muted { color: var(--ink-soft); font-size: 0.82rem; }
.wo-center { text-align: center; padding: 22px 0; }

.wo-req {
  margin-left: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--heritage-red, #CC0000);
}

/* ── Upload zone ─────────────────────────────────────────── */

.wo-dropzone {
  border: 2px dashed var(--rule);
  border-radius: 10px;
  padding: 26px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
  background: var(--paper);
}

.wo-dropzone:hover,
.wo-dropzone:focus-visible,
.wo-dropzone.is-over {
  border-color: var(--heritage-gold, #D4A843);
  background: rgba(212, 168, 67, 0.06);
  outline: none;
}

.wo-dropzone-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wo-dropzone-inner strong {
  font-size: 0.92rem;
  color: var(--ink-strong);
}

.wo-dropzone-inner span {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.wo-upload-status { margin-top: 12px; display: grid; gap: 4px; }
.wo-upload-ok,
.wo-upload-err {
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--rule);
}
.wo-upload-ok  { color: var(--success-deep, #2d8c3c); border-color: rgba(45, 140, 60, 0.3); }
.wo-upload-err { color: var(--danger, #c0392b);       border-color: rgba(192, 57, 43, 0.3); }

/* ── Warnings ────────────────────────────────────────────── */

.wo-warnings { margin-top: 14px; display: grid; gap: 6px; }

.wo-warning,
.wo-warning-inline {
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(212, 168, 67, 0.10);
  border: 1px solid rgba(212, 168, 67, 0.35);
  color: var(--ink-strong);
}

.wo-warning-inline { margin-top: 8px; }

/* Coverage banner — the honesty notice on a partial report. */
.wo-coverage-banner {
  border-left: 4px solid var(--heritage-gold, #D4A843);
  margin-bottom: 18px;
}
.wo-coverage-banner strong { display: block; margin-bottom: 4px; color: var(--ink-strong); }
.wo-coverage-banner p { margin: 0 0 10px; font-size: 0.85rem; color: var(--ink-soft); max-width: 78ch; }

/* ── Stat tiles ──────────────────────────────────────────── */

.wo-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.wo-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
}

.wo-stat-value { font-size: 1.4rem; font-weight: 700; color: var(--ink-strong); line-height: 1.1; }
.wo-stat-label { font-size: 0.74rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.4px; }

.wo-stat-danger { border-color: rgba(192, 57, 43, 0.35); }
.wo-stat-danger .wo-stat-value { color: var(--danger, #c0392b); }
.wo-stat-warn   { border-color: rgba(212, 168, 67, 0.45); }
.wo-stat-ok     { border-color: rgba(45, 140, 60, 0.35); }

/* ── Filters ─────────────────────────────────────────────── */

.wo-filters {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.wo-field { display: flex; flex-direction: column; gap: 4px; }
.wo-field > span { font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.4px; }
.wo-field .form-input { min-width: 180px; }
.wo-field-block { display: block; margin-top: 12px; }
.wo-field-block > span { display: block; margin-bottom: 4px; }
.wo-field-block .form-input { width: 100%; }

/* ── Tables ──────────────────────────────────────────────── */

.wo-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.wo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.wo-table th,
.wo-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.wo-table th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ink-soft);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 1;
}

.wo-table .wo-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.wo-table tbody tr:hover { background: rgba(0, 0, 0, 0.02); }

.wo-row-click { cursor: pointer; }
.wo-row-click:focus-visible {
  outline: 2px solid var(--heritage-gold, #D4A843);
  outline-offset: -2px;
}

.wo-table-lines td:nth-child(4) { min-width: 200px; }

/* ── Suggestions ─────────────────────────────────────────── */

.wo-suggestion {
  display: grid;
  gap: 2px;
  font-size: 0.8rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: var(--paper);
}

/* A "strong" suggestion is still only a suggestion — gold, never green, so it
   never reads as confirmed. */
.wo-suggestion.is-strong { border-color: rgba(212, 168, 67, 0.5); }
.wo-suggestion.is-modal  { margin: 12px 0; }
.wo-suggestion code { font-size: 0.8rem; font-weight: 700; color: var(--ink-strong); }

/* ── Detail modal ────────────────────────────────────────── */

.wo-detail { display: grid; gap: 6px; }

.wo-detail-row {
  display: grid;
  grid-template-columns: minmax(140px, 34%) 1fr;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.85rem;
}

.wo-detail-label { color: var(--ink-soft); font-weight: 600; }
.wo-detail-value { color: var(--ink-strong); word-break: break-word; }

.wo-map-modal p { margin: 0 0 6px; font-size: 0.88rem; }

/* -- Source file link (#242) --------------------------------
   The filename used to be an inert pill, so it read as a status chip and not
   as something you could open. It is now an anchor: pointer cursor, underline
   on hover, visible focus ring, and a small down-arrow affordance. */

a.wo-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

a.wo-file-link:hover,
a.wo-file-link:focus-visible {
  text-decoration: underline;
  background: rgba(45, 140, 60, 0.20);
  border-color: rgba(45, 140, 60, 0.55);
}

a.wo-file-link:focus-visible {
  outline: 2px solid var(--focus-ring, #cc0000);
  outline-offset: 2px;
}

.wo-file-icon { font-size: 0.85em; opacity: 0.75; }

/* Bytes were never retained (pre-#242 rows): show it is not clickable. */
.wo-file-stale { cursor: not-allowed; opacity: 0.72; }


/* ── Mobile ──────────────────────────────────────────────── */

@media (max-width: 720px) {
  .wo-toolbar { flex-direction: column; align-items: stretch; }
  .wo-toolbar-right { justify-content: flex-start; }
  .wo-stats { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
  .wo-stat-value { font-size: 1.15rem; }
  .wo-filters { flex-direction: column; align-items: stretch; }
  .wo-field .form-input { min-width: 0; width: 100%; }
  .wo-detail-row { grid-template-columns: 1fr; gap: 2px; }
  .wo-table { font-size: 0.8rem; }
  .wo-table th, .wo-table td { padding: 7px 8px; }
}
/* ============================================================
   60-site-agent.css
   Site Agent — read-only website auditor (Module: site-agent)

   Concatenated into main.css by scripts/build-css.sh in lexical
   order — DO NOT EDIT main.css directly.

   Design intent:
     • The live trace reads like a log, not a dashboard: monospace
       tool names, fixed-width seq column, dense rows.
     • BLOCKED steps are styled as a visible, calm guardrail signal
       (gold, not red). A refusal is the system working; painting it
       as an error teaches users to distrust the safety layer.
     • Findings table collapses to stacked cards under 720px so the
       module is usable on a phone (Module Integration Checklist).
   ============================================================ */

/* ── Launcher ───────────────────────────────────────────── */

.site-agent .sa-launcher-sub {
  margin: -4px 0 16px;
  font-size: 0.9rem;
}

.site-agent .sa-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.site-agent .sa-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 0;
  min-width: 0;
}

.site-agent .sa-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary, #4a4a4a);
}

.site-agent .sa-help {
  font-size: 0.76rem;
  line-height: 1.4;
}

.site-agent .sa-objective {
  resize: vertical;
  min-height: 72px;
}

.site-agent .sa-form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.site-agent .sa-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.site-agent .sa-form-error {
  font-size: 0.84rem;
  color: var(--danger, #c0392b);
  line-height: 1.4;
}

/* ── Live trace ─────────────────────────────────────────── */

.site-agent .sa-trace-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.site-agent .sa-trace-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.site-agent .sa-trace-counts {
  font-size: 0.82rem;
}

.site-agent .sa-steps {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border-light, #e8e4dc);
  border-radius: var(--radius, 8px);
  background: var(--surface-alt, #faf8f4);
}

.site-agent .sa-steps-waiting {
  padding: 18px;
  font-size: 0.86rem;
  text-align: center;
}

.site-agent .sa-step {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule-soft, #efece6);
  font-size: 0.84rem;
}

.site-agent .sa-step:last-child { border-bottom: 0; }

.site-agent .sa-step-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.site-agent .sa-step-seq {
  min-width: 2.2em;
  font-variant-numeric: tabular-nums;
  color: var(--text-mute, #8a8580);
  font-size: 0.78rem;
}

.site-agent .sa-step-tool {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.78rem;
  color: var(--text-secondary, #4a4a4a);
  background: var(--paper, #fff);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-light, #e8e4dc);
}

.site-agent .sa-step-url {
  color: var(--heritage-red, #cc0000);
  text-decoration: none;
  overflow-wrap: anywhere;
  min-width: 0;
}

.site-agent .sa-step-url:hover { text-decoration: underline; }

.site-agent .sa-step-http,
.site-agent .sa-step-dur {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--text-mute, #8a8580);
}

.site-agent .sa-step-title {
  margin: 3px 0 0 2.8em;
  font-size: 0.78rem;
}

/* A blocked step is the allowlist doing its job. Gold = "we stopped",
   not red = "something broke". Left rule makes it scannable in a long log. */
.site-agent .sa-step-blocked {
  background: rgba(212, 168, 67, 0.10);
  border-left: 3px solid var(--heritage-gold, #d4a843);
}

.site-agent .sa-step-error {
  background: rgba(192, 57, 43, 0.07);
  border-left: 3px solid var(--danger, #c0392b);
}

.site-agent .sa-step-reason {
  margin: 3px 0 0 2.8em;
  font-size: 0.78rem;
  color: var(--text-secondary, #4a4a4a);
}

/* ── Findings ───────────────────────────────────────────── */

.site-agent .sa-findings-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.site-agent .sa-export {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.site-agent .sa-export-label {
  font-size: 0.8rem;
}

.site-agent .sa-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0 8px;
}

.site-agent .sa-filter.is-active {
  background: var(--heritage-red, #cc0000);
  border-color: var(--heritage-red, #cc0000);
  color: #fff;
}

.site-agent .sa-filter-n {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
  margin-left: 3px;
}

.site-agent .sa-provenance {
  font-size: 0.78rem;
  margin: 0 0 10px;
}

.site-agent .sa-table { width: 100%; }

.site-agent .sa-finding-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.site-agent .sa-rule-id {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.74rem;
}

.site-agent .sa-evidence {
  margin-top: 4px;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.site-agent .sa-rec {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text-secondary, #4a4a4a);
}

.site-agent .sa-ranking {
  margin-top: 4px;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.site-agent .sa-cell-url a {
  color: var(--heritage-red, #cc0000);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.site-agent .sa-cell-url a:hover { text-decoration: underline; }

.site-agent .sa-no-match {
  padding: 20px;
  text-align: center;
  font-size: 0.88rem;
}

/* ── History ────────────────────────────────────────────── */

.site-agent .sa-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-agent .sa-history-item + .sa-history-item {
  border-top: 1px solid var(--rule-soft, #efece6);
}

.site-agent .sa-history-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 4px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  flex-wrap: wrap;
}

.site-agent .sa-history-btn:hover { background: var(--surface-alt, #faf8f4); }

.site-agent .sa-history-obj {
  font-size: 0.88rem;
  font-weight: 500;
  min-width: 0;
  overflow-wrap: anywhere;
}

.site-agent .sa-history-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ── Mobile ─────────────────────────────────────────────── */

@media (max-width: 720px) {
  .site-agent .sa-form-row { flex-direction: column; gap: 14px; }

  .site-agent .sa-steps { max-height: 320px; }

  .site-agent .sa-step-title,
  .site-agent .sa-step-reason { margin-left: 0; }

  /* Stacked cards: the 4-column findings table cannot survive a phone.
     Each cell gets its header inline via data-label. */
  .site-agent .sa-table thead { display: none; }

  .site-agent .sa-table,
  .site-agent .sa-table tbody,
  .site-agent .sa-table tr,
  .site-agent .sa-table td { display: block; width: 100%; }

  .site-agent .sa-table tr {
    border: 1px solid var(--border-light, #e8e4dc);
    border-radius: var(--radius, 8px);
    margin-bottom: 10px;
    padding: 10px;
  }

  .site-agent .sa-table td { border: 0; padding: 3px 0; }

  /* Re-attach the column header the hidden thead used to provide, so a stacked
     cell is never an unlabelled fragment. `finding` is self-evident from its
     own bold title, so it opts out. */
  .site-agent .sa-table td[data-label]:not(.sa-cell-finding)::before {
    content: attr(data-label) ": ";
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-mute, #8a8580);
  }

  .site-agent .sa-export { width: 100%; }
}

/* ── Dark mode ──────────────────────────────────────────── */

body.dark-mode .site-agent .sa-steps {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .site-agent .sa-step {
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

body.dark-mode .site-agent .sa-step-tool {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .site-agent .sa-step-blocked {
  background: rgba(212, 168, 67, 0.14);
}

body.dark-mode .site-agent .sa-history-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ── Pre-flight policy strip (P0 harden 2026-08-08) ───────
   Sits above the launcher form and answers "what may this agent open, and
   can it run at all?" before the user writes an objective. Muted by design:
   it is context, not an alarm — except .sa-policy-blocker, which IS the
   alarm and therefore carries the gold (not red) treatment used elsewhere
   for "the safety layer is doing its job", per .sa-step-blocked. */

.site-agent .sa-policy {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-agent .sa-policy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.site-agent .sa-policy-label {
  font-weight: 600;
}

.site-agent .sa-policy-hosts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Empty allowlist is not a neutral state — every run will be refused. */
.site-agent .sa-policy-empty {
  color: #b3261e;
  font-weight: 600;
}

.site-agent .sa-policy-methods {
  font-size: 0.8rem;
}

.site-agent .sa-policy-blocker {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(212, 168, 67, 0.14);
  border: 1px solid rgba(212, 168, 67, 0.45);
  font-size: 0.85rem;
  line-height: 1.45;
}

/* ── Starter objective (first-run affordance) ────────────── */

.site-agent .sa-starter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -4px 0 4px;
}

.site-agent .sa-starter-label {
  font-size: 0.82rem;
}

/* ── Accepted-but-not-running banner ─────────────────────
   Gold, matching .sa-step-blocked: the run was refused execution by a
   deliberate safety/config switch, not broken by an error. Red here would
   teach users to read the off-switch as a failure. */

.site-agent .sa-dispatch-warn {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(212, 168, 67, 0.12);
  border: 1px solid rgba(212, 168, 67, 0.45);
}

.site-agent .sa-dispatch-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.site-agent .sa-dispatch-body {
  font-size: 0.85rem;
  line-height: 1.5;
}

.site-agent .sa-dispatch-hint {
  font-size: 0.8rem;
  margin-top: 6px;
}

/* ── Dark mode ───────────────────────────────────────────── */

body.dark-mode .site-agent .sa-policy {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .site-agent .sa-policy-empty {
  color: #f2b8b5;
}

body.dark-mode .site-agent .sa-dispatch-warn,
body.dark-mode .site-agent .sa-policy-blocker {
  background: rgba(212, 168, 67, 0.16);
}

/* ══════════════════════════════════════════════════════════════════════════
   #223 — SEO SCORE, RECOMMENDATIONS, DRAFTED COPY
   ══════════════════════════════════════════════════════════════════════════
   Lance asked for a score, prioritized fixes, and paste-ready meta/alt copy.
   Two visual rules carry meaning rather than decoration:

     1. The "not scored" state looks NOTHING like a low score. It renders an em
        dash on a neutral background, never a red 0. A red zero would say "your
        site is broken" when the truth is "we could not look at your site".

     2. A draft's BEFORE and AFTER sit on the same grid with their character
        counts aligned, because the whole review decision is "is the after
        actually better than the before, and does it fit the budget".
   ───────────────────────────────────────────────────────────────────────── */

.site-agent .sa-score-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.site-agent .sa-score-dial {
  flex: 0 0 auto;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid currentColor;
}

.site-agent .sa-score-num { font-size: 2rem; font-weight: 800; line-height: 1; }
.site-agent .sa-score-grade { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; margin-top: 2px; }

.site-agent .sa-tone-success { color: #2e7d4f; }
.site-agent .sa-tone-info    { color: #1f6f8b; }
.site-agent .sa-tone-warn    { color: #a4750f; }
.site-agent .sa-tone-danger  { color: #a32b26; }
.site-agent .sa-tone-neutral { color: var(--text-mute, #8a8580); }

.site-agent .sa-score-meta { flex: 1 1 260px; min-width: 0; }

.site-agent .sa-score-coverage { font-size: 0.82rem; margin: 0 0 10px; }

.site-agent .sa-score-partial {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(212, 168, 67, 0.16);
  border: 1px solid rgba(212, 168, 67, 0.45);
  color: #8a6a10;
}

.site-agent .sa-score-cats { list-style: none; margin: 0 0 10px; padding: 0; }

.site-agent .sa-score-cat {
  display: grid;
  grid-template-columns: minmax(88px, 130px) 1fr 34px;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  padding: 2px 0;
}

.site-agent .sa-score-cat-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.site-agent .sa-score-cat-fill { display: block; height: 100%; background: currentColor; }
.site-agent .sa-score-cat-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.site-agent .sa-score-basis { font-size: 0.75rem; margin: 0; line-height: 1.45; }

/* NOT SCORED — deliberately neutral. See rule 1 in the block header. */
.site-agent .sa-score-none-body { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

.site-agent .sa-score-dash {
  flex: 0 0 auto;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: var(--text-mute, #8a8580);
  border: 3px dashed rgba(0, 0, 0, 0.16);
}

.site-agent .sa-score-none-title { font-weight: 700; margin: 0 0 4px; }

/* ── Recommendation tabs ─────────────────────────────────── */

.site-agent .sa-seo-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.site-agent .sa-seo-tab.is-active { background: var(--lkk-red, #c00); color: #fff; border-color: var(--lkk-red, #c00); }
.site-agent .sa-seo-empty { padding: 18px 0; font-size: 0.86rem; }

/* ── Priority plan ───────────────────────────────────────── */

.site-agent .sa-plan { list-style: none; margin: 0; padding: 0; }

.site-agent .sa-plan-item {
  padding: 12px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.site-agent .sa-plan-item:first-child { border-top: 0; }

.site-agent .sa-plan-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.site-agent .sa-plan-rank {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.74rem; font-weight: 700;
  background: rgba(0, 0, 0, 0.07);
}

.site-agent .sa-plan-title { font-weight: 600; font-size: 0.92rem; }
.site-agent .sa-plan-meta { font-size: 0.78rem; margin: 4px 0 0 30px; }

.site-agent .sa-plan-draftable {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(46, 125, 79, 0.12);
  border: 1px solid rgba(46, 125, 79, 0.35);
  color: #2e7d4f;
}

.site-agent .sa-plan-rec { font-size: 0.85rem; line-height: 1.5; margin: 6px 0 0 30px; }
.site-agent .sa-plan-urls { list-style: none; margin: 6px 0 0 30px; padding: 0; font-size: 0.78rem; }
.site-agent .sa-plan-urls li { padding: 1px 0; }

/* ── Drafted copy ────────────────────────────────────────── */

.site-agent .sa-draft-disclosure {
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 10px 12px;
  margin: 0 0 14px;
  border-radius: 8px;
  background: rgba(212, 168, 67, 0.12);
  border: 1px solid rgba(212, 168, 67, 0.45);
}

.site-agent .sa-draft-page { margin-bottom: 18px; }
.site-agent .sa-draft-url { font-size: 0.84rem; font-weight: 600; margin: 0 0 8px; word-break: break-all; }

.site-agent .sa-draft {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.site-agent .sa-draft-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.site-agent .sa-draft-field { font-size: 0.8rem; font-weight: 700; }

.site-agent .sa-draft-badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(31, 111, 139, 0.12);
  border: 1px solid rgba(31, 111, 139, 0.35);
  color: #1f6f8b;
}

.site-agent .sa-draft-before,
.site-agent .sa-draft-after {
  display: grid;
  grid-template-columns: 62px 1fr auto auto;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.84rem;
}

.site-agent .sa-draft-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mute, #8a8580);
}

.site-agent .sa-draft-text { word-break: break-word; line-height: 1.45; }
.site-agent .sa-draft-suggested { font-weight: 600; }
.site-agent .sa-draft-len { font-size: 0.72rem; font-variant-numeric: tabular-nums; color: var(--text-mute, #8a8580); }
.site-agent .sa-draft-absent .sa-draft-text { font-style: italic; }
.site-agent .sa-draft-img { font-size: 0.74rem; margin-bottom: 4px; word-break: break-all; }
.site-agent .sa-draft-why { font-size: 0.76rem; line-height: 1.45; margin-top: 6px; }
.site-agent .sa-draft-note { font-size: 0.78rem; line-height: 1.45; margin: 6px 0 0; }

/* ── Full report ─────────────────────────────────────────── */

.site-agent .sa-report {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  line-height: 1.6;
  max-height: 620px;
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── Mobile ──────────────────────────────────────────────── */

@media (max-width: 720px) {
  .site-agent .sa-score-body,
  .site-agent .sa-score-none-body { gap: 14px; }

  .site-agent .sa-score-dial,
  .site-agent .sa-score-dash { width: 84px; height: 84px; }

  .site-agent .sa-score-num { font-size: 1.6rem; }

  .site-agent .sa-score-cat { grid-template-columns: minmax(74px, 96px) 1fr 30px; font-size: 0.76rem; }

  /* Stack the before/after grid: four columns at 360px produces a one-word-per
     -line ladder that is unreadable, and the character count is the thing a
     reviewer actually needs kept next to the text. */
  .site-agent .sa-draft-before,
  .site-agent .sa-draft-after {
    grid-template-columns: 1fr auto;
    row-gap: 2px;
  }
  .site-agent .sa-draft-tag { grid-column: 1 / -1; }
  .site-agent .sa-draft-after .btn { grid-column: 1 / -1; justify-self: start; margin-top: 4px; }

  .site-agent .sa-plan-meta,
  .site-agent .sa-plan-rec,
  .site-agent .sa-plan-urls { margin-left: 0; }

  .site-agent .sa-seo-tabs { width: 100%; }
  .site-agent .sa-seo-tab { flex: 1 1 auto; }
}

/* ── Dark mode ───────────────────────────────────────────── */

body.dark-mode .site-agent .sa-score-cat-bar { background: rgba(255, 255, 255, 0.12); }
body.dark-mode .site-agent .sa-score-dash { border-color: rgba(255, 255, 255, 0.2); }
body.dark-mode .site-agent .sa-plan-rank { background: rgba(255, 255, 255, 0.1); }
body.dark-mode .site-agent .sa-plan-item { border-top-color: rgba(255, 255, 255, 0.1); }
body.dark-mode .site-agent .sa-draft { border-color: rgba(255, 255, 255, 0.14); }
body.dark-mode .site-agent .sa-draft-disclosure { background: rgba(212, 168, 67, 0.16); }

body.dark-mode .site-agent .sa-report {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .site-agent .sa-tone-success { color: #7fd6a3; }
body.dark-mode .site-agent .sa-tone-info    { color: #7ec8e3; }
body.dark-mode .site-agent .sa-tone-warn    { color: #e8c26a; }
body.dark-mode .site-agent .sa-tone-danger  { color: #f2a5a1; }
body.dark-mode .site-agent .sa-score-partial { color: #e8c26a; }
body.dark-mode .site-agent .sa-plan-draftable { color: #7fd6a3; }
body.dark-mode .site-agent .sa-draft-badge { color: #7ec8e3; }
/* ═══════════════════════════════════════════════════════════════════
   Recipe Workbench — FULL-PAGE EDITOR (v2, 2026-08-12)

   Loaded after 45- (base) and 46- (v2 chef surface). Purely ADDITIVE:
   every selector here is new (.rwb-editor-*), so nothing in 45 or 46 is
   overridden or edited. The form body inside .rwb-editor-surface keeps
   using the v2 rules it already had.

   Why this file exists: the editor used to be a utils.modal(). Nathaniel
   kept getting "kicked out of building a recipe" because a dialog can
   always be dismissed. The editor is now a routed page, so it needs page
   chrome — breadcrumb, sticky header, save rail — that a modal got for
   free from .modal-header / .modal-footer.

   NOT a fullscreen takeover: the SPA shell (sidebar + topbar) stays put.
   Chefs keep their navigation. See isFullscreenRoute() in ui/shell.js —
   this route is deliberately absent from that list.
   ═══════════════════════════════════════════════════════════════════ */

.rwb-editor-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Breadcrumb ───────────────────────────────────────────────────
   The explicit way back. A page has no ✕, so the exit must be visible
   and always in the same place. */
.rwb-editor-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rwb-editor-crumb {
  appearance: none;
  border: 0;
  background: none;
  padding: 4px 2px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink-mute, #6B6560);
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.rwb-editor-crumb:hover {
  color: var(--heritage-red, #CC0000);
  text-decoration: underline;
}

.rwb-editor-crumb:focus-visible {
  outline: 2px solid var(--heritage-red, #CC0000);
  outline-offset: 2px;
}

/* ── Sticky header ────────────────────────────────────────────────
   Recipe name + status/author meta on the left, autosave status and
   Save on the right. Sticky so a chef 40 ingredient lines deep can
   still see "saved 3s ago" and reach Save without scrolling back up —
   the modal footer used to guarantee that for free.

   top: 0 works because the page scrolls in the shell content column,
   not in a nested scroller. z-index stays BELOW the sidebar (10) so an
   open mobile sidebar is never underlapped by the recipe title. */
.rwb-editor-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0 10px;
  background: var(--eggshell-bright, var(--paper, #FBF6EC));
  border-bottom: 1px solid var(--rule, #E5D9C4);
}

.rwb-editor-titlewrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;   /* lets a long recipe name ellipsis instead of shoving Save off-screen */
  flex: 1 1 340px;
}

.rwb-editor-title {
  margin: 0;
  font-family: var(--font-display, 'ABC Arizona Flare', 'Playfair Display', Georgia, serif);
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 600;
  color: var(--ink-strong, #1A1410);
  overflow-wrap: anywhere;
}

.rwb-editor-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink-mute, #6B6560);
}

.rwb-editor-meta .badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
}

.rwb-editor-meta-sep {
  color: var(--rule, #E5D9C4);
}

/* Save rail. Mirrors .rwb-footer-end's shape so the controls a chef
   learned in the modal are the same controls, just relocated. */
.rwb-editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.rwb-editor-actions .rwb-autosave-status {
  font-size: 0.78rem;
  white-space: nowrap;
}

/* ── Honesty bar ──────────────────────────────────────────────────
   Shown ONLY when the server draft could not be minted, i.e. the work
   really is tab-local. Never shown on the happy path: a permanent
   "your work might be lost" banner is how a warning becomes wallpaper. */
.rwb-editor-warnbar {
  padding: 9px 12px;
  border: 1px solid var(--warn-deep, #B45309);
  border-left-width: 3px;
  border-radius: 8px;
  background: var(--warn-soft, rgba(180, 83, 9, 0.08));
  color: var(--warn-deep, #B45309);
  font-size: 0.85rem;
}

/* ── Form surface ─────────────────────────────────────────────────
   The .section/.card mold every other AIOP page uses. The modal gave
   the form a max-width; on a page we cap the measure ourselves so an
   ultrawide monitor doesn't stretch ingredient rows to 2000px. */
.rwb-editor-surface {
  padding: 18px 20px 22px;
  border: 1px solid var(--rule, #E5D9C4);
  border-radius: 12px;
  background: var(--paper, #FBF6EC);
}

.rwb-editor-body {
  max-width: 1100px;
}

/* The page owns its own bottom breathing room now that no modal
   footer sits under the last field. */
.rwb-editor-body .rwb-edit-form {
  padding-bottom: 4px;
}

/* ── Mobile ───────────────────────────────────────────────────────
   Save must stay reachable with a thumb: on narrow screens the header
   stacks and the action rail goes full-width. */
@media (max-width: 720px) {
  .rwb-editor-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .rwb-editor-title {
    font-size: 1.25rem;
  }

  .rwb-editor-actions {
    justify-content: space-between;
    width: 100%;
  }

  .rwb-editor-actions .btn {
    min-height: 44px;   /* touch target floor, same as the modal buttons */
  }

  .rwb-editor-surface {
    padding: 14px 12px 18px;
  }
}

/* ── Dark mode ────────────────────────────────────────────────────
   90-dark-mode.css loads after this file, so these live under the same
   [data-theme="dark"] hook rather than editing that file. */
[data-theme="dark"] .rwb-editor-header {
  background: var(--paper, #1A1714);
  border-bottom-color: var(--rule, #3A332C);
}

[data-theme="dark"] .rwb-editor-surface {
  background: var(--paper-2, #201C18);
  border-color: var(--rule, #3A332C);
}

/* ── Print ────────────────────────────────────────────────────────
   Editor chrome is screen-only. The kitchen sheet is printed from the
   DETAIL view (printKitchenSheet), never from the editor, and this
   file adds no content whatsoever to any print path. */
@media print {
  .rwb-editor-breadcrumb,
  .rwb-editor-header,
  .rwb-editor-warnbar {
    display: none !important;
  }
}

/* ── Library card: "unsaved draft" flag ───────────────────────────
   A recipe minted by /new is committed as "Untitled recipe" until the
   chef presses Save, because autosave deliberately writes ONLY the
   draft buffer (a debounce must never mutate a committed row). The card
   therefore shows the name out of that buffer, and this flag says where
   it came from — the chef sees their recipe by name AND is told it still
   needs a Save. Silence here would look exactly like the data loss this
   whole change exists to prevent. */
.rwb-card-draftflag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px dashed var(--warn-deep, #B45309);
  background: var(--warn-soft, rgba(180, 83, 9, 0.08));
  color: var(--warn-deep, #B45309);
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  vertical-align: middle;
  white-space: nowrap;
}
/* ============================================================
   63-deductions-flags.css
   Deductions Intelligence — flag chips, flag worklist drawer, ready
   banner, line-kind row tints, foot bar, merge-fee card, PO suggestion,
   workbook-tab pill.

   Scoping contract: every selector is prefixed .di-* (or .ded-*), so
   nothing here can leak into other modules.
   Dark mode: [data-theme="dark"] overrides at the bottom (matches
   90-dark-mode.css). Surface/text/border tokens are already retokenized
   for dark by 90-dark-mode.css — only the hardcoded rgba severity tints
   and left-border accents need explicit dark handling.
   ============================================================ */

/* ── Flag chips ──────────────────────────────────────── */

.di-flag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  white-space: nowrap;
  vertical-align: middle;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-soft, #555);
}

.di-flag-chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.di-flag-chip__count {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

/* Blocking = red. Hard stop: the check cannot be marked ready. */
.di-flag-chip--blocking {
  background: rgba(192, 57, 43, 0.14);
  border-color: rgba(192, 57, 43, 0.28);
  color: var(--danger, #c0392b);
}

/* Advisory = amber. Informational; does not gate readiness. */
.di-flag-chip--warn {
  background: rgba(212, 168, 67, 0.20);
  border-color: rgba(212, 168, 67, 0.38);
  color: #8a6a1f;
}

.di-flag-chip--cleared {
  background: rgba(45, 140, 60, 0.14);
  border-color: rgba(45, 140, 60, 0.28);
  color: var(--success-deep, #2d8c3c);
}

button.di-flag-chip,
.di-flag-chip[role="button"] {
  cursor: pointer;
  font-family: inherit;
}

button.di-flag-chip:hover,
.di-flag-chip[role="button"]:hover { filter: brightness(0.96); }

.di-flag-chip:focus-visible {
  outline: 2px solid var(--accent, #5B2C8A);
  outline-offset: 2px;
}

/* ── Flag worklist drawer ────────────────────────────── */

.di-flag-drawer {
  border: 1px solid var(--border-subtle, #ececec);
  border-radius: var(--radius, 8px);
  background: var(--surface, #fff);
  padding: 12px 14px;
  margin: 12px 0;
}

.di-flag-drawer__title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-mute, #777);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.di-flag-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.di-flag-drawer__empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--success-deep, #2d8c3c);
}

.di-flag-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-subtle, #ececec);
  border-left: 3px solid var(--rule, #e0e0e0);
  background: var(--surface, #fff);
}

.di-flag-item--blocking {
  border-left-color: var(--danger, #c0392b);
  background: rgba(192, 57, 43, 0.045);
}

.di-flag-item--warn {
  border-left-color: var(--heritage-gold, #D4A843);
  background: rgba(212, 168, 67, 0.06);
}

.di-flag-item__code {
  grid-column: 1;
  align-self: start;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-soft, #555);
  white-space: nowrap;
}

.di-flag-item__detail {
  grid-column: 2;
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--ink, #1a1a1a);
}

.di-flag-item__resolution {
  grid-column: 2;
  margin: 0;
  font-size: 0.79rem;
  line-height: 1.45;
  color: var(--text-mute, #777);
}

.di-flag-item__resolution::before {
  content: "↳ ";
  opacity: 0.7;
}

.di-flag-item__meta {
  grid-column: 2;
  font-size: 0.74rem;
  color: var(--ink-faint, #999);
  font-variant-numeric: tabular-nums;
}

/* ── Ready banner ────────────────────────────────────── */

.di-ready-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--border-subtle, #ececec);
  border-left: 4px solid var(--rule, #e0e0e0);
  background: var(--surface-elevated, #fafafa);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink, #1a1a1a);
  margin: 12px 0;
}

.di-ready-banner__icon {
  flex: 0 0 auto;
  font-size: 1rem;
  line-height: 1.35;
}

.di-ready-banner__body { flex: 1 1 auto; min-width: 0; }

.di-ready-banner__title {
  margin: 0;
  font-weight: 700;
}

.di-ready-banner__note {
  margin: 3px 0 0;
  font-size: 0.81rem;
  color: var(--text-mute, #777);
}

.di-ready-banner--blocked {
  border-left-color: var(--danger, #c0392b);
  background: rgba(192, 57, 43, 0.07);
}

.di-ready-banner--blocked .di-ready-banner__title { color: var(--danger, #c0392b); }

.di-ready-banner--ok {
  border-left-color: var(--success-deep, #2d8c3c);
  background: rgba(45, 140, 60, 0.07);
}

.di-ready-banner--ok .di-ready-banner__title { color: var(--success-deep, #2d8c3c); }

/* ── Line-kind row tints ─────────────────────────────── */
/* Subtle left-border accents, deliberately distinct from each other:
   repayment = purple (money flowing back TO the retailer, human-only)
   merge fee = gold   (inferred/derived, needs confirmation)
   retailer fee = teal (a billed fee, not a deduction)
   Plain deductions get no tint — they are the default case.        */

.di-line--repayment,
.di-line--merge-fee,
.di-line--fee {
  border-left: 3px solid transparent;
}

.di-line--repayment {
  border-left-color: var(--heritage-purple, #5B2C8A);
  background: rgba(91, 44, 138, 0.05);
}

.di-line--merge-fee {
  border-left-color: var(--heritage-gold, #D4A843);
  background: rgba(212, 168, 67, 0.07);
}

.di-line--fee {
  border-left-color: #2a7f8f;
  background: rgba(42, 127, 143, 0.06);
}

/* Table rows: tint the cells, since <tr> backgrounds are unreliable
   once cell backgrounds are set elsewhere in the deductions grid. */
tr.di-line--repayment > td { background: rgba(91, 44, 138, 0.05); }
tr.di-line--merge-fee > td { background: rgba(212, 168, 67, 0.07); }
tr.di-line--fee > td { background: rgba(42, 127, 143, 0.06); }

tr.di-line--repayment > td:first-child { box-shadow: inset 3px 0 0 var(--heritage-purple, #5B2C8A); }
tr.di-line--merge-fee > td:first-child { box-shadow: inset 3px 0 0 var(--heritage-gold, #D4A843); }
tr.di-line--fee > td:first-child { box-shadow: inset 3px 0 0 #2a7f8f; }

.di-line__kind-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-soft, #555);
  white-space: nowrap;
}

/* ── Foot bar (sticky) ───────────────────────────────── */

.di-foot-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle, #ececec);
  border-radius: 0 0 var(--radius, 8px) var(--radius, 8px);
  background: var(--surface-elevated, #fafafa);
  box-shadow: var(--shadow-sm, 0 -2px 6px rgba(0, 0, 0, 0.05));
  font-size: 0.86rem;
  /* keep clear of iOS home indicator when it pins to the viewport bottom */
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.di-foot-bar__label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-mute, #777);
  margin-right: auto;
}

.di-foot-bar__total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink, #1a1a1a);
}

.di-foot-bar__variance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-soft, #555);
}

.di-foot-bar__variance--ok {
  background: rgba(45, 140, 60, 0.14);
  color: var(--success-deep, #2d8c3c);
}

.di-foot-bar__variance--fail {
  background: rgba(192, 57, 43, 0.14);
  color: var(--danger, #c0392b);
}

.di-foot-bar--fail { border-top-color: rgba(192, 57, 43, 0.45); }

/* ── Merge-fee card ──────────────────────────────────── */

.di-merge-fee-card {
  border: 1px solid var(--border-subtle, #ececec);
  border-left: 3px solid var(--heritage-gold, #D4A843);
  border-radius: var(--radius, 8px);
  background: var(--surface, #fff);
  padding: 12px 14px;
  margin: 12px 0;
}

.di-merge-fee-card__title {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-mute, #777);
}

.di-merge-fee-card__amount {
  font-size: 1.12rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink, #1a1a1a);
}

.di-merge-fee-card__basis {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(212, 168, 67, 0.18);
  color: #8a6a1f;
}

.di-merge-fee-card__context {
  margin: 8px 0 0;
  font-size: 0.79rem;
  line-height: 1.5;
  color: var(--text-mute, #777);
  font-variant-numeric: tabular-nums;
}

.di-merge-fee-card__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.di-merge-fee-card__hint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--ink-faint, #999);
}

/* ── PO invoice suggestion ───────────────────────────── */

.di-po-suggest {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px dashed var(--border-soft, #e6e6e6);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-elevated, #fafafa);
  margin: 8px 0;
  font-size: 0.85rem;
  line-height: 1.45;
}

.di-po-suggest__check {
  flex: 0 0 auto;
  margin-top: 2px;
  cursor: pointer;
}

.di-po-suggest__body { flex: 1 1 auto; min-width: 0; }

.di-po-suggest__value {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-weight: 700;
  color: var(--ink, #1a1a1a);
  overflow-wrap: anywhere;
}

.di-po-suggest__source {
  display: block;
  margin-top: 2px;
  font-size: 0.76rem;
  color: var(--text-mute, #777);
}

.di-po-suggest__hint {
  display: block;
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--ink-faint, #999);
}

.di-po-suggest--empty {
  border-style: solid;
  border-color: rgba(212, 168, 67, 0.38);
  background: rgba(212, 168, 67, 0.07);
  color: #8a6a1f;
}

/* ── Workbook tab pill ───────────────────────────────── */

.di-sheet-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle, #ececec);
  background: rgba(0, 0, 0, 0.04);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-soft, #555);
  vertical-align: middle;
}

.di-sheet-pill__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 18ch;
}

.di-sheet-pill__icon { flex: 0 0 auto; opacity: 0.75; }

.di-sheet-pill--ambiguous {
  border-color: rgba(212, 168, 67, 0.45);
  background: rgba(212, 168, 67, 0.18);
  color: #8a6a1f;
}

/* ── Mobile (≤ 380px safe) ───────────────────────────── */

@media (max-width: 480px) {
  .di-flag-item {
    grid-template-columns: 1fr;
  }

  .di-flag-item__code,
  .di-flag-item__detail,
  .di-flag-item__resolution,
  .di-flag-item__meta {
    grid-column: 1;
  }

  .di-flag-item__code { justify-self: start; }

  .di-foot-bar {
    justify-content: flex-start;
    gap: 8px 12px;
    font-size: 0.82rem;
  }

  .di-foot-bar__label {
    margin-right: 0;
    flex: 1 0 100%;
  }

  .di-flag-drawer,
  .di-merge-fee-card { padding: 10px 11px; }

  .di-merge-fee-card__actions { gap: 8px; }

  .di-merge-fee-card__actions > * { flex: 1 1 auto; }

  .di-sheet-pill__name { max-width: 12ch; }

  .di-ready-banner { padding: 10px 11px; }
}

/* ── Dark mode ───────────────────────────────────────── */
/* Surface/text/border tokens are retokenized globally by
   90-dark-mode.css, so only the hardcoded tints + literal colors
   defined above need overriding here. */

[data-theme="dark"] .di-flag-chip {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary, #cfcfcf);
}

[data-theme="dark"] .di-flag-chip--blocking {
  background: rgba(255, 107, 107, 0.18);
  border-color: rgba(255, 107, 107, 0.34);
  color: #ff8f8f;
}

[data-theme="dark"] .di-flag-chip--warn {
  background: rgba(212, 168, 67, 0.22);
  border-color: rgba(212, 168, 67, 0.42);
  color: #e8c877;
}

[data-theme="dark"] .di-flag-chip--cleared {
  background: rgba(80, 200, 110, 0.18);
  border-color: rgba(80, 200, 110, 0.34);
  color: #7fd694;
}

[data-theme="dark"] .di-flag-item--blocking { background: rgba(255, 107, 107, 0.09); }

[data-theme="dark"] .di-flag-item--blocking { border-left-color: #ff8f8f; }

[data-theme="dark"] .di-flag-item--warn { background: rgba(212, 168, 67, 0.10); }

[data-theme="dark"] .di-flag-item__code {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary, #cfcfcf);
}

[data-theme="dark"] .di-ready-banner--blocked {
  background: rgba(255, 107, 107, 0.10);
  border-left-color: #ff8f8f;
}

[data-theme="dark"] .di-ready-banner--blocked .di-ready-banner__title { color: #ff8f8f; }

[data-theme="dark"] .di-ready-banner--ok {
  background: rgba(80, 200, 110, 0.10);
  border-left-color: #7fd694;
}

[data-theme="dark"] .di-ready-banner--ok .di-ready-banner__title { color: #7fd694; }

[data-theme="dark"] .di-line--repayment,
[data-theme="dark"] tr.di-line--repayment > td { background: rgba(155, 110, 214, 0.11); }

[data-theme="dark"] .di-line--repayment { border-left-color: #9b6ed6; }

[data-theme="dark"] tr.di-line--repayment > td:first-child { box-shadow: inset 3px 0 0 #9b6ed6; }

[data-theme="dark"] .di-line--merge-fee,
[data-theme="dark"] tr.di-line--merge-fee > td { background: rgba(212, 168, 67, 0.13); }

[data-theme="dark"] .di-line--fee,
[data-theme="dark"] tr.di-line--fee > td { background: rgba(90, 190, 205, 0.11); }

[data-theme="dark"] .di-line--fee { border-left-color: #5abecd; }

[data-theme="dark"] tr.di-line--fee > td:first-child { box-shadow: inset 3px 0 0 #5abecd; }

[data-theme="dark"] .di-line__kind-tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary, #cfcfcf);
}

[data-theme="dark"] .di-foot-bar {
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .di-foot-bar__variance {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary, #cfcfcf);
}

[data-theme="dark"] .di-foot-bar__variance--ok {
  background: rgba(80, 200, 110, 0.18);
  color: #7fd694;
}

[data-theme="dark"] .di-foot-bar__variance--fail {
  background: rgba(255, 107, 107, 0.18);
  color: #ff8f8f;
}

[data-theme="dark"] .di-foot-bar--fail { border-top-color: rgba(255, 107, 107, 0.45); }

[data-theme="dark"] .di-merge-fee-card__basis {
  background: rgba(212, 168, 67, 0.22);
  color: #e8c877;
}

[data-theme="dark"] .di-po-suggest--empty {
  background: rgba(212, 168, 67, 0.11);
  border-color: rgba(212, 168, 67, 0.42);
  color: #e8c877;
}

[data-theme="dark"] .di-sheet-pill {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary, #cfcfcf);
}

[data-theme="dark"] .di-sheet-pill--ambiguous {
  background: rgba(212, 168, 67, 0.20);
  border-color: rgba(212, 168, 67, 0.45);
  color: #e8c877;
}
/* Source-linked PDF review stays inside the Redemption SPA. */
.dp-pdf-review { margin-block: 1rem; border: 1px solid var(--border); padding: 1rem; border-radius: 12px; }
.dp-review-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.dp-review-layout { display: grid; grid-template-columns: minmax(280px, 42%) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; }
.dp-review-source { position: sticky; top: 5rem; align-self: start; min-width: 0; }
.dp-review-source img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; background: white; border: 1px solid var(--border); margin-top: .5rem; }
.dp-review-editor { min-width: 0; max-height: 75vh; overflow-y: auto; padding-inline-end: .4rem; }
.dp-review-row,.dp-review-line { border: 1px solid var(--border); border-radius: 8px; padding: .8rem; margin-block: .75rem; }
.dp-review-flagged { border-inline-start: 4px solid var(--warning, #b7791f); }
.dp-review-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .6rem; }
.dp-pdf-review label { display: flex; flex-direction: column; gap: .25rem; margin-block: .5rem; font-size: .85rem; }
.dp-pdf-review input,.dp-pdf-review textarea,.dp-pdf-review select { width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; }
.dp-review-invalid { outline: 2px solid var(--warning, #b7791f); }
.dp-pdf-review pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 200px; overflow: auto; font-size: .8rem; }
.dp-review-issues { font-size: .85rem; color: var(--text-secondary); }
@media(max-width: 1000px) { .dp-review-layout { grid-template-columns: 1fr; } .dp-review-source { position: static; } .dp-review-source img { max-height: 42vh; } }
@media(max-width: 480px) { .dp-review-fields { grid-template-columns: 1fr; } .dp-pdf-review { padding: .5rem; } }
/* FB-408: say why Import is locked; bulk attestation stays server-validated. */
.dp-review-blockers { margin-block: .75rem; padding: .75rem 1rem; border: 1px solid var(--warning, #b7791f); border-radius: 10px; background: var(--surface-2, rgba(183,121,31,.06)); }
.dp-review-blockers.dp-review-ready { border-color: var(--success-deep, #1c6b45); }
.dp-review-blockers ul { margin: .25rem 0 .5rem 1.1rem; padding: 0; }
.dp-review-bulk { border-top: 1px solid var(--border); padding-top: .6rem; margin-top: .6rem; }
.dp-review-bulk pre { max-height: 120px; }
/* Cooking Floor badge sign-in + Letter print sheet (floor-badges.js). Own file so the
   tablet palette pin in 64-production-floor.css is untouched. Print is black on white. */
.pf-badge-scan-btn { width: 100%; margin: 0 0 12px; min-height: 56px; }
.pf-badge-scanner video { width: 100%; max-height: 50vh; background: black; border-radius: 8px; }
.pf-badge-page { padding: 16px; max-width: 1100px; margin: 0 auto; }
.pf-badge-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pf-badge-msg.is-error { color: var(--danger, firebrick); }
.pf-badge-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.pf-badge-table th, .pf-badge-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border, lightgray); vertical-align: middle; }
.pf-badge-table tr.is-inactive { opacity: .55; }
.pf-badge-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pf-badge-print-bar { display: flex; align-items: center; gap: 12px; margin: 16px 0 8px; }
.pf-badge-sheet { display: grid; grid-template-columns: repeat(3, 2.5in); gap: 0; justify-content: center; }
.pf-badge-card { box-sizing: border-box; width: 2.5in; height: 3.3in; padding: .15in; border: 1px dashed gray; text-align: center; background: white; color: black; break-inside: avoid; page-break-inside: avoid; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pf-badge-card-qr svg { width: 1.7in; height: 1.7in; display: block; }
.pf-badge-card-name { font-size: 16pt; margin: .08in 0 0; line-height: 1.1; }
.pf-badge-card-ini { font-size: 20pt; font-weight: 700; margin: .02in 0 0; letter-spacing: .05em; }
.pf-badge-card-plant { font-size: 10pt; margin: 0 0 .05in; text-transform: uppercase; letter-spacing: .1em; }
@media print {
  @page { size: letter; margin: .4in; }
  body.pf-printing-badges * { visibility: hidden; }
  body.pf-printing-badges .pf-badge-sheet, body.pf-printing-badges .pf-badge-sheet * { visibility: visible; }
  body.pf-printing-badges .pf-badge-sheet { position: absolute; left: 0; top: 0; }
}
/* ── FB #556: "Still there?" before the floor tablet's idle sign-out ─────────
   pf-idle-warn.js, PF_IDLE_WARN (default on). Read at arm's length on a
   plant-floor tablet: big title, big countdown, one full-width button. The
   whole dimmed area is the tap target; any tap keeps the person signed in. */
.pf-idle-warn {
  position: fixed; inset: 0; z-index: 1300;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(20, 24, 32, .6);
  cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pf-idle-warn.is-leaving { opacity: 0; transition: opacity .2s ease; }
.pf-idle-warn-card {
  width: min(600px, 100%);
  background: var(--surface, #fff); color: var(--text, #1a1a1a);
  border-radius: 20px; padding: 32px 28px 28px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .35);
}
.pf-idle-warn-title { margin: 0 0 10px; font-size: 44px; font-weight: 800; line-height: 1.15; }
.pf-idle-warn-body { margin: 0; font-size: 24px; line-height: 1.35; color: var(--text, #1a1a1a); }
.pf-idle-warn-clock {
  margin: 8px 0 22px;
  font-size: 88px; font-weight: 800; line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--brand-red, #b3261e);
}
.pf-idle-warn-stay {
  display: block; width: 100%; min-height: 96px; padding: 12px 16px;
  border: 0; border-radius: 14px;
  background: var(--brand-red, #b3261e); color: #fff;
  font-size: 30px; font-weight: 800; line-height: 1.2;
  cursor: pointer;
}
@media (max-width: 480px) {
  .pf-idle-warn-card { padding: 24px 18px 20px; }
  .pf-idle-warn-title { font-size: 34px; }
  .pf-idle-warn-body { font-size: 20px; }
  .pf-idle-warn-clock { font-size: 68px; }
  .pf-idle-warn-stay { min-height: 80px; font-size: 24px; }
}
/* Cooking Floor lead records (2026-10-08, Option A) — read-only Records on the
   gloved floor tablet for a designated floor lead (pf-lead-records.js).
   Every tap target here is >= 56px (the floor's gloved-tap minimum). */
.pf-who-records { min-height: 56px; font-weight: 700; }
.pfg-shiftbtn.pfg-records { min-height: 56px; display: inline-flex; align-items: center; justify-content: center; background: #fff; color: var(--pfg-ink-strong, #1d2b36); border-color: #fff; }

.pfr-tablet { font-size: 1.05rem; }
.pfr-tab-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pfr-tab-title { flex: 1 1 260px; }
.pfr-tab-title h1 { margin: 0; font-size: 1.5rem; }
.pfr-tab-title p { margin: 4px 0 0; }
.pfr-tab-ro { font-weight: 700; padding: 8px 14px; border-radius: 999px; background: var(--surface-muted, rgba(0,0,0,0.06)); }
.pfr-tab-btn { min-height: 56px; min-width: 56px; padding: 0 20px; font-size: 1.05rem; font-weight: 700; }
.pfr-tab-back { min-width: 200px; }
.pfr-tablet .pfr-field select, .pfr-tablet .pfr-field input { min-height: 56px; font-size: 1.05rem; }
.pfr-tablet .pfr-preset, .pfr-tablet .pfr-chip { min-height: 56px; padding: 8px 18px; font-size: 1rem; }
.pfr-tablet .pfr-actions .btn, .pfr-tablet .pfr-pager .btn { min-height: 56px; min-width: 56px; padding: 0 20px; }
.pfr-tablet .pfr-sort { min-height: 56px; }
.pfr-tablet .pfr-table td { padding: 14px 10px; }
.pfr-tablet .pfr-tr { min-height: 56px; }
.pfr-tablet .pfr-ev { padding: 12px; }

/* Manager Setup panel → Floor leads. */
.pf-lead-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.pf-lead-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border, rgba(0,0,0,0.08)); }
.pf-lead-tag { font-size: 0.8rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--status-success-bg, #e6f4ea); color: var(--status-success, #2e7d32); }

/* Lead plant feedback (2026-10-13, pf-lead-feedback.js). Read-only list. */
.pfr-tab-feedback { min-width: 180px; }
.pflf-list { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 12px; }
.pflf-item { border: 1px solid var(--border, rgba(0,0,0,0.12)); border-radius: 10px; padding: 14px 16px; background: var(--surface, #fff); }
.pflf-item.pflf-done { opacity: 0.85; }
.pflf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pflf-status { font-weight: 700; font-size: 0.9rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-muted, rgba(0,0,0,0.06)); }
.pflf-status-implemented { background: var(--status-success-bg, #e6f4ea); color: var(--status-success, #2e7d32); }
.pflf-status-new, .pflf-status-reopened { background: #fff4e5; color: #8a4b00; }
.pflf-msg { margin: 8px 0; white-space: pre-wrap; font-size: 1.05rem; }
.pflf-shots { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.pflf-shot img { max-height: 160px; max-width: 240px; border-radius: 6px; border: 1px solid var(--border, rgba(0,0,0,0.12)); }
.pflf-reply { margin-top: 8px; padding: 10px 12px; border-left: 4px solid var(--brand, #cc0000); background: var(--surface-muted, rgba(0,0,0,0.04)); white-space: pre-wrap; }
.pflf-noreply { margin-top: 6px; }
.pfr-tablet .pflf-tab { min-height: 56px; }
.pfr-dailylog { margin-top: 8px; }
.pfr-dl-saved ul { margin: 6px 0 0; padding-left: 18px; }
/* ── FB #500: swipe between cooking lines (pf-line-swipe.js) ───────────────
   "Line 2 of 3" with dots, on the classic tablet and the guided line board.
   Display only: the line chips / Change line stay the buttons. Shown only
   when a work center has 2+ physical lines and the tablet is not bound to one. */
.pf-lineswipe {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px;
  margin: 0 0 10px; padding: 8px 14px; border-radius: 12px;
  background: #3a4353; color: #fff; font-weight: 800; user-select: none;
}
.pf-lineswipe-arrow { font-size: 28px; line-height: 1; min-width: 14px; text-align: center; opacity: .85; }
.pf-lineswipe-dots { display: inline-flex; gap: 8px; align-items: center; }
.pf-lineswipe-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, .35); }
.pf-lineswipe-dot.is-on { background: #fff; transform: scale(1.25); }
.pf-lineswipe-pos { font-size: 18px; }
/* The next line is being read (classic swipe / chip): dimmed until it lands. */
.pf-lineswipe.is-busy { opacity: .6; transition: opacity .15s; }
.pf-lineswipe-hint { order: 1; flex-basis: 100%; text-align: center; font-size: 13px; font-weight: 600; opacity: .85; }
/* PR #355 (2026-10-27 decision): the bar stays pinned at the top while the
   operator scrolls. position: sticky keeps it in the flow, so nothing moves
   when it pins (no layout shift). z-index 20 keeps it under the shell top bar
   (60) and its menus, the guided top bar (30), sheets (1200) and toasts (9100).
   Classic: the window scrolls, so it pins just under the shell's sticky top bar
   (same height formula as 03-shell.css / 02-layout.css, and 46-system-status.css
   while a status banner is up). A floor kiosk (#view.pf-kiosk-root) has no
   shell top bar: it pins at the top safe-area edge. */
.pf-tablet > .pf-lineswipe {
  position: -webkit-sticky; position: sticky; z-index: 20;
  top: calc(var(--header-h, 72px) + env(safe-area-inset-top, 0px) + 2px);
}
html.has-system-status .pf-tablet > .pf-lineswipe { top: calc(var(--ssb-height, 0px) + var(--header-h, 72px) + 6px); }
#view.pf-kiosk-root .pf-tablet > .pf-lineswipe { top: env(safe-area-inset-top, 0px); }
/* Guided board: a direct child of the scrolling .pfg-main (above the board
   title), so it pins just under the guided top bar, full width. A sticky box
   pins inside the scroller's padding, so top is minus .pfg-main's 10px top
   padding (64-production-floor-pages.css): flush under the top bar, no strip
   of scrolling cards above it. */
.pfg-main > .pf-lineswipe {
  position: -webkit-sticky; position: sticky; z-index: 20; top: -10px;
  flex: 0 0 auto; margin: 0;
}
/* A control brought into view (focus, scrollIntoView) never lands under the
   pinned bar: the scroll area keeps the bar's height (plus the top bar) clear
   at the top. --pf-lineswipe-room is the bar's tallest height in any locale
   at this width, plus a small gap. */
html:has(.pf-tablet > .pf-lineswipe), .pfg-main:has(> .pf-lineswipe) { --pf-lineswipe-room: 56px; }
@media (max-width: 899px) {
  html:has(.pf-tablet > .pf-lineswipe), .pfg-main:has(> .pf-lineswipe) { --pf-lineswipe-room: 80px; }
}
html:has(.pf-tablet > .pf-lineswipe) { scroll-padding-top: calc(var(--header-h, 72px) + env(safe-area-inset-top, 0px) + 2px + var(--pf-lineswipe-room)); }
html.has-system-status:has(.pf-tablet > .pf-lineswipe) { scroll-padding-top: calc(var(--ssb-height, 0px) + var(--header-h, 72px) + 6px + var(--pf-lineswipe-room)); }
html:has(#view.pf-kiosk-root .pf-tablet > .pf-lineswipe) { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + var(--pf-lineswipe-room)); }
.pfg-main:has(> .pf-lineswipe) { scroll-padding-top: var(--pf-lineswipe-room); }
@media (min-width: 900px) {
  .pf-lineswipe-hint { flex-basis: auto; }
}
/* PR #355 follow-up (2026-10-27 decision): in portrait the hint is its own second
   row. Once the bar is pinned (is-pinned, set by pf-line-swipe.js) the hint
   hides so the pinned bar is one row; the script adds the freed height to the
   bar's bottom margin, so nothing below it moves. Unpinned, the hint shows. */
@media (max-width: 899px) {
  .pf-lineswipe.is-pinned .pf-lineswipe-hint { display: none; }
}
/* PR #355 follow-up: pinned, the bar has square corners. With rounded corners
   the outline of a card scrolling under it showed beside them (768x1024). */
.pf-lineswipe.is-pinned { border-radius: 0; }
/* ═══════════════════════════════════════════════════════════════════════════
   Cooking Floor — GUIDED PAGES (opt-in per tablet, pf-guided.js).
   Every selector is .pfg-* and only exists inside .pfg-root, which only renders
   when this browser's localStorage pf.ui === 'pages'. Classic screens are not
   touched by any rule here. Palette = AIOP tokens (00-reset.css) as used by the
   sibling prototype (scratch/pf-pages-proto-20261006/proto/app.css).
   Glove floor: 64px for every control, 96px for the one primary action.
   ═══════════════════════════════════════════════════════════════════════════ */
.pfg-root {
  --pfg-red: #CC0000; --pfg-red-dark: #8B0000; --pfg-ink: #2C2520; --pfg-ink-strong: #1A1410;
  --pfg-paper: #FBF6EC; --pfg-surface: #FFFDF8; --pfg-rule: #E5D9C4; --pfg-mute: #6B6560;
  --pfg-ok: #2D8C3C; --pfg-warn: #C68A1F; --pfg-danger: #C0392B; --pfg-tap: 64px;
  font-size: 17px; color: var(--pfg-ink); background: var(--pfg-paper);
  /* One screen (Kevin 2026-10-06, tablet fit): top bar + scrolling main +
     pinned footer. 100vh first, 100dvh where the browser knows it. */
  height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
}
.pfg-root button { font: inherit; cursor: pointer; }
.pfg-root button:disabled { cursor: not-allowed; }
.pfg-root h1 { margin: 0 0 4px; font-size: 1.5rem; line-height: 1.2; }
.pfg-root h2 { margin: 0 0 8px; font-size: 1.15rem; }
.pfg-muted { color: var(--pfg-mute); }
.pfg-small { font-size: .85rem; }
.pfg-main {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  width: 100%; max-width: 1180px; margin: 0 auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px;
}

/* buttons */
.pfg-btn {
  min-height: var(--pfg-tap); padding: 10px 20px; border-radius: 12px; font-weight: 700; font-size: 1.05rem;
  border: 2px solid var(--pfg-ink); background: var(--pfg-surface); color: var(--pfg-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.pfg-btn-primary { background: var(--pfg-red); border-color: var(--pfg-red); color: #fff; }
.pfg-btn-sm { min-height: var(--pfg-tap); font-size: .95rem; }
.pfg-off { background: #FFF5E6; border-color: var(--pfg-warn); color: #6b4300; }
.pfg-primary {
  width: 100%; min-height: 96px; border-radius: 16px; border: 0; background: var(--pfg-red); color: #fff;
  font-size: 1.6rem; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 12px;
  box-shadow: 0 3px 0 rgba(0,0,0,.18);
}
.pfg-primary:active { background: var(--pfg-red-dark); }
.pfg-primary.is-locked { background: #E4D2B5; color: var(--pfg-ink); box-shadow: none; }
.pfg-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }

/* top bar */
.pfg-topbar { flex: 0 0 auto; position: relative; z-index: 30; background: var(--pfg-ink-strong); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.pfg-tb-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 10px; flex-wrap: wrap; }
.pfg-tb-row2 { border-top: 1px solid rgba(255,255,255,.12); align-items: stretch; flex-wrap: nowrap; }
.pfg-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 1.05rem; min-width: 0; }
.pfg-crumb { color: #E9DFCF; }
.pfg-crumb.is-strong { color: #fff; font-weight: 800; }
/* FB #420: the cooker crumb on a batch page is a button (set / change the cooker). */
.pfg-crumb-tank { font: inherit; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.45); border-radius: 10px; padding: 6px 12px; min-height: var(--pfg-tap); cursor: pointer; } /* M-80: the file's 64px glove floor (was 44px) */
.pfg-crumb-tank:active { background: rgba(255,255,255,.25); }
.pfg-sep { color: #8b7f70; }
.pfg-tb-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pfg-alerts, .pfg-classic, .pfg-lang button {
  min-height: var(--pfg-tap); min-width: var(--pfg-tap); border-radius: 10px; border: 2px solid rgba(255,255,255,.35);
  background: transparent; color: #fff; font-weight: 700; padding: 0 12px;
}
.pfg-alerts.has { border-color: var(--pfg-warn); color: #FFD27A; }
.pfg-alerts.is-red { border-color: #ff6b5b; color: #ffb3aa; background: rgba(192,57,43,.25); }
.pfg-classic { background: #fff; color: var(--pfg-ink-strong); border-color: #fff; }
.pfg-op { font-weight: 700; padding: 0 4px; }
.pfg-shift { display: inline-flex; gap: 6px; }
.pfg-shiftbtn {
  min-height: var(--pfg-tap, 48px); padding: 0 12px; border-radius: 10px; font: inherit; font-weight: 700; font-size: .95rem;
  background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.5); cursor: pointer; white-space: nowrap;
}
.pfg-shiftbtn:active { background: rgba(255,255,255,.15); }
.pfg-net { font-weight: 700; font-size: .95rem; padding: 0 4px; }
.pfg-net.is-on { color: #8BE39A; }
.pfg-net.is-off { color: #fff; background: var(--pfg-danger); border-radius: 8px; padding: 6px 10px; }
/* M-34: the server answered with an error: "not updated since", not offline. */
.pfg-net.is-stale { color: #1d1206; background: #F2C46D; border-radius: 8px; padding: 6px 10px; }
.pfg-tb-cell { display: flex; flex-direction: column; justify-content: center; min-height: var(--pfg-tap); padding: 4px 10px; border-radius: 10px; background: rgba(255,255,255,.06); flex: 1 1 0; min-width: 0; color: #fff; border: 0; text-align: left; }
.pfg-tb-cell small { color: #BFB3A2; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.pfg-tb-val { font-weight: 800; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; }
button.pfg-tb-next { background: var(--pfg-red); }
.pfg-hold b { font-variant-numeric: tabular-nums; font-size: 1.2rem; }
.pfg-hold small { color: #E9DFCF; text-transform: none; letter-spacing: 0; }
.pfg-lang { display: flex; gap: 4px; flex: 0 0 auto; }
.pfg-lang button { min-width: 52px; padding: 0 8px; }
.pfg-lang button.is-on { background: #fff; color: var(--pfg-ink-strong); }
.pfg-alertlist { padding: 6px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
/* M-35: the list collapses (display:flex above used to override [hidden]). */
.pfg-alertlist[hidden] { display: none; }
.pfg-alert { padding: 10px 12px; border-radius: 8px; font-weight: 700; }
.pfg-alert.is-red { background: var(--pfg-danger); }
.pfg-alert.is-amber { background: #8a5a00; }

/* cards */
.pfg-card { background: var(--pfg-surface); border: 1px solid var(--pfg-rule); border-radius: 16px; padding: 14px 16px; box-shadow: 0 4px 12px rgba(60,40,20,.08); }
.pfg-center { text-align: center; }
.pfg-help { font-size: 1.1rem; line-height: 1.4; margin: 2px 0 8px; }
.pfg-linepick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.pfg-line { flex-direction: column; min-height: 96px; }
.pfg-line small { font-weight: 600; color: var(--pfg-mute); }

/* line board */
.pfg-boardhead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.pfg-boardhead p { margin: 0; flex: 1 1 260px; }
.pfg-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.pfg-cooker {
  display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 16px; min-height: 240px;
  background: var(--pfg-surface); border: 2px solid var(--pfg-rule); border-left-width: 10px; border-radius: 16px; color: var(--pfg-ink);
}
.pfg-cooker.is-idle { opacity: .85; }
.pfg-cc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pfg-cc-num { font-size: 1.5rem; font-weight: 850; }
.pfg-pill { padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: .9rem; background: #eee; }
.pfg-cc-timer { display: flex; flex-direction: column; }
.pfg-cc-timer b { font-size: 2.2rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pfg-cc-timer small { color: var(--pfg-mute); }
.pfg-cc-prog { height: 10px; background: #EFE6D6; border-radius: 6px; overflow: hidden; display: block; }
.pfg-cc-prog i { display: block; height: 100%; background: var(--pfg-ok); }
.pfg-cc-ratio { font-size: .9rem; color: var(--pfg-mute); }
.pfg-cc-next { margin-top: auto; padding: 10px 12px; background: #FBEDEA; border-radius: 10px; display: flex; flex-direction: column; }
.pfg-cc-next small { color: var(--pfg-red); font-weight: 800; text-transform: uppercase; font-size: .78rem; }
.pfg-cc-next b { font-size: 1.1rem; }
.pfg-cc-others { font-size: .9rem; color: var(--pfg-mute); }
.st-mixing { border-left-color: #5B2C8A; } .pfg-pill.st-mixing { background: #EDE3F6; color: #5B2C8A; }
.st-cooking { border-left-color: var(--pfg-red); } .pfg-pill.st-cooking { background: #FBE0DD; color: #8B0000; }
.st-qcwait { border-left-color: var(--pfg-warn); } .pfg-pill.st-qcwait { background: #FFF0D2; color: #6b4300; }
.st-qchold { border-left-color: var(--pfg-warn); } .pfg-pill.st-qchold { background: #FFF0D2; color: #6b4300; }
.st-cooling { border-left-color: #1F6FB2; } .pfg-pill.st-cooling { background: #DCEBF8; color: #134a78; }
.st-filling { border-left-color: var(--pfg-ok); } .pfg-pill.st-filling { background: #DDF1E0; color: #1F6B2B; }
.st-done { border-left-color: #9a9a9a; } .pfg-pill.st-done { background: #eee; color: #444; }
.pfg-unassigned { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
/* pf-ux-earlier (FB #422): Earlier batches · Fix a time */
.pfg-earlier-entry { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.pfg-earlier-btn { min-height: var(--pfg-tap); font-size: 1.1rem; }
.pfg-earlier-btn.is-carryover, .pfg-earlier-carry { border-color: var(--pfg-warn); }
.pfg-earlier-carry { margin: 0; padding: 8px 12px; border-radius: 10px; background: #FFF5E6; color: #6b4300; font-weight: 800; border: 2px solid var(--pfg-warn); }
.pfg-earlier-run { margin-top: 12px; }
.pfg-earlier-run.is-carryover { border: 2px dashed var(--pfg-warn); background: #FFF8EC; }
.pfg-earlier-run h2 { margin: 0 0 8px; font-size: 1.2rem; }
.pfg-earlier-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pfg-earlier-row { min-height: var(--pfg-tap); flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; border-left-width: 8px; }
.pfg-earlier-row small { font-weight: 600; color: #555; }
.pfg-carry-banner { flex: 0 0 auto; padding: 8px 12px; border-radius: 10px; background: #FFF5E6; border: 2px solid var(--pfg-warn); color: #6b4300; font-weight: 800; }

/* batch page */
.pfg-strip { flex: 0 0 auto; display: flex; gap: 5px; overflow-x: auto; overscroll-behavior-x: contain; scroll-behavior: smooth; padding: 2px 2px 4px; }
.pfg-chip {
  flex: 1 1 0; min-width: 62px; min-height: 64px; overflow-wrap: normal; hyphens: auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 10px; border: 2px solid var(--pfg-rule); background: var(--pfg-surface); color: var(--pfg-ink); padding: 4px; font-size: .85rem;
}
.pfg-chip .n { font-weight: 850; }
.pfg-chip .l { font-weight: 700; text-align: center; line-height: 1.1; }
.pfg-chip .tm { font-variant-numeric: tabular-nums; color: var(--pfg-mute); }
.pfg-chip.is-done { background: #EAF5EC; border-color: #9FD3A8; }
.pfg-chip.is-current { background: var(--pfg-red); color: #fff; border-color: var(--pfg-red); }
.pfg-chip.is-current .tm { color: #fff; }
.pfg-chip.is-future { opacity: .45; border-style: dashed; }
.pfg-chip.is-viewing { outline: 4px solid var(--pfg-ink-strong); outline-offset: 1px; }
.pfg-stepmeta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--pfg-mute); font-weight: 700; margin-bottom: 6px; }
.pfg-tag { background: var(--pfg-ink-strong); color: #fff; padding: 4px 10px; border-radius: 8px; }
.pfg-tag.is-ro { background: #4a5a6a; }
.pfg-facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 10px; }
.pfg-fact { background: var(--pfg-paper); border: 1px solid var(--pfg-rule); border-radius: 10px; padding: 6px 12px; display: flex; flex-direction: column; }
.pfg-fact small { color: var(--pfg-mute); font-weight: 700; }
/* pf-pi-ui (2026-10-09, audit #7): "N special instructions" pointer under the
   primary button. At 1024x768 the specials block starts below the fold; this
   says it is there and scrolls to it. Secondary look, amber like the block. */
.pfg-specials-jump {
  width: 100%; min-height: var(--pfg-tap); margin-top: 10px; border-radius: 12px;
  border: 2px solid var(--pfg-warn); background: var(--pfg-surface); color: #8a5a00;
  font-size: 1.1rem; font-weight: 800;
}
.pfg-holdbox { border-radius: 12px; padding: 8px 14px; margin: 4px 0 10px; display: flex; flex-direction: column; background: #FFF0D2; }
.pfg-holdbox.is-cook { background: #FBE0DD; }
.pfg-holdbox.is-warn { background: #FFE2A8; }
.pfg-holdbox.is-over { background: var(--pfg-danger); color: #fff; }
.pfg-big { font-size: 2.3rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pfg-refusal { border: 3px solid var(--pfg-danger); background: #FDECEA; border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.pfg-refusal b { color: var(--pfg-danger); font-size: 1.2rem; }
.pfg-refusal p { margin: 6px 0 0; font-size: 1.1rem; }
.pfg-acks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.pfg-ack { display: flex; align-items: center; gap: 14px; min-height: var(--pfg-tap); padding: 8px 12px; border: 2px solid var(--pfg-rule); border-radius: 12px; font-size: 1.1rem; font-weight: 700; }
.pfg-ack input { width: 32px; height: 32px; }
.pfg-records { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.pfg-rec { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 1.15rem; font-weight: 700; }
.pfg-rec.is-struck { text-decoration: line-through; color: var(--pfg-mute); font-weight: 600; }
.pfg-rec-reason { font-weight: 600; color: var(--pfg-mute); text-decoration: none; }
/* FB #594: "Changed after QC · who · when" (amber tag, never struck). */
.pf-after-qc { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #FFF0D2; color: #7A4B00; font-size: 0.85rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.pfg-orig { border-top: 1px dashed var(--pfg-rule); padding-top: 6px; }
.pfg-notank { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #FFF0D2; border-radius: 12px; font-weight: 700; }
/* Back / Something's off: pinned to the bottom of the screen, never scrolled away. */
.pfg-foot {
  flex: 0 0 auto; display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--pfg-paper);
  border-top: 1px solid var(--pfg-rule); box-shadow: 0 -4px 12px rgba(60,40,20,.08);
}
.pfg-foot .pfg-btn { min-height: var(--pfg-tap); flex: 1 1 0; }

/* time chips sheet (inside the shared .pf-sheet) */
.pfg-qchips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0; }
.pfg-qchip {
  min-height: 80px; border-radius: 12px; border: 2px solid var(--border, #d8dbe0); background: var(--surface, #fff);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 1.15rem;
}
.pfg-qchip small { color: var(--muted, #6b7280); font-variant-numeric: tabular-nums; }
.pfg-qchip.is-on { border-color: #CC0000; background: #FBE0DD; }
/* FB #647 (PF_BACKENTRY_SEED): "N min ago" chips under the four main chips, smaller, 4 a row (3 on a phone). */
.pfg-agochips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 10px; }
.pfg-sheet .pfg-agochips .pfg-qchip { min-height: 64px; font-size: 1rem; }
.pfg-sheet .pfg-agochips .pfg-qchip b { font-size: 1.05rem; }
.pfg-sheet .pfg-agochips .pfg-qchip small[data-g-chiptime] { font-size: 1.1rem; }
@media (max-width: 520px) { .pfg-agochips { grid-template-columns: repeat(3, 1fr); } }
.pfg-will { font-weight: 800; font-size: 1.15rem; min-height: 1.4em; }
.pfg-sheet .pf-sheet-actions .btn:disabled { opacity: .5; }

/* tablet widths: 820 portrait / 1024 landscape */
@media (max-width: 900px) {
  .pfg-tb-row2 { flex-wrap: wrap; }
  .pfg-tb-row2 .pfg-tb-cell { flex: 1 1 30%; }
  .pfg-lang { flex: 1 1 100%; justify-content: flex-end; }
  .pfg-chip { font-size: .78rem; }
}
/* short landscape screens (1024x768 and below): tighter type, same tap sizes */
@media (max-height: 800px) {
  .pfg-root h1 { font-size: 1.35rem; }
  .pfg-help { font-size: 1.02rem; }
  .pfg-tb-cell small { font-size: .72rem; }
  .pfg-cooker { min-height: 0; padding: 12px 14px; }
  .pfg-primary { min-height: 80px; font-size: 1.45rem; }
  .pfg-facts { margin: 2px 0 8px; }
  .pfg-refusal { padding: 8px 12px; margin-bottom: 10px; }
  .pfg-refusal b { font-size: 1.1rem; }
  .pfg-refusal p { margin-top: 4px; font-size: 1.02rem; line-height: 1.3; }
}

/* ═══ GUIDED MODE CHROME (tablet fit, Kevin 2026-10-06) ═══════════════════
   "the modal should be more easily visible on tablet, it's usually cutoff".
   Only while a guided page is on screen (body:has(.pfg-root)); classic and
   every other module are untouched. The app header, search, footer and the
   floating chat/assistant buttons are hidden, the page itself never scrolls,
   and every sheet is centred INSIDE the visible viewport (keyboard included,
   via --pfg-vvh/--pfg-vvt from pf-guided.js) with its buttons pinned. */
body:has(.pfg-root) { overflow: hidden; --pfg-vh: 100vh; }
@supports (height: 100dvh) { body:has(.pfg-root) { --pfg-vh: 100dvh; } }
body:has(.pfg-root) .main > .topbar,
body:has(.pfg-root) .main > .app-footer,
body:has(.pfg-root) .sidebar,
body:has(.pfg-root) .sidebar-scrim,
body:has(.pfg-root) .agent-fab,
body:has(.pfg-root) .agent-fab-tooltip { display: none !important; }
/* The feedback button is the global report path and is never hidden
   (feedback-fab-fullscreen.test.js, Kevin 2026-07-31). In guided mode it moves
   into a reserved slot at the right end of the pinned footer, so it never sits
   on Save, the primary button or a hold timer. Under an open sheet it drops
   below the sheet's backdrop (still there, one tap away after the sheet). */
body:has(.pfg-root) .feedback-fab {
  right: calc(12px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 9001;
}
body:has(.pfg-root) .feedback-fab-tooltip {
  right: calc(12px + env(safe-area-inset-right, 0px));
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}
body:has(.pfg-root):has(.pf-sheet-backdrop) .feedback-fab { z-index: 1100; }
body:has(.pfg-root) .pfg-foot { padding-right: calc(72px + env(safe-area-inset-right, 0px)); }
body:has(.pfg-root) .app-shell { grid-template-columns: minmax(0, 1fr); min-height: 0; }
body:has(.pfg-root) .main { height: var(--pfg-vh); overflow: hidden; }
body:has(.pfg-root) .main > .content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0; max-width: none; margin: 0; }
/* Inside the app shell the root fills .content; on the floor kiosk root
   (main#view.pf-kiosk-root, no shell) it keeps its own 100dvh height. */
body:has(.pfg-root) .main > .content > .pfg-root { flex: 1 1 auto; min-height: 0; height: auto; }
body:has(.pfg-root) .toast-container { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

body:has(.pfg-root) .pf-sheet-backdrop {
  top: var(--pfg-vvt, 0px); bottom: auto; height: var(--pfg-vvh, var(--pfg-vh));
  align-items: center; padding: 12px;
}
body:has(.pfg-root) .pf-sheet {
  max-width: 760px; max-height: calc(var(--pfg-vvh, var(--pfg-vh)) - 24px);
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 18px; padding: 12px 16px 0; box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
body:has(.pfg-root) .pf-sheet-head { flex: 0 0 auto; margin-bottom: 6px; }
body:has(.pfg-root) .pf-sheet-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scroll-padding-bottom: 104px; /* a focused input is never parked under the pinned buttons */
}
body:has(.pfg-root) .pf-sheet-actions {
  position: sticky; bottom: 0; z-index: 2; margin-top: 8px;
  padding: 10px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface, #fff); box-shadow: 0 -10px 12px -8px rgba(0, 0, 0, .18);
}
body:has(.pfg-root) .pf-sheet-help { margin-bottom: 8px; }
body:has(.pfg-root) .pf-sheet-msg { min-height: 0; margin: 4px 0 0; }
body:has(.pfg-root) .pf-sheet-msg:empty { display: none; }
body:has(.pfg-root) .pf-time-display { margin: 2px 0; }
body:has(.pfg-root) .pf-time-big { font-size: 48px; }
body:has(.pfg-root) .pf-step-row { margin: 6px 0 8px; }
body:has(.pfg-root) .pf-chip-row { margin-bottom: 8px; }
body:has(.pfg-root) .pf-num-display { margin: 2px 0 8px; }
body:has(.pfg-root) .pf-keypad { gap: 8px; }
.pf-try-guided { min-height: 56px; }

/* 2026-10-07 start a run on guided pages: fits 1024x768 and 820x1180, no scroll to Confirm. */
.pfg-start-h { margin: 6px 0 4px; font-size: 1rem; font-weight: 800; }
.pfg-schips { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 4px 0 8px; max-height: 176px; overflow-y: auto; }
.pfg-schip { min-height: var(--pfg-tap, 64px); padding: 6px 10px; text-align: center; }
.pfg-schip:disabled { opacity: .45; }
.pfg-typemat { width: 100%; }
.pfg-typemat.is-on { border-color: #CC0000; background: #FBE0DD; }
.pfg-nchips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.pfg-nchip { min-width: var(--pfg-tap, 64px); min-height: var(--pfg-tap, 64px); border-radius: 12px; border: 2px solid var(--border, #d8dbe0); background: var(--surface, #fff); font-size: 1.3rem; font-weight: 800; }
.pfg-nchip.is-on { border-color: #CC0000; background: #FBE0DD; }
.pfg-sheet .pfg-start .pf-sheet-actions .btn { min-height: 96px; }
.pfg-start-msg:not(:empty) { color: var(--pfg-danger, #C0392B); font-weight: 800; }
.pfg-startbtn { min-height: 96px; }

/* 2026-10-07 guided polish. The sheet is a body-level portal (outside
   .pfg-root), so --pfg-* tokens are unset there: literal colours on purpose. */
.pfg-sheet .pfg-start .pf-sheet-actions [data-g-startgo] { background: #CC0000; border-color: #CC0000; color: #fff; font-weight: 800; }
.pfg-sheet .pfg-start .pf-sheet-actions [data-g-startgo]:disabled { background: #CC0000; color: #fff; }
.pfg-sheet .pfg-start .pf-sheet-actions [data-sheet-cancel] { background: #fff; border-color: #2C2520; color: #2C2520; }
.pfg-sheet .pfg-start .pfg-typemat { min-height: 64px; border: 2px solid #2C2520; border-radius: 12px; background: #FFFDF8; color: #2C2520; font-weight: 700; font-size: 1.05rem; }
.pfg-sheet .pfg-start .pfg-typemat.is-on { border-color: #CC0000; background: #FBE0DD; }
.pfg-nmore { padding: 0 14px; font-size: 1.05rem; }
/* A toast (e.g. "Signed in as ...") never sits over a sheet's buttons: while
   a sheet is open it goes under the backdrop, like the feedback button. */
body:has(.pfg-root):has(.pf-sheet-backdrop) .toast-container { z-index: 1150; pointer-events: none; }

/* pf-ux-holdalert (2026-10-08): cooker card + step card when the cook hold is done. */
.pfg-cooker.is-holddone, .pfg-stepcard.is-holddone { border-color: #0f766e; border-left-color: #0f766e; box-shadow: 0 0 0 4px rgba(15, 118, 110, .3); animation: pfg-holddone-pulse 1.6s ease-in-out infinite; }
.pfg-holddone-msg { display: block; margin: 4px 0 8px; padding: 10px 14px; border-radius: 12px; background: #0f766e; color: #fff; font-size: 1.2rem; font-weight: 850; }
.pfg-holddone-msg[hidden] { display: none; }
@keyframes pfg-holddone-pulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(15, 118, 110, .3); } 50% { box-shadow: 0 0 0 10px rgba(15, 118, 110, .5); } }
@media (prefers-reduced-motion: reduce) { .pfg-cooker.is-holddone, .pfg-stepcard.is-holddone { animation: none; } }

/* M-77 (cook bug hunt 2026-10-23): step labels wrap between words, never
   mid-word ("Targe t"). A word longer than the chip shrinks a step instead. */
.pfg-chip .l { word-break: normal; }
@media (max-width: 1100px) { .pfg-chip { font-size: .78rem; } }

/* M-33: re-cook pending on a guided batch: the classic screen records it. */
.pfg-recook { margin: 12px 0; padding: 10px 12px; border-radius: 10px; background: #FFF5E6; border: 2px solid var(--pfg-warn); color: #6b4300; font-weight: 700; }
.pfg-recook p { margin: 0 0 8px; }

/* Hot / cold fill (2026-10-27): "Fill hot instead (no cooling)" on the cooling step. */
.pfg-hotfill { margin: 12px 0 0; }
.pfg-hotfill p { margin: 0 0 6px; }
.pfg-hotfill-btn { min-height: 56px; width: 100%; font-weight: 700; }
/* 2026-10-29 QC resample: record button + recorded resamples under the QC hold box. */
.pfg-resample { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.pfg-resample-btn { min-height: 56px; flex: 1 1 100%; font-weight: 700; }
.pfg-rec-fill { font-weight: 600; }
/* PI editor: start a draft from a builder file (2026-11-02). Same tokens as
   64-production-floor-pi-editor.css; tap targets >= 40px. */
.pie-builder { border: 1px solid var(--border, rgba(0,0,0,0.1)); border-radius: 10px; padding: 14px 16px; background: var(--surface-raised, var(--surface, #fff)); }
.pie-builder-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.pie-builder-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.pie-builder-head .section-title { margin: 0 0 4px; }
.pie-builder-head p { margin: 2px 0; }
.pie-builder-kinds { font-size: 0.82rem; }
.pie-builder-act .btn { min-height: 44px; white-space: nowrap; }
.pie-builder-refused { margin-top: 12px; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--status-danger, #b3261e); background: var(--status-danger-bg, #fde7e7); }
.pie-builder-refused strong { color: var(--status-danger, #b3261e); }
.pie-builder-refused .pie-issues { margin: 8px 0 0; }
.pie-builder-src { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-radius: 8px; border-left: 4px solid var(--brand-primary, var(--accent, #555)); background: var(--surface-raised, var(--surface, #fff)); }
.pie-builder-src .btn { min-height: 36px; margin-left: 6px; }
.pie-builder-src .pie-issues { margin: 6px 0 0; }
@media (max-width: 640px) {
  .pie-builder-act, .pie-builder-act .btn { width: 100%; }
}
.pie-builder-check { margin-top: 4px; }
.pie-builder-info summary { cursor: pointer; min-height: 32px; padding-top: 6px; }
/* Starter checks + numbers in the step text (2026-11-02). */
.pie-starter { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border, rgba(0,0,0,0.15)); }
.pie-starter h4 { margin: 0 0 2px; }
.pie-starter-label { font-size: 0.8rem; margin: 0 0 6px; }
.pie-line-fill select[data-f$=".pack_type"] { max-width: 220px; }
/* PI editor prototype (2026-10-29): #/production-floor/pi-editor.
   Desktop admin surface (I&Q / QA office), not the gloved floor tablet.
   Tap targets stay >= 40px for iPad use. Tokens only, no new hex families
   (fallbacks match 64-production-floor-records.css). */
.pie-page { display: flex; flex-direction: column; gap: var(--space-4, 16px); }
.pie-banner { padding: 10px 14px; border-radius: 8px; background: var(--status-warning-bg, #fff4e0); color: var(--status-warning, #8a5300); border: 1px solid var(--status-warning, #8a5300); }
.pie-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.pie-plants { display: flex; gap: 6px; }
.pie-search { max-width: 360px; }
.pie-new { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.pie-new select { min-height: 40px; }
.pie-tablewrap { overflow-x: auto; }
.pie-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.pie-table th, .pie-table td { padding: 8px 10px; border-bottom: 1px solid var(--border, rgba(0,0,0,0.1)); text-align: left; vertical-align: top; }
.pie-table .btn { min-height: 40px; white-space: nowrap; }
.pie-mono { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.85rem; }
.pie-doc { font-size: 0.78rem; }
.pie-headbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.pie-title { flex: 1 1 280px; }
.pie-savebar { display: flex; gap: 8px; align-items: center; }
.pie-conflict { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--status-danger, #b3261e); background: var(--status-danger-bg, #fde7e7); color: var(--status-danger, #b3261e); }
.pie-btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pie-tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border, rgba(0,0,0,0.1)); }
.pie-tab { min-height: 44px; padding: 8px 16px; border: 0; border-bottom: 3px solid transparent; background: none; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.pie-tab.is-on { border-bottom-color: var(--brand-primary, var(--accent)); }
.pie-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.pie-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.pie-form { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.pie-form[disabled] { opacity: 0.85; }
.pie-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 10px; align-items: start; padding: 6px 0; }
.pie-label { font-weight: 600; padding-top: 9px; }
.pie-ctl input[type="text"], .pie-ctl select, .pie-ctl textarea { min-height: 40px; max-width: 520px; width: 100%; }
.pie-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border, rgba(0,0,0,0.1)); }
.pie-line input[type="text"], .pie-line select { min-height: 40px; }
.pie-line > input[type="text"] { flex: 1 1 180px; }
.pie-line-n { min-width: 44px; font-weight: 700; }
.pie-line-msgs { flex-basis: 100%; }
.pie-x { font-weight: 700; }
.pie-num { display: inline-flex; align-items: center; gap: 4px; }
.pie-num input { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.pie-num-wide input { width: 120px; }
.pie-num input.is-bad { border-color: var(--status-danger, #b3261e); outline: 2px solid var(--status-danger-bg, #fde7e7); }
.pie-unit { color: var(--text-secondary, inherit); font-size: 0.85rem; }
.pie-below { font-weight: 700; }
.pie-checks { display: flex; flex-wrap: wrap; gap: 16px; padding: 6px 0; }
.pie-check { display: inline-flex; gap: 6px; align-items: center; min-height: 40px; }
.pie-help { font-size: 0.8rem; margin-top: 2px; }
.pie-msgs:empty { display: none; }
.pie-msg { font-size: 0.85rem; margin-top: 4px; padding: 2px 0; }
.pie-msg-error { color: var(--status-danger, #b3261e); font-weight: 600; }
.pie-msg-warn { color: var(--status-warning, #8a5300); }
.pie-specials { padding-left: 1.6em; display: flex; flex-direction: column; gap: 8px; }
.pie-special { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: start; }
.pie-special textarea { width: 100%; min-height: 48px; font: inherit; }
.pie-special .pie-msgs { grid-column: 1 / -1; }
.pie-special-btns { display: flex; gap: 2px; }
.pie-checksum { padding: 8px 10px; border-radius: 8px; margin-bottom: 8px; }
.pie-checksum.is-ok { background: var(--status-success-bg, #e8f5e9); color: var(--status-success, #2e7d32); }
.pie-checksum.is-bad { background: var(--status-danger-bg, #fde7e7); color: var(--status-danger, #b3261e); }
.pie-issues { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.pie-tablet { max-width: 1024px; border: 10px solid var(--surface-muted, rgba(0,0,0,0.08)); border-radius: 18px; padding: 8px; background: var(--surface, transparent); }
.pie-today { margin-top: 12px; }
.pie-tablet-old { opacity: 0.8; }
.pie-diff .pie-before { color: var(--status-danger, #b3261e); text-decoration: line-through; }
.pie-diff .pie-after { color: var(--status-success, #2e7d32); font-weight: 600; }
.pie-sdiff { margin: 0; padding-left: 0; list-style: none; }
.pie-sd-add { color: var(--status-success, #2e7d32); font-weight: 600; }
.pie-sd-del { color: var(--status-danger, #b3261e); text-decoration: line-through; }
.pie-sd-same { color: var(--text-secondary, inherit); }
.pie-runs, .pie-events { padding-left: 1.2em; }
.pie-approve-box { padding: 12px; border: 1px solid var(--border, rgba(0,0,0,0.1)); border-radius: 8px; margin: 8px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.pie-approve-box textarea { min-height: 60px; max-width: 520px; }
.pie-notice { margin: 12px 0; }
.pie-mail { border: 1px solid var(--border, rgba(0,0,0,0.1)); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.pie-mailbody { white-space: pre-wrap; font-size: 0.85rem; margin: 6px 0; }
/* Two-step cook (2026-10-30): one row per stage, the stage named first. */
.pie-stages { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 0; }
.pie-stages .pie-label { padding-top: 0; margin-right: 6px; }
.pie-stage-h { min-width: 120px; font-weight: 700; }
.pie-stage-name { display: inline-flex; gap: 6px; align-items: center; flex: 1 1 220px; }
.pie-stage-name input[type="text"] { flex: 1 1 160px; min-height: 40px; }
.pie-actions { white-space: nowrap; }
.pie-actions .btn { margin: 2px 0; }
/* Version history (read-only). */
.pie-pick { width: 32px; text-align: center; }
.pie-pick input { width: 20px; height: 20px; }
.pie-hist-ev summary { cursor: pointer; min-height: 32px; }
/* Print view: a DRAFT, never a controlled document. */
.pie-print-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pie-print-sheet { position: relative; max-width: 1024px; padding: 24px; border: 1px solid var(--border, rgba(0,0,0,0.1)); border-radius: 8px; background: var(--surface, #fff); overflow: hidden; }
.pie-print-stamp { padding: 8px 12px; margin: 0 0 12px; border: 2px solid var(--status-danger, #b3261e); color: var(--status-danger, #b3261e); font-weight: 800; letter-spacing: 0.04em; text-align: center; text-transform: uppercase; }
.pie-print-sheet > .pie-print-stamp:last-child { margin: 16px 0 0; }
.pie-print-watermark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 120px; font-weight: 900; color: var(--status-danger, #b3261e); opacity: 0.07; transform: rotate(-28deg); pointer-events: none; white-space: nowrap; z-index: 0; }
.pie-print-sheet > *:not(.pie-print-watermark) { position: relative; z-index: 1; }
.pie-print-title { margin: 0 0 8px; }
.pie-print-fields { border-collapse: collapse; margin-bottom: 12px; font-size: 0.9rem; }
.pie-print-fields th { text-align: left; padding: 4px 16px 4px 0; vertical-align: top; white-space: nowrap; }
.pie-print-fields td { padding: 4px 0; }
.pie-print-card { border-width: 4px; }
@media print {
  /* App chrome (sidebar, topbar, footer) is hidden by 99-overrides; hide the
     rest of this page so only the sheet prints. */
  body.pie-print-mode .pie-page > *:not([data-pie-body]),
  body.pie-print-mode .pie-print-bar,
  body.pie-print-mode .feedback-fab,
  body.pie-print-mode .feedback-fab-tooltip,
  body.pie-print-mode .agent-fab,
  body.pie-print-mode .agent-fab-tooltip,
  body.pie-print-mode .help-panel,
  body.pie-print-mode .toast-container { display: none !important; }
  html:has(body.pie-print-mode) { background: #fff !important; }
  /* Plain white paper: no app background, texture or edge shading. */
  body.pie-print-mode, body.pie-print-mode .app-shell, body.pie-print-mode .main,
  body.pie-print-mode .content, body.pie-print-mode #view, body.pie-print-mode .pie-page { background: #fff !important; box-shadow: none !important; }
  body.pie-print-mode::before, body.pie-print-mode::after { display: none !important; }
  body.pie-print-mode .pie-print-sheet { width: 100%; max-width: none; border: 0; padding: 0; overflow: visible; }
  body.pie-print-mode .pie-print-watermark { position: fixed; opacity: 0.1; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.pie-print-mode .pie-print-stamp { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.pie-print-mode .pie-print-card { break-inside: avoid; }
}
@media (max-width: 900px) {
  .pie-layout { grid-template-columns: minmax(0, 1fr); }
  .pie-side { position: static; max-height: none; }
  .pie-row { grid-template-columns: minmax(0, 1fr); }
  .pie-label { padding-top: 0; }
  .pie-new { margin-left: 0; }
}

/* 2026-11-10 source first (PI_EDITOR_SOURCE_FIRST): the builder file leads,
   typing by hand is the quieter second way; the side panel lists what approval
   waits for; the tablet card sits live beside the form. */
.pie-builder-first { border: 2px solid var(--brand-primary, var(--accent)); }
.pie-byhand { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border, rgba(0,0,0,0.15)); }
.pie-byhand select { min-height: 40px; }
.pie-byhand-note { flex-basis: 100%; font-size: 0.82rem; }
.pie-layout-sf { grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1fr); }
.pie-msg-ok { color: var(--status-success, #2e7d32); }
.pie-sf { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.pie-sf-src.is-none { padding: 10px; border-radius: 8px; border: 1px solid var(--status-warning, #8a5300); background: var(--status-warning-bg, #fff4e0); }
.pie-sf-src.is-none p { margin: 6px 0; }
.pie-sf-confirm { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pie-sf-confirm input { flex: 1 1 160px; min-height: 40px; }
.pie-sf-confirm .btn { min-height: 40px; }
.pie-sf-block { padding: 10px; border-radius: 8px; border: 1px solid var(--border, rgba(0,0,0,0.12)); }
.pie-sf-diffs { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pie-sf-diff { padding: 8px; border-radius: 6px; border-left: 4px solid var(--status-warning, #8a5300); background: var(--surface-muted, rgba(0,0,0,0.03)); }
.pie-sf-diff.is-acked { border-left-color: var(--status-success, #2e7d32); }
.pie-sf-diff .btn { min-height: 40px; margin-top: 4px; }
.pie-sf-vals { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.9rem; }
.pie-sf-stop { padding: 10px; border-radius: 8px; border: 1px solid var(--status-danger, #b3261e); background: var(--status-danger-bg, #fde7e7); }
.pie-sf-stop .pie-issues { margin: 6px 0 0; }
.pie-livecard { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border, rgba(0,0,0,0.1)); }
.pie-glance { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pie-glance-item { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border, rgba(0,0,0,0.12)); font-size: 0.85rem; }
.pie-glance-item.is-blank { border-color: var(--status-warning, #8a5300); background: var(--status-warning-bg, #fff4e0); }
.pie-tablet-live { border-width: 6px; padding: 4px; }
@media (max-width: 900px) {
  .pie-layout-sf { grid-template-columns: minmax(0, 1fr); }
}
.pie-glancebox { margin-bottom: 10px; }
.pie-glancebox .pie-glance { margin-bottom: 0; }
/* 2026-11-10 addendum: plain "on the tablets?" status, scheduled-without-a-PI list. */
.pie-plain { display: inline-block; margin-left: 6px; font-size: 0.82rem; font-weight: 600; color: var(--status-warning, #8a5300); }
.pie-plain-live { color: var(--status-success, #2e7d32); }
.pie-gaps { border: 1px solid var(--status-warning, #8a5300); border-radius: 8px; }
.pie-gaplist { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pie-gap .btn { min-height: 40px; }
/* 2026-11-10 "PI: both": unanswered yes/no, similar live PI, signed record. */
.pie-tri select { min-height: 40px; margin-left: 6px; }
.pie-tri.is-unanswered select { border-color: var(--status-warning, #8a5300); background: var(--status-warning-bg, #fff4e0); }
.pie-similar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border, rgba(0,0,0,0.15)); }
.pie-similar .btn { min-height: 40px; }
.pie-signed { margin: 6px 0; font-weight: 600; color: var(--status-success, #2e7d32); }
/* Cooking Floor Records view (2026-10-08) — #/production-floor/records.
   Desktop + tablet supervisor surface (not the gloved floor tablet), so the
   platform control sizes apply; tap targets stay >= 40px for iPad use. */
.pfr-page { display: flex; flex-direction: column; gap: var(--space-4, 16px); }
.pfr-filters { display: flex; flex-direction: column; gap: 12px; }
.pfr-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.pfr-field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; flex: 1 1 150px; font-size: 0.85rem; }
.pfr-field > span { color: var(--text-secondary, inherit); font-weight: 600; }
.pfr-field select, .pfr-field input { min-height: 40px; }
.pfr-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.pfr-preset, .pfr-chip {
  min-height: 40px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border, currentColor); background: var(--surface, transparent); color: inherit;
}
.pfr-preset.is-on, .pfr-chip.is-on { background: var(--brand-primary, var(--accent)); border-color: var(--brand-primary, var(--accent)); color: var(--text-on-brand, #fff); }
.pfr-chip b { margin-left: 4px; }
.pfr-chips-label { font-weight: 600; margin-right: 4px; }
.pfr-actions { display: flex; gap: 8px; }
.pfr-export { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; }
.pfr-export p { margin: 4px 0 0; max-width: 60ch; }
.pfr-export-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pfr-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.pfr-layout:has(.pfr-detail:not([hidden])) { grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); }
.pfr-summary { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; margin-bottom: 8px; font-weight: 600; }
.pfr-warn { color: var(--status-warning, #b26a00); font-weight: 600; }
.pfr-applied-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pfr-applied { font-size: 0.8rem; padding: 2px 8px; border-radius: 6px; background: var(--surface-muted, rgba(0,0,0,0.05)); }
.pfr-tablewrap { overflow-x: auto; }
.pfr-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.pfr-table th, .pfr-table td { padding: 8px 10px; border-bottom: 1px solid var(--border, rgba(0,0,0,0.1)); text-align: left; vertical-align: top; }
.pfr-sort { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; }
.pfr-tr { cursor: pointer; }
.pfr-tr:hover, .pfr-tr:focus { background: var(--surface-muted, rgba(0,0,0,0.04)); outline: none; }
.pfr-status { font-weight: 600; }
.pfr-status-open { color: var(--status-warning, #b26a00); }
.pfr-status-done { color: var(--status-success, #2e7d32); }
.pfr-flag { display: inline-block; font-size: 0.75rem; padding: 1px 6px; border-radius: 6px; margin: 1px 0; background: var(--surface-muted, rgba(0,0,0,0.06)); }
.pfr-flag-hold, .pfr-flag-missing { background: var(--status-danger-bg, #fde7e7); color: var(--status-danger, #b3261e); }
.pfr-flag-corrections, .pfr-flag-superseded { background: var(--status-warning-bg, #fff4e0); color: var(--status-warning, #8a5300); }
.pfr-pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; }
.pfr-h3 { margin-top: 20px; }
.pfr-detail-head { display: flex; justify-content: space-between; align-items: center; }
.pfr-timeline { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.pfr-ev { padding: 8px 10px; border-left: 3px solid var(--border, rgba(0,0,0,0.15)); }
.pfr-ev.is-superseded { opacity: 0.65; }
.pfr-ev.is-superseded .pfr-ev-val s { text-decoration-thickness: 2px; }
.pfr-ev.is-correction { border-left-color: var(--brand-primary, var(--accent)); }
.pfr-ev-main { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.pfr-ev-step { font-weight: 700; }
.pfr-ev-val { font-variant-numeric: tabular-nums; }
.pfr-ev-meta { font-size: 0.8rem; }
.pfr-ev-chain { font-size: 0.85rem; margin-top: 4px; }
.pfr-tag { font-size: 0.72rem; padding: 1px 6px; border-radius: 6px; background: var(--surface-muted, rgba(0,0,0,0.06)); }
.pfr-tag-corr { font-weight: 700; }
/* QA late mark (2026-11-10): gray, never struck, never red (cross-outs keep red, #307). */
.pfr-tag-late { background: #ecebe8; color: #555; border: 1px solid #d6d3cd; }
.pfr-late-note { margin: 4px 0 8px; font-size: 0.85rem; }
.pfr-holds, .pfr-reflist { margin: 8px 0; padding-left: 18px; }
.pf-records-link { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
@media (max-width: 900px) {
  .pfr-layout:has(.pfr-detail:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .pfr-field { min-width: 100%; }
}
/* Fill temp drop follow-up: "Fill temp: QC Filling & Packaging report" under a pack-only fill start. */
.pfr-ev-note { font-size: 0.85rem; margin-top: 4px; font-style: italic; }
/* FB #578 + leads (PF_RUN_LINE_CHANGE): a floor lead's "Change line" /
   cancel empty run on the Cooking Floor tablet (pf-run-line-tablet.js).
   Tablet targets: 56px+ buttons and selects (gloves). */
.pf-linefix-row { margin: 4px 0 12px; }
.pf-linefix-tab { min-height: 56px; }
.pf-rlt { display: flex; flex-direction: column; gap: 12px; font-size: 1.05rem; }
.pf-rlt-eyebrow { margin: 0; font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #5f6b76); }
.pf-rlt-product { margin: 0; }
.pf-rlt-label { margin: 4px 0 0; font-weight: 700; }
.pf-rlt-muted { color: var(--text-muted, #5f6b76); }
.pf-rlt-choices { display: flex; flex-wrap: wrap; gap: 12px; }
.pf-rlt-choices .pf-bigbtn { min-width: 140px; min-height: 64px; font-size: 1.15rem; }
.pf-rlt-run { flex: 1 1 100%; justify-content: flex-start; text-align: left; }
.pf-rlt-tanks { display: flex; flex-direction: column; gap: 12px; }
.pf-rlt-tankpick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pf-rlt-select { min-height: 56px; min-width: 200px; font-size: 1.05rem; padding: 8px 12px; }
.pf-rlt-why, .pf-rlt-error { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--status-warning-bg, #fff4e5); }
.pf-rlt-error { background: var(--status-danger-bg, #fdecea); color: var(--status-danger, #b3261e); }
.pf-rlt-what { margin: 0; }
.pf-rlt-confirm { padding: 12px; border: 2px solid var(--status-danger, #b3261e); border-radius: 10px; }
.pf-rlt-danger { color: var(--status-danger, #b3261e); border-color: var(--status-danger, #b3261e); }
.pf-rlt .pf-sheet-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
/* Cooking Floor "Supervisor · Today" (2026-11-10) — #/production-floor/supervisor.
   Desktop / iPad supervisor surface (pf-supervisor.js): lines with today's
   cooking runs, Move… dialog that pushes / pulls not-started batches between
   production days. Tap targets >= 40px. */
.pfs-page { display: flex; flex-direction: column; gap: var(--space-4, 16px); }
.pfs-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.pfs-plants { display: flex; gap: 6px; flex-wrap: wrap; }
.pfs-plant, .pfs-reason {
  min-height: 40px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border, currentColor); background: var(--surface, transparent); color: inherit; font: inherit;
}
.pfs-plant.is-on { background: var(--brand-primary, var(--accent)); border-color: var(--brand-primary, var(--accent)); color: var(--text-on-brand, #fff); }
.pfs-reason.is-on { border-color: var(--brand-primary, var(--accent)); box-shadow: inset 0 0 0 1px var(--brand-primary, var(--accent)); font-weight: 600; }
.pfs-day { display: flex; gap: 8px; align-items: center; }
.pfs-day .btn { min-width: 40px; min-height: 40px; font-size: 1.2rem; }
.pfs-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 16px; align-items: start; }
.pfs-h2 { margin: 0 0 8px; font-size: 1.15rem; }
.pfs-lines { display: flex; flex-direction: column; gap: 12px; }
.pfs-line { padding: 12px 16px; }
.pfs-line-head h3 { margin: 0 0 6px; font-size: 1.05rem; }
.pfs-line-head p { margin: 0 0 6px; }
.pfs-subline { font-weight: 400; font-size: 0.9rem; color: var(--text-secondary, inherit); }
.pfs-run { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border, rgba(0,0,0,0.1)); }
.pfs-run:first-of-type { border-top: 0; }
.pfs-run-name { font-weight: 700; color: var(--brand-primary, inherit); }
.pfs-run-meta, .pfs-run-next { font-size: 0.85rem; }
.pfs-bar { height: 8px; border-radius: 999px; background: var(--surface-muted, rgba(0,0,0,0.08)); overflow: hidden; display: flex; }
.pfs-bar-done { background: var(--status-success, #2e7d32); }
.pfs-bar-started { background: var(--status-warning, #b26a00); }
.pfs-move-btn { min-height: 40px; min-width: 96px; }
/* FB #576-578 (PF_RUN_LINE_CHANGE): wrong cooking line / cancel an empty run. */
.pfs-run:has(.pfs-linefix-btn) { grid-template-columns: minmax(0, 1fr) 120px auto auto; }
.pfs-linefix-btn { min-height: 40px; }
.pfs-tanks { display: flex; flex-direction: column; gap: 8px; }
.pfs-tankpick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pfs-tankpick select { min-height: 40px; }
.pfs-danger { color: var(--status-danger, #b3261e); border-color: var(--status-danger, #b3261e); }
.pfs-sidecol { display: flex; flex-direction: column; gap: 12px; }
.pfs-side { padding: 12px 16px; }
.pfs-side-title { margin: 0 0 8px; font-size: 1.05rem; }
.pfs-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pfs-log-item { padding: 8px 10px; border-radius: 8px; background: var(--surface-muted, rgba(0,0,0,0.04)); }
.pfs-log-what { font-weight: 600; margin-top: 4px; }
.pfs-log-meta { font-size: 0.8rem; margin-top: 2px; }
.pfs-tag { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.pfs-tag-push { background: var(--status-warning-bg, #fff4e0); color: var(--status-warning, #8a5300); }
.pfs-tag-pull { background: var(--status-info-bg, #e8f0fe); color: var(--status-info, #1a4fa0); }
.pfs-note { padding: 10px 14px; border-left: 3px solid var(--brand-gold, var(--accent)); background: var(--surface-muted, rgba(0,0,0,0.04)); font-size: 0.9rem; }
.pfs-ok { padding: 10px 14px; border-radius: 8px; background: var(--status-success-bg, #e6f4ea); color: var(--status-success, #1e5e2b); font-weight: 600; margin: 0; }
.pfs-past { margin: 0; }
.pfs-dialog { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 16, 12, 0.45); }
.pfs-dialog-card { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface, #fff); color: inherit; border-radius: 16px; padding: 20px 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.pfs-dialog-card h2 { margin: 2px 0 4px; font-size: 1.4rem; }
.pfs-eyebrow, .pfs-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary, inherit); }
.pfs-label { margin: 14px 0 6px; }
.pfs-dir, .pfs-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.pfs-dircard, .pfs-daycard {
  display: flex; flex-direction: column; gap: 2px; text-align: left; min-height: 56px; padding: 10px 12px; cursor: pointer;
  border-radius: 10px; border: 1px solid var(--border, rgba(0,0,0,0.15)); background: var(--surface, transparent); color: inherit; font: inherit;
}
.pfs-dircard span, .pfs-daycard span { font-size: 0.8rem; color: var(--text-secondary, inherit); }
.pfs-dircard.is-on, .pfs-daycard.is-on { border: 2px solid var(--status-success, #2e7d32); background: var(--status-success-bg, #e6f4ea); }
.pfs-dircard[disabled] { opacity: 0.55; cursor: not-allowed; }
.pfs-stepper { display: flex; align-items: center; gap: 12px; }
.pfs-stepper .btn { min-width: 44px; min-height: 44px; font-size: 1.2rem; }
.pfs-stepper output { min-width: 2ch; font-size: 1.4rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.pfs-reasons { display: flex; flex-wrap: wrap; gap: 8px; }
.pfs-text { width: 100%; min-height: 40px; margin-top: 8px; box-sizing: border-box; }
.pfs-what { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-muted, rgba(0,0,0,0.05)); font-size: 0.9rem; }
.pfs-error { color: var(--status-danger, #b3261e); font-weight: 600; }
.pfs-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.pfs-dialog-actions .btn { min-height: 44px; }
@media (max-width: 900px) {
  .pfs-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .pfs-run { grid-template-columns: minmax(0, 1fr) auto; }
  .pfs-run .pfs-bar { grid-column: 1 / -1; grid-row: 2; }
  .pfs-run .pfs-linefix-btn { grid-column: 1 / -1; }
}

/* Batch cap (2026-11-10, PF_BATCH_CAP): extra-batch requests on the
   Supervisor screen (desktop / phone browser) and the ask on the tablet. */
.pfs-reqs { border-left: 3px solid var(--status-warning, #b26a00); }
.pfs-badge { display: inline-block; margin-left: 6px; font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--brand-primary, var(--accent)); color: var(--text-on-brand, #fff); vertical-align: middle; }
.pfs-req { padding: 12px 0; border-top: 1px solid var(--border, rgba(0,0,0,0.1)); display: flex; flex-direction: column; gap: 8px; }
.pfs-req:first-of-type { border-top: 0; }
.pfs-req-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.85rem; }
.pfs-tag-extra { background: var(--status-warning-bg, #fff4e0); color: var(--status-warning, #8a5300); }
.pfs-req-name { font-weight: 700; font-size: 1.1rem; }
.pfs-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pfs-stat { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; background: var(--surface-muted, rgba(0,0,0,0.05)); }
.pfs-stat b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.pfs-stat span { font-size: 0.8rem; color: var(--text-secondary, inherit); }
.pfs-req-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }
.pfs-allow { min-height: 52px; font-size: 1.05rem; font-weight: 700; background: var(--status-success, #2e7d32); border-color: var(--status-success, #2e7d32); color: #fff; }
.pfs-decline { min-height: 48px; font-weight: 700; }
.pfs-req-foot, .pfs-req-night { font-size: 0.8rem; margin: 0; }
.pfs-answered { margin: 0; padding-left: 18px; font-size: 0.85rem; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 900px) {
  .pfs-sidecol { order: -1; }
}
.pf-capbox { margin-top: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border, rgba(0,0,0,0.15)); background: var(--surface, #fff); display: flex; flex-direction: column; gap: 8px; }
.pf-capbox p { margin: 0; }
.pf-capbox.is-waiting { background: var(--status-info-bg, #ede7f6); border-color: var(--status-info, #7e57c2); }
.pf-cap-declined, .pfg-capwait.is-declined { color: var(--status-danger, #b3261e); font-weight: 600; }
.pf-cap-askbtn { min-height: 56px; }
.pfg-capwait { display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--status-info-bg, #ede7f6); font-weight: 600; }
/* ═══════════════════════════════════════════════════════════════════════════
   Cooking Floor (production-floor) — Hy Lu, 2026-08-18

   TWO SURFACES WITH OPPOSITE CONSTRAINTS:

   1. TABLET (#/production-floor) — an iPad on a cook line. The operator wears
      wet gloves. Every tap target here is >= 56px because a gloved fingertip
      contact patch is ~15mm and the platform default 32px control is simply
      not reliably hittable. No hover-only affordance exists on this surface:
      there is no cursor on a tablet, so anything revealed by :hover is
      invisible to the only user who matters.

   2. TV (?tv=1) — a wall screen read at ~10 feet. Type is sized so the batch
      number and its time are legible across a plant floor. The palette is the
      light Lee Kum Kee house surface (Kevin/Hy 2026-10-07: "more LKK themed,
      not dark mode"), see the TV BOARD block. `body.pf-tv-mode` hides the app shell entirely: nav, search
      and the Ask FAB are all unreachable on a wall TV, and rendering them just
      steals pixels from the only thing anyone is looking at.

   The board layout deliberately mirrors the whiteboard photographed on
   2026-08-18: a horizontal strip per SKU, numbered chips 1..N, the wall clock
   written under the started ones, blank slots left blank. The blanks are
   information (work remaining) — they are not an empty state.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── TABLET ───────────────────────────────────────────────────────────────── */

/* ══ VISUAL REC 1 + 2 — SCOPED TOKEN BRIDGE (correctness, not aesthetics) ═════

   TWO REAL BUGS, both found by measurement:

   1. DARK MODE RENDERED THIS SURFACE AT 1.09:1.
      `.pf-plantbtn`, `.pf-input`, `.pf-time` and friends set
      `color: var(--text, #1a1a1a)` on `background: var(--surface, #fff)`.
      `90-dark-mode.css` REDEFINES `--surface` to `#1E2130` but `--text` is not
      defined anywhere in the platform, so it fell through to its `#1a1a1a`
      fallback: near-black text on a dark slate panel. There are ZERO `.pf-*`
      rules in the dark-mode file, and the theme toggle is user-reachable and
      persisted — one tap bricked the floor tablet. Same failure class as the
      2026-08-07 light-on-light research inputs.

   2. THE MODULE INVENTED FOUR TOKENS THAT DO NOT EXIST.
      `--brand-red`, `--brand-gold`, `--muted`, `--surface-2`. The house defines
      `--heritage-red`, `--heritage-gold`, `--ink-mute`, `--warm-white`/`--paper`
      /`--rule`. So every one of those fell through to a COOL grey fallback on a
      warm-eggshell platform, which is why this screen subtly looked like a
      different product.

   THE FIX IS THE `58-heads-cockpit.css:20-33` PRECEDENT: a scoped alias bridge,
   not a global repaint. Twelve lines, and nothing outside `.pf-tablet` /
   `.pf-floorhead` changes — so no other module's palette moves.

   THE TV BLOCK IS STILL OUT OF THIS BRIDGE, for a different reason now. Until
   2026-10-07 it was a hand-tuned dark surface on raw hex. Kevin/Hy 2026-10-07
   ("Hy wants the TV Board to be more LKK themed, not dark mode") moved it to
   the light house palette, so it has its OWN scoped `--pftv-*` token block in
   the TV section that resolves to the house tokens and pins them light even
   when the office dark toggle is persisted in the wall browser. Do not extend
   THIS bridge to `.pf-tv`: its dark-mode branch would repaint the wall. */
.pf-tablet,
.pf-floorhead,
.pf-plantrow,
.pf-supervisor {
  --surface: var(--warm-white, #FFFDF8);
  --surface-2: var(--eggshell-bright, #FFF5E6);
  --border: var(--rule, #E5D9C4);
  --text: var(--ink, #2C2520);
  --muted: var(--ink-mute, #6B6560);
  --brand-red: var(--heritage-red, #CC0000);
  --brand-gold: var(--heritage-gold, #D4A843);
}

/* Dark mode gets REAL values rather than inheriting a light bridge. The floor
   tablet is not expected to run dark — but the toggle exists, so the surface has
   to stay legible when someone finds it. Text lands ~11:1 on the dark panel. */
[data-theme="dark"] .pf-tablet,
[data-theme="dark"] .pf-floorhead,
[data-theme="dark"] .pf-plantrow,
[data-theme="dark"] .pf-supervisor {
  --surface: #1E2130;
  --surface-2: #252838;
  --border: #3B3F54;
  --text: #E5E7EB;
  --muted: #9CA3AF;
  /* Heritage red is too dark to read on slate; use the lighter house red so the
     one-primary stamp button stays the loudest thing in the row. */
  --brand-red: var(--heritage-red-deep, #D41920);
  --brand-gold: var(--heritage-gold-light, #E8C572);
}

.pf-tablet { display: flex; flex-direction: column; gap: 16px; }

.pf-bigrow { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── POLISH-T1: COMPACT FLOOR HEADER (replaces pageHero) ───────────────────
   pageHero is right for an analyst on a laptop and wrong for a 390px iPad on a
   cook line: eyebrow + italic title + description + actions is ~180px of chrome
   above the only field the operator keys, which puts the material input below
   the fold and makes a wet-gloved scroll the first gesture of the shift.

   This header answers the only two context questions an operator actually has —
   which plant, which day — and keeps the Open-TV control, which is the sole
   navigation on this surface. One line tall. */
.pf-floorhead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 10px 0 14px;
  border-bottom: 2px solid var(--border, #e5e7eb);
  margin-bottom: 4px;
}
.pf-floorhead-id { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.pf-floorhead-plant { font-size: 1.35rem; font-weight: 850; letter-spacing: .01em; }
.pf-floorhead-date { font-size: 1.15rem; font-weight: 750; color: var(--text, #2c2520); }
/* Batch date clarity (2026-11-10): a day picked that is not today is marked. */
.pf-floorhead-date.is-other-day { color: #6b4e00; background: #fff6d6; border: 2px solid #e6b800; border-radius: 999px; padding: 2px 12px; }
/* Open TV keeps the 56px floor: it is still a control on a touch surface. */
.pf-floorhead-tv { min-height: 56px; display: inline-flex; align-items: center; }

/* ── POLISH-T2a: PLANTS AS A COMPACT SEGMENTED ROW ─────────────────────────
   Plant is chosen once a shift, if ever — the tablet is bolted to one line. It
   does not deserve a .section card with its own heading, which cost a whole
   thumb-scroll and pushed the material field down.

   The 56px gloved-tap floor is UNCHANGED. This is layout only: the buttons got
   shorter labels' worth of horizontal room, not smaller targets. */
.pf-plantrow {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.pf-plantbtn {
  flex: 1 1 auto;
  min-height: 56px;
  min-width: 88px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  border: 2px solid var(--border, #d8dbe0);
  background: var(--surface, #fff);
  color: var(--text, #1a1a1a);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.pf-plantbtn:active { transform: translateY(1px); }
.pf-plantbtn.is-active {
  background: var(--brand-red, #cc0000);
  border-color: var(--brand-red, #cc0000);
  color: #fff;
}
.pf-plantbtn:focus-visible { outline: 3px solid var(--brand-gold, #d4a843); outline-offset: 2px; }

/* ── POLISH-T3: SUPERVISOR FOOTER ──────────────────────────────────────────
   The audit export is a supervisor's monthly errand, not a floor instruction.
   It sat as a full section competing with the PI card for the fold, so it moves
   into a collapsed <details> at the very bottom.

   <details> is acceptable HERE and ONLY here. Specials remain an always-visible
   <section> (UX-1): a process instruction behind a tap is an instruction nobody
   reads, but a CSV link behind a tap is just tidy. */
.pf-supervisor { padding: 0; }
.pf-supervisor-summary {
  display: flex; align-items: center;
  min-height: 56px;
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted, #6b7280);
  cursor: pointer;
  list-style: none;
}
.pf-supervisor-summary::-webkit-details-marker { display: none; }
.pf-supervisor-summary::before {
  content: '\25B8';
  margin-right: 10px;
  font-size: 1.1rem;
  transition: transform .15s ease;
}
.pf-supervisor[open] > .pf-supervisor-summary::before { transform: rotate(90deg); }
.pf-supervisor-summary:focus-visible { outline: 3px solid var(--brand-gold, #d4a843); outline-offset: -3px; }
.pf-supervisor-body { padding: 0 16px 16px; }

/* 56px floor — the gloved-fingertip minimum. Do not shrink for density. */
.pf-bigbtn {
  min-height: 56px;
  min-width: 96px;
  padding: 14px 22px;
  font-size: 1.05rem;
  font-weight: 650;
  border-radius: 10px;
  border: 2px solid var(--border, #d8dbe0);
  background: var(--surface, #fff);
  color: var(--text, #1a1a1a);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.pf-bigbtn:active { transform: translateY(1px); }
.pf-bigbtn.is-active {
  background: var(--brand-red, #cc0000);
  border-color: var(--brand-red, #cc0000);
  color: #fff;
}

.pf-input {
  min-height: 56px;
  padding: 12px 14px;
  font-size: 1.05rem;
  border: 2px solid var(--border, #d8dbe0);
  border-radius: 10px;
  background: var(--surface, #fff);
  color: var(--text, #1a1a1a);
  flex: 1 1 180px;
  min-width: 0;
}
/* POLISH-T2b: the material number IS the page, so it is the biggest control on
   it. 64px tall / 1.75rem digits so a ten-digit material is readable at arm's
   length while typing, and `flex-basis` is generous enough that the field keeps
   a full row to itself instead of sharing one with the Load button. */
.pf-input-big {
  font-size: 1.75rem;
  font-weight: 700;
  min-height: 64px;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
  flex: 1 1 260px;
}
.pf-input-sm  { flex: 0 1 120px; }
/* pf-pi-ui (2026-10-09, audit #17): the classic start-row cooker field. Its
   short placeholder ("Cooker (opt.)", 4 locales) needs up to ~145px at 1024. */
.pf-input-cooker { flex: 0 1 150px; }
.pf-input:focus-visible { outline: 3px solid var(--brand-gold, #d4a843); outline-offset: 1px; }

.pf-material-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
/* The title is a bare h3.section-title (margin: 0 from 02-layout), not a
   .section-header. Without this, "Material number" sits on the 64px field. */
.pf-material > .section-title { margin: 0 0 14px; }
.pf-runs > .section-title { margin: 0 0 14px; }
.pf-material-msg { margin-top: 8px; min-height: 20px; font-size: .95rem; }
.pf-msg-err { color: var(--danger, #c0392b); font-weight: 600; }

/* ── PI reference card (read-only: the operator confirms, never edits) ────── */

.pf-pi-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pf-pi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 12px;
}
.pf-pi-grid h4 {
  margin: 0 0 6px;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted, #6b7280);
}
.pf-pi-list { margin: 0; padding-left: 18px; line-height: 1.7; font-size: .98rem; }
.pf-nocook { font-style: italic; color: var(--muted, #6b7280); font-size: 1rem; padding: 8px 0; }

/* ── UX-1: SPECIALS ARE ALWAYS ON SCREEN ───────────────────────────────────
   These used to sit inside a collapsed <details>. On a cook line an
   instruction that requires a tap is an instruction nobody reads: Panda OS
   §8.1 ("if adjustment is made ... at or above 212F") has to be legible the
   moment the PI loads, with no gesture at all.

   Amber, not red: these are process requirements to follow, not failures to
   react to. Red is reserved on this surface for the PSI stop, which is the one
   rule that actually halts a batch.

   The numbered list gives operator and supervisor a shared referent across a
   loud room ("do number 3 first"). An empty specials array renders no section
   whatsoever — never a reassuring "none", which would be the platform
   asserting a fact about a controlled document it cannot support. */
.pf-specials {
  margin: 14px 0 4px;
  padding: 14px 16px;
  border-left: 6px solid #d4a843;
  border-radius: 8px;
  background: #fffaf0;
}
.pf-specials-title {
  margin: 0 0 8px;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 800;
  color: #8a5a00;
}
.pf-specials-list {
  margin: 0;
  padding-left: 22px;
  line-height: 1.6;
  font-size: 1.02rem;
  color: #3d2c00;
}
/* Specials standard (docs/PF-SPECIALS-STANDARD.md, 2026-10-08): one item may
   carry the English line, then the Chinese line, split by "\n". pre-line keeps
   that break (and collapses any other run of spaces) so a bilingual item reads
   as two lines under one number instead of one run-on line. */
.pf-special { margin: 6px 0; font-weight: 550; white-space: pre-line; }

/* ── UX-2a: COOK STEPS AS BIG NUMBERS ─────────────────────────────────────
   A cook step is two numbers the operator must hit, so it renders as two
   numbers rather than a sentence. Sized for a glance at arm's length; the step
   label is the smallest element because it is the part they already know. */
.pf-cooksteps { display: flex; flex-direction: column; gap: 10px; }
.pf-cookstep {
  padding: 10px 12px;
  border: 2px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--surface-2, #fafafa);
}
.pf-cookstep-nums {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.pf-cook-temp, .pf-cook-mins {
  font-size: 2.1rem;
  font-weight: 850;
  line-height: 1.05;
  color: var(--text, #1a1a1a);
}
.pf-cook-unit {
  font-size: .95rem;
  font-weight: 650;
  margin-left: 2px;
  color: var(--muted, #6b7280);
}
.pf-cook-x { font-size: 1.1rem; font-weight: 700; color: var(--muted, #9ca3af); }
.pf-cookstep-label {
  margin-top: 4px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted, #6b7280);
}

/* ── UX-2b: FILL TEMPS AS ONE CHIP PER PACK ───────────────────────────────
   The operator's question is "what does THIS pack need?", so pack is the unit
   of layout. The HDPE tilt / cool-to-190 note rides on the chip: dropping it
   for tidiness would delete a real processing step. */
.pf-fillchips { display: flex; flex-direction: column; gap: 8px; }
/* ══ VISUAL REC 8 — THE ACCENT ENCODES POLARITY, OR IT DOES NOT EXIST ════════
   The `#60a5fa` blue left border was a FOURTH accent with no meaning in the
   contract's three-family chip vocabulary. Decoration on a food-safety card,
   deleted.

   Replaced with the one distinction here that is genuinely a safety fact:
   `sauce_hold` fill temps are HOT MINIMUMS (Can > 170F — too COLD is the defect)
   and `sfg` fill temps are COLD MAXIMUMS (PET < 100F — too HOT is the defect).
   Same-shaped numbers, opposite failure directions. A band (170–185F) makes no
   polarity claim and stays neutral. */
.pf-fillchip {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 12px;
  border: 2px solid var(--border, #e5e7eb);
  border-left-width: 5px;
  border-left-color: var(--border, #E5D9C4);
  border-radius: 8px;
  background: var(--surface, #fff);
}
.pf-fillchip-pack { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6B6560); }
.pf-fillchip-rule { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
/* REC 8 — THE HDPE JUG NOTE WAS THE SMALLEST TYPE ON THE CARD.
   "cool to 190F first, then tilt" is a real processing step from a controlled
   document — it is how the jug gets filled without deforming, not a footnote.
   Promoted from .85rem to 1rem and given the amber weight the specials use. */
.pf-fillchip-note {
  font-size: 1rem;
  color: #7a5c00;
  font-weight: 700;
  line-height: 1.4;
  margin-top: 2px;
}
/* Polarity accents. Warm = a HOT minimum (filling cold is the defect);
   cool = a COLD maximum (filling hot is the defect). Neither is the alarm red,
   which stays reserved for the PSI hard stop. */
.pf-fillchip-hotmin  { border-left-color: var(--brand-gold, #D4A843); }
.pf-fillchip-coldmax { border-left-color: #4a7fa5; }

/* ── UX-2c: STOP-THE-BATCH RULES AS CHIPS ─────────────────────────────────
   Colour is calibrated to consequence and must not overstate: amber hold (QC
   decides), red PSI (hard refusal), neutral for the rest. */
.pf-rulechips { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-rulechip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 2px solid var(--border, #e5e7eb);
  background: var(--surface-2, #f3f4f6);
  font-size: .95rem;
  font-weight: 650;
  line-height: 1.3;
}
.pf-rulechip-hold   { border-color: #e6b800; background: #fffdf2; color: #8a5a00; }
.pf-rulechip-psi    { border-color: var(--danger, #c0392b); background: #fdf2f2; color: var(--danger, #c0392b); font-weight: 800; }
.pf-rulechip-filter { border-color: #cbd5e1; }

/* ── UX-3: START-RUN ROW (SKU is read-only, from the resolved PI) ────────── */
.pf-pi-newrun {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border, #e5e7eb);
}
/* Read-only, and it must LOOK read-only: no input border, no caret affordance.
   Styling it like a field would invite an operator to try to correct a name
   that comes from a controlled document. */
.pf-run-sku {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1 1 220px; min-width: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2, #f3f4f6);
  border: 2px solid transparent;
}
.pf-run-sku-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted, #6b7280); }
.pf-run-sku-value { font-size: 1.05rem; font-weight: 750; overflow-wrap: anywhere; }

/* ── Run list ─────────────────────────────────────────────────────────────── */

.pf-runlist { display: flex; flex-direction: column; gap: 10px; }
.pf-runcard {
  display: block; width: 100%; text-align: left;
  padding: 16px; min-height: 72px;
  border: 2px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: var(--surface, #fff);
  cursor: pointer;
}
.pf-runcard.is-active { border-color: var(--brand-red, #cc0000); background: #fff7f7; }
.pf-runcard-sku { font-size: 1.15rem; font-weight: 700; }
.pf-runcard-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 6px; font-size: .9rem; color: var(--muted, #6b7280);
}
.pf-runcard-live { color: var(--brand-red, #cc0000); font-weight: 700; }
/* pf-ux-earlier (FB #422): run still open from the previous plant day */
.pf-runcard.is-carryover { border-color: #7a5c00; border-style: dashed; background: #fff5e6; }
.pf-runcard-carry { color: #7a5c00; font-weight: 800; }
.pf-runcard-carry-open { color: #7a5c00; font-weight: 700; }
.pf-carry-banner { margin: 6px 0; padding: 10px 14px; border-radius: 10px; background: #fff5e6; border: 2px solid #7a5c00; color: #7a5c00; font-weight: 700; font-size: 1.05rem; }

/* ── Time card ────────────────────────────────────────────────────────────── */

.pf-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pf-card-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── UX-5: REMEMBERED OPERATOR CHIP ───────────────────────────────────────
   Shows who is stamping on THIS tablet and is tappable to change. Visible by
   design: a shift change must be noticeable BEFORE the next stamp, not
   discovered later in the export. Unset state is deliberately dashed and muted
   so it reads as "not yet answered" rather than as a name. */
.pf-opchip {
  display: flex; align-items: center; gap: 8px;
  min-height: 56px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 2px solid var(--border, #d8dbe0);
  background: var(--surface, #fff);
  cursor: pointer;
  font: inherit;
}
.pf-opchip-label {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .07em;
  font-weight: 700; color: var(--muted, #6b7280);
}
.pf-opchip-value { font-size: 1.15rem; font-weight: 800; text-transform: uppercase; }
.pf-opchip.is-set { border-color: var(--brand-gold, #d4a843); background: #fffaf0; }
.pf-opchip.is-unset { border-style: dashed; }
.pf-opchip.is-unset .pf-opchip-value { color: var(--muted, #9ca3af); font-weight: 650; text-transform: none; }

.pf-oil-banner {
  margin: 12px 0;
  padding: 12px 14px;
  border-left: 4px solid var(--danger, #c0392b);
  background: #fdf2f2;
  font-weight: 650;
  border-radius: 6px;
}

.pf-batches { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
/* FB #454: finished batches leave the working list behind one Show/Hide button. */
.pf-done-fold .pf-done-fold-btn { width: 100%; min-height: 56px; justify-content: flex-start; font-size: 1.05rem; font-weight: 700; }
.pf-done-fold-list:not([hidden]) { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
/* FB #436: second Add batch under the batch list, so a long list needs no scroll back up. */
.pf-addbatch-foot { display: flex; justify-content: flex-end; margin-top: 12px; }

.pf-batch {
  border: 2px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface, #fff);
}
.pf-batch.is-done { background: #f6fbf7; border-color: #cde9d5; }
/* Hold breach is amber, never red: the PI routes it to QC for a decision, it
   is not an automatic failure. Colour must not overstate the finding. */
.pf-batch.is-hold { border-color: #e6b800; background: #fffdf2; }

.pf-batch-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pf-batch-no { font-size: 1.2rem; font-weight: 800; }
/* Batch date clarity (2026-11-10): "Batch 1 · Tue, Nov 10". A batch from an
   earlier plant day (carried over) is amber with "Yesterday", never plain. */
.pf-batch-day { font-size: 1.1rem; font-weight: 750; color: var(--text, #2c2520); font-variant-numeric: tabular-nums; }
.pf-batch-day::before { content: "\00B7\00A0"; color: var(--muted, #6B6560); }
.pf-batch-day.is-earlier { color: #6b4e00; background: #fff6d6; border: 2px solid #e6b800; border-radius: 999px; padding: 2px 10px; }
.pf-batch-day.is-earlier::before { content: none; }
.pf-card .pf-batch-day { font-size: 1.3rem; }
/* 2026-11-10 (owner): the batch title is the batch number / date control. No
   box: the underlined number says it can be tapped; 64px glove floor. */
.pf-batch-title {
  display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-height: 64px; padding: 4px 8px; margin-left: -8px; border: 0; border-radius: 10px;
  background: transparent; color: inherit; font: inherit; text-align: left;
  cursor: pointer; touch-action: manipulation;
}
.pf-batch-title .pf-batch-no { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: var(--muted, #6B6560); }
.pf-batch-title:active { background: rgba(0,0,0,.06); }
.pf-batch-title:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }

/* ══ VISUAL REC 4 — THE OPERATORS' RING ══════════════════════════════════

   The circled numeral is the most-used mark on BOTH photographed boards and was
   completely absent here. Board 14884 — the stated TV target — is BLACK MARKER
   ONLY: the floor's invented language is enclosure, position and strike, not
   hue. So this is a shape primitive first; colour is secondary reinforcement.

     outlined ring        pending
     filled ring          in progress
     filled ring + strike done

   Deliberately NOT an emoji or an icon font: both boards contain zero
   checkmarks, X's and arrows, and an icon set would be a new language for the
   exact users who bounced off Smartsheet. Ring / strike / blank is already
   understood.

   REVISED 2026-11-03 (owner: "make the icons colors and numbers real"): the
   cooking tablet now carries ONE simple picture per step and state (pot,
   thermometer, clock, snowflake, tray, pause, check, triangle, stop octagon),
   drawn by CSS masks from the step key the markup already has, in
   64z-production-floor-glance.css. Still never an emoji or a glyph in the
   markup, and the ring / fill / strike marks below are unchanged. Plant C
   operators read pictures and numbers before words. The TV strip is unchanged.

   `aria-hidden` in the markup because `.pf-batch-no` beside it already carries
   "Batch 3" as real text — the ring is a visual echo, not a second announcement. */
.pf-batch-ring {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  flex: 0 0 auto;
  border-radius: 999px;
  font-size: 1.25rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  /* The board draws an oval in marker, so the ring is a stroke, not a fill. */
  border: 3px solid var(--text, #2C2520);
  color: var(--text, #2C2520);
  background: transparent;
}
/* Pending = outline only. This is the un-circled number on the wall. */
.pf-batch-ring-pending {
  border-color: var(--muted, #6B6560);
  color: var(--muted, #6B6560);
  border-style: solid;
}
/* In progress = filled. The board circles the batch it has started. */
.pf-batch-ring-live {
  background: var(--brand-red, #CC0000);
  border-color: var(--brand-red, #CC0000);
  color: #fff;
}
/* Done = filled AND struck. Both marks, exactly like the board. */
.pf-batch-ring-done {
  background: var(--text, #2C2520);
  border-color: var(--text, #2C2520);
  color: #fff;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

/* REC 5 — the n/6 ratio: "how much of this batch is left" without counting
   boxes. Same shared referent the numbered specials list already gives. */
.pf-batch-ratio {
  font-size: .85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted, #6B6560);
  letter-spacing: .02em;
}
.pf-batch-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2, #f3f4f6);
  padding: 2px 8px; border-radius: 6px; font-size: .9rem;
}

.pf-cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pf-cell { display: flex; flex-direction: column; gap: 6px; }
.pf-cell-label {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted, #6B6560); font-weight: 650;
  display: flex; align-items: baseline; gap: 6px;
}
/* pf-pi-ui (2026-10-09, audit #4): process card batch row. A step with a PI
   limit ("ROOM TEMPERATURE" + "BELOW 80°F") ran past its 150px cell into the
   next cell's ordinal ("BELOW2/11"). Scoped to the process card: the ordinal
   keeps column 1, the step name wraps in column 2, and the limit hint sits on
   its own line under the name. Nothing leaves the cell, and "n/11" never ends
   up alone on a line. */
.pf-proc-batch .pf-cell { min-width: 0; }
.pf-proc-batch .pf-cell-label {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  column-gap: 6px; row-gap: 2px; overflow-wrap: anywhere;
}
.pf-proc-batch .pf-cell-ord { grid-column: 1; }
.pf-proc-batch .pf-proc-limit-hint { grid-column: 2; }
/* REC 5 — THE ORDINAL. Sequence cannot be colour-only on a landscape iPad,
   where `.pf-cells` auto-fit renders six visually identical boxes and the
   left-to-right stacking only kicks in at 430px. Small, tabular, and redundant
   with the colour on purpose — redundancy is what survives glare. */
.pf-cell-ord {
  flex: 0 0 auto;
  font-size: .7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--muted, #6B6560);
  opacity: .85;
}
.pf-cell-next .pf-cell-ord { color: var(--brand-red, #CC0000); opacity: 1; }
/* ── UX-4: THE TIMELINE ───────────────────────────────────────────────────
   Before: six identical "Stamp now" buttons. Six equal primary actions is zero
   guidance, and it made an out-of-order stamp exactly as easy as the right one.

   Now exactly ONE cell in each batch row is a live primary button (the next
   unstamped field per fieldsForStyle). Done cells show clock + initial. Later
   cells stay visible but inert — the operator needs to know a QC release is
   coming before they commit the cook, they just must not be able to stamp it
   yet. Visible-but-inert is the point; hiding future steps would trade one kind
   of blindness for another. */
.pf-stamp {
  min-height: 56px;
  border: 2px dashed var(--border, #d8dbe0);
  border-radius: 10px;
  background: var(--surface-2, #fafafa);
  font-size: 1rem; font-weight: 600; cursor: pointer;
  color: var(--muted, #6b7280);
}
.pf-stamp:active { background: #eef2f7; }

/* The one fat primary tap. Solid brand red, 72px, and it names the step it is
   about to stamp so a one-tap action is never an ambiguous one. */
.pf-stamp-next {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 72px;
  border: 2px solid var(--brand-red, #cc0000);
  border-style: solid;
  background: var(--brand-red, #cc0000);
  color: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .12);
}
.pf-stamp-next:active { background: #a80000; }
.pf-stamp-verb { font-size: 1.05rem; font-weight: 800; letter-spacing: .01em; }
.pf-stamp-step { font-size: .8rem; font-weight: 650; opacity: .92; }

/* NEXT label above the live button, so the eye lands on the sequence position
   and not only on the colour. */
.pf-cell-next .pf-cell-label { color: var(--brand-red, #cc0000); font-weight: 800; }

/* ── VISUAL REC 3 + 6 — RECESSION BY SIZE AND WEIGHT, NOT BY FADING OUT ─────

   Was `opacity: .55` on the cell plus `#9ca3af` on white in the slot — 2.54:1,
   under the 3:1 floor. Dimming is also the weaker cue: faded text reads as a
   rendering fault or a low battery, not as "this is not mine yet".

   The boards draw a LINE under the not-yet-done group. So we do that: a real
   divider before the first later cell (rec 6), and the recession comes from
   smaller/lighter type at a READABLE contrast rather than from transparency
   (rec 3). Opacity drops to .78 so the cue survives without going under the
   floor. */
.pf-cell-later { opacity: .78; }
.pf-later-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 56px;
  border: 2px dotted var(--border, #e5e7eb);
  border-radius: 10px;
  /* ~5:1 via --ink-mute instead of 2.54:1 cool grey. */
  color: var(--muted, #6B6560);
  font-size: 1.1rem;
  background: transparent;
}

/* REC 6 — THE GROUP RULE. The whiteboard's horizontal line under the remaining
   group, carried into the timeline. `:first-of-type` on the later cells only, so
   exactly one divider is drawn at the boundary. Vertical on a wide grid where
   the cells sit side by side; horizontal once they stack at 430px. */
.pf-cell-later:first-of-type {
  border-left: 2px solid var(--border, #E5D9C4);
  padding-left: 10px;
  margin-left: 2px;
}
/* The stacked (narrow-screen) variant of this divider lives in the EXISTING
   `@media (max-width: 430px)` block further down, not in a second one. Two
   separate 430px blocks would make "the 390px baseline" ambiguous for anyone
   reading the file — and the polish suite reasonably assumes there is one. */

.pf-cell-value { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 56px; }

/* ── POLISH-T5: THE STAMPED CLOCK IS A REAL TAP TARGET ──────────────────────
   Correcting a stamp was a bare text button with an underline that appeared on
   :hover. Two failures on the only surface that matters: there is no cursor on
   an iPad so the affordance was invisible, and the target was ~28px tall — half
   the gloved-fingertip minimum this whole file is built around.

   Now it is a bordered chip at the same 56px floor as Stamp, with a dashed edge
   that says "editable" without a hover, and a visible :active state so a gloved
   tap is confirmed. The ISO strikethrough beside it is untouched. */
.pf-time {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 56px;
  min-width: 88px;
  padding: 8px 14px;
  font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--surface-2, #f7f8fa);
  border: 2px dashed var(--border, #d8dbe0);
  border-radius: 10px;
  cursor: pointer;
  color: var(--text, #1a1a1a);
}
.pf-time:active { background: #eef2f7; transform: translateY(1px); }
.pf-time:hover { border-color: var(--brand-gold, #d4a843); }
.pf-time:focus-visible { outline: 3px solid var(--brand-gold, #d4a843); outline-offset: 2px; }
/* Kevin 2026-10-06: on a cooking run the recorded temperature is its own
   tap target, the same dashed chip as the time (same 56px floor, same
   affordance). "Add °F" (no reading logged) keeps the chip, quieter text. */
.pf-temp-edit { min-width: 88px; }
.pf-temp-edit.is-empty { font-size: 1.05rem; font-weight: 700; color: var(--muted, #6B6560); }

/* THE ISO STRIKETHROUGH. This is the audit artifact, not decoration: the
   original value must remain visible beside its replacement forever. If this
   rule is ever removed, the append-only guarantee in the API becomes
   invisible to the auditor standing at the tablet. */
/* REC 3 — THE ISO ARTIFACT WAS THE FAINTEST TEXT ON THE CARD.
   `#9ca3af` on white measures 2.54:1. This is the superseded value an auditor is
   being asked to trust, and the brief says it must stay VISIBLE. Recession now
   comes from the strike itself plus a slightly smaller size — not from dropping
   under the contrast floor. `--ink-mute` lands ~5:1. */
.pf-struck {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  color: var(--muted, #6B6560);
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pf-initial {
  font-size: .8rem; font-weight: 700;
  background: var(--brand-gold, #d4a843); color: #241c00;
  padding: 2px 7px; border-radius: 999px; text-transform: uppercase;
}

/* ── THE Temp.(F) BOX FROM THE PRINTED CARD ─────────────────────────────────
   Hy's Hoisin card prints a temperature under the processing From, under the
   processing To, and beside QC Release. Row 1 reads 200 / 203 / 204.

   READ-ONLY, and visibly so: this is a `span`, not a button, so it cannot be
   confused with the dashed `.pf-time` chip that means "tap to correct". A
   temperature is corrected through the same ISO path as the time it belongs to,
   which keeps ONE correction affordance per cell instead of two.

   NEUTRAL, NOT AMBER, NOT RED — same reasoning as `.pf-chip-temp` on the TV: a
   recorded reading is a fact, and this file reserves red for the PSI stop.
   Tabular numerals so 98 and 203 line up down a column of cells. */
.pf-temp {
  display: inline-flex; align-items: center;
  font-size: 1.05rem; font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px; border-radius: 8px;
  /* TOKENS + THE FALLBACK LITERALS ALREADY IN THIS FILE. Deliberately no new
     hex: the visual pass concluded this module's problem was never too few
     colours, and `.pf-time` right above already establishes
     --surface-2/#f7f8fa and --border/#d8dbe0 as the "recorded value" surface.
     Reusing them makes the temperature chip visibly the same KIND of thing as
     the clock beside it, at zero palette cost.

     `--muted`, not `--text-muted`: the dark-mode bridge at the top of this file
     defines --muted. An unbridged token would fall through to its literal and go
     low-contrast the moment someone flips the theme. */
  background: var(--surface-2, #f7f8fa);
  border: 1px solid var(--border, #d8dbe0);
  color: var(--muted, #6B6560);
  white-space: nowrap;
}

.pf-psi {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border, #e5e7eb);
}
.pf-psi label { font-size: .9rem; font-weight: 600; }
.pf-check { display: flex; align-items: center; gap: 8px; }
/* Checkbox scaled up: the PSI-replacement confirm is a safety gate and must be
   as easy to hit as any other control on this surface. */
.pf-check input { width: 26px; height: 26px; }

.pf-export-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }

/* ── Phone / narrow tablet (390px baseline) ───────────────────────────────── */
@media (max-width: 430px) {
  /* UX-4 on 390px: the timeline STACKS rather than shrinking to a 2-up grid.
     One step per row keeps the next-step button full width and thumb-sized;
     two 150px columns would put the live primary action at half width next to
     an inert placeholder, which is the opposite of the intent. */
  .pf-cells { grid-template-columns: 1fr; }
  .pf-stamp-next { min-height: 76px; }
  /* Later steps collapse to a single compact line each so a 6-step card is
     still scrollable without hiding what is coming. */
  .pf-cell-later { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
  .pf-cell-later .pf-later-slot { min-height: 36px; flex: 0 0 56px; }
  /* VISUAL REC 6 — the group rule, stacked. The cells run top-to-bottom here, so
     the boundary the boards draw as a horizontal underline is a horizontal rule. */
  .pf-cell-later:first-of-type {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    border-top: 2px solid var(--border, #E5D9C4);
    padding-top: 10px;
    margin-top: 4px;
  }

  .pf-input, .pf-input-sm { flex: 1 1 100%; }
  .pf-bigbtn { flex: 1 1 100%; }
  .pf-material-row { flex-direction: column; align-items: stretch; }
  .pf-run-sku { flex: 1 1 100%; }
  .pf-opchip { flex: 1 1 100%; justify-content: center; }
  .pf-cook-temp, .pf-cook-mins { font-size: 1.9rem; }

  /* Floor header compresses but keeps Open TV reachable on one row. */
  .pf-floorhead { padding: 6px 0 10px; }
  .pf-floorhead-plant { font-size: 1.2rem; }
  .pf-floorhead-tv { flex: 1 1 100%; justify-content: center; }

  /* Plants stay one row of three at 390px — 3 × ~110px fits, and wrapping them
     to two rows would re-spend the vertical space this pass just reclaimed. */
  .pf-plantrow { gap: 6px; }
  .pf-plantbtn { flex: 1 1 0; min-width: 0; padding: 10px 6px; font-size: .95rem; }

  /* ── POLISH-T4: THE LIVE NEXT-STAMP IS ABOVE THE FOLD ────────────────────
     Once a run is active the operator's whole job is one button. On a 390px
     iPad the DONE cells were full-height rows stacked above it, so a batch six
     stamps deep pushed the live primary action off-screen and the operator had
     to scroll to work — while holding a hose.

     Fix is vertical budget, not hiding: done cells collapse to a single compact
     line (label left, clock right) so six of them cost ~6 lines instead of ~6
     cards, and the next-step cell keeps its full 76px. The done clock keeps the
     56px correction target (T5) — it is a row now, not a shrunken chip. */
  .pf-cell-done {
    flex-direction: row; align-items: center; justify-content: space-between;
    gap: 10px;
    padding: 2px 0;
    border-bottom: 1px solid var(--border, #f0f1f3);
  }
  .pf-cell-done .pf-cell-label { flex: 1 1 auto; min-width: 0; }
  .pf-cell-done .pf-cell-value { flex: 0 0 auto; min-height: 56px; justify-content: flex-end; }
  .pf-cell-done .pf-time { min-height: 56px; min-width: 76px; font-size: 1.25rem; }

  /* Batch head is one tight row so the card starts at the work, not at chrome. */
  .pf-batch { padding: 10px; }
  .pf-batch-head { margin-bottom: 6px; }

  /* The time card is the only thing on screen once a run is live: pull it up so
     the next-step button lands in the first viewport height. */
  .pf-card-head { margin-bottom: 4px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TV BOARD — 10-foot read
   ═══════════════════════════════════════════════════════════════════════════ */

/* ══ TV LEE KUM KEE LIGHT THEME (Kevin/Hy 2026-10-07) ══════════════════════

   Kevin 2026-10-07 17:31 PT: "Hy wants the TV Board to be more LKK themed, not
   dark mode." This REPLACES the 2026-08 decision to keep the wall dark (the
   "a bright screen is the brightest object in the room" argument). The wall is
   now the house surface: Bright Eggshell page (never pure white), warm-white
   cards, warm rules, a Heritage Red masthead carrying the Red Bridge logo
   (floor/internal = Red Bridge only: no Golden Plaque, no Gateway corners),
   gold rules and gold-ink accents, purple for the SKU headers.

   ONE scoped token block, `--pftv-*`, so the wall never borrows the tablet's
   bridge. Light values resolve through the house tokens; the dark block below
   pins them to literals because `90-dark-mode.css` remaps --eggshell-bright,
   --warm-white, --ink and --rule, and a wall browser that once had the office
   dark toggle tapped would otherwise repaint the board.

   ALARM vs BRAND RED. Heritage Red is the masthead and NOTHING ELSE on this
   surface. The 2-hour QC hold (the only safety state the wall shows) is a
   dark-amber BLOCK with a heavy amber border, a folded corner, a warning
   glyph and its "HOLD 0:00 / 25:00 left" label: four cues, none of them red,
   so a cream wall full of brand red can never be read as a wall full of
   alarms, and the hold survives colour-blindness and glare.

   Contrast (measured, WCAG): ink 17.9:1, SKU purple 9.5:1, gold-ink numbers
   7.2-7.6:1, done green 9.5:1, live white-on-green 8.7:1, hold text 9.1:1,
   secondary labels >= 7.8:1, masthead white-on-red 5.8:1 (large display text
   only). Full table in the PR. */
body.pf-tv-mode,
:where(.pf-tv) {
  --pftv-page:     var(--eggshell-bright, #FFF5E6);
  --pftv-card:     var(--warm-white, #FFFDF8);
  --pftv-rule:     var(--rule, #E5D9C4);
  --pftv-ink:      var(--ink-strong, #1A1410);
  --pftv-ink-2:    var(--ink-soft, #4A4038);
  --pftv-ink-3:    var(--ink-mute, #6B6560);
  --pftv-red:      var(--heritage-red, #CC0000);
  --pftv-gold:     var(--heritage-gold, #D4A843);
  --pftv-gold-ink: #6B4E00;
  --pftv-purple:   var(--heritage-purple, #5B2C8A);
  --pftv-shade:    var(--eggshell-shade, #F0E0C8);
  --pftv-done-bg:  #E3F1E5;
  --pftv-done-ink: #14451F;
  --pftv-done-edge:#2c6b41;
  --pftv-live:     #17552A;
  --pftv-cook-bg:  #F7EBD0;
  --pftv-fill-bg:  #EFE6F7;
  --pftv-fill-ink: #3D1A5C;
}
[data-theme="dark"] body.pf-tv-mode,
[data-theme="dark"] :where(.pf-tv) {
  --pftv-page:     #FFF5E6;
  --pftv-card:     #FFFDF8;
  --pftv-rule:     #E5D9C4;
  --pftv-ink:      #1A1410;
  --pftv-ink-2:    #4A4038;
  --pftv-ink-3:    #6B6560;
  --pftv-red:      #CC0000;
  --pftv-gold:     #D4A843;
  --pftv-purple:   #5B2C8A;
  --pftv-shade:    #F0E0C8;
  color-scheme: light;
}

/* The shell is unreachable on a wall TV — hide it rather than shrink it. */
body.pf-tv-mode .app-nav,
body.pf-tv-mode .sidebar,
body.pf-tv-mode .app-header,
body.pf-tv-mode .ask-fab,
body.pf-tv-mode .page-hero { display: none !important; }
body.pf-tv-mode { background: #FFF5E6; background: var(--pftv-page, #FFF5E6); }
[data-theme="dark"] body.pf-tv-mode { background: #FFF5E6; }
body.pf-tv-mode #view,
body.pf-tv-mode .app-main { padding: 0 !important; margin: 0 !important; max-width: none !important; }

/* TV-FIT (2026-10-07, Kevin 12:25: "when at a larger resolution it squeezes
   into mobile size"). NOT a media query. Measured in Chromium: at any CSS width
   above 1280px the shell is `.app-shell { grid-template-columns: 248px 1fr }`
   (02-layout.css). The rule above hides the sidebar with `display: none`, so the
   sidebar no longer takes the first grid cell, `main.main` auto-places into it,
   and the whole board renders in a 248px column: SKUs one letter per line, a
   phone-width strip on a 4K wall. At 1280px and below the nav-drawer breakpoint
   (25-plan.css) collapses the grid to one column, which is why small screens
   looked right and big ones did not.

   The names in the hide-list above (.app-header, .app-nav, .ask-fab, .app-main)
   are not the names the shell renders, so the real top bar, footer and Ask
   AIOP button also stayed on the wall. These are the real ones.

   The feedback button is not on the TV board at all (owner request 2026-10-29: "TV
   board should hide the feedback drawer"). feedback.js removes it from the
   document while body.pf-tv-mode is set; no CSS hides it here, so the
   never-hidden rule for every other page (feedback-fab-fullscreen.test.js)
   still holds. */
body.pf-tv-mode .app-shell { display: block !important; grid-template-columns: none !important; }
body.pf-tv-mode .main { display: block !important; min-width: 0; width: 100%; }
body.pf-tv-mode .topbar,
body.pf-tv-mode .app-footer,
body.pf-tv-mode .sidebar-scrim,
body.pf-tv-mode .agent-fab,
body.pf-tv-mode .agent-fab-tooltip { display: none !important; }

/* POLISH-TV6: the board is a FIXED-HEIGHT viewport, not a scrolling document.
   `height: 100vh` + `overflow: hidden` is the structural half of the no-scroll
   rule — it forces the density ladder to do its job instead of letting a sixth
   strip quietly push the notes rail off a 1080p screen. Beyond the ladder's
   floor (7+ strips) content clips rather than scrolls, which is the honest
   failure mode on a wall with no mouse: a supervisor can see there is more, and
   nobody can reach a scrollbar anyway. */
.pf-tv {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  box-sizing: border-box;
  background: var(--pftv-page, #FFF5E6);
  color: var(--pftv-ink, #1A1410);
  --pftv-pad: clamp(12px, 1.6vw, 28px);
  padding: var(--pftv-pad);
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.2vh, 22px);
}

/* POLISH-TV5: HEADER IS PLANT · DATE · CLOCK · BATCHES-DONE. Nothing else.
   No plant-switcher: the Open-TV link already carries `plant=`, and a control
   nobody can reach on a wall-mounted screen is just stolen pixels. `flex: 0 0
   auto` so the header never grows at the strips' expense. */
.pf-tv-head {
  display: flex; align-items: center; gap: clamp(14px, 1.8vw, 36px); flex-wrap: wrap;
  /* LEE KUM KEE MASTHEAD: a full-bleed Heritage Red band with a gold rule.
     Bleeds to the screen edge by cancelling the board padding. */
  margin: calc(-1 * var(--pftv-pad, 16px)) calc(-1 * var(--pftv-pad, 16px)) 0;
  padding: clamp(6px, .9vh, 12px) var(--pftv-pad, 16px);
  background: var(--pftv-red, #CC0000);
  color: #FFFDF8;
  border-bottom: clamp(3px, .45vh, 6px) solid var(--pftv-gold, #D4A843);
  flex: 0 0 auto;
}
/* Red Bridge on a warm-white plate: the arch is red, so it needs a light
   ground to read on a red band (and the brand rule is the logo stands out). */
.pf-tv-logo {
  display: block; flex: 0 0 auto;
  height: clamp(34px, 3.2vw, 64px); width: auto;
  background: #FFFDF8; border-radius: 8px;
  padding: clamp(3px, .3vw, 6px) clamp(6px, .5vw, 10px);
  box-sizing: content-box;
}
.pf-tv-plant { font-size: clamp(28px, 3.4vw, 60px); font-weight: 900; letter-spacing: .02em; color: #FFFDF8; }
.pf-tv-date  { font-size: clamp(18px, 1.8vw, 32px); color: #FFFDF8; font-weight: 650; }
/* Clock + total sit on a warm-white plaque with a gold edge: gold accents at a
   7:1+ read, which gold-on-red cannot give. */
.pf-tv-clock {
  font-size: clamp(20px, 2vw, 36px); color: var(--pftv-gold-ink, #6B4E00); font-weight: 800;
  background: var(--pftv-card, #FFFDF8); border: 2px solid var(--pftv-gold, #D4A843);
  border-radius: 8px; padding: 0 .45em; line-height: 1.35;
}
.pf-tv-total {
  margin-left: auto; text-align: right;
  background: var(--pftv-card, #FFFDF8); border: 2px solid var(--pftv-gold, #D4A843);
  border-radius: 8px; padding: .15em .6em;
}
.pf-tv-total-n { display: block; font-size: clamp(30px, 3.4vw, 64px); font-weight: 900; color: var(--pftv-gold-ink, #6B4E00); line-height: 1; }
.pf-tv-total-l { font-size: clamp(11px, .9vw, 16px); text-transform: uppercase; letter-spacing: .12em; color: var(--pftv-ink-2, #4A4038); font-weight: 700; }
/* M-71 "Not updated since HH:MM: check the TV connection" (a failed poll keeps
   the last board up). It had no rule, so it rendered as bare page text. A calm
   cream line with a dark-amber edge: noticeable, readable, never the red alarm
   colour. The all plants screen's own rule (65-) sets the same look there.
   The line sits above the masthead, whose negative top margin (the full-bleed
   red band) used to slide over it on both screens; the bottom margin gives
   that space back. */
.pf-tv .pf-tv-stale {
  flex: 0 0 auto; color: #4a3a00; background: var(--pftv-shade, #F0E0C8);
  border: 2px solid #4a3a00; border-radius: 10px; padding: .25em .7em;
  font-weight: 800; font-size: calc(clamp(14px, 1.2vw, 24px) * var(--pf-strip-scale, 1));
  margin-bottom: var(--pftv-pad, 16px);
}

/* ── POLISH-TV6: DENSITY LADDER ─────────────────────────────────────────
   The requirement is that the DEFAULT 8/18 seed fits a 1080p 55" screen with no
   scroll. That seed is five strips on Plant A (CL100F + Panda OS from board
   14884, plus KC / M.Teriyaki / Stir Fry from 14885), so a fixed type scale
   cannot satisfy both "fits five" and "fills the wall when two are running".

   `--pf-strip-scale` is a single multiplier the strip's own type keys off, and
   the JS-emitted `data-density` steps it. Two strips get the full scale; five
   get 0.72; seven or more stop shrinking (the brief allows overflow past that
   point, and legibility at ten feet beats completeness).

   `min-height: 0` on the strips column is load-bearing: without it a flex child
   refuses to shrink below its content and the last strip clips instead of the
   column distributing space. */
.pf-tv-strips {
  display: flex; flex-direction: column;
  gap: clamp(8px, 1.2vh, 22px);
  flex: 1 1 auto;
  min-height: 0;
  /* TV-FIT: when even the last rung does not fit, the strips clip at the
     column edge instead of painting underneath the notes rail. */
  overflow: hidden;
  --pf-strip-scale: 1;
}
/* The ladder is calibrated against a real 1080p budget, not picked by eye.
   At 1920×1080 the fixed cost is header ~104px + notes rail ~49px + padding and
   gaps ~82px ≈ 235px, leaving ~845px for the strips. The 8/18 seed is FIVE
   strips, so each may cost ~165px including the 4 inter-strip gaps.

   Scale .72 measured 167px/strip → 1105px total → 25px of clipped notes rail.
   .66 lands the seed at ~1037px with ~43px of headroom for a wrapped note or a
   longer SKU. Re-run the arithmetic if the header or the rail changes. */
.pf-tv-strips[data-density="md"] { --pf-strip-scale: .82; gap: clamp(7px, 1vh, 16px); }
.pf-tv-strips[data-density="sm"] { --pf-strip-scale: .66; gap: clamp(6px, .8vh, 12px); }
.pf-tv-strips[data-density="xs"] { --pf-strip-scale: .54; gap: clamp(4px, .5vh, 8px); }
/* TV-FIT: one rung below xs, reached only when fitTvBoard measures that xs
   still does not fit the screen (e.g. five strips, two of them 20+ batches).
   This is the floor: below it the chip number drops under ~15px at 1080p,
   which stops reading at ten feet. Past this rung the board clips. */
.pf-tv-strips[data-density="xxs"] { --pf-strip-scale: .46; gap: clamp(3px, .4vh, 6px); }

.pf-tv-strip {
  background: var(--pftv-card, #FFFDF8);
  border: 2px solid var(--pftv-rule, #E5D9C4);
  border-left: 6px solid var(--pftv-gold, #D4A843);
  border-radius: 12px;
  padding: calc(clamp(8px, 1.1vw, 18px) * var(--pf-strip-scale, 1));
  display: flex; flex-direction: column;
  gap: calc(10px * var(--pf-strip-scale, 1));
}

/* ── POLISH-TV1 / TV3: STRIP HEAD = WHITEBOARD TOP LINE ────────────────────
   Was a single wrapping flex row: SKU, line, live pill and target were all
   siblings, so a long SKU wrapped "Now on batch 4" onto its own line (TV3's
   complaint — it read as a floating pill and a walker had to hunt for a green
   chip instead) and could push the target under the SKU.

   Now a 2-column grid: identity on the left (SKU with line + live state
   directly under it, one visual unit), target hard-anchored right. Grid, not
   flex, so the target column cannot be displaced by SKU length. */
.pf-tv-strip-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 1.6vw, 32px);
}
/* Cooking/processing strips carry no quantity (Hy 2026-10-07): the identity
   block takes the whole head instead of leaving an empty right column. */
.pf-tv-strip-head.pf-tv-strip-head-noqty { grid-template-columns: minmax(0, 1fr); }
.pf-tv-strip-id { min-width: 0; display: flex; flex-direction: column; gap: calc(4px * var(--pf-strip-scale, 1)); }
.pf-tv-strip-sub { display: flex; align-items: center; gap: clamp(8px, 1vw, 18px); flex-wrap: wrap; }
.pf-tv-sku {
  font-size: calc(clamp(20px, 2.3vw, 44px) * var(--pf-strip-scale, 1));
  font-weight: 800; line-height: 1.1;
  color: var(--pftv-purple, #5B2C8A);
  overflow-wrap: anywhere;
}
.pf-tv-line { font-size: calc(clamp(13px, 1.15vw, 24px) * var(--pf-strip-scale, 1)); color: var(--pftv-ink-2, #4A4038); font-weight: 650; }
/* Live state is a board fact and sits with the SKU it describes. */
.pf-tv-live {
  font-size: calc(clamp(15px, 1.4vw, 30px) * var(--pf-strip-scale, 1));
  font-weight: 800; color: #FFFDF8;
  background: var(--pftv-live, #17552A); padding: 2px 14px; border-radius: 999px;
  white-space: nowrap;
}
.pf-tv-live-idle { background: var(--pftv-shade, #F0E0C8); color: var(--pftv-ink-2, #4A4038); }
/* The photo's big "6000": the loudest number on the row, anchored right by the
   grid column rather than by `margin-left:auto` in a row that could wrap. */
.pf-tv-target {
  font-size: calc(clamp(24px, 2.9vw, 58px) * var(--pf-strip-scale, 1));
  font-weight: 900; color: var(--pftv-gold-ink, #6B4E00); line-height: 1;
  /* brand gold, like the marker: a gold underline rule under gold-ink figures
     (#d4a843 text on cream is 2.2:1 and would not read at ten feet). */
  border-bottom: .08em solid #d4a843; padding-bottom: .04em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── POLISH-TV2: CHIPS READ AT TEN FEET ─────────────────────────────────
   The chip row IS the whiteboard: number on top, marker time underneath, blank
   slots left blank because the blanks are the remaining work.

   `flex-wrap: nowrap` + `flex: 1 1 0` is the change that matters. The old
   wrapping row let a 13-slot strip (CL100F on the seed) break onto a second
   line, which turned one whiteboard row into two and broke the 1-screen budget.
   Now the slots divide the row's width evenly and always stay on one line —
   exactly like the marker chips on the photographed board.

   No icons, no sparklines, no second metric row: anything added here comes out
   of the chip's type size, and the chip's type size is the whole point. */
.pf-tv-chips {
  display: flex;
  gap: calc(clamp(5px, .6vw, 12px) * var(--pf-strip-scale, 1));
  flex-wrap: nowrap;
  align-items: stretch;
}
.pf-chip {
  flex: 1 1 0;
  min-width: 0;
  padding: calc(clamp(5px, .65vw, 13px) * var(--pf-strip-scale, 1)) calc(clamp(3px, .4vw, 8px) * var(--pf-strip-scale, 1));
  border-radius: 10px;
  background: var(--pftv-card, #FFFDF8);
  border: 2px solid var(--pftv-rule, #E5D9C4);
  color: var(--pftv-ink, #1A1410);
  text-align: center;
}
/* TV-FIT: the wall chip may shrink to its share of the row. Two rules later in
   this file used to stop it: the touch-sheet chip (min-width 96px, white
   fill — now scoped to buttons/labels) and the `(pointer: coarse)` 56px
   touch minimum, which a TV browser that reports a coarse pointer would apply
   to a chip nobody can touch. */
.pf-tv .pf-chip { min-width: 0; min-height: 0; overflow: hidden; }

/* TV-FIT (2026-10-07): a strip with more than 14 batches (Plant B's
   21-batch SFG-Hoisin for cans) wraps into rows of EQUAL width instead of
   running off the right edge. tvChipsMarkup sets --pf-chip-cols so 21 reads
   as 11 + 10, left to right like the marker board. One-row strips keep the
   nowrap flex row above unchanged. */
.pf-tv-chips-multirow {
  display: grid;
  grid-template-columns: repeat(var(--pf-chip-cols, 14), minmax(0, 1fr));
}
/* REC 4 ON THE WALL — the same enclosure the tablet now uses and the same mark
   the operators draw in marker. A started chip's number gets the ring; an
   unstarted one stays plain, which is exactly how board 14884 reads. */
.pf-chip-no {
  font-size: calc(clamp(17px, 1.75vw, 34px) * var(--pf-strip-scale, 1));
  font-weight: 800; line-height: 1.1;
}
.pf-chip-done .pf-chip-no,
.pf-chip-in_progress .pf-chip-no,
.pf-tv .pf-chip-filling .pf-chip-no,
.pf-chip-live .pf-chip-no {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: calc(clamp(24px, 2.4vw, 46px) * var(--pf-strip-scale, 1));
  min-height: calc(clamp(24px, 2.4vw, 46px) * var(--pf-strip-scale, 1));
  border-radius: 999px;
  border: 2px solid currentColor;
  font-variant-numeric: tabular-nums;
}
/* Done also carries the STRIKE — filled ring + strike, the board's "finished". */
.pf-chip-done .pf-chip-no {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
/* Marker time under the number. `min-height` reserves the line even when blank
   so a started and an unstarted chip are the same height — a ragged chip row
   reads as a rendering fault from across the floor. */
.pf-chip-time {
  font-size: calc(clamp(12px, 1.25vw, 26px) * var(--pf-strip-scale, 1));
  color: var(--pftv-ink-2, #4A4038); min-height: 1.25em; line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.pf-chip-done { background: var(--pftv-done-bg, #E3F1E5); border-color: var(--pftv-done-edge, #2c6b41); color: var(--pftv-done-ink, #14451F); }
.pf-chip-done .pf-chip-time { color: var(--pftv-done-ink, #14451F); }
.pf-chip-in_progress { background: var(--pftv-cook-bg, #F7EBD0); border-color: #d4a843; border-style: dashed; }
.pf-chip-in_progress .pf-chip-time { color: #4a3a00; }
/* FILLING (F6, 2026-09-17) had no wall style and read as an unstarted chip.
   On cream it gets the purple family: distinct from cooking (gold, dashed),
   done (green, struck) and hold (dark-amber block). */
.pf-tv .pf-chip-filling { background: var(--pftv-fill-bg, #EFE6F7); border-color: var(--pftv-purple, #5B2C8A); color: var(--pftv-fill-ink, #3D1A5C); }
.pf-tv .pf-chip-filling .pf-chip-time { color: var(--pftv-fill-ink, #3D1A5C); }

/* ══ VISUAL REC 7 — THE HOLD BREACH HAS TO BE VISIBLE AT TEN FEET ═══════════

   Was `border-color: #e6b800` and NOTHING ELSE. A chip that is both `done` and
   `hold` kept the green `#16301f` fill, so at ten feet a 2px amber edge against a
   green fill was very nearly nothing — while the 2-hour post-QC hold is stated in
   three separate PIs and is the single most safety-relevant thing on this wall.

   Three changes:
     1. A REAL FILL, not just an edge.
     2. HOLD OUTRANKS DONE in the cascade — it is declared after `.pf-chip-done`
        and raises specificity, so a done+hold chip reads as HOLD. A supervisor
        needs to see "this one needs a QC decision", not "this one is finished".
     3. A SECOND NON-COLOUR CUE: a corner mark, so the state survives
        colour-blindness and a sun-lit screen.

   STAYS AMBER. QC owns the disposition ("take sample to QC for checking"), so it
   must never become red — red is the PSI hard stop and stealing it would destroy
   the one alarm colour on the surface. */
.pf-chip-hold,
.pf-chip.pf-chip-hold,
.pf-chip-done.pf-chip-hold,
.pf-chip-in_progress.pf-chip-hold {
  background: #4a3a00;
  border-color: #e6b800;
  border-width: 3px;
  color: #ffe89a;
  position: relative;
}
.pf-chip-hold .pf-chip-no { color: #ffe89a; }
.pf-chip-hold .pf-chip-time { color: #ffd84d; }
/* AUDIT pf_155 F1 (2026-10-08): the light-wall filling rule above is 0,3,0 and
   was beating this 0,2,0 hold rule, leaving a filling+hold chip time #3D1A5C on
   #4A3A00 (1.26:1). Hold outranks filling the same way it outranks done. */
.pf-tv .pf-chip-filling.pf-chip-hold .pf-chip-time { color: #ffd84d; }
/* The second, non-colour cue: a folded amber corner. Not an icon — both boards
   contain zero icons — just a mark, like the group underline on 14884. */
/* LIGHT WALL (2026-10-07): a third non-colour cue, a warning glyph top-left.
   On cream the dark-amber block is already the darkest object on the board;
   the glyph + the "HOLD 0:00 / left" label make it readable without colour. */
.pf-tv .pf-chip-hold::before {
  content: '\26A0';
  position: absolute; top: 2px; left: 6px;
  font-size: calc(clamp(12px, 1.1vw, 22px) * var(--pf-strip-scale, 1));
  line-height: 1; color: #ffe89a;
}
.pf-chip-hold::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  border-width: 0 12px 12px 0;
  border-style: solid;
  border-color: transparent #e6b800 transparent transparent;
  border-top-right-radius: 8px;
}

/* THE LIVE CHIP IS THE LOUDEST THING ON THE WALL (TV2).
   "Which batch are we on right now" is the one fact a supervisor crosses the
   floor to read, so the live chip gets the green ring AND a brighter fill AND
   heavier type — three redundant signals, because a single cue that depends on
   colour alone fails for a colour-blind supervisor and washes out on a sun-lit
   plant TV. Motion is the fourth cue and the only optional one. */
.pf-chip-live {
  border-color: #17552A;
  border-width: 3px;
  background: var(--pftv-live, #17552A);
  box-shadow: 0 0 0 3px rgba(23, 85, 42, .28);
  animation: pf-pulse 2s ease-in-out infinite;
}
.pf-chip-live .pf-chip-no { color: #FFFDF8; font-weight: 900; }
.pf-chip-live .pf-chip-time { color: #FFFDF8; }
@keyframes pf-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(23, 85, 42, .28); }
  50%      { box-shadow: 0 0 0 8px rgba(23, 85, 42, .10); }
}
@media (prefers-reduced-motion: reduce) {
  .pf-chip-live { animation: none; }
}

/* ── POLISH-TV4: NOTES RAIL STAYS MARKER-STYLE ───────────────────────────
   On board 14885 these are red handwriting on the right rail: "CO1 CO2 CO3 all
   done", bag/filter reminders, "smells all good". They are shift asides, not
   controls — so they render as flat marker text on a dark rail with no button
   chrome whatsoever, and they never grow to compete with the chips.

   `flex: 0 0 auto` keeps the rail from stealing height from the strips when a
   note wraps; the strips own the flexible space (TV6). */
.pf-tv-notes {
  display: flex; gap: clamp(10px, 1.2vw, 22px); flex-wrap: wrap;
  border-top: 3px solid var(--pftv-gold, #D4A843); padding-top: clamp(8px, 1vh, 14px);
  flex: 0 0 auto;
}
/* Tablet 10/29b (item 6): the colour key. Its own line under the notes; the
   swatches are real chips (same classes as the strips), shrunk, no pulse. */
.pf-tv-legend {
  flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center;
  gap: clamp(6px, 0.8vw, 16px) clamp(10px, 1.2vw, 24px);
  font-size: clamp(11px, 0.95vw, 19px); color: var(--pftv-ink-2, #4A4038); font-weight: 600;
}
.pf-tv-legend-title { font-weight: 800; color: var(--pftv-ink, #1A1410); }
.pf-tv-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.pf-tv .pf-tv-legend-swatch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.4em; height: 2em; padding: 0; border-radius: 6px; animation: none;
}
.pf-tv .pf-tv-legend-swatch .pf-chip-no { font-size: 1em; min-width: 1.4em; min-height: 1.4em; border-width: 2px; }
.pf-tv .pf-tv-legend-swatch.pf-chip-hold::before { font-size: 0.8em; top: 0; left: 2px; }
.pf-tv .pf-tv-legend-swatch.pf-chip-hold::after { border-width: 0 7px 7px 0; }
.pf-tv-note {
  font-size: clamp(13px, 1.2vw, 24px);
  color: var(--pftv-ink, #1A1410);
  font-weight: 600;
  padding: 2px 0 2px 14px;
  border-left: 5px solid var(--pftv-ink-3, #6B6560);
  background: none;
  border-radius: 0;
  line-height: 1.35;
}
/* REC 8 (TV half) — the orphan `#60a5fa` blue goes here too. CIP is a cleaning
   note, not a fourth semantic family; it takes a neutral-cool rail edge that
   reads as "different kind of note" without claiming a meaning the chip
   vocabulary does not have. Filter keeps gold. */
.pf-tv-note-cip    { border-left-color: var(--pftv-purple, #5B2C8A); }
.pf-tv-note-filter { border-left-color: #d4a843; }

/* LOW-2: 7+ strips clip by design. Show a cue instead of a silent missing rail. */
.pf-tv-overflow {
  flex: 0 0 auto;
  color: var(--pftv-gold-ink, #6B4E00);
  font-size: clamp(13px, 1.2vw, 22px);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.pf-tv-loading, .pf-tv-empty, .pf-tv-error {
  color: var(--pftv-ink-2, #4A4038); font-size: clamp(18px, 2vw, 34px);
  padding: 15vh 0; text-align: center;
}
/* Not red: red is the masthead. A failed load is a dark-amber line with a
   warning glyph, the same non-red treatment as the hold. */
.pf-tv-error { color: #4a3a00; font-weight: 800; }
.pf-tv-error::before { content: '\26A0  '; }

/* ═══════════════════════════════════════════════════════════════════════════
   PROCESS PASS A1–A7 (2026-08-19) — the PIs' own sequence, on screen

   Grounded in Hy's five Production Instructions, not in a UX opinion:
     A1 pre-start acks       Panda OS §1–2 / oil §1–6
     A2 first-batch handshake Panda OS §11–12 / oil §12–13
     A3 live 2h hold clock    Panda OS §10.1 / SFG §, oil = NO clock
     A4 oil PSI every batch   oil §10–11
     A5 pace vs target        the board's own 4:00 → 6:25 → 8:15
     A6 doc age               effective_date / supersedes already in the library
     A7 dual-run honesty      Esther still owns paper-vs-digital

   COLOUR DISCIPLINE IS UNCHANGED. Red remains the PSI hard stop and nothing
   else. Every gate and clock added here is amber, because every one of them
   routes to a human decision (QC, Engineering, a filler, a supervisor) rather
   than to an automatic failure. A red hold clock would tell an operator the
   batch is condemned; the PI says "take sample to QC for checking".
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── A1: PRE-START CARD ────────────────────────────────────────────────────
   Amber like specials, because it is the same kind of thing: an instruction the
   operator must act on before the product moves. 56px tap floor on every row —
   these are gloved taps like any other control on this surface.

   No "check all" shortcut exists by design: each line is a separate PI step and
   one master switch would turn five acknowledgements into one shrug. */
.pf-preflight {
  border-left: 6px solid var(--brand-gold, #d4a843);
  background: #fffdf2;
}
.pf-preflight-title { margin: 0 0 4px; font-size: 1.1rem; font-weight: 800; }
.pf-preflight-help {
  margin: 0 0 12px; font-size: .9rem; line-height: 1.45;
  color: var(--muted, #6b7280);
}
.pf-preflight-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pf-preflight-check {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 4px 8px;
  border-radius: 10px; cursor: pointer;
  font-size: 1rem; font-weight: 600; line-height: 1.3;
}
.pf-preflight-check input[type="checkbox"] {
  /* Same scale-up as the PSI replacement confirm: a safety acknowledgement must
     be hittable in gloves, and a 16px native box is not. */
  width: 30px; height: 30px; flex: 0 0 auto; accent-color: var(--brand-red, #cc0000);
}
.pf-preflight-item.is-done .pf-preflight-label { text-decoration: none; opacity: .7; font-weight: 500; }
.pf-preflight-confirm { width: 100%; }

/* ── A2: THE FILLING-LINE HANDSHAKE ───────────────────────────────────────
   A SECONDARY group, visually subordinate to the timeline's one fat primary
   (UX-4). These are small acknowledgements — "Engineering released", "filler
   told" — not candidates for "the next step", and they must never compete with
   the one button the operator is meant to tap next.

   Still 56px: subordinate in emphasis, identical in reachability. */
.pf-handshake {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border, #e5e7eb);
}
.pf-handshake-title {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted, #6b7280); font-weight: 650; margin-bottom: 6px;
}
.pf-handshake-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-hs { display: flex; }
.pf-hs-btn {
  min-height: 56px;
  padding: 8px 16px;
  border: 2px solid var(--brand-gold, #d4a843);
  border-radius: 10px;
  background: #fffdf2;
  color: #4a3a00;
  font-size: .95rem; font-weight: 700;
  cursor: pointer;
}
.pf-hs-btn:active { background: #f7edd0; transform: translateY(1px); }
.pf-hs-btn:focus-visible { outline: 3px solid var(--brand-gold, #d4a843); outline-offset: 2px; }
/* Acknowledged: the clock replaces the button. An answered handshake is not a
   pending action, so it stops looking like one. */
.pf-hs-done {
  align-items: center; gap: 8px;
  min-height: 56px; padding: 8px 14px;
  border-radius: 10px; background: #f6fbf7; border: 2px solid #cde9d5;
}
.pf-hs-label { font-size: .8rem; font-weight: 650; color: var(--muted, #6b7280); }
.pf-hs-time { font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* A2 — ready for fill, on the tablet.
   2026-09-17 (H6, Hy 10:45:05): "If it's ready, then they can power up GREEN,
   but they do not cross this path." Green = ready to fill; the strike-through
   is reserved for actual fill_end evidence (`.pf-batch.is-done`). Was amber. */
.pf-ready-badge {
  font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  background: var(--success); color: #fff;
  padding: 3px 10px; border-radius: 999px;
}
/* H6 — fill has started; waiting for fill_end. Not struck through. */
.pf-filling-badge {
  font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  /* H6 (2026-09-17 checkpoint): in-process is ORANGE — the palette's warning
     amber — not slate/blue. Green is READY, orange is FILLING, struck is DONE. */
  background: var(--warning); color: #fff;
  padding: 3px 10px; border-radius: 999px;
}

/* ── A3: THE LIVE HOLD CLOCK ──────────────────────────────────────────────
   The 2-hour rule made visible WHILE the sauce sits, which is the only time a
   human can still act on it. Neutral until 15 minutes remain, then amber, then
   amber-breached. NEVER red and never a refusal: the PI assigns the disposition
   to QC ("take sample to QC for checking"), so the copy routes there instead of
   condemning the batch.

   Oil renders no clock at all — PI-500002 has a NULL hold and a fabricated 2:00
   would be an invented process control. */
.pf-holdclock {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--border, #e5e7eb);
  background: var(--surface-2, #f7f8fa);
}
.pf-holdclock-label {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 650; color: var(--muted, #6b7280);
}
.pf-holdclock-value {
  font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums;
  line-height: 1;
}
.pf-holdclock-note { font-size: .85rem; font-weight: 600; color: var(--muted, #6b7280); }
.pf-holdclock.is-warn {
  border-color: var(--brand-gold, #d4a843); background: #fffdf2;
}
.pf-holdclock.is-warn .pf-holdclock-value { color: #7a5c00; }
/* Breached is a LOUDER AMBER, not red. Red is the PSI stop. */
.pf-holdclock.is-breached {
  border-color: #e6b800; background: #fff6d6;
}
.pf-holdclock.is-breached .pf-holdclock-value { color: #6b4e00; }
.pf-holdclock.is-breached .pf-holdclock-note { color: #6b4e00; font-weight: 700; }
/* 2026-10-29 QC resample: the record button sits in the hold cell; recorded
   resamples list under it (tap the time to correct, like any entry). */
.pf-resample-ctl { margin: 4px 0 8px; }
.pf-resample-ctl .pf-resample-btn { min-height: 44px; }
.pf-resamples { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; font-size: .9rem; }
.pf-resample-entry { display: inline-flex; align-items: center; gap: 6px; }

/* ── A5: PACE — READ-ONLY, AND LABELLED AN ESTIMATE ───────────────────────
   Done/planned plus the measured cycle from marks the floor already wrote. Not
   a schedule, not a commitment, and deliberately quiet: it is context for a
   supervisor, not an instruction to an operator. No progress bar — a bar implies
   a deadline nobody agreed to. */
.pf-pace {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline;
  margin: 4px 0 12px;
  font-size: .9rem; color: var(--muted, #6b7280);
}
.pf-pace-ratio { font-weight: 800; color: var(--text, #1a1a1a); font-variant-numeric: tabular-nums; }
.pf-pace-cycle, .pf-pace-last { font-weight: 600; font-variant-numeric: tabular-nums; }
.pf-pace-est { font-style: italic; }

/* ── A6: DOC AGE, HONEST ──────────────────────────────────────────────────
   The doc number, its effective date and what it supersedes — already in the PI
   library, never on screen until now. A PI older than five years says so.
   Muted, not alarming: an old document is not a wrong document, and this is
   information for a supervisor's judgement, not a refusal. Never hidden. */
.pf-doc {
  display: flex; flex-direction: column; gap: 4px;
  margin: 0 0 12px; padding-bottom: 10px;
  border-bottom: 1px dashed var(--border, #e5e7eb);
}
.pf-doc-ids { display: flex; gap: 12px; flex-wrap: wrap; font-size: .8rem; color: var(--muted, #6b7280); }
.pf-doc-no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.pf-doc-eff, .pf-doc-sup { font-weight: 600; }
.pf-doc-age { font-size: .85rem; font-weight: 700; color: #7a5c00; }

/* ── A7: DUAL-RUN HONESTY ─────────────────────────────────────────────────
   Esther's line, stated plainly on both surfaces. NOT a badge, NOT an "ISO
   certified" claim, and it does not say the digital record is accepted —
   because it is not, yet. Quiet by design: it is a standing truth, not an
   alert, and it must not compete with a cook step for attention. */
.pf-dualrun {
  margin-top: 14px; padding-top: 10px;
  border-top: 1px dashed var(--border, #e5e7eb);
  font-size: .8rem; line-height: 1.45;
  color: var(--muted, #6b7280);
}
/* TV variant. Gold marker edge like the other rail notes, but not `.pf-tv-note`
   — the operator-notes cap is exactly six marker lines and this standing line
   must neither consume one nor be counted as one. */
.pf-tv-dualrun {
  font-size: clamp(11px, .95vw, 18px);
  color: var(--pftv-ink-2, #4A4038);
  font-weight: 600;
  padding: 2px 0 2px 14px;
  border-left: 5px solid var(--pftv-rule, #E5D9C4);
  line-height: 1.35;
  flex: 1 1 100%;
}

/* ── A2 / A3 / A4 ON THE WALL ─────────────────────────────────────────────
   Extra chip lines are additive and INTENTIONALLY small: the density ladder
   (PTV6-02b) is arithmetic against a real 1080p budget, so these ride at a
   fraction of the chip-time size and scale with `--pf-strip-scale` like
   everything else in the strip. They do not add a second metric ROW — they
   annotate the chip that already exists. */
.pf-chip-hold-left,
.pf-chip-ready-mark,
.pf-chip-temp,
.pf-chip-psi {
  font-size: calc(clamp(9px, .85vw, 16px) * var(--pf-strip-scale, 1));
  font-weight: 800; line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.pf-chip-hold-left { color: #4a3a00; }
/* Inside the dark-amber hold block the label flips light (9.1:1). */
.pf-chip-hold .pf-chip-hold-left { color: #ffe89a; }
.pf-chip-hold-left.is-breached { color: #ffe89a; text-decoration: underline; text-decoration-thickness: 2px; }
/* All plants follow-up (2026-11-07): a LIVE chip whose hold clock still has
   15+ min left is green, not amber, so the dark-amber label above (#4a3a00 on
   #17552A, about 1.3:1) was unreadable. It flips light there only (about
   8:1); an amber hold chip keeps its own #ffe89a label. */
.pf-chip-live:not(.pf-chip-hold) .pf-chip-hold-left { color: #FFFDF8; }
.pf-chip-ready-mark { color: var(--pftv-done-ink, #14451F); }
.pf-chip-live .pf-chip-ready-mark { color: #FFFDF8; }
.pf-chip-psi { color: var(--pftv-ink-2, #4A4038); }

/* The paper's Temp.(F) column on the wall.

   NEUTRAL, DELIBERATELY NOT RED AND NOT AMBER, and REUSING the PSI tint rather
   than introducing a hex. A recorded temperature is a FACT, not a finding: amber
   belongs to the 2-hour hold and red is reserved for the oil PSI stop, the
   module's only hard refusal. A 203°F reading rendered amber would train the
   floor to read "normal" as "warning", which is how alarm fatigue starts.

   Sharing `.pf-chip-psi`'s exact colour is the point, not laziness: PSI and °F
   are the same category of mark — a number the operator wrote in a box — so they
   should read as one visual class on the wall. */
.pf-chip-temp { color: var(--pftv-ink-2, #4A4038); }

/* Ready for fill on the wall: this is the chip that replaces the shout across
   the floor. Green edge — it is a go signal, not a warning. */
.pf-chip-ready { border-color: #17552A; border-width: 3px; }

.pf-tv-ready {
  font-size: calc(clamp(13px, 1.2vw, 26px) * var(--pf-strip-scale, 1));
  font-weight: 800; color: var(--pftv-done-ink, #14451F);
  background: var(--pftv-done-bg, #E3F1E5); border: 2px solid var(--pftv-done-edge, #2c6b41);
  padding: 0 12px; border-radius: 999px;
  white-space: nowrap;
}

/* A5 on the wall. Subordinate to the SKU and the target, because pace is
   context and neither of those is. */
.pf-tv-pace {
  display: flex; gap: clamp(8px, 1vw, 16px); flex-wrap: wrap;
  font-size: calc(clamp(11px, 1vw, 20px) * var(--pf-strip-scale, 1));
  color: var(--pftv-ink-2, #4A4038); font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.pf-tv-pace-ratio { color: var(--pftv-gold-ink, #6B4E00); font-weight: 800; }

/* ── FLOOR SIGN IN (2026-09-03, Hy Lu / Plant B) ───────────────────────────

   The shared Samsung tablet bookmarked on the plant floor. Same gloved-tap
   constraint as the rest of the tablet surface: every control here is >= 56px.

   Names are BUTTONS, not a <select>. A native select on Android opens a
   system picker with ~40px rows, which is exactly the target this whole
   stylesheet exists to avoid, and it hides the list behind a tap. The roster
   is short (one plant's crew), so showing it flat costs nothing and removes a
   step from a task performed at the start of every shift. */
.pf-login {
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(16px, 4vw, 48px) 16px;
}
.pf-login-card {
  width: 100%; max-width: 640px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: clamp(20px, 3vw, 32px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.pf-login-title {
  margin: 0 0 4px; font-size: clamp(22px, 3vw, 30px);
  font-weight: 800; color: var(--text, #1a1a1a);
}
.pf-login-plant {
  margin: 0 0 20px; font-size: 16px; font-weight: 650;
  color: var(--brand-red, #cc0000); letter-spacing: 0.01em;
}
.pf-login-step {
  margin: 20px 0 10px; font-size: 15px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted, #6b7280);
}

/* Auto-fill grid: one column on a phone held sideways, two or three on the
   Samsung tablet, without a media-query ladder that would need re-tuning the
   first time the crew gets a different device. */
.pf-login-names {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.pf-login-name {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 56px; padding: 10px 16px;
  border: 2px solid var(--border, #e5e7eb); border-radius: 10px;
  background: var(--surface-2, #f7f8fa);
  font-size: 18px; font-weight: 700; text-align: left;
  color: var(--text, #1a1a1a);
  cursor: pointer;
  /* No transition on transform: a tap must feel instant under gloves. */
  transition: border-color 0.12s ease, background 0.12s ease;
}
.pf-login-name:hover { border-color: var(--brand-red, #cc0000); }
/* Type-to-find (2026-10-05): `display:flex` above would beat the UA [hidden]
   rule, so a filtered-out name must be hidden explicitly. */
.pf-login-name[hidden] { display: none; }
.pf-login-search { display: block; margin: 0 0 12px; }
.pf-login-search-label {
  display: block; margin-bottom: 6px;
  font-size: 16px; font-weight: 700; color: var(--text, #1a1a1a);
}
.pf-login-search-input {
  width: 100%; min-height: 56px; padding: 10px 16px; box-sizing: border-box;
  border: 2px solid var(--border, #e5e7eb); border-radius: 10px;
  font-size: 20px; background: #fff; color: var(--text, #1a1a1a);
}
.pf-login-search-input:focus { outline: none; border-color: var(--brand-red, #cc0000); }
.pf-login-search-hint { margin: -4px 0 12px; font-size: 16px; color: var(--text-muted, #4b5563); }
.pf-login-nomatch { margin: 0 0 12px; font-size: 17px; font-weight: 700; color: var(--brand-red, #cc0000); }
.pf-login-nomatch[hidden] { display: none; }
.pf-login-name.is-picked {
  border-color: var(--brand-red, #cc0000); background: #fff7f7;
}
.pf-login-name-text { flex: 1 1 auto; }
.pf-login-name-ini {
  flex: 0 0 auto; font-size: 13px; font-weight: 800;
  color: var(--brand-red, #cc0000); background: #fff; border-radius: 6px;
  padding: 3px 8px; border: 1px solid var(--border, #e5e7eb);
  font-variant-numeric: tabular-nums;
}

.pf-login-code {
  width: 100%; min-height: 56px; padding: 10px 16px;
  border: 2px solid var(--border, #e5e7eb); border-radius: 10px;
  font-size: 22px; font-weight: 700; letter-spacing: 0.18em;
  background: var(--surface-2, #f7f8fa);
  color: var(--text, #1a1a1a);
}
.pf-login-code:focus { outline: none; border-color: var(--brand-red, #cc0000); }

.pf-login-msg { min-height: 20px; margin: 12px 0 0; font-size: 15px; font-weight: 650; }
.pf-login-msg.is-error { color: var(--danger, #c0392b); }
/* 2026-11-21 offline sign-in: the card note and the strip while signed in without Wi-Fi. */
.pf-login-offline { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: #fff5e6; color: #2c2520; border: 1px solid #e8c572; font-size: 15px; font-weight: 600; }
.pf-offline-banner { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 900; padding: 8px 14px; border-radius: 999px; background: #2c2520; color: #fffdf8; font-size: 14px; font-weight: 650; box-shadow: 0 2px 8px rgba(0,0,0,.25); pointer-events: none; }

.pf-login-go { width: 100%; min-height: 56px; margin-top: 14px; font-size: 18px; font-weight: 750; }
.pf-login-go:disabled { opacity: 0.45; cursor: not-allowed; }

/* Signed-in strip in the floor header. The initials are the load-bearing
   element: they are what gets written on the card, so the operator can see at
   a glance whose letters are about to be stamped. */
.pf-floorhead-who { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pf-who-ini {
  font-size: 13px; font-weight: 800; color: var(--brand-red, #cc0000);
  background: #fff7f7; border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px; padding: 3px 8px;
}
.pf-who-name { font-size: 15px; font-weight: 650; color: var(--muted, #6b7280); }
.pf-who-out { min-height: 44px; }

/* Cooking tablet only — Hy 2026-09-10. No TV selectors. */
.pf-card .pf-initial { text-transform: none; overflow-wrap: anywhere; }
.pf-card [data-cook-hold] { align-items: center; }
.pf-card .pf-cook-hold-value { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.pf-card [data-cook-hold] progress { width: 100%; height: 18px; accent-color: var(--brand-red, #c40000); }
.pf-card .pf-stamp:disabled, .pf-card .pf-hs-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Office-only filling review. Cooking tablet/TV selectors are unchanged. */
.pf-filling { padding: 1rem; }
.pf-fill-layout { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(340px, 1fr); gap: 1.5rem; align-items: start; }
.pf-fill-evidence { position: sticky; top: 1rem; }
.pf-fill-image { overflow: auto; max-height: 80vh; border: 1px solid var(--border); }
.pf-fill-image img { display: block; width: 100%; }
.pf-fill-image.is-zoomed img { width: 180%; max-width: none; }
.pf-filling label { display: flex; flex-direction: column; gap: .35rem; margin: .6rem 0; }
.pf-filling label:has(input[type="checkbox"]) { flex-direction: row; align-items: start; }
.pf-filling input:not([type="checkbox"]), .pf-filling select { min-height: 40px; min-width: 0; width: 100%; }
.pf-fill-row { border: 1px solid var(--border); border-radius: .5rem; margin: 1rem 0; padding: .75rem; min-width: 0; }
.pf-fill-stop { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.pf-fill-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.pf-fill-check { font-weight: 600; }
.pf-filling [data-result] { padding: 1rem; background: var(--bg-secondary); border: 1px solid var(--border); }
.pf-filling [data-message] { font-weight: 600; }
@media (max-width: 850px) { .pf-fill-layout { grid-template-columns: minmax(0, 1fr); } .pf-fill-evidence { position: static; } .pf-fill-image { max-height: 55vh; } }

/* Full-pack review stays in the supervisor surface, never tablet/TV styles. */
.pf-filling { max-width: 1600px; margin-inline: auto; }
.pf-fill-toolbar { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
.pf-fill-toolbar > label { max-width: 320px; }
.pf-fill-toolbar input[type="file"] { max-width: 240px; font-size: .85rem; }
.pf-fill-toolbar .btn { white-space: normal; }
.pf-fill-queue { margin: 1rem 0; border-block: 1px solid var(--border); padding: .8rem 0; }
.pf-fill-queue > summary, .pf-fill-row > summary { cursor: pointer; font-weight: 650; overflow-wrap: anywhere; }
.pf-fill-queue [data-queue] { display: grid; grid-template-columns: repeat(auto-fill,minmax(215px,1fr)); gap: .5rem; max-height: 240px; overflow: auto; padding: .7rem .2rem; }
.pf-fill-page { background: var(--bg-card,#fff); color: inherit; border: 1px solid var(--border,#e5d9c4); border-radius: 8px; text-align: left; padding: .75rem; cursor: pointer; min-width: 0; }
.pf-fill-page.active { border: 2px solid var(--brand-red,#cc0000); background: #fff7f7; }
.pf-fill-page span, .pf-fill-page small { display: block; overflow-wrap: anywhere; margin-top: .25rem; }
.pf-fill-page small { color: var(--muted,#6b6560); }
.pf-fill-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .25rem .75rem; }
.pf-fill-grid > label { min-width: 0; }
.pf-filling textarea { width: 100%; box-sizing: border-box; min-width: 0; resize: vertical; }
.pf-filling input, .pf-filling select { box-sizing: border-box; }
.pf-filling details { min-width: 0; }
.pf-filling details > p, .pf-filling code { overflow-wrap: anywhere; }
.pf-fill-row { margin-block: .7rem; }
.pf-fill-row > summary span { font-size: .8rem; color: var(--muted,#6b6560); }
.pf-fill-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
.pf-fill-evidence > details { margin-top: .75rem; max-width: 100%; }
.pf-filling [data-message] { padding: .75rem; background: var(--bg-secondary,#fff5e6); border-radius: 8px; }
.pf-filling [data-result] li { margin-block: .4rem; }
.pf-filling [data-accounting] fieldset { min-width: 0; border: 1px solid var(--border); border-radius: .4rem; }
@media (max-width: 600px) {
  .pf-fill-grid, .pf-fill-metrics { grid-template-columns: minmax(0,1fr); }
  .pf-filling { padding: .65rem; }
  .pf-fill-toolbar > *, .pf-fill-toolbar > label { width: 100%; max-width: 100%; }
  .pf-fill-toolbar input[type="file"] { width: 100%; max-width: 100%; }
  .pf-fill-queue [data-queue] { grid-template-columns: repeat(2,minmax(0,1fr)); max-height: 180px; }
  .pf-fill-page { padding: .5rem; font-size: .8rem; }
  .pf-fill-image { max-height: 42vh; }
}

/* Office review stays within one task section; controls remain reachable. */
.pf-fill-tabs { display:flex; flex-wrap:wrap; gap:6px; margin:12px 0; }
.pf-fill-tabs [aria-selected="true"] { border-color:#cc0000; color:var(--brand-red,#cc0000); font-weight:700; }
.pf-fill-review-sticky { position:sticky; top:64px; z-index:5; padding:8px; background:var(--surface,#fff); border-bottom:1px solid var(--border,#e5d9c4); }
.pf-filling [data-panel][hidden] { display:none; }
.pf-fill-row h4 { margin:0 0 8px; }
.pf-fill-row > details { margin-top:6px; }

.pf-filling [hidden] { display:none !important; }


/* Filling review: report first, compact keyboard review, original source always nearby. */
/* The shell's body overflow-x:hidden creates a non-scrolling overflow-y:auto
   ancestor, trapping sticky review controls while the document scrolls. Clip
   horizontal paint only on this route, without creating a scroll container. */
html:has(.pf-filling), body:has(.pf-filling) { overflow-x:clip; overflow-y:visible; }
.pf-fill-report { border:1px solid var(--border,#e5d9c4); border-radius:12px; padding:16px; background:var(--bg-card,#fff); margin:12px 0; }
.pf-fill-report-title { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.pf-fill-report-title > div { flex:1; min-width:180px; }
.pf-fill-report-title h2 { margin:0; font-size:1.2rem; }
.pf-fill-report-title p { margin:5px 0 10px; color:var(--muted,#6b6560); font-size:.88rem; }
.pf-fill-report-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin:12px 0 8px; }
.pf-fill-report-metrics > div { border-left:3px solid var(--brand-gold,#d4a843); padding:7px 10px; background:var(--bg-secondary,#fff5e6); min-width:0; }
.pf-fill-report-metrics span { display:block; font-size:.75rem; color:var(--muted,#6b6560); }
.pf-fill-report-metrics strong { display:block; font-size:1.6rem; font-variant-numeric:tabular-nums; }
.pf-fill-report-metrics small { font-size:.85rem; font-weight:500; color:var(--muted,#6b6560); }
.pf-fill-report [data-report] > p { margin:8px 0; font-size:.8rem; }
.pf-fill-intake > summary,.pf-fill-report-table > summary { cursor:pointer; font-size:.85rem; font-weight:650; }
.pf-fill-report-table { margin-top:8px; }
.pf-fill-table-scroll { overflow:auto; max-width:100%; margin-top:10px; }
.pf-fill-table-scroll table { border-collapse:collapse; width:100%; font-size:.84rem; }
.pf-fill-table-scroll th,.pf-fill-table-scroll td { text-align:left; padding:8px; border-bottom:1px solid var(--border,#e5d9c4); vertical-align:top; }
.pf-fill-table-scroll th { font-size:.76rem; color:var(--muted,#6b6560); }
.pf-fill-table-scroll td small { display:block; font-size:.7rem; }
.pf-fill-page-heading { display:flex; flex-wrap:wrap; gap:2px 16px; align-items:center; padding:8px 0; }
.pf-fill-page-heading h2 { width:100%; margin:0; font-size:1.2rem; }
.pf-fill-page-heading p { margin:0; font-size:.8rem; color:var(--muted,#6b6560); }
.pf-fill-page-heading .pf-fill-copy-select { flex:1; flex-direction:row; align-items:center; font-size:.75rem; min-width:240px; margin:4px 0; }
.pf-fill-copy-select select { flex:1; min-height:32px; }
.pf-fill-layout { grid-template-columns:minmax(310px,.95fr) minmax(400px,1.15fr); gap:18px; }
.pf-fill-layout > * { min-width:0; }
.pf-fill-evidence { top:70px; }
.pf-fill-source-context { border:1px solid var(--border,#e5d9c4); border-radius:9px; padding:10px; background:var(--bg-card,#fff); margin-bottom:8px; }
.pf-fill-source-title { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.pf-fill-source-title strong { flex:1; font-size:.85rem; }
.pf-fill-source-title .btn { padding:5px 8px; min-height:32px; font-size:.72rem; }
.pf-fill-source-context p { font-size:.75rem; color:var(--muted,#6b6560); margin:7px 0; overflow-wrap:anywhere; }
.pf-fill-source-context canvas { width:100%; height:auto; max-height:230px; object-fit:contain; display:block; background:#fff; border-radius:4px; }
.pf-fill-image { max-height:55vh; background:#fff; }
.pf-fill-image-stage { position:relative; width:100%; }
.pf-fill-image.is-zoomed .pf-fill-image-stage { width:180%; }
.pf-fill-image.is-zoomed img { width:100%; }
.pf-fill-source-region { position:absolute; box-sizing:border-box; border:2px solid #d4a843; background:rgba(255,196,78,.13); pointer-events:none; }
.pf-fill-read-options { font-size:.8rem; margin:4px 0; }
.pf-fill-read-options > summary { cursor:pointer; color:var(--muted,#6b6560); }
.pf-fill-review-sticky { margin:0 0 7px; top:64px; border-radius:8px 8px 0 0; display:flex; gap:8px; }
.pf-fill-review-sticky .btn { flex:1; }
.pf-filling [data-identity] > summary { font-size:.8rem; cursor:pointer; padding:5px 0; }
.pf-fill-tabs { margin:7px 0; gap:4px; }
.pf-fill-tabs .btn { flex:1; padding:8px 5px; font-size:.79rem; }
.pf-fill-review-toolbar { display:flex; gap:10px; align-items:center; justify-content:space-between; }
.pf-fill-review-toolbar > label { flex-direction:row; align-items:center; margin:4px 0; font-size:.8rem; }
.pf-fill-review-toolbar select { min-height:34px; width:auto; max-width:160px; }
.pf-fill-review-toolbar .btn { min-height:34px; padding:6px 9px; font-size:.78rem; }
.pf-fill-row-summary { font-size:.72rem; color:var(--muted,#6b6560); margin:5px 0 9px; }
.pf-fill-column-settings { margin:6px 0 10px; border:1px solid var(--border,#e5d9c4); border-radius:6px; padding:8px; font-size:.85rem; }
.pf-fill-column-settings > summary { cursor:pointer; font-weight:650; }
.pf-fill-grid-head,.pf-fill-count-main { display:grid; grid-template-columns:32px 56px minmax(90px,1fr) 100px 44px; gap:8px; align-items:center; }
.pf-fill-grid-head { padding:5px 8px; font-size:.68rem; color:var(--muted,#6b6560); }
.pf-fill-count-row { margin:0; padding:5px 8px; border-radius:0; border:0; border-bottom:1px solid var(--border,#e5d9c4); transition:background .1s; }
.pf-fill-count-row.is-active { box-shadow:inset 3px 0 var(--brand-red,#cc0000); background:var(--bg-secondary,#fff5e6); }
.pf-fill-count-row.has-conflict { border-left:3px solid #d4a843; padding-left:5px; }
.pf-fill-count-row .pf-fill-count-input,.pf-fill-count-row .pf-fill-count-check { margin:0; }
.pf-fill-count-row .pf-fill-count-input input { min-height:34px; height:34px; padding:4px 7px; font-variant-numeric:tabular-nums; }
.pf-fill-count-row .pf-fill-count-check { display:flex; justify-content:center; padding:8px; }
.pf-fill-count-check input { width:18px; height:18px; margin:0; }
.pf-fill-source-link { background:transparent; border:0; color:var(--brand-red,#cc0000); padding:2px 0; text-align:left; cursor:pointer; font:inherit; }
.pf-fill-source-link:hover { text-decoration:underline; }
.pf-fill-source-link:focus-visible,.pf-fill-issue-link:focus-visible { outline:2px solid var(--brand-red,#cc0000); outline-offset:2px; }
.pf-fill-source-link strong { font-size:.9rem; }
.pf-fill-source-link small,.pf-fill-raw small { display:block; font-size:.68rem; color:var(--muted,#6b6560); overflow-wrap:anywhere; }
.pf-fill-raw > span { font-size:.92rem; font-variant-numeric:tabular-nums; }
.pf-fill-count-row .pf-fill-row-more { margin:1px 0 0 104px; }
.pf-fill-row-more > summary { font-size:.67rem; color:var(--muted,#6b6560); cursor:pointer; }
.pf-fill-row-more[open] { margin-left:0; padding-top:6px; }
.pf-fill-row-more > details { margin-top:8px; }
.pf-fill-issue-link { background:transparent; border:0; padding:3px 0; color:inherit; text-align:left; cursor:pointer; font:inherit; text-decoration:underline; text-decoration-color:var(--border,#e5d9c4); }
.pf-fill-issue-link:hover { color:var(--brand-red,#cc0000); }
.pf-fill-sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.pf-filling [data-message] { padding:6px 9px; font-size:.8rem; margin:6px 0; }
.pf-filling [data-coverage] { margin:6px 0; font-size:.75rem; color:var(--muted,#6b6560); }
.pf-fill-queue { margin:8px 0; padding:7px 0; font-size:.8rem; }
@media(max-width:1000px) { .pf-fill-layout { grid-template-columns:minmax(280px,.85fr) minmax(360px,1.15fr); gap:12px; } }
@media(max-width:850px) {
 .pf-fill-layout { grid-template-columns:minmax(0,1fr); }
 .pf-fill-evidence { position:sticky; top:60px; z-index:4; background:var(--bg-card,#fff); border-bottom:1px solid var(--border,#e5d9c4); }
 .pf-fill-evidence > details { display:none; }
 .pf-fill-evidence > [data-full-scan].is-peeking { display:block; }
 .pf-fill-source-context { margin:0; padding:7px; }
 .pf-fill-source-context canvas { max-height:85px; }
 .pf-fill-source-context p { overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; margin:4px 0; font-size:.69rem; }
 .pf-fill-image { max-height:170px; }
 .pf-fill-review-sticky { top:calc(60px + var(--pf-fill-source-height,160px)); z-index:3; }
 .pf-fill-report-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .pf-fill-report { padding:10px; }
 .pf-fill-report-title .btn { font-size:.77rem; padding:7px 8px; }
 .pf-fill-page-heading .pf-fill-copy-select { flex-direction:column; align-items:stretch; min-width:0; width:100%; }
 .pf-fill-count-main,.pf-fill-grid-head { grid-template-columns:28px 42px minmax(55px,1fr) 76px 32px; gap:5px; }
 .pf-fill-count-row .pf-fill-row-more { margin-left:80px; }
 .pf-fill-row-more[open] { margin-left:0!important; }
 .pf-fill-report-metrics strong { font-size:1.35rem; }
 .pf-fill-review-toolbar select { max-width:137px; }
 .pf-fill-report-table td,.pf-fill-report-table th { min-width:90px; }
}

.pf-fill-review-tasks { padding:7px 9px; margin:6px 0; border:1px solid var(--border,#e5d9c4); border-radius:6px; background:var(--bg-secondary,#fff5e6); font-size:.76rem; }
.pf-fill-review-tasks summary { cursor:pointer; font-weight:650; }
/* Layout sweep 2026-10-25 (phone + tablet, all locales): the full-width
   disclosure rows in the review form ("Optional pieces-to-cases conversion",
   "Map reviewed production to workbook Delivered", "Page coverage", "Break
   reference") were 23px tall and stacked, under the 24px WCAG 2.5.8 minimum.
   min-height only lifts rows shorter than 24px; taller ones are unchanged. */
.pf-filling details > summary { min-height: 24px; }
.pf-fill-task-list { display:grid; gap:3px; margin-top:7px; }

@media(max-width:850px) { .pf-fill-source-context canvas.is-full-page { max-height:135px; } }

/* Same three office links on every Cooking Floor, Filling Reports, and Filling Floor tab. */
.pf-fill-workflow-nav {
  display: flex; flex-wrap: wrap; gap: var(--space-2, 8px);
  margin: 0 0 var(--space-3, 12px);
}
.pf-fill-workflow-nav .btn { min-height: 44px; }


/* ═══════════════════════════════════════════════════════════════════════════
   2026-09-17 — HY MEETING REFINEMENTS (H1–H12)
   Android tablet (Samsung Galaxy Tab class: 800×1280 portrait, 1280×800
   landscape). Every new control keeps the 56px gloved-tap floor; the primary
   sheet actions are 64px. Nothing below is hover-only.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── H7: station strip / header ─────────────────────────────────────────── */
.pf-station-strip {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px; padding: 10px 14px;
  border-radius: 10px; background: var(--surface-2, #fafafa); border: 1px solid var(--border, #e5e7eb);
  font-size: 15px; font-weight: 700; color: #3a4353;
}
.pf-station-icon { font-size: 16px; }
/* Remote reassign (2026-11-10): "Line changed" banner on a moved tablet.
   Heritage purple (house token, same family as the light TV's purple status),
   the mockup's colour for a supervisor's change; no new colour. OK is a 48px+ target. */
.pf-line-changed {
  margin: 0 0 12px; padding: 14px 16px; border-radius: 12px;
  background: #efe6f7; border: 2px solid var(--heritage-purple, #5b2c8a); color: var(--heritage-purple-dark, #3d1a5c);
}
.pf-line-changed-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 18px; }
.pf-line-changed-tag {
  display: inline-block; padding: 4px 10px; border-radius: 6px;
  background: var(--heritage-purple, #5b2c8a); color: #fff; font-size: 14px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.pf-line-changed-body { margin: 0 0 10px; font-size: 16px; line-height: 1.4; }
.pf-line-changed .pf-bigbtn { min-height: 52px; }
.pfg-root .pf-line-changed { margin: 8px 12px 12px; }
.pf-setup-reline { flex: 1 1 100%; }
.pf-setup-reline label { font-weight: 600; }
.pf-floorhead-station {
  font-size: 14px; font-weight: 800; letter-spacing: .02em;
  padding: 6px 12px; border-radius: 999px;
  background: #3a4353; color: #fff; white-space: nowrap;
}
.pf-who-break, .pf-who-hand { min-height: 48px; }
.pf-floorhead-who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── H2/H11: bottom sheets ──────────────────────────────────────────────── */
body.pf-sheet-lock { overflow: hidden; }
.pf-sheet-backdrop {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(20, 24, 32, .55);
  display: flex; align-items: flex-end; justify-content: center;
}
.pf-sheet {
  width: 100%; max-width: 720px; max-height: 92vh; overflow: auto;
  background: var(--surface, #fff); color: var(--text, #1a1a1a);
  border-radius: 18px 18px 0 0; padding: 14px 18px 22px;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
}
.pf-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.pf-sheet-title { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.25; }
.pf-sheet-x {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 12px;
  border: 2px solid var(--border, #e5e7eb); background: var(--surface-2, #f7f8fa);
  font-size: 22px; font-weight: 800; cursor: pointer;
}
/* pf-ux-refusal (2026-10-08): persistent refusal panel (classic + guided). */
.pf-refusal-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.pf-refusal-actions .pfg-btn { flex: 1 1 200px; min-height: 64px; font-size: 18px; }
.pf-sheet-refusal .pfg-refusal { border: 3px solid #C0392B; background: #fdf2f2; border-radius: 12px; padding: 14px 16px; margin: 0; }
.pf-sheet-refusal .pfg-refusal b { color: #C0392B; font-size: 22px; }
.pf-sheet-refusal .pfg-refusal > b { display: none; } /* the sheet title already says it */
.pf-sheet-refusal .pfg-refusal p { margin: 8px 0 0; font-size: 19px; line-height: 1.35; }
.pf-sheet-refusal .pfg-btn { min-height: 64px; padding: 10px 20px; border-radius: 12px; font-weight: 800; border: 2px solid #2C2520; background: #fff; color: #2C2520; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.pf-sheet-refusal .pfg-btn-primary { background: #CC0000; border-color: #CC0000; color: #fff; }
.pf-sheet-help { margin: 0 0 12px; font-size: 15px; color: var(--muted, #6b7280); }
/* pf-ux-copy: read-only previous-step context on the time sheet */
.pf-sheet-prev { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, #f7f8fa); font-size: 18px; font-weight: 700; }
/* Tablet 11/03 fix A: the first discard window (QC release time) reads like the previous-step line; the "don't change QC release" note is quieter. */
.pf-sheet-help[data-time-window] { margin: 0 0 6px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, #f7f8fa); font-size: 18px; font-weight: 700; color: var(--text); }
.pf-sheet-note { margin: 0 0 12px; font-size: 15px; color: var(--muted); }
/* Parent steer 11/03 fix B: the catch-up time sheet's one-tap Just now, full width on top. */
.pf-quick-now { display: block; width: 100%; min-height: 64px; margin: 0 0 14px; font-size: 22px; font-weight: 800; }
/* PF_STEP_TIME_PROMPT (2026-11-21): "N min ago" chips on the when-sheet, glove-size. */
.pf-ago-row { margin: 0 0 12px; gap: 8px; }
.pf-ago-row .pf-ago-chip { flex: 1 1 22%; min-height: 56px; font-size: 19px; font-weight: 700; }
.pf-step:disabled, .pfg-qchip:disabled { opacity: .45; cursor: not-allowed; }
/* Review MUST-1 (11/03): catch-up sheet, "Save time" waits until the clock is set; this line says so. */
.pf-sheet-touch { margin: 8px 0 0; font-size: 17px; font-weight: 700; color: var(--text); }
.pf-sheet-touch[hidden] { display: none; }
/* FB #647 (PF_BACKENTRY_SEED): the clock opened at the previous step; this line says so. */
.pf-sheet-seed { margin: 0 0 12px; font-size: 17px; font-weight: 700; color: var(--text); }
/* Tablet 11/03 fix C: the batch opened from an overlap refusal is outlined once. */
.pf-batch.pf-batch-focus { outline: 3px solid var(--brand-gold); outline-offset: 4px; border-radius: 12px; }
.pf-sheet-msg { min-height: 22px; margin: 8px 0 0; font-size: 15px; font-weight: 700; color: var(--danger, #c0392b); }
.pf-sheet-actions { display: flex; gap: 12px; margin-top: 12px; }
.pf-sheet-actions .pf-bigbtn { flex: 1 1 0; min-height: 64px; font-size: 18px; }

/* chips: 56px tall, big label + small sub-line
   TV-FIT (2026-10-07): scoped to the touch chips (buttons, and the date input
   label). The TV batch chips are <div>s with the same class; this rule sits
   later in the file, so unscoped it gave every wall chip a 96px minimum width
   (21 batches ran off the screen) and a white fill (the dark TV palette went
   light). `:where()` keeps the specificity of the old `.pf-chip` selector so
   every tablet override after it still wins exactly as before. */
.pf-chip-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
:where(button, label).pf-chip {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; min-width: 96px; padding: 8px 14px;
  border: 2px solid var(--border, #e5e7eb); border-radius: 12px;
  background: var(--surface-2, #f7f8fa); color: var(--text, #1a1a1a);
  font-size: 16px; font-weight: 700; cursor: pointer; text-align: center;
}
.pf-chip.is-picked { border-color: var(--brand-red, #cc0000); background: #fff7f7; color: var(--brand-red, #cc0000); }
.pf-chip-main { font-size: 16px; font-weight: 800; }
.pf-chip-sub { font-size: 12px; font-weight: 600; color: var(--muted, #6b7280); }
.pf-chip.is-picked .pf-chip-sub { color: inherit; }
.pf-chip-input { padding: 6px 10px; }
.pf-chip-input input { min-height: 40px; font-size: 16px; border: 0; background: transparent; color: inherit; }

/* time sheet */
.pf-time-display { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0; }
.pf-time-big { font-size: 56px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: .02em; min-width: 170px; text-align: center; }
.pf-step {
  min-width: 64px; min-height: 64px; border-radius: 14px;
  border: 2px solid var(--border, #d8dbe0); background: var(--surface-2, #f7f8fa);
  font-size: 26px; font-weight: 800; cursor: pointer;
}
.pf-step:active { background: var(--surface-2, #fafafa); }
.pf-step-row { display: flex; gap: 10px; justify-content: center; margin: 8px 0 12px; }
.pf-step-wide { flex: 1 1 0; font-size: 18px; min-height: 56px; }
.pf-time-native { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pf-time-native label { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.pf-native-time { min-height: 56px; font-size: 20px; padding: 6px 10px; border: 2px solid var(--border, #d8dbe0); border-radius: 10px; }

/* keypad sheet */
.pf-num-display { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.pf-num-input { flex: 1 1 auto; font-size: 34px; font-weight: 800; text-align: center; min-height: 64px; font-variant-numeric: tabular-nums; }
.pf-num-unit { font-size: 22px; font-weight: 800; color: var(--muted, #6b7280); min-width: 36px; }
.pf-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pf-key {
  min-height: 64px; border-radius: 14px; font-size: 26px; font-weight: 800; cursor: pointer;
  border: 2px solid var(--border, #d8dbe0); background: var(--surface-2, #f7f8fa);
}
.pf-key:active { background: var(--surface-2, #fafafa); }

/* choice sheet */
.pf-choice-note { width: 100%; min-height: 56px; font-size: 17px; padding: 10px 14px; border: 2px solid var(--border, #d8dbe0); border-radius: 10px; }
.pf-chip-wrap .pf-chip { flex: 1 1 calc(50% - 10px); }

/* handover sheet reuses the login name grid */
.pf-sheet-handover .pf-login-names { margin-bottom: 12px; }
.pf-sheet-handover .pf-login-code { margin-bottom: 4px; }

/* ── H1: tank chip on each batch ────────────────────────────────────────── */
.pf-tank { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; flex-wrap: wrap; }
.pf-tank-label { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7280); }
.pf-tank-value { font-size: 18px; }
.pf-tank-btn {
  min-height: 56px; min-width: 120px; padding: 8px 16px;
  border: 2px dashed var(--border, var(--border, #e5e7eb)); border-radius: 12px;
  background: var(--surface-2, #f7f8fa); font-size: 18px; font-weight: 800; cursor: pointer;
}
.pf-tank.is-set .pf-tank-btn { border-style: solid; border-color: #3a4353; color: #3a4353; background: var(--surface-2, #fafafa); }
.pf-tank.is-unset .pf-tank-btn { color: var(--brand-red, #cc0000); border-color: var(--brand-red, #cc0000); }
/* FB #426: audited tank change on a started batch (classic). */
.pf-tank-change-btn {
  min-height: 48px; padding: 6px 14px; border: 2px solid #3a4353; border-radius: 12px;
  background: var(--surface, #fff); color: #3a4353; font-size: 16px; font-weight: 800; cursor: pointer;
}

/* FB #431: remove a wrong "Adjusted / retest" entry (classic re-cook cell). */
.pf-void-btn {
  min-height: 48px; padding: 6px 14px; border: 2px solid var(--brand-red, #cc0000); border-radius: 12px;
  background: var(--surface, #fff); color: var(--brand-red, #cc0000); font-size: 16px; font-weight: 800; cursor: pointer;
}
/* FB #429: "Reached earlier? Enter time" on the target-reached keypad. */
.pf-num-earlier { width: 100%; margin: 4px 0 8px; }
/* Tablet 10/29 (item 1b): "Just now / Earlier" two-option choice on reading sheets. */
.pf-num-when { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 8px; }
.pf-num-when .pf-num-earlier, .pf-num-when .pf-num-when-now { width: 100%; margin: 0; border: 2px solid var(--border, #d8dbe0); background: var(--surface, #fff); color: inherit; }
.pf-num-when .is-picked { border-color: var(--brand-red, #cc0000); background: #fff7f7; color: var(--brand-red, #cc0000); font-weight: 800; }

/* ── H4: legacy heating record (read-only history row) ──────────────────── */
.pf-legacy-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2, #fafafa); font-size: 14px; color: var(--muted, #6b7280); }

/* ── H5: auxiliary stamp (parallel fill / cooled-product confirmation) ──── */
.pf-stamp-aux {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 64px;
  border: 2px solid #3a4353; border-style: solid; background: #fff; color: #3a4353;
}
.pf-stamp-aux:active { background: var(--surface-2, #fafafa); }
.pf-stamp-aux:disabled { opacity: .5; cursor: not-allowed; }
.pf-cell-aux .pf-cell-label { color: #3a4353; font-weight: 800; }
.pf-coolready { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 0; padding: 10px 12px; border: 1px dashed var(--border, #e5e7eb); border-radius: 10px; background: var(--surface-2, #fafafa); }
.pf-coolready-btn { flex: 0 0 auto; min-width: 260px; }
.pf-coolready-help { flex: 1 1 200px; font-size: 13px; color: var(--muted, #6b7280); }
.pf-coolready.is-done { border-style: solid; background: var(--surface-2, #fafafa); font-size: 15px; }

/* ── H10: schedule picker ───────────────────────────────────────────────── */
.pf-sched { margin: 0 0 12px; }
.pf-sched-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pf-sched-title { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7280); }
.pf-sched-line { font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: #3a4353; color: #fff; }
.pf-sched-refresh { margin-left: auto; width: 48px; height: 48px; border-radius: 10px; border: 2px solid var(--border, #e5e7eb); background: var(--surface-2, #f7f8fa); font-size: 20px; cursor: pointer; }
.pf-sched-msg { margin: 0; font-size: 14px; }
.pf-sched-chips { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pf-sched-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  min-height: 72px; padding: 10px 14px; text-align: left;
  border: 2px solid var(--border, #e5e7eb); border-radius: 12px;
  background: var(--surface-2, #f7f8fa); color: var(--text, #1a1a1a); cursor: pointer;
}
.pf-sched-chip:active { border-color: var(--brand-red, #cc0000); background: #fff7f7; }
.pf-sched-chip.is-nopi { opacity: .6; cursor: not-allowed; background: #fafafa; }
.pf-sched-name { font-size: 17px; font-weight: 800; }
.pf-sched-meta { font-size: 13px; color: var(--muted, #6b7280); font-variant-numeric: tabular-nums; }
.pf-sched-pi { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--success); }
.pf-sched-chip.is-nopi .pf-sched-pi { color: var(--brand-red, #cc0000); }
.pf-sched-src { margin: 8px 0 0; font-size: 12px; }

/* ── H11: low-typing feedback ───────────────────────────────────────────── */
.pf-feedback .pf-chip-row { margin-bottom: 0; }
.pf-fb-chip { flex: 1 1 calc(33% - 10px); }

/* ── H12: Android tablet layout ─────────────────────────────────────────────
   Portrait 800px: two-column cells, full-width sheet, header wraps.
   Landscape 1280px: three/four-column cells, sheet capped at 720px. */
@media (min-width: 700px) and (max-width: 900px) {
  .pf-cells { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-floorhead { flex-wrap: wrap; row-gap: 8px; }
  .pf-sheet { max-width: 100%; border-radius: 16px 16px 0 0; }
  .pf-fb-chip { flex: 1 1 calc(50% - 10px); }
}
@media (min-width: 1100px) and (max-width: 1400px) {
  .pf-cells { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (pointer: coarse) {
  .pf-time, .pf-hs-btn, .pf-tank-btn, .pf-tank-change-btn, .pf-void-btn, .pf-chip, .pf-sched-chip, .pf-key, .pf-step { min-height: 56px; }
}

/* F18 (2026-09-17) — manager tablet setup (desktop coordinator/manager view only) */
.pf-setup { margin: 16px 0 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.pf-setup-summary { padding: 12px 16px; font-weight: 600; cursor: pointer; min-height: 56px; display: flex; align-items: center; }
.pf-setup-body { padding: 0 16px 16px; display: grid; gap: 16px; }
.pf-setup-section { display: grid; gap: 8px; }
.pf-setup-section h4 { margin: 0; font-size: 1rem; }
.pf-setup-hint { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.pf-setup-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pf-setup-row .pf-input { min-height: 48px; flex: 1 1 160px; }
.pf-setup-row .pf-input-short { flex: 0 1 120px; }
.pf-setup-stations { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pf-setup-station { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.pf-setup-station.is-here { border-color: var(--success); }
.pf-setup-station.is-inactive { opacity: 0.7; }
.pf-setup-station-main { display: grid; gap: 2px; }
.pf-setup-state { color: var(--text-muted); font-size: 0.9rem; }
.pf-setup-station-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-setup-toggle { display: flex; gap: 10px; align-items: center; min-height: 48px; }
.pf-setup-toggle input { width: 24px; height: 24px; }
.pf-setup-url { display: inline-block; padding: 8px 10px; border-radius: 8px; background: var(--surface-2, var(--bg)); word-break: break-all; font-size: 0.85rem; flex: 1 1 260px; }
.pf-setup-msg { margin: 0; min-height: 1.2em; font-size: 0.95rem; }
.pf-setup-msg.is-error { color: var(--danger); }
.pf-setup-msg.is-ok { color: var(--success); }
.pf-tablet.is-floor .pf-setup { display: none; }

/* Manager provisioning runs on the tablet too. */
.pf-setup .pf-btn { min-height: 56px; min-width: 56px; padding: 12px 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.pf-setup .pf-btn-primary { background: var(--primary, #CC0000); color: #fff; border-color: var(--primary, #CC0000); }
.pf-setup .pf-btn:focus-visible { outline: 3px solid var(--warning); outline-offset: 2px; }
.pf-setup .pf-setup-row .pf-input, .pf-setup .pf-setup-toggle { min-height: 56px; }

/* Plant work-center inventory: source labels fit glove-sized controls. */
.pf-sched-lines .pf-chip { min-height: 56px; white-space: normal; max-width: 100%; overflow-wrap: anywhere; }
.pf-sched-lines .pf-chip-sub { display: block; font-size: 0.78rem; font-weight: 400; }
.pf-sched-lines .pf-chip:disabled { opacity: .65; cursor: not-allowed; }
#pf-setup-line { min-height: 48px; min-width: 0; max-width: 100%; flex: 1 1 300px; }

/* Quantity-only review shortcuts: selections are not source approvals. */
.pf-fill-row-select { display:flex; align-items:center; justify-content:center; min-height:44px; margin:0; }
.pf-fill-row-select input { width:18px; height:18px; margin:0; }
.pf-fill-bulk { padding:12px; margin:10px 0; border:1px solid var(--border,#e5d9c4); border-radius:8px; }
.pf-fill-bulk h3 { margin:0 0 6px; font-size:1rem; }
.pf-fill-bulk p { margin:6px 0; font-size:.85rem; }
.pf-fill-bulk .pf-fill-actions { flex-wrap:wrap; }
.pf-fill-bulk .btn { min-height:44px; white-space:normal; }
.pf-fill-bulk [data-quantity-selection-list] { max-height:190px; overflow:auto; overflow-wrap:anywhere; padding-left:20px; }
.pf-fill-bulk [data-quantity-selection-list] li { margin:5px 0; }
.pf-fill-bulk [data-bulk-exclusion-reason] { width:100%; min-height:44px; }
.pf-fill-row [data-action="promote-observed"] { min-height:44px; white-space:normal; margin:4px 8px 4px 0; }

/* Runtime-first source review: keep quantity readiness separate. */
.pf-fill-runtime-steps { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pf-fill-runtime-steps button { min-height: 44px; flex: 1 1 150px; }
.pf-fill-runtime-guidance, .pf-fill-runtime-status { padding: 12px 16px; border-left: 3px solid var(--rule, #e5d9c4); background: var(--surface-2, var(--bg, #fff5e6)); }
.pf-fill-po-runtime { margin: 12px 0 20px; }
.pf-fill-po-runtime small { display: block; margin-top: 6px; }
.pf-fill-po-runtime td { vertical-align: top; min-width: 140px; }
.pf-fill-po-runtime .pf-fill-source-link { display: block; min-height: 44px; text-align: left; }
@media (max-width: 700px) { .pf-fill-runtime-steps button { flex-basis: 42%; } }

@media (max-width: 700px) {
 .pf-fill-po-runtime table, .pf-fill-po-runtime tbody { display:block; }
 .pf-fill-po-runtime thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
 .pf-fill-po-runtime tbody tr { display:block; border:1px solid var(--border,#e5d9c4); border-radius:8px; margin-bottom:10px; }
 .pf-fill-po-runtime td { display:block; min-width:0; overflow-wrap:anywhere; }
 .pf-fill-po-runtime td::before { content:attr(data-label); display:block; font-size:.7rem; font-weight:650; margin-bottom:4px; }
}

/* 2026-10-06 line picker: physical line + cooker chips on the start row. */
.pf-floorline { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; }
.pf-floorline-title { font-weight: 800; font-size: 15px; }
.pf-floorline .pf-chip-row { margin-bottom: 4px; }
.pf-floorline .pf-chip:disabled { opacity: .55; cursor: not-allowed; }
.pf-floorline-msg { margin: 0; color: var(--brand-red, #cc0000); font-weight: 700; }

/* 2026-10-06 line picker up front: physical lines in the schedule area before a PI. */
.pf-sched-floorline { margin: 6px 0 10px; padding: 10px 12px; border: 2px solid var(--border, #e5e7eb); border-radius: 12px; background: var(--surface-2, #f7f8fa); }
.pf-sched-floorline .pf-chip { min-height: 56px; }
.pf-sched-floorline .pf-chip-sub { display: block; }
.pf-sched-pickline { font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--brand-red, #cc0000); color: #fff; }
.pf-floorline-picked { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pf-floorline-value { font-weight: 800; font-size: 16px; padding: 6px 12px; border-radius: 10px; background: #3a4353; color: #fff; }
.pf-floorline-change { min-height: 44px; }

/* ── Feedback button on the Cooking Floor tablet (2026-10-06) ─────────────
   The feedback button is never hidden (feedback-fab-fullscreen.test.js, Kevin
   2026-07-31). On a floor tablet (main#view.pf-kiosk-root, no shell, no Ask
   AIOP button) it sits in the bottom-right corner instead of the shell slot
   at right:92px. Classic pages get room at the bottom so the last control
   scrolls clear of it. Under an open sheet it drops below the backdrop (still
   there, one tap away after the sheet), the same rule as the guided pages. */
body:has(.pf-kiosk-root) .feedback-fab {
  right: calc(12px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
body:has(.pf-kiosk-root) .feedback-fab-tooltip {
  right: calc(12px + env(safe-area-inset-right, 0px));
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}
body:has(.pf-kiosk-root):has(.pf-sheet-backdrop) .feedback-fab { z-index: 1100; }
/* Classic pages scroll, so any fixed corner button would sit on some control
   at some scroll position. Reserve a right gutter (button 48px + 12px edge +
   gap) so no classic control ever passes under it, plus room at the bottom. */
.pf-kiosk-root .pf-tablet {
  padding-right: calc(68px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

/* Cooking outbox pending badge (quiet releases B, 2026-10-07): entries saved
   on the tablet that have not reached the server yet. Small, fixed, never
   blocks a tap. */
.pf-outbox-badge {
  position: fixed; left: 12px; bottom: 12px; z-index: 900;
  padding: 8px 14px; border-radius: 999px;
  background: #fff6d6; color: #6b4e00; border: 1px solid #e8c572;
  font-weight: 600; font-size: 15px; pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.pf-outbox-badge [data-outbox-line] + [data-outbox-line] { margin-top: 4px; }
/* M2: entries refused after they were saved. Stays until Dismiss. */
.pf-outbox-refused {
  position: fixed; left: 12px; right: 12px; bottom: 64px; z-index: 950;
  padding: 10px 14px; border-radius: 10px;
  background: #fff6d6; color: #6b4e00; border: 2px solid #c40000;
  font-size: 16px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
/* Tablet 10/29b + PR #380 review S2: starts as a one-line strip (Show) so the
   cooker cards stay clear at 1024x768; open, about two rows with its own
   scroll, and the Hide bar stays on top while the list scrolls. */
.pf-outbox-refused { max-height: min(40vh, 240px); overflow-y: auto; overscroll-behavior: contain; }
.pf-outbox-refused.is-folded { padding: 4px 14px; }
.pf-outbox-foldbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; position: sticky; top: -10px; background: #fff6d6; z-index: 1; }
.pf-outbox-refused.is-folded .pf-outbox-foldbar { color: #c40000; }
.pf-outbox-fold { min-height: 48px; min-width: 96px; font-size: 16px; font-weight: 600; }
.pf-outbox-dismisshelp { margin: 0 0 6px; font-size: 14px; }
.pf-review-list { margin: 0 0 12px; padding-left: 20px; }
/* Tablet 10/29b (item 3): open steps at a shift change. */
.pf-review-openlist { list-style: none; padding-left: 0; }
.pf-review-open { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #e5e7eb; }
.pf-review-enter { min-height: 48px; min-width: 120px; font-weight: 600; }
.pf-open-notice { margin: 8px 0 12px; padding: 10px 14px; border: 2px solid #0f766e; border-radius: 10px; background: rgba(15, 118, 110, .08); color: var(--ink-strong, #1a1410); }
.pf-open-notice-title { display: block; margin-bottom: 4px; font-size: 17px; }
.pf-open-notice-list { margin: 0 0 8px; padding-left: 20px; font-size: 16px; }
.pf-open-notice-hide { min-height: 48px; min-width: 96px; }
/* Tablet 10/29b (item 5): language on the sign-in card (gloved taps). */
.pf-login-lang { display: block; margin: 0 0 12px; }
.pf-login-lang-label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.pf-login-lang-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-login-langbtn { min-height: 48px; min-width: 96px; padding: 0 14px; border-radius: 10px; border: 2px solid #d8dbe0; background: #fff; font-size: 18px; font-weight: 700; color: inherit; }
.pf-login-langbtn.is-on { border-color: #0f766e; background: rgba(15, 118, 110, .08); color: #0f766e; }
/* Tablet 10/29b (item 4): PI missing from the schedule list, and the mark on a
   run started from a typed code (QA / planning). */
.pf-pi-missing { margin: 10px 0 6px; }
.pf-pi-missing-title { margin: 0; font-size: 17px; font-weight: 700; }
.pf-pi-missing-help { margin: 2px 0 0; font-size: 14px; color: var(--muted, #6b6560); }
.pf-offsched { background: #fff6d6; color: #6b4e00; border: 1px solid #e8c572; font-weight: 600; }
.pf-tv-offsched { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #fff6d6; color: #6b4e00; border: 1px solid #e8c572; font-weight: 700; font-size: calc(clamp(12px, 1.1vw, 22px) * var(--pf-strip-scale, 1)); }
.pf-review-list li { margin: 4px 0; }
.pf-outbox-refused-title { font-weight: 700; color: #c40000; margin-bottom: 6px; }
.pf-outbox-refused-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.pf-outbox-dismiss { min-height: 48px; min-width: 96px; font-size: 16px; font-weight: 600; }
/* M4: entries waiting more than 4 h: red, tell the supervisor. */
.pf-outbox-badge.is-stale { background: #c40000; color: #fff; border-color: #c40000; font-weight: 700; }
.pf-outbox-askowner { font-size: 14px; font-style: italic; }
.pf-outbox-sendrow { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
/* 2026-10-16: the badge itself never blocks a tap (pointer-events: none on the
   container), but its Send / Discard buttons must be tappable. Before this the
   supervisor Send inherited pointer-events: none and could never be tapped. */
.pf-outbox-badge .pf-outbox-sendrow,
.pf-outbox-badge .pf-outbox-send,
.pf-outbox-badge .pf-outbox-discard { pointer-events: auto; }
.pf-outbox-send, .pf-outbox-discard { min-height: 48px; min-width: 96px; font-size: 16px; font-weight: 600; }
.pf-sentby { font-size: 13px; font-style: italic; }

/* pf-ux-holdalert (2026-10-08): THE HOLD IS DONE, READ THE TEMPERATURE NOW.
   Readable from across the room: a strong teal block (not the PSI red, not the
   QC-hold amber) with a slow pulse on the row edge. Pulse stops under
   prefers-reduced-motion. Display only. */
.pf-batch.is-holddone { border-color: #0f766e; border-width: 3px; box-shadow: 0 0 0 4px rgba(15, 118, 110, .25); animation: pf-holddone-pulse 1.6s ease-in-out infinite; }
.pf-holdclock.is-holddone { border-color: #0f766e; background: #0f766e; color: #fff; }
.pf-holdclock.is-holddone .pf-cook-hold-value { color: #fff; font-size: 1.9rem; }
.pf-stamp.is-holddone { outline: 4px solid #0f766e; outline-offset: 2px; }
.pf-num-target { margin: 0 0 10px; font-size: 18px; font-weight: 800; color: inherit; }
@keyframes pf-holddone-pulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(15, 118, 110, .25); } 50% { box-shadow: 0 0 0 10px rgba(15, 118, 110, .45); } }
@media (prefers-reduced-motion: reduce) { .pf-batch.is-holddone { animation: none; } }
/* pf-step5-onetap (2026-10-08): visible pre-filled hold end + honest attest button */
.pf-s5-time { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 12px; border: 2px solid #0f766e; border-radius: 10px; background: rgba(15, 118, 110, .08); }
.pf-s5-time-text { font-size: 22px; font-weight: 800; flex: 1 1 auto; }
.pf-s5-change, .pf-s5-now { min-height: 48px; min-width: 88px; font-weight: 700; }
.pf-s5-attest { display: block; width: 100%; min-height: 64px; margin: 0 0 12px; font-size: 22px; font-weight: 800; color: #fff; background: #17552a; border: 0; }
.pf-temp-edit.is-attest { font-size: 1.05rem; font-weight: 800; color: #17552a; }
.pfg-rec-temp.is-attest { color: #17552a; }
.pf-chip-temp-attest { font-weight: 800; }
.pf-chip-live .pf-chip-temp-attest { color: #FFFDF8; }

/* pf-daymarker (2026-10-09): non-production day banner (inventory count,
   cleaning, holiday). Display only. House tokens only (no new palette, B-24):
   cream + gold edge, dark ink; never the red masthead. */
.pf-daystatus {
  display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center;
  margin: 12px 0; padding: 22px 18px; border-radius: 14px;
  background: #fff5e6; border: 2px solid #e8c572; color: #2c2520;
}
.pf-daystatus-text { font-size: clamp(20px, 2.4vw, 30px); font-weight: 800; line-height: 1.25; }
.pf-daystatus-note { font-size: 14px; opacity: .8; }
.pf-daystatus-cleaning { border-style: dashed; }
.pf-tv-daystatus { margin: 10vh auto 0; max-width: 80%; padding: 4vh 3vw; }
.pf-tv-daystatus .pf-daystatus-text { font-size: clamp(28px, 3.6vw, 64px); }
.pf-tv-daystatus .pf-daystatus-note { font-size: clamp(16px, 1.4vw, 26px); }
[data-theme="dark"] .pf-daystatus:not(.pf-tv-daystatus) { background: #252838; border-color: #3b3f54; color: #fffdf8; }

/* 2026-10-15 Plant B overnight fixes: back-entry offer (#439),
   cooker overlap / open-earlier sheets, batch remark (#440). */
.pf-time-day { text-align: center; margin: 2px 0 6px; font-weight: 600; }
.pf-back-entry { border: 2px solid var(--warning); border-radius: 10px; padding: 8px 10px; margin: 6px 0 10px; }
.pf-back-entry[hidden] { display: none; }
.pf-back-entry .pf-bigbtn { width: 100%; }
.pf-overlap-what { font-weight: 700; font-size: 1.1rem; margin: 0 0 6px; }
.pf-overlap [data-overlap-continue] { width: 100%; margin: 6px 0 10px; }
.pf-open-earlier-run { border-top: 1px solid var(--border); padding: 8px 0; }
.pf-open-earlier-run .pf-bigbtn { width: 100%; }
.pf-remark { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.pf-remark-text { font-style: italic; }
.pf-chip-remark { font-size: 0.75rem; font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
/* 10/15 plant-manager meeting (rule 5): overnight batch moved to today. */
.pf-moved { margin-top: 6px; font-weight: 600; }
.pf-move .pf-bigbtn, .pf-overlap [data-overlap-move], .pf-open-earlier-run [data-move-today] { width: 100%; margin: 6px 0; }

/* ── LAB RELEASE (2026-10-17, phase 1a shadow) ─────────────────────────────
   Same status strip as the hold clock (.pf-holdclock): icon + text + colour,
   never colour alone. Green = lab passed, neutral = waiting, amber = out of
   date or a time difference to check. Information only, never a refusal. */
.pf-labchip { align-items: center; }
.pf-labchip-icon { font-size: 1.3rem; font-weight: 900; line-height: 1; }
.pf-labchip-text { font-size: 1rem; font-weight: 750; }
.pf-labchip-note { flex-basis: 100%; font-size: .9rem; font-weight: 650; color: #6b4e00; }
.pf-labchip.is-passed { border-color: #cde9d5; background: #f6fbf7; }
.pf-labchip.is-passed .pf-labchip-icon { color: var(--success); }
.pf-labchip.is-stale, .pf-labchip.has-note { border-color: var(--brand-gold, #d4a843); background: #fffdf2; }
.pf-labchip.is-stale .pf-labchip-text { color: #6b4e00; }
.pf-lab-page .pf-lab-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pf-lab-row { padding: 14px; }
.pf-lab-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; margin: 8px 0 12px; }
.pf-lab-facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; color: var(--muted, #6b7280); }
.pf-lab-facts dd { margin: 0; font-size: 1.05rem; font-weight: 650; }
.pf-lab-pass, .pf-lab-actions .btn { min-height: 52px; min-width: 140px; font-size: 1.05rem; }
.pf-lab-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.pf-lab-confirm { border-top: 2px solid var(--border, #e5e7eb); padding-top: 12px; display: grid; gap: 10px; }
.pf-lab-confirm-title { font-size: 1.15rem; margin: 0; }
.pf-lab-field { display: grid; gap: 4px; font-weight: 650; }
.pf-lab-field .pf-input { min-height: 48px; font-size: 1.05rem; }
.pf-lab-reasons { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.pf-lab-reasons .pf-check { min-height: 44px; align-items: center; display: inline-flex; gap: 6px; font-size: 1rem; }
.pfr-labpair { display: flex; flex-wrap: wrap; gap: 6px 24px; padding: 8px 12px; margin: 8px 0; border: 2px solid var(--border, #e5e7eb); border-radius: 10px; }
@media (max-width: 520px) { .pf-lab-pass, .pf-lab-actions .btn { width: 100%; } }
/* PR #233 audit: "not entered yet" is information (plain strip, smaller
   type, info icon), never an alarm under the hold clock. Time hint, plant
   picker, start-trial box, list-out-of-date note. */
.pf-labchip.is-info { border-style: dashed; background: var(--surface, #fff); }
.pf-labchip.is-info .pf-labchip-text { font-weight: 600; font-size: .95rem; color: var(--muted, #4b5563); }
.pf-labchip.is-info .pf-labchip-icon { font-size: 1.1rem; color: var(--muted, #4b5563); }
.pf-lab-hint { margin: -6px 0 0; font-size: .95rem; }
.pf-lab-plant { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; }
.pf-lab-plant .pf-input { min-height: 44px; font-size: 1rem; }
.pf-lab-start { display: grid; justify-items: center; gap: 8px; margin-top: 12px; }
.pf-lab-start .btn { min-height: 48px; }
/* Lab sign-in (2026-10-27): shared lab tablet + lab PC. Who is signed in is
   always on screen, with a large Sign out; idle warning strip; signed-out
   card for the next person; lab list for lab managers and admins. */
.pf-lab-whoami { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 14px; margin: 0 0 12px;
  border: 2px solid var(--border, #e5e7eb); border-left: 6px solid var(--brand-red, #cc0000); border-radius: 10px; background: var(--surface, #fff); }
.pf-lab-whoami-name { margin: 0; font-size: 1.2rem; flex: 1 1 260px; }
.pf-lab-whoami-name strong { font-size: 1.35rem; }
.pf-lab-whoami-hint { margin: 0; flex-basis: 100%; order: 3; font-size: .95rem; }
.pf-lab-whoami-actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* Admin not on the lab list: just the Lab list button (only admins list lab managers). */
.pf-lab-adminbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin: 0 0 12px; }
.pf-lab-adminbar .btn { min-height: 44px; }
.pf-lab-whoami-actions .btn { min-height: 52px; min-width: 140px; font-size: 1.05rem; }
.pf-lab-idlewarn { margin: 0 0 12px; }
.pf-lab-idlewarn[hidden] { display: none; }
.pf-lab-recorded-as { margin: 0; font-weight: 650; }
.pf-lab-signin { max-width: 560px; margin: 8vh auto 0; padding: 24px; display: grid; gap: 14px; text-align: center;
  border: 2px solid var(--border, #e5e7eb); border-radius: 14px; background: var(--surface, #fff); }
.pf-lab-signin h1 { margin: 0; font-size: 1.8rem; }
.pf-lab-signin-lead { margin: 0; font-size: 1.1rem; }
.pf-lab-signin-btn { min-height: 56px; font-size: 1.15rem; justify-self: center; padding-inline: 28px; display: inline-flex; align-items: center; justify-content: center; }
.pf-lab-signin-note { margin: 0; font-size: .95rem; }
.pf-lab-roster { border: 2px solid var(--border, #e5e7eb); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.pf-lab-roster h3 { margin: 16px 0 4px; font-size: 1.05rem; }
.pf-lab-roster-list { margin-top: 8px !important; }
.pf-lab-roster-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 10px 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; }
.pf-lab-roster-row .pf-lab-actions { margin-top: 0; }
.pf-lab-roster-main { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.pf-lab-roster-tags { font-size: .95rem; }
.pf-lab-roster-in { color: var(--success); font-weight: 650; }
.pf-lab-roster-self { font-weight: 650; }
.pf-lab-roster-form { border-top: 0; padding-top: 4px; width: 100%; }
.pf-lab-roster-removed, .pf-lab-roster-log { margin-top: 12px; }
.pf-lab-roster-removed summary, .pf-lab-roster-log summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 650; }
@media (max-width: 520px) {
  .pf-lab-whoami-actions, .pf-lab-whoami-actions .btn { width: 100%; }
  .pf-lab-signin { margin-top: 4vh; padding: 18px; }
}

/* M-80 (cook bug hunt 2026-10-23): the classic "Batch no. / date" button
   (was the 29px browser default) and Add batch (43px) meet this file's 56px
   gloved-fingertip floor. */
.pf-binfo-btn {
  min-height: 56px; min-width: 56px; padding: 8px 14px; border-radius: 10px;
  border: 2px dashed currentColor; background: transparent; color: inherit;
  font: inherit; font-weight: 700; cursor: pointer; touch-action: manipulation;
}
.pf-binfo-btn:active { background: rgba(0,0,0,.06); }
.pf-addbatch { min-height: 56px; }
/* M-37: Try again on the first-load error card. */
.ui-error-action [data-pf-board-retry] { min-height: 56px; }
/* M-30: the guided Sign out choice stacks its three big buttons. */
.pf-sheet-actions-stack { flex-direction: column; align-items: stretch; }
/* M-32: Try again next to Dismiss on an entry the system kept failing. */
.pf-outbox-retry { min-height: 48px; min-width: 96px; font-size: 16px; font-weight: 600; margin-right: 8px; }
/* Lab sign-in (2026-10-27): "Not on the lab list yet" card (office sign-in). */
.pf-lab-identity { max-width: 620px; margin: 4vh auto 0; padding: 22px; display: grid; gap: 12px; text-align: center;
  border: 3px solid var(--brand-red, #cc0000); border-radius: 14px; background: var(--surface, #fff); }
.pf-lab-identity h2 { margin: 0; font-size: 1.6rem; }
.pf-lab-identity-lead { margin: 0; }
.pf-lab-identity-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.pf-lab-identity-actions .btn { min-height: 56px; min-width: 200px; font-size: 1.1rem; }
.pf-lab-iam { min-height: 48px; display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.pf-lab-iam input { width: 26px; height: 26px; flex: none; }
@media (max-width: 520px) { .pf-lab-identity-actions .btn { width: 100%; } }
/* Lab sign-in, steer 2 (2026-10-27): the name banner stays on screen on the
   lab tablet/PC kiosk (no app shell there), the saved confirmation is big. */
.pf-lab-whoami-label { font-weight: 650; }
.pf-lab-whoami-name strong { font-size: 1.5rem; }
.pf-lab-kiosk .pf-lab-whoami { position: sticky; top: 0; z-index: 5; box-shadow: var(--shadow); }
.pf-lab-saved .pf-labchip-text { font-size: 1.2rem; font-weight: 800; }
/* Same trap as Filling review (above): any overflow-x:hidden ancestor would
   trap the sticky name banner. Clip horizontal paint on the lab page only. */
html:has(.pf-lab-page), body:has(.pf-lab-page) { overflow-x:clip; overflow-y:visible; }
/* Phone: keep the pinned banner to one compact row (name + Sign out) so it
   does not cover the form; focused fields scroll clear of it. */
html:has(.pf-lab-kiosk) { scroll-padding-top: 140px; }
@media (max-width: 520px) {
  .pf-lab-kiosk .pf-lab-whoami { padding: 8px 10px; gap: 6px 10px; flex-wrap: nowrap; }
  .pf-lab-kiosk .pf-lab-whoami-hint { display: none; }
  .pf-lab-kiosk .pf-lab-whoami-name { flex: 1 1 auto; min-width: 0; font-size: 1rem; }
  .pf-lab-kiosk .pf-lab-whoami-name strong { font-size: 1.15rem; display: block; overflow-wrap: anywhere; }
  .pf-lab-kiosk .pf-lab-whoami-actions, .pf-lab-kiosk .pf-lab-whoami-actions .btn { width: auto; }
  .pf-lab-kiosk .pf-lab-whoami-actions .btn { min-width: 0; min-height: 48px; padding-inline: 14px; }
  html:has(.pf-lab-kiosk) { scroll-padding-top: 90px; }
}
/* Lab PIN sign-in ("Go pin", 2026-10-27): on an enrolled lab device the
   signed-out card lists big name buttons for the device's plant, then a PIN
   step. Lab list rows carry PIN actions; lab devices are listed under it. */
.pf-lab-device-line { margin: 0; font-weight: 650; }
.pf-lab-names { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pf-lab-name { width: 100%; min-height: 60px; font-size: 1.15rem; overflow-wrap: anywhere; }
.pf-lab-pinform { text-align: left; border-top: 0; padding-top: 0; }
.pf-lab-pin { font-size: 1.6rem; letter-spacing: .3em; min-height: 56px; }
.pf-lab-pinform .pf-lab-actions .btn { min-height: 56px; min-width: 140px; font-size: 1.1rem; }
.pf-lab-pinset { border-top: 0; padding-top: 4px; width: 100%; }
.pf-lab-devices { margin-top: 16px; padding: 0; }
.pf-lab-device-list { margin-top: 8px !important; }
.pf-lab-device-form { border-top: 0; padding-top: 8px; }
@media (max-width: 520px) {
  .pf-lab-names { grid-template-columns: 1fr; }
  .pf-lab-pinform .pf-lab-actions .btn { width: 100%; }
}

/* Hot / cold fill temperature at fill start (2026-10-27): the pack picker
   (one big tap per PI pack, its printed limits underneath) and the recorded
   fill line on the batch row. */
.pf-fill-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 8px 0 12px; }
.pf-fill-pack { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 64px; text-align: left; white-space: normal; }
.pf-fill-pack-name { font-size: 18px; font-weight: 700; }
.pf-fill-pack-rule { font-size: 14px; color: var(--muted, #6b7280); }
.pf-fill-rec { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 8px; background: #F3F4F6; }
.pf-stamp-aux[data-hot-fill] { border-style: dashed; }
/* A pack with a hot AND a cold rule asks "Hot fill (no cooling step)" or
   "Cold fill (cooling step)" with two big buttons (fill temp drop 2026-10-28:
   no number either way). */
.pf-fill-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 8px 0 12px; }
.pf-fill-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 72px; text-align: left; white-space: normal; }
/* Fill temp drop: the time sheet names the pack and the hot / cold choice before Save. */
.pf-sheet-fill-choice { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
/* Tablet 10/29b (item 7): "Not sent" on a batch card (classic + guided), with
   Fix. Same colours as the refused-entries box (no new colours). */
.pf-notsent { margin: 6px 0 8px; padding: 8px 12px; border: 2px solid #c40000; border-radius: 10px; background: #fff6d6; color: #6b4e00; }
.pf-notsent-pill { display: inline-block; font-weight: 800; color: #c40000; margin-bottom: 4px; }
.pf-notsent-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 16px; }
.pf-notsent-row + .pf-notsent-row { border-top: 1px solid #e8c572; }
.pf-notsent-noowner { flex: 0 1 45%; font-size: 14px; font-style: italic; text-align: right; }
.pf-notsent-fix { min-height: 48px; min-width: 96px; font-size: 16px; font-weight: 700; border-radius: 10px; border: 2px solid #c40000; background: #fff; color: #c40000; }
/* PF_PREFLIGHT_JUMP (2026-11-12): "Open pre-start checks" / "Send again · 09:10"
   on a mix entry refused for the checks (same red, filled), and the card it
   lands on (same gold outline as a focused batch). */
.pf-notsent-preflight, .pf-notsent-resend { background: #c40000; color: #fff; margin-right: 8px; padding: 0 12px; }
.pf-preflight.pf-preflight-focus, .pf-notsent.pf-preflight-focus { outline: 3px solid var(--brand-gold); outline-offset: 4px; border-radius: 12px; }
.pfg-cc-notsent { font-weight: 800; color: #c40000; }
.pfg-notsent-list { margin-top: 12px; }
.pfg-notsent-batch + .pfg-notsent-batch { margin-top: 10px; }

/* ══ TV BOARD ON A PHONE (owner request 2026-10-29 18:26) ═════════════════════
   "TV board should ... be mobile optimized." The owner's iPhone (home-screen app,
   black-translucent status bar) showed the wall layout squeezed to 390px: the
   logo under the status bar, an oversized BATCHES DONE plaque, 9 cramped chips
   per row, a big empty gap between the run card and the footer (the wall board
   is a fixed 100vh screen and the strips column takes the spare height), and a
   colour key wrapping raggedly.

   On a phone the board is a normal scrolling page instead of a fixed screen:
   safe-area padding, a compact two-row header, chips in a grid as wide as the
   phone allows (readable numbers and times, no sideways scroll), the notes and
   colour key straight under the last run, and the key as a tidy grid.

   ONLY phones match. Portrait: 600px wide or less. Landscape: 460px tall or
   less. A wall TV is never either (1080p at device pixel ratio 2 is 960 x 540,
   a 720p TV at 1.5 is 853 x 480), so the 1080p / 4K wall layout is untouched.
   Display only: the same markup, data, refresh and hold / colour rules. Every
   selector is under .pf-tv, so the cooking tablet's chips are unaffected. */
@media (max-width: 600px), (orientation: landscape) and (max-height: 460px) {
  .pf-tv {
    --pftv-pad: 10px;
    height: auto; max-height: none;
    min-height: 100vh; min-height: 100dvh;
    overflow: visible;
    gap: 10px;
    padding: 10px calc(10px + env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) calc(10px + env(safe-area-inset-left, 0px));
  }
  /* Masthead: still full bleed, now clear of the status bar / notch. Grid:
     logo | plant over date | clock | batches done. */
  .pf-tv .pf-tv-head {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    grid-template-areas: "back logo plant clock total" "back logo date clock total";
    align-items: center;
    gap: 0 8px;
    margin: -10px calc(-10px - env(safe-area-inset-right, 0px)) 0 calc(-10px - env(safe-area-inset-left, 0px));
    padding: calc(6px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-right, 0px)) 6px calc(10px + env(safe-area-inset-left, 0px));
    border-bottom-width: 3px;
  }
  .pf-tv .pf-tv-back { grid-area: back; }
  .pf-tv .pf-tv-logo { grid-area: logo; height: 28px; padding: 3px 5px; border-radius: 6px; }
  .pf-tv .pf-tv-plant { grid-area: plant; font-size: 20px; line-height: 1.15; }
  .pf-tv .pf-tv-date { grid-area: date; font-size: 13px; line-height: 1.2; }
  .pf-tv .pf-tv-clock { grid-area: clock; font-size: 15px; border-width: 2px; border-radius: 6px; white-space: nowrap; }
  .pf-tv .pf-tv-total { grid-area: total; margin-left: 0; padding: 2px 8px; border-radius: 6px; text-align: center; }
  .pf-tv .pf-tv-total-n { font-size: 22px; }
  /* 11px, not 9px: the smallest size read across a room (nightly sweep 2026-11-11). */
  .pf-tv .pf-tv-total-l { display: block; font-size: 11px; letter-spacing: .04em; line-height: 1.2; max-width: 8em; }
  /* Runs stack at their natural height; nothing stretches to fill the screen. */
  .pf-tv .pf-tv-strips,
  .pf-tv .pf-tv-strips[data-density] {
    --pf-strip-scale: 1;
    flex: 0 0 auto;
    overflow: visible;
    gap: 10px;
  }
  .pf-tv .pf-tv-strip { padding: 10px; gap: 8px; border-radius: 10px; }
  .pf-tv .pf-tv-strip-sub { gap: 6px 8px; }
  .pf-tv .pf-tv-live,
  .pf-tv .pf-tv-ready { padding: 1px 10px; }
  /* Chips: as many per row as fit at a readable size (5 on a 390px phone,
     6 at 430px, about 11 in landscape), still read left to right in batch
     order. Replaces both the one-row flex strip and the wall's 14-wide grid. */
  .pf-tv .pf-tv-chips,
  .pf-tv .pf-tv-chips-multirow {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 6px;
  }
  .pf-tv .pf-chip { padding: 6px 2px; border-radius: 8px; }
  .pf-tv .pf-chip-no { font-size: 18px; }
  .pf-tv .pf-chip-time { font-size: 13px; }
  .pf-tv .pf-chip-hold-left,
  .pf-tv .pf-chip-ready-mark,
  .pf-tv .pf-chip-temp,
  .pf-tv .pf-chip-psi { font-size: 10px; letter-spacing: 0; overflow-wrap: anywhere; }
  .pf-tv .pf-chip-hold::before { font-size: 11px; left: 3px; }
  .pf-tv .pf-tv-legend-swatch.pf-chip-hold::before { font-size: 0.8em; top: 0; left: 2px; }
  /* Notes rail + colour key follow the last run directly. */
  .pf-tv .pf-tv-notes { gap: 8px; padding-top: 8px; border-top-width: 2px; }
  .pf-tv .pf-tv-note { font-size: 14px; padding-left: 10px; border-left-width: 4px; }
  .pf-tv .pf-tv-dualrun { font-size: 12px; padding-left: 10px; border-left-width: 4px; }
  /* Colour key: a tidy grid (two columns on a portrait phone). The long hold
     line takes a full row so it never squeezes into half a column. */
  .pf-tv .pf-tv-legend {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px 12px;
    font-size: 13px;
    line-height: 1.25;
  }
  .pf-tv .pf-tv-legend-title { grid-column: 1 / -1; }
  .pf-tv .pf-tv-legend-item { min-width: 0; gap: 8px; }
  .pf-tv .pf-tv-legend-item[data-tv-legend-item="hold"] { grid-column: 1 / -1; }
  .pf-tv .pf-tv-legend-swatch { flex: 0 0 auto; }
}

/* ══ TV BOARD BACK BUTTON (owner request 2026-10-29 18:43) ════════════════
   "We should also make the TV board have a back button for mobile PWA." An
   installed app has no browser back, so a phone that opened the board was
   stuck on it. Hidden by default: the wall TV never shows it (pixel-identical,
   nothing to focus). Shown on a phone (same query as the phone layout), a
   portrait tablet, and an installed app up to tablet size. It sits first in
   the masthead, before the logo, which already clears the status bar / notch
   on a phone (safe-area padding above). Tap: production-floor.js tvGoBack. */
.pf-tv-back { display: none; }
.pf-tv .pf-tv-back {
  align-items: center; justify-content: center;
  flex: 0 0 auto;
  width: 44px; height: 44px; min-height: 44px; padding: 0; margin: 0;
  border-radius: 999px;
  border: 2px solid var(--pftv-gold, #D4A843);
  background: var(--pftv-card, #FFFDF8);
  color: var(--pftv-red, #CC0000);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pf-tv .pf-tv-back:active { transform: scale(.94); }
.pf-tv .pf-tv-back:focus-visible { outline: 3px solid #FFFDF8; outline-offset: 2px; }
/* Where it shows. The installed-app clause also needs a touch screen, so a
   wall TV running the installed app (remote or mouse, no touch) stays clean. */
@media (max-width: 600px), (orientation: landscape) and (max-height: 460px), (max-width: 1024px) and (orientation: portrait), (display-mode: standalone) and (pointer: coarse) and (max-width: 1366px) {
  .pf-tv .pf-tv-back { display: inline-flex; }
}
/* Installed app found by script (body.pf-tv-app, set by renderTvBoard): older
   iPhones report it only as navigator.standalone, not the media query. */
@media (pointer: coarse) and (max-width: 1366px) {
  body.pf-tv-app .pf-tv .pf-tv-back { display: inline-flex; }
}
/* Out-of-limit reading banner (Plant C, 2026-12-02, Jason Du). A reading at or
   above its PI limit showed only a small red line in its cell, and the operator
   thought the tablet was stuck. Process card only: a full-width, high-contrast
   box at the batch (or pre-run) row saying what is wrong and what to do, with a
   large "Take a new reading" button. The batch head says it is waiting for a
   new reading. Display only: limits and blocking rules are unchanged. */
.pf-card-process .pf-proc-outbanner {
  margin: 8px 0 10px; padding: 14px 16px;
  border-radius: 10px;
  background: var(--brand-red, #CC0000); color: #fff;
  display: grid; gap: 4px;
}
.pf-card-process .pf-proc-outbanner-title { font-size: 1.6rem; font-weight: 800; line-height: 1.15; }
.pf-card-process .pf-proc-outbanner-limit { font-size: 1.15rem; font-weight: 700; }
.pf-card-process .pf-proc-outbanner-action { font-size: 1.15rem; font-weight: 600; }
.pf-card-process .pf-proc-outbanner-locked { font-size: .95rem; opacity: .95; }
.pf-card-process .pf-proc-outbanner .pf-proc-retake {
  justify-self: start; margin-top: 8px;
  min-height: 56px; padding: 12px 28px; font-size: 1.2rem; font-weight: 800;
  background: #fff; color: var(--brand-red, #CC0000); border: 3px solid #fff;
}
.pf-card-process .pf-proc-outnote { font-size: .8rem; font-weight: 700; color: var(--brand-red, #CC0000); margin-top: 4px; }
.pf-card-process .pf-proc-waiting {
  margin-left: 8px; padding: 4px 10px; border-radius: 999px;
  background: var(--brand-red, #CC0000); color: #fff;
  font-size: .9rem; font-weight: 800;
}
/* ═══════════════════════════════════════════════════════════════════════════
   Cooking tablet — GLANCE PASS (11/03). Classic card, guided pages, sheets.

   Plant C operators read numbers, pictures and colour first; words are the
   weak channel. This file makes the numbers an operator reads at arm's length
   (about 1 m) big and dark, puts every control on the 64px glove floor, and
   (sections below) gives each step one picture and each state the TV board's
   colour key. Visual only: same taps, same order, same buttons, same server.

   Loaded after 64-production-floor*.css (lexical order in build-css.sh), so
   the earlier files keep their documented reasons and this one only overrides.
   Colours: only values already in the house / TV palette of
   64-production-floor.css (palette guard B-24 spirit: no new hues, no second
   alarm red).
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --gl-ink: #1A1410;          /* house ink-strong, 17:1 on cream */
  --gl-mute: #4A4038;         /* house ink-2, 9:1 on cream (was #6B6560, 5:1) */
}
/* Dark theme: the classic tablet and the sheets follow the module's dark
   bridge (64-production-floor.css), so their ink turns light. Guided pages
   are always on their own light paper. Light fills (done chip, amber hold
   box, gold ring) set their dark ink explicitly below. */
[data-theme="dark"] .pf-tablet, [data-theme="dark"] .pf-floorhead, [data-theme="dark"] .pf-sheet { --gl-ink: #E5E7EB; --gl-mute: #9CA3AF; }
[data-theme="dark"] .pfg-root { --gl-ink: #1A1410; --gl-mute: #4A4038; }

/* ═══ 1. BIG NUMBERS (classic card) ═════════════════════════════════════════ */

/* Batch number: the ring is the batch, readable across the cooker (40 → 64px). */
.pf-card .pf-batch-ring { width: 64px; height: 64px; font-size: 2.1rem; border-width: 4px; }
.pf-card .pf-batch-no { font-size: 1.6rem; }
.pf-card .pf-batch-ratio { font-size: 1.1rem; color: var(--gl-mute); }

/* Step labels: the words stay, a size below the numbers. .85rem (was .75rem)
   and not more, so a full 10-step batch still shows "First discard release"
   and "Add remark" without a scroll on a 1280x800 tablet. */
.pf-card .pf-cell-label { font-size: .85rem; letter-spacing: .03em; color: var(--gl-mute); line-height: 1.2; }
.pf-card .pf-cell-ord { font-size: .9rem; color: var(--gl-ink); opacity: 1; }

/* Recorded times / readings: 21px → 34px, dark ink (AAA), still the dashed
   "tap to correct" chip, now on the 64px floor. */
.pf-card .pf-time { font-size: 2.15rem; min-height: 64px; min-width: 120px; padding: 4px 14px; color: var(--gl-ink); }
.pf-card .pf-temp { font-size: 2.15rem; min-height: 64px; padding: 4px 12px; color: var(--gl-ink); border-radius: 10px; }
.pf-card .pf-temp-edit.is-empty { font-size: 1.2rem; }
.pf-card .pf-cell-value { min-height: 64px; gap: 6px; }

/* The next-step button: the verb and the step name a size up. */
.pf-card .pf-stamp-next { min-height: 80px; padding: 6px 10px; }
.pf-card .pf-stamp-next .pf-stamp-verb { font-size: 1.45rem; }
.pf-card .pf-stamp-next .pf-stamp-step { font-size: .95rem; line-height: 1.2; opacity: 1; }
/* Short landscape screens: a little tighter so the longest locale (es) still
   shows a full 10-step batch's last buttons without a scroll (measured). */
@media (max-height: 860px) {
  .pf-card .pf-stamp-next { padding: 4px 10px; }
  .pf-card .pf-stamp-next .pf-stamp-step { font-size: .9rem; line-height: 1.15; }
  .pf-card .pf-batch-head { margin-bottom: 6px; }
  .pf-card .pf-cells { row-gap: 8px; }
}

/* Hold clocks: the minutes left are the number to read (24 / 20px → 54px). */
.pf-card .pf-holdclock { align-items: center; gap: 6px 14px; padding: 10px 14px; border-width: 3px; }
.pf-card .pf-holdclock-value, .pf-card .pf-cook-hold-value { font-size: 3.4rem; line-height: 1; color: var(--gl-ink); }
.pf-card .pf-holdclock.is-holddone .pf-cook-hold-value { color: #fff; font-size: 2.6rem; }
.pf-card .pf-holdclock-label { font-size: 1rem; color: var(--gl-mute); }
.pf-card .pf-holdclock-note { font-size: 1.1rem; color: var(--gl-mute); }
.pf-card [data-cook-hold] { font-size: 1.1rem; font-weight: 700; }
.pf-card [data-cook-hold] progress { height: 22px; }

/* First discard / filler handshake time. */
.pf-card .pf-hs-time { font-size: 1.9rem; color: var(--gl-ink); }

/* ═══ 4. GLOVE FLOOR: every control at least 64px (same place, same order) ═ */
.pf-card .btn, .pf-floorhead .btn, .pf-who-out, .pf-binfo-btn, .pf-done-fold .pf-done-fold-btn,
.pf-opchip, .pf-tank-change-btn, .pf-card .pf-hs-btn, .pf-card .pf-resample-ctl .pf-resample-btn { min-height: 64px; }
.pf-done-fold .pf-done-fold-btn { font-size: 1.1rem; }
.pf-opchip-label { font-size: .8rem; color: var(--gl-mute); }
.pf-card .pf-hs-btn { font-size: 1.1rem; }

/* ═══ SHEETS (classic + guided share them) ══════════════════════════════════ */
.pf-sheet-title { font-size: 22px; }
/* Time sheet clock 56 → 84px; the steppers, date chips and boxes to 64px. */
.pf-time-big { font-size: 84px; letter-spacing: .01em; color: var(--gl-ink); }
body:has(.pfg-root) .pf-time-big { font-size: 72px; }
.pf-time-display { margin: 2px 0; }
.pf-sheet .pf-step, .pf-sheet .pf-step-wide { min-height: 64px; font-size: 22px; }
.pf-sheet .pf-chip-row .pf-chip { min-height: 64px; }
.pf-sheet .pf-chip-input input, .pf-sheet .pf-native-time { min-height: 64px; font-size: 22px; }
.pf-sheet .pf-time-native .pf-bigbtn { min-height: 64px; }
.pf-sheet-prev, .pf-sheet-help[data-time-window] { font-size: 22px; font-weight: 700; color: var(--gl-ink); }
.pf-time-day { font-size: 18px; color: var(--gl-ink); }
/* Keypad: the reading 34 → 56px; keys 58px in landscape so Save stays on a
   1280x800 screen, 72px where the screen has the height (portrait). */
.pf-num-input { font-size: 56px; min-height: 72px; color: var(--gl-ink); }
.pf-sheet .pf-key { min-height: 58px; font-size: 30px; }
@media (min-height: 1000px) { .pf-sheet .pf-key { min-height: 72px; } }
.pf-sheet .pf-num-target { font-size: 24px; font-weight: 800; color: var(--gl-ink); margin: 0 0 6px; }
.pf-sheet-actions .pf-bigbtn { min-height: 72px; font-size: 22px; }
/* Short landscape screens (1280x800): the time sheet keeps Save on screen
   with no scroll, as today. The clock is 64px (was 56), the steppers and boxes
   stay on the 64px floor, and the space comes from margins / padding. */
@media (max-height: 860px) {
  .pf-sheet { padding-top: 10px; padding-bottom: 14px; }
  .pf-sheet-time .pf-sheet-title { font-size: 20px; }
  .pf-sheet-time .pf-quick-now { margin-bottom: 8px; }
  .pf-sheet-time .pf-sheet-help { margin-bottom: 6px; }
  .pf-sheet-time .pf-sheet-prev, .pf-sheet-time .pf-sheet-help[data-time-window] { font-size: 18px; padding: 6px 12px; margin-bottom: 8px; }
  .pf-sheet-time .pf-chip-row { margin-bottom: 6px; }
  .pf-time-big, body:has(.pfg-root) .pf-time-big { font-size: 64px; line-height: 1.1; }
  .pf-time-day { font-size: 16px; margin: 0 0 4px; }
  .pf-sheet-time .pf-step-row { margin: 4px 0 6px; }
  .pf-sheet-actions .pf-bigbtn { min-height: 64px; }
  .pf-sheet-actions { margin-top: 8px; }
}

/* ═══ 8. SIGN-IN LANGUAGE: 48 → 64px ════════════════════════════════════════ */
.pf-login-langbtn { min-height: 64px; min-width: 112px; font-size: 20px; }

/* ═══ GUIDED (.pfg-*) — big numbers ═════════════════════════════════════════ */
/* top bar: labels a step bigger, the hold clock bigger */
.pfg-tb-cell small { font-size: .85rem; }
.pfg-tb-val { font-size: 1.15rem; }
.pfg-tb-val.pfg-hold b, .pfg-hold b { font-size: 1.5rem; }
/* step strip: the recorded time is the number to read (13-17px → 1.3rem, about 20px bold, dark) */
.pfg-chip { min-height: 76px; }
.pfg-chip .tm { font-size: 1.3rem; font-weight: 800; color: var(--gl-ink); }
.pfg-chip.is-current .tm { color: #fff; }
.pfg-chip .n { font-size: 1rem; }
/* step card */
.pfg-stepmeta { font-size: 1.1rem; color: var(--gl-mute); }
.pfg-tag { font-size: 1.1rem; padding: 6px 12px; }
.pfg-root .pfg-stepcard h1 { font-size: 1.7rem; }
.pfg-fact b { font-size: 1.4rem; }
.pfg-fact small { color: var(--gl-mute); }
.pfg-rec { font-size: 1.4rem; }
/* hold boxes: big digits (37 → 58px) */
.pfg-big { font-size: 3.6rem; font-weight: 900; }
.pfg-holdbox small { font-size: 1.05rem; font-weight: 700; }
.pfg-primary.is-locked [data-count] { font-size: 2.6rem; font-variant-numeric: tabular-nums; }
/* line board cards: cooker number + batch big */
.pfg-cc-num { font-size: 2.2rem; }
.pfg-cc-batch b { font-size: 1.6rem; }
.pfg-cc-timer b { font-size: 2.6rem; }
/* Short landscape screens (1024x768, 1280x800): the line board keeps all
   three cooker cards clear of the pinned "not recorded" strip, as today. The
   numbers stay bigger than before; spacing gives the room back. */
@media (max-height: 800px) {
  .pfg-tb-val { font-size: 1.05rem; }
  .pfg-cooker { gap: 5px; padding: 10px 14px; }
  .pfg-cc-num { font-size: 1.85rem; }
  .pfg-cc-batch b { font-size: 1.3rem; }
  .pfg-cc-timer b { font-size: 2.4rem; }
  .pfg-cc-next { padding: 8px 12px; }
}
/* time chips: the times big */
.pfg-qchip small[data-g-chiptime] { font-size: 1.6rem; font-weight: 800; color: var(--gl-ink); }
.pfg-qchip b { font-size: 1.3rem; }
.pfg-root .pfg-qchip, .pf-sheet .pfg-qchip { min-height: 96px; }
.pfg-will { font-size: 1.3rem; }

/* ═══ 6. GUIDED PRIMARY LABEL BUG ═══════════════════════════════════════════
   `.pfg-root button { font: inherit }` (0,1,1) beat `.pfg-primary
   { font-size: 1.6rem }` (0,1,0), so the one big step button rendered its
   label at the 17px root size and normal weight. Same specificity as the
   reset, later in the cascade: the intended size and weight apply. */
.pfg-root .pfg-primary { font-size: 1.9rem; font-weight: 800; min-height: 104px; }
@media (max-height: 800px) { .pfg-root .pfg-primary { font-size: 1.75rem; min-height: 96px; } }

/* ═══ 4/8. GUIDED GLOVE FLOOR: language EN/ES/简/繁 52 → 64px wide ═══════════ */
.pfg-lang button { min-width: 64px; }

/* ═══ 5. CONTRAST ═══════════════════════════════════════════════════════════ */
/* guided top bar: quiet values were 2.7:1 ("No hold running") → about 11:1 */
.pfg-tb-cell small { color: #E9DFCF; }
.pfg-tb-cell .pfg-muted, .pfg-tb-val.pfg-muted { color: #E9DFCF; }
/* "Ready for fill" pill: white on --success measured 4.26:1 → TV done green 9:1 */
.pf-card .pf-ready-badge { background: #17552A; color: #fff; font-size: .95rem; padding: 5px 12px; }
/* pending ring: muted 5:1 → ink-2 9:1 */
.pf-card .pf-batch-ring-pending { color: var(--gl-mute); border-color: var(--gl-mute); }
/* disabled cook-hold Record (hold still running): it looked like a pale live
   button at opacity .5. Now a solid, clearly-off slate with white text (8:1). */
.pf-card .pf-stamp-next[data-cook-hold-until]:disabled { opacity: 1; background: var(--gl-mute); border-color: var(--gl-mute); color: #fff; box-shadow: none; }

/* ═══ 2 + 3. THE TV COLOUR KEY + ONE PICTURE PER STEP ═══════════════════════
   Colour = the TV board key (ok / check / stop), and NEVER colour alone: each
   state also has a picture and a shape.
     ok     green  #17552A / #E3F1E5 / #14451F  + check-in-circle, solid edge
     check  amber  #e6b800 edge, #fff6d6 or the TV hold block #4a3a00/#ffe89a
                   + pause (a hold is running) or triangle (over / tell QC)
     stop   red    #CC0000                       + octagon ("Not saved" only)
   An overdue QC hold stays AMBER, like the TV: QC decides, it is not a stop.

   REC 4 (2026-09) said "no icons: the boards use ring / strike / blank". The
   owner reversed it on 11/03 for the cooking tablet ("make the icons colors
   and numbers real"). Rule now: one simple picture per step and state, drawn
   here by CSS from the step key the markup already carries (data-field /
   data-stamp on classic, data-g-ico on guided). Never an emoji or a glyph
   character in the markup (fonts differ per tablet; a screen reader would
   read it). The ring / strike / blank marks stay as they were.
   Pictures: pot = mix / cook, thermometer = a reading, clock = QC / discard
   time, snowflake = cooling, tray + arrow = filling. */
:root {
  --gl-ok: #17552A; --gl-ok-bg: #E3F1E5; --gl-ok-ink: #14451F; --gl-ok-edge: #2c6b41;
  --gl-check-edge: #e6b800; --gl-check-bg: #fff6d6; --gl-check-ink: #4a3a00; --gl-check-on-dark: #ffe89a;
  --gl-stop: #CC0000; --gl-stop-bg: #FDECEA;
  --ico-thermo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 14.8V4a2 2 0 0 0-4 0v10.8a4 4 0 1 0 4 0z'/%3E%3Cpath d='M12 17.5V9'/%3E%3Cpath d='M17 5h3M17 9h3'/%3E%3C/svg%3E");
  --ico-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.2'/%3E%3Cpath d='M12 6.5V12l3.8 2.4'/%3E%3C/svg%3E");
  --ico-pot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 11h16v6a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3z'/%3E%3Cpath d='M1.5 12.5H4M20 12.5h2.5'/%3E%3Cpath d='M9 3.5c-.8 1 .8 2-.1 3.2M13 3.5c-.8 1 .8 2-.1 3.2M17 3.5c-.8 1 .8 2-.1 3.2'/%3E%3C/svg%3E");
  --ico-snow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2v20M3.3 7l17.4 10M3.3 17L20.7 7'/%3E%3Cpath d='M9 3.5l3 2.5 3-2.5M9 20.5l3-2.5 3 2.5'/%3E%3C/svg%3E");
  --ico-fill: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2.5v7M8.5 6.5L12 10l3.5-3.5'/%3E%3Cpath d='M5 12h14v8.5a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1z'/%3E%3C/svg%3E");
  --ico-pause: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='5' y='4' width='5' height='16' rx='1.2'/%3E%3Crect x='14' y='4' width='5' height='16' rx='1.2'/%3E%3C/svg%3E");
  --ico-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M7 12.4l3.4 3.4 6.8-7'/%3E%3C/svg%3E");
  --ico-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' fill-rule='evenodd'%3E%3Cpath d='M12 1.8L23 21.5H1zM10.7 8.2h2.6v7.2h-2.6zM10.6 17.1h2.8v2.6h-2.8z'/%3E%3C/svg%3E");
  --ico-stop: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' fill-rule='evenodd'%3E%3Cpath d='M7.9 1.5h8.2l6.4 6.4v8.2l-6.4 6.4H7.9l-6.4-6.4V7.9zM6 10.4h12v3.2H6z'/%3E%3C/svg%3E");
}

/* ── the picture primitive: a mask, so it takes the text colour ──────────── */
.pfx-ico,
.pf-card .pf-cell[data-field] > .pf-cell-label::before,
.pf-card .pf-stamp-next[data-stamp]::before,
.pfg-chip[data-g-ico]::before,
.pf-card .pf-holdclock::before,
.pfg-holdbox::before,
.pfg-refusal > b .pfx-ico,
.pf-sheet-refusal .pf-sheet-title::before,
.pfg-pill::before,
.pf-card .pf-hs-done::before,
.pf-card .pf-ready-badge::before,
.pf-card .pf-batch-head .badge-warn::before,
.pf-sheet .pf-chip-row .pf-chip.is-picked .pf-chip-main::before,
.pf-num-when .is-picked::before,
.pf-sheet .pf-num-target::before,
.pf-sheet-prev::before,
.pf-sheet-help[data-time-window]::before,
.pfg-alert.is-red::before,
.pfg-cc-timer.is-over::before {
  content: ''; display: inline-block; flex: 0 0 auto; vertical-align: middle;
  width: 1.25em; height: 1.25em; background: currentColor;
  -webkit-mask: var(--ico, var(--ico-clock)) center / contain no-repeat;
  mask: var(--ico, var(--ico-clock)) center / contain no-repeat;
}
/* A cell / chip whose step has no picture below draws nothing. */
.pfx-ico { width: 1.15em; height: 1.15em; }
.pfx-ico:not([data-g-ico]):not([data-ico]) { display: none; }

/* one picture per step (the event type the markup already carries) */
[data-field="mix_start"], [data-field="mix_end"], [data-field="cook_start"],
[data-stamp="mix_start"], [data-stamp="mix_end"], [data-stamp="cook_start"],
[data-g-ico="mix_start"], [data-g-ico="mix_end"], [data-g-ico="cook_start"], .pfx-ico[data-ico="pot"] { --ico: var(--ico-pot); --ico-on: inline-block; }
[data-field="temp_reach"], [data-field="cook_end"], [data-field^="cook2_"], [data-field^="reheat_"],
[data-stamp="temp_reach"], [data-stamp="cook_end"], [data-stamp^="cook2_"], [data-stamp^="reheat_"],
[data-g-ico="temp_reach"], [data-g-ico="cook_end"], [data-g-ico^="cook2_"], [data-g-ico^="reheat_"], .pfx-ico[data-ico="thermo"] { --ico: var(--ico-thermo); --ico-on: inline-block; }
[data-field^="cool"], [data-stamp^="cool"], [data-g-ico^="cool"] { --ico: var(--ico-snow); --ico-on: inline-block; }
[data-field="qc_release"], [data-field="drain_off"], [data-stamp="qc_release"], [data-stamp="drain_off"],
[data-g-ico="qc_release"], [data-g-ico="drain_off"], .pfx-ico[data-ico="clock"] { --ico: var(--ico-clock); --ico-on: inline-block; }
[data-field^="fill_"], [data-stamp^="fill_"], [data-g-ico^="fill_"] { --ico: var(--ico-fill); --ico-on: inline-block; }
.pfx-ico[data-ico="pause"] { --ico: var(--ico-pause); }
.pfx-ico[data-ico="check"] { --ico: var(--ico-check); }
.pfx-ico[data-ico="stop"] { --ico: var(--ico-stop); }
.pfx-ico[data-ico="warn"] { --ico: var(--ico-warn); }
.pf-card .pf-cell[data-field] > .pf-cell-label::before, .pfg-chip[data-g-ico]::before, .pf-card .pf-stamp-next[data-stamp]::before { display: var(--ico-on, none); }
.pfx-ico[data-g-ico] { display: var(--ico-on, none); }

/* ═══ CLASSIC ═══════════════════════════════════════════════════════════════ */
/* step picture before the ordinal; the label wraps beside it */
/* (the label is already a one-line flex row: picture | ordinal | words; the
   words wrap in their own column, so the picture never takes a line) */
.pf-card .pf-cell[data-field] > .pf-cell-label { align-items: center; }
.pf-card .pf-cell[data-field] > .pf-cell-label::before { width: 24px; height: 24px; color: var(--gl-mute); }
/* done = ok: the picture becomes the green check, the recorded time sits on green */
.pf-card .pf-cell-done[data-field] > .pf-cell-label::before { --ico: var(--ico-check); display: inline-block; color: var(--gl-ok); }
.pf-card .pf-cell-done .pf-time { border-color: var(--gl-ok-edge); background: var(--gl-ok-bg); color: #1A1410; }
/* the process card (other styles) keeps its own grid label and no pictures */
.pf-card .pf-proc-batch .pf-cell[data-field] > .pf-cell-label::before { display: none; }
.pf-card.pf-card-process .pf-cell[data-field] > .pf-cell-label { align-items: normal; }
/* the next step: the picture is on the button, big */
.pf-card .pf-cell-next[data-field] > .pf-cell-label::before { display: none; }
.pf-card .pf-stamp-next { flex-direction: row; flex-wrap: wrap; gap: 2px 10px; text-align: center; }
.pf-card .pf-stamp-next[data-stamp]::before { width: 36px; height: 36px; }
.pf-card .pf-stamp-next .pf-stamp-step { flex: 1 1 100%; }
.pf-card .pf-stamp-next[data-outbox-pending]::before { display: none; }
/* hold still running on the next button = pause */
.pf-card .pf-stamp-next[data-cook-hold-until]:disabled::before { --ico: var(--ico-pause); display: inline-block; }

/* batch ring: in progress = TV "cooking" gold, done = ok green (+ the strike).
   Red is left for stop. The ring / fill / strike shapes are unchanged. */
.pf-card .pf-batch-ring-live { background: #F7EBD0; border-color: #d4a843; border-style: dashed; color: #1A1410; }
.pf-card .pf-batch-ring-done { background: var(--gl-ok); border-color: var(--gl-ok); }
.pf-card .pf-batch.is-done { border-color: var(--gl-ok-edge); }

/* status badges: picture + colour + words */
.pf-card .pf-ready-badge { display: inline-flex; align-items: center; gap: 6px; --ico: var(--ico-check); }
.pf-card .pf-batch-head .badge-warn { background: var(--gl-check-ink); color: var(--gl-check-on-dark); border: 3px solid var(--gl-check-edge); font-size: .95rem; padding: 5px 12px; display: inline-flex; align-items: center; gap: 6px; --ico: var(--ico-warn); }

/* hold clocks: a hold running = check (amber) + pause; over = TV hold block + triangle */
.pf-card .pf-holdclock { --ico: var(--ico-pause); background: var(--gl-check-bg); border-color: var(--gl-check-edge); }
.pf-card .pf-holdclock::before { width: 44px; height: 44px; color: var(--gl-check-ink); }
.pf-card .pf-holdclock .pf-holdclock-value, .pf-card .pf-holdclock .pf-cook-hold-value { color: #1A1410; }
.pf-card .pf-holdclock .pf-holdclock-label, .pf-card .pf-holdclock .pf-holdclock-note { color: var(--gl-check-ink); }
.pf-card [data-cook-hold] { border-style: dashed; color: var(--gl-check-ink); }
.pf-card [data-cook-hold] progress { accent-color: var(--gl-check-ink); }
.pf-card .pf-holdclock.is-warn { --ico: var(--ico-warn); border-width: 4px; }
.pf-card .pf-holdclock.is-breached { --ico: var(--ico-warn); background: var(--gl-check-ink); border-color: var(--gl-check-edge); border-width: 4px; }
.pf-card .pf-holdclock.is-breached::before,
.pf-card .pf-holdclock.is-breached .pf-holdclock-value,
.pf-card .pf-holdclock.is-breached .pf-holdclock-label,
.pf-card .pf-holdclock.is-breached .pf-holdclock-note { color: var(--gl-check-on-dark); }
/* the cook hold is done (read the temperature now): the existing teal block + check */
.pf-card .pf-holdclock.is-holddone { --ico: var(--ico-check); background: #0f766e; border-color: #0f766e; }
.pf-card .pf-holdclock.is-holddone::before, .pf-card .pf-holdclock.is-holddone .pf-holdclock-label, .pf-card .pf-holdclock.is-holddone .pf-holdclock-note { color: #fff; }

/* first discard / filler handshake done = ok */
.pf-card .pf-hs-done { display: inline-flex; align-items: center; gap: 8px; border-color: var(--gl-ok-edge); background: var(--gl-ok-bg); --ico: var(--ico-check); }
.pf-card .pf-hs-done::before { color: var(--gl-ok); width: 26px; height: 26px; }

/* The card must fit at EVERY batch stage, not only an early one (review
   rounds 1 and 2). Past QC release a batch carries a hold clock, eight done
   steps and the batch-1 "First discard release"; the bigger numbers had
   pushed the next-step button and that handshake below the fold. The space
   comes from rows that were mostly empty, never from the current step:
   - the tank sits beside the batch number, and "Record QC resample" beside
     the hold clock (both rows were one short item on a whole line);
   - the handshake title sits beside its buttons;
   - an operator name is shown whole: beside the times when it fits, else
     on the line under them, wrapping where it is wider than the step
     (review round 3: operators must read the full name). Only a short
     landscape screen keeps it to one line (below).
   These hold at every screen size: on a portrait 800x1280 tablet a long name
   plus a recorded QC resample had pushed "First discard release" off the
   screen (review round 2). Every control stays on the 64px floor and the
   rows wrap back to full lines where they do not fit. */
.pf-card .pf-batch:not(.pf-proc-batch) { display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; }
.pf-card .pf-batch:not(.pf-proc-batch) > * { flex: 1 1 100%; min-width: 0; }
.pf-card .pf-batch:not(.pf-proc-batch) > .pf-batch-head { flex: 1 1 auto; }
.pf-card .pf-batch:not(.pf-proc-batch) > .pf-tank { flex: 0 0 auto; margin: 0 0 6px; }
.pf-card .pf-batch:not(.pf-proc-batch) > .pf-holdclock { flex: 1 1 60%; margin-bottom: 8px; }
.pf-card .pf-batch:not(.pf-proc-batch) > .pf-resample-ctl { flex: 0 0 auto; margin: 0 0 8px; }
.pf-card .pf-handshake { display: flex; flex-wrap: wrap; align-items: center; column-gap: 14px; }
.pf-card .pf-handshake-title { margin-bottom: 0; }
.pf-card .pf-holdclock .pf-holdclock-label { flex: 1 1 12em; min-width: 0; }
.pf-card .pf-initial { max-width: 100%; }
/* Short landscape screens (1280x800) need more: the hold clock keeps its 51px
   digits on less padding, so the clock row is as tall as the 64px resample
   button beside it, and a done step is a recorded fact, so its time / reading
   is 26px (main 22px; the step being done now keeps the big button and the
   keypad's 56px reading), so the operator tag fits on the chips' line again.
   Portrait keeps 32px+ done times. */
@media (max-height: 860px) {
  .pf-card .pf-holdclock { padding: 4px 12px; }
  .pf-card .pf-cell-done .pf-time, .pf-card .pf-cell-done .pf-temp { font-size: 1.75rem; min-width: 0; padding: 4px 10px; }
  .pf-card .pf-cell-done .pf-cell-value { gap: 6px; }
  .pf-card .pf-handshake { margin-top: 8px; padding-top: 8px; }
}
/* A phone (430px and under) lays a done step out as one row, label left and
   value right, and the value never shrank: a long name ran past the card's
   edge and was cut by it (review round 3). The value now gives way and the
   name wraps under the time; a recorded QC resample's name does the same. */
@media (max-width: 430px) {
  .pf-card .pf-cell-done .pf-cell-value { flex: 0 1 auto; min-width: 0; }
}
.pf-card .pf-resample-entry { flex-wrap: wrap; max-width: 100%; }
/* A short landscape tablet (1280x800, 1024x768) has no room for a name on
   two lines: the next-step button would leave the screen. There a name stays
   on one line and a name wider than the step is cut at its START
   ("...lupe Hernandez-Rodriguez"), so two operators who share a long first
   part still look different; the full name is the tag's title. The marks
   around the text keep its punctuation in reading order. A 35-character name
   still shows whole at 1280x800. */
@media (max-height: 860px) and (orientation: landscape) {
  .pf-card .pf-initial { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; direction: rtl; }
  .pf-card .pf-initial::before, .pf-card .pf-initial::after { content: "\200E"; }
}

/* ═══ SHEETS ════════════════════════════════════════════════════════════════ */
/* the picked day = ok + check (was the stop red) */
.pf-sheet .pf-chip-row .pf-chip.is-picked { border-color: var(--gl-ok); background: var(--gl-ok-bg); color: var(--gl-ok-ink); border-width: 3px; }
.pf-sheet .pf-chip-row .pf-chip.is-picked .pf-chip-main::before { --ico: var(--ico-check); width: 1em; height: 1em; margin-right: 6px; vertical-align: -2px; }
/* the keypad's picked "Just now" / "Earlier" = ok + check (was the stop red) */
.pf-num-when .is-picked { border-color: var(--gl-ok); background: var(--gl-ok-bg); color: var(--gl-ok-ink); border-width: 3px; --ico: var(--ico-check); }
.pf-num-when .is-picked::before { width: 1.1em; height: 1.1em; margin-right: 8px; }
.pf-sheet .pf-num-target { display: flex; align-items: center; gap: 8px; --ico: var(--ico-thermo); }
.pf-sheet .pf-num-target::before { width: 30px; height: 30px; }
.pf-sheet-prev, .pf-sheet-help[data-time-window] { display: flex; align-items: center; gap: 10px; --ico: var(--ico-clock); }
.pf-sheet-prev::before, .pf-sheet-help[data-time-window]::before { width: 30px; height: 30px; color: var(--gl-mute); }

/* "Not saved" = STOP: the octagon + red, big. The buttons inside are dark ink
   so the only red on the screen is the stop sign itself. */
.pf-sheet-refusal .pf-sheet-title { color: var(--gl-stop); font-size: 28px; display: flex; align-items: center; gap: 12px; --ico: var(--ico-stop); }
.pf-sheet-refusal .pf-sheet-title::before { width: 48px; height: 48px; }
.pf-sheet-refusal .pfg-refusal, .pfg-refusal { border-width: 4px; border-color: var(--gl-stop); background: var(--gl-stop-bg); }
.pfg-refusal > b { display: inline-flex; align-items: center; gap: 10px; font-size: 1.5rem; color: var(--gl-stop); }
.pfg-refusal > b .pfx-ico { width: 44px; height: 44px; }
.pfg-refusal p { color: #1A1410; }
.pf-sheet-refusal .pfg-btn-primary, .pfg-refusal .pfg-btn-primary { background: #1A1410; border-color: #1A1410; color: #fff; }
/* Dark theme (review round 1): the sheet is dark there and #CC0000 on it
   measured 2.71:1. The title and its octagon (same currentColor) take the
   app's dark-theme red #FF6B6B (as 32-feedback-thread.css), about 6:1. The
   panel under it stays light pink, so its words keep the dark ink: the dark
   theme's `p { color: var(--text-primary) }` had made them light on light
   (about 1:1, on main too). */
[data-theme="dark"] .pf-sheet-refusal .pf-sheet-title { color: #FF6B6B; }
[data-theme="dark"] .pf-sheet-refusal .pfg-refusal p { color: #1A1410; }

/* ═══ GUIDED ════════════════════════════════════════════════════════════════ */
/* red alerts on guided are QC-hold alerts (resample due, hold flagged): TV amber */
.pfg-alerts.is-red { border-color: var(--gl-check-edge); color: var(--gl-check-on-dark); background: rgba(230, 184, 0, .18); }
.pfg-alert.is-red { background: var(--gl-check-ink); color: var(--gl-check-on-dark); border: 3px solid var(--gl-check-edge); display: flex; gap: 10px; align-items: center; --ico: var(--ico-warn); }
.pfg-alert.is-red::before { width: 28px; height: 28px; }

/* step strip: picture per step; done = ok check */
.pfg-chip[data-g-ico]::before { width: 24px; height: 24px; color: var(--gl-mute); }
.pfg-chip.is-done { background: var(--gl-ok-bg); border-color: var(--gl-ok-edge); border-width: 3px; }
.pfg-chip.is-done[data-g-ico]::before { --ico: var(--ico-check); display: inline-block; color: var(--gl-ok); }
.pfg-chip.is-done .n { display: none; } /* the check picture replaces the ✓ text */
.pfg-chip.is-current[data-g-ico]::before { color: #fff; width: 28px; height: 28px; }
.pfg-chip.is-future { opacity: .7; }

/* step card: the step's picture beside its name, and on the big button */
.pfg-stepcard h1 { display: flex; align-items: center; gap: 12px; }
.pfg-stepcard h1 .pfx-ico { width: 1.3em; height: 1.3em; }
.pfg-primary .pfx-ico { width: 52px; height: 52px; }
.pfg-root .pfg-primary.is-locked { background: var(--gl-check-bg); border: 4px dashed var(--gl-check-edge); color: var(--gl-check-ink); }

/* hold boxes: running = check (amber) + pause / clock; over = TV hold block + triangle */
.pfg-holdbox { --ico: var(--ico-pause); flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 14px; padding: 10px 16px; border: 3px solid var(--gl-check-edge); background: var(--gl-check-bg); color: var(--gl-check-ink); }
.pfg-holdbox::before { width: 52px; height: 52px; order: -2; }
.pfg-holdbox small { flex: 1 1 60%; }
.pfg-holdbox .pfg-big { order: -1; flex: 0 0 auto; }
.pfg-holdbox.is-cook { background: var(--gl-check-bg); border-style: dashed; }
.pfg-holdbox.is-qc { --ico: var(--ico-clock); }
.pfg-holdbox.is-warn { --ico: var(--ico-warn); border-width: 4px; }
.pfg-holdbox.is-over { --ico: var(--ico-warn); background: var(--gl-check-ink); color: var(--gl-check-on-dark); border-style: solid; border-width: 4px; }
.pfg-holdbox.is-qc.is-over .pfg-big { font-size: 2.6rem; }

/* line board: state pill = picture + TV colour + word; an over QC hold = TV hold block */
.pfg-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 1rem; padding: 8px 12px; --ico: var(--ico-pot); }
.pfg-pill::before { width: 22px; height: 22px; }
.pfg-pill.st-mixing, .pfg-pill.st-cooking { background: #F7EBD0; color: var(--gl-check-ink); }
.st-cooking { border-left-color: #d4a843; }
.pfg-pill.st-qcwait { --ico: var(--ico-clock); }
.pfg-pill.st-qchold { --ico: var(--ico-pause); background: var(--gl-check-ink); color: var(--gl-check-on-dark); }
.pfg-pill.st-cooling { --ico: var(--ico-snow); }
.pfg-pill.st-filling { --ico: var(--ico-fill); background: #EFE6F7; color: #3D1A5C; }
.st-filling { border-left-color: #5B2C8A; }
.pfg-pill.st-done { --ico: var(--ico-check); background: var(--gl-ok-bg); color: var(--gl-ok-ink); }
.st-done { border-left-color: var(--gl-ok); }
.pfg-pill.st-rework, .pfg-pill.st-idle { --ico: none; }
.pfg-pill.st-rework::before, .pfg-pill.st-idle::before { display: none; }
.pfg-cc-timer.is-over { background: var(--gl-check-ink); color: var(--gl-check-on-dark); border: 3px solid var(--gl-check-edge); border-radius: 10px; padding: 6px 10px 6px 52px; position: relative; --ico: var(--ico-warn); }
.pfg-cc-timer.is-over b { font-size: 1.9rem; }
.pfg-cc-timer.is-over small { color: var(--gl-check-on-dark); }
.pfg-cc-timer.is-over::before { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; }

/* done card: ok */
.pfg-done h1 .pfx-ico { width: 48px; height: 48px; color: var(--gl-ok); }
.pfg-stepcard.pfg-done { border: 3px solid var(--gl-ok-edge); }

/* guided time chips: the picked one = ok */
.pfg-qchip.is-on { border-color: var(--gl-ok); background: var(--gl-ok-bg); border-width: 4px; }

/* ═══ 7. "GO" IS GREEN (own commit: revert it alone to keep the red go) ═════
   The next step, the guided current chip and big step button, and the sheets'
   Save were the same #CC0000 as the "Not saved" stop panel. They take the TV
   key's ok green ("Batch on now"), so red means stop and nothing else. Same
   place, same size, same tap. If the plant lead wants the red go back, revert
   this commit only: every other change stands. */
.pf-card .pf-stamp-next { background: var(--gl-ok); border-color: var(--gl-ok); color: #fff; }
.pf-card .pf-stamp-next:active { background: var(--gl-ok-ink); }
.pf-card .pf-cell-next .pf-cell-label, .pf-card .pf-cell-next .pf-cell-ord { color: var(--gl-ok-ink); }
.pf-sheet-actions .pf-bigbtn.btn-primary, .pf-sheet .pf-quick-now.btn-primary { background: var(--gl-ok); border-color: var(--gl-ok); color: #fff; }
.pfg-root { --pfg-red: var(--gl-ok); --pfg-red-dark: var(--gl-ok-ink); }
.pfg-cc-next { background: var(--gl-ok-bg); }
.pfg-cc-next small { color: var(--gl-ok-ink); }
/* ============================================================
   65-feedback-leaderboard.css — Feedback Hub → Board tab (2026-08-21)

   Admin-only reporter board. Operational table, NOT a game board:
   no podium, no medals, no trophy colours, no motion. Same house rule
   as the Impact card — fade only, no scale/bounce/confetti.

   Scoped entirely under .fblb-* so it cannot touch the existing
   My/Backlog/Shipped markup.
   ============================================================ */

/* ── Summary cards ───────────────────────────────────────── */
.fblb-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.fblb-card {
  background: var(--surface-raised, #fff);
  border: 1px solid var(--border, #e6e0d8);
  border-radius: 10px;
  padding: 14px 16px;
}

.fblb-card-value {
  font-size: 1.6rem;
  font-weight: 650;
  line-height: 1.1;
  color: var(--text, #2c2622);
  font-variant-numeric: tabular-nums;
}

.fblb-card-label {
  margin-top: 4px;
  font-size: .78rem;
  color: var(--text-mute, #7a726a);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Table ───────────────────────────────────────────────── */
.fblb-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.fblb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9em;
}

.fblb-table th,
.fblb-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border, #e6e0d8);
  text-align: left;
  vertical-align: middle;
}

.fblb-table th {
  font-weight: 600;
  color: var(--text-mute, #7a726a);
  white-space: nowrap;
}

.fblb-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Numeric columns: right-aligned, tabular so digits line up. */
.fblb-table .fblb-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fblb-rank {
  color: var(--text-mute, #7a726a);
  /* Fits the widest localized header ("Puesto") plus 3 digits. The column is a
     view ordinal, so it stays visually quiet next to the real numbers. */
  width: 4.5em;
}

.fblb-name {
  font-weight: 600;
  color: var(--text, #2c2622);
}

.fblb-shipped {
  font-weight: 650;
}

.fblb-when {
  white-space: nowrap;
  color: var(--text-mute, #7a726a);
}

/* Active-span suffix ("over 42 days") sits under the date on desktop. */
.fblb-span {
  display: block;
  font-size: .76rem;
  color: var(--text-mute, #7a726a);
  opacity: .85;
}

/* ── Sortable headers ────────────────────────────────────── */
.fblb-sort {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-bottom: 1px dotted transparent;
}

.fblb-sort:hover {
  color: var(--text, #2c2622);
  border-bottom-color: var(--border-strong, #cfc6ba);
}

.fblb-sort.is-active {
  color: var(--text, #2c2622);
  font-weight: 700;
}

.fblb-sort:focus-visible {
  outline: 2px solid var(--focus, #9a7b4f);
  outline-offset: 2px;
}

/* ── Hit-rate chip ───────────────────────────────────────── */
/* Tone bands: >=90 good, 70-89 mid, <70 low. Muted, not celebratory. */
.fblb-rate {
  display: inline-block;
  min-width: 3.2em;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.fblb-rate-good {
  background: var(--success-bg, #e7f3ea);
  color: var(--success-fg, #2f6b42);
}

.fblb-rate-mid {
  background: var(--neutral-bg, #f1eee9);
  color: var(--text-mute, #6d655c);
}

.fblb-rate-low {
  background: var(--warn-bg, #fdf1de);
  color: var(--warn-fg, #8a5a1a);
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .fblb-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .fblb-card-value { font-size: 1.35rem; }

  /* The table stays a table and scrolls horizontally — stacking eight
     numeric columns into cards makes the comparison the board exists
     for impossible to read. */
  .fblb-table {
    min-width: 640px;
  }
}

/* Dark mode lives in 90-dark-mode.css under [data-theme="dark"].
   Do NOT add @media (prefers-color-scheme: dark) here — that keys off
   the OS, not the app toggle, and paints these cards dark on a light
   hub (2026-08-21, same class as upload-zone). */
/* ═══════════════════════════════════════════════════════════════════════════
   ALL PLANTS BOARD (2026-11-07) — #/production-floor?tv=1&plant=all
   (public/js/ui/pf-all-plants.js). One read-only summary of Plant A + B + C.

   Every selector is under .pf-all (or is the new .pf-floorhead-all link), so the
   per-plant floor TV boards and the cooking tablet are untouched. Loaded after
   64-production-floor.css, so the plant board's phone masthead rules apply first
   and these refine them. No new colours: the --pftv-* tokens and the hold, live
   and done hexes already in 64-production-floor.css (hold amber #4a3a00 /
   #e6b800 / #ffe89a, done #E3F1E5 / #14451F / #2c6b41, gold ink #6B4E00).
   Red stays the masthead only. There is no "on track" / "behind plan" colour:
   the screen shows only the estimated finish (no plan exists to compare).
   ═══════════════════════════════════════════════════════════════════════════ */

/* Cooking Floor header link, beside Open TV (same size and phone rule). */
.pf-floorhead-all { min-height: 56px; display: inline-flex; align-items: center; }
/* The header spreads its items (space-between); keep the two board links
   together on the right. Only applies when the link is there. */
.pf-floorhead .pf-floorhead-tv:has(+ .pf-floorhead-all) { margin-left: auto; }
@media (max-width: 430px) { .pf-floorhead-all { flex: 1 1 100%; justify-content: center; } }

.pf-all { --pf-all-s: 1; }
.pf-all a.pf-all-band { color: inherit; text-decoration: none; }
.pf-all .pf-all-refresh { font-size: clamp(12px, .9vw, 17px); color: #FFFDF8; opacity: .92; font-weight: 600; }

/* ── Attention bar: the screen's headline ──────────────────────────────── */
.pf-all-attn { display: flex; align-items: center; flex-wrap: wrap; gap: clamp(8px, .8vw, 16px); flex: 0 0 auto; }
.pf-all-attn-title {
  font-size: calc(clamp(16px, 1.45vw, 28px) * var(--pf-all-s)); font-weight: 900; text-transform: uppercase;
  letter-spacing: .06em; color: var(--pftv-ink, #1A1410); margin-right: .2em;
}
.pf-all-attn-item {
  display: inline-flex; align-items: center; gap: .45em;
  font-size: calc(clamp(16px, 1.45vw, 28px) * var(--pf-all-s)); font-weight: 800;
  padding: .12em .7em; border-radius: 999px; border: 3px solid transparent; white-space: nowrap;
}
.pf-all-attn-n { font-size: 1.15em; font-weight: 900; font-variant-numeric: tabular-nums; }
/* Hold family = the chip's dark-amber block. */
.pf-all-attn-hold { background: #4a3a00; border-color: #e6b800; color: #ffe89a; }
.pf-all-attn-hold::before { content: '\26A0'; }
/* Not updated / not read = dark-amber ink + glyph on the shade, no fill. */
.pf-all-attn-stale { background: var(--pftv-shade, #F0E0C8); border-color: #4a3a00; color: #4a3a00; }
.pf-all-attn-stale::before { content: '\23F1'; }
.pf-all-attn-quiet { background: var(--pftv-done-bg, #E3F1E5); border-color: var(--pftv-done-edge, #2c6b41); color: var(--pftv-done-ink, #14451F); }
.pf-all-attn-quiet::before { content: '\2713'; font-weight: 900; }

/* ── Freshness words (TV + app) ─────────────────────────────────────────── */
.pf-all .pf-all-stale, .pf-all .pf-all-unread { color: #4a3a00; font-weight: 800; line-height: 1.25; }
.pf-all .pf-all-stale::before, .pf-all .pf-all-unread::before { content: '\26A0\00a0'; }
.pf-all .pf-all-stale-sub { display: block; font-weight: 650; font-size: .85em; color: var(--pftv-ink-2, #4A4038); }
.pf-all .pf-all-updated { color: var(--pftv-ink-2, #4A4038); font-weight: 650; }
.pf-all .pf-all-est { color: var(--pftv-ink-2, #4A4038); font-weight: 650; }
.pf-all .pf-all-idle {
  display: inline-flex; font-weight: 800; padding: .08em .65em; border-radius: 999px;
  background: var(--pftv-shade, #F0E0C8); color: var(--pftv-ink-2, #4A4038);
}
.pf-all .pf-all-noaccess {
  display: inline-flex; font-weight: 800; padding: .08em .65em; border-radius: 999px;
  background: var(--pftv-shade, #F0E0C8); color: var(--pftv-ink-2, #4A4038);
}
.pf-all .pf-all-noaccess-sub, .pf-all .pf-all-unread-msg { color: var(--pftv-ink-2, #4A4038); font-weight: 650; }
/* Real-CSS gap seen while mocking: a LIVE chip with a running (>15 min) hold
   clock printed #4a3a00 on the live green. The plant board now has its own
   rule for it (64-, live chips that are not amber); this one stays as built. */
.pf-all .pf-chip-live .pf-chip-hold-left { color: #FFFDF8; }
/* The big total covers only the plants read ("2 of 3 plants"). */
.pf-all .pf-all-total-part {
  display: block; font-size: clamp(11px, .9vw, 16px); font-weight: 800; line-height: 1.25;
  color: #4a3a00; letter-spacing: 0; text-transform: none; white-space: nowrap;
}
.pf-all .pf-all-total-part::before { content: '\26A0\00a0'; }
/* The M-71 whole-screen "Not updated since" line (the screen's own reads). */
.pf-all .pf-tv-stale {
  flex: 0 0 auto; color: #4a3a00; background: var(--pftv-shade, #F0E0C8);
  border: 2px solid #4a3a00; border-radius: 10px; padding: .25em .7em;
  font-weight: 800; font-size: calc(clamp(14px, 1.2vw, 24px) * var(--pf-all-s));
}

/* ═══════════════════════════════ TV VARIANT ═══════════════════════════════
   1920x1080 (and the 960x540 a 1080p TV reports at 2x). One band per plant:
   plant | batches done + estimate | lines | needs attention. No scrolling:
   fitAllPlants steps data-density down (lg, md, sm) until it fits. */
.pf-all-tv[data-density="md"] { --pf-all-s: .86; }
.pf-all-tv[data-density="sm"] { --pf-all-s: .74; }
/* The smallest rung also trims the band's vertical padding and line gaps
   (a 1080p TV at 2x is 960 x 540: two lines + their header must still fit). */
.pf-all-tv[data-density="sm"] .pf-all-band { padding-top: 4px; padding-bottom: 4px; }
.pf-all-tv[data-density="sm"] .pf-all-lines { gap: 3px; }
.pf-all-tv[data-density="sm"] .pf-all-line { gap: 2px; }
.pf-all-tv .pf-all-bands {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-rows: repeat(var(--pf-all-rows, 3), minmax(0, 1fr));
  gap: clamp(8px, 1.1vh, 18px);
}
.pf-all-tv .pf-all-band {
  position: relative; height: 100%; box-sizing: border-box; overflow: hidden; min-height: 0;
  display: grid;
  grid-template-columns: clamp(150px, 15vw, 300px) clamp(170px, 18vw, 360px) minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(10px, 1.6vw, 32px);
  background: var(--pftv-card, #FFFDF8);
  border: 2px solid var(--pftv-rule, #E5D9C4);
  border-left: 10px solid var(--pftv-gold, #D4A843);
  border-radius: 14px;
  padding: clamp(8px, 1.2vh, 20px) clamp(36px, 3vw, 60px) clamp(8px, 1.2vh, 20px) clamp(12px, 1.3vw, 26px);
}
/* Tap / click a plant = open its own board: a quiet chevron, not a button. */
.pf-all-tv a.pf-all-band::after {
  content: '\203A'; position: absolute; right: clamp(10px, 1vw, 22px); top: 50%;
  transform: translateY(-55%); font-size: clamp(32px, 3.4vw, 72px); font-weight: 300;
  color: var(--pftv-ink-3, #6B6560); line-height: 1;
}
.pf-all-tv a.pf-all-band:focus-visible { outline: 4px solid var(--pftv-gold, #D4A843); outline-offset: 2px; }
.pf-all-tv .pf-all-band.is-stale,
.pf-all-tv .pf-all-band.is-unread,
.pf-all-tv .pf-all-band.is-unavailable { border-style: dashed; border-color: #4a3a00; border-left-style: solid; border-left-color: #4a3a00; }
.pf-all-tv .pf-all-band.is-stale .pf-all-dim,
.pf-all-tv .pf-all-band.is-unread .pf-all-dim { opacity: .45; filter: grayscale(.6); }
.pf-all-tv .pf-all-band.is-noaccess { border-left-color: var(--pftv-rule, #E5D9C4); background: var(--pftv-page, #FFF5E6); grid-template-columns: clamp(150px, 15vw, 300px) minmax(0, 1fr); }
.pf-all-tv .pf-all-band.is-unavailable { grid-template-columns: clamp(150px, 15vw, 300px) minmax(0, 1fr); }
.pf-all-tv .pf-all-noaccess-sub, .pf-all-tv .pf-all-unread-msg { font-size: calc(clamp(16px, 1.4vw, 28px) * var(--pf-all-s)); }

.pf-all-tv .pf-all-id { display: flex; flex-direction: column; align-items: flex-start; gap: .35em; min-width: 0; }
.pf-all-tv .pf-all-plantname { font-size: calc(clamp(32px, 3.9vw, 80px) * var(--pf-all-s)); font-weight: 900; line-height: 1; color: var(--pftv-ink, #1A1410); letter-spacing: .01em; white-space: nowrap; }
.pf-all-tv .pf-all-updated, .pf-all-tv .pf-all-stale, .pf-all-tv .pf-all-unread,
.pf-all-tv .pf-all-noaccess { font-size: calc(clamp(13px, 1.25vw, 25px) * var(--pf-all-s)); }

.pf-all-tv .pf-all-count { display: flex; flex-direction: column; gap: .4em; min-width: 0; }
.pf-all-tv .pf-all-count-num { line-height: .95; color: var(--pftv-gold-ink, #6B4E00); font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pf-all-tv .pf-all-count-done { font-size: calc(clamp(44px, 5.6vw, 116px) * var(--pf-all-s)); }
.pf-all-tv .pf-all-count-of { font-size: calc(clamp(22px, 2.4vw, 50px) * var(--pf-all-s)); color: var(--pftv-ink-2, #4A4038); font-weight: 800; }
.pf-all-tv .pf-all-count-l,
.pf-all-tv .pf-all-lines-sum { font-size: calc(clamp(11px, .95vw, 18px) * var(--pf-all-s)); text-transform: uppercase; letter-spacing: .12em; color: var(--pftv-ink-2, #4A4038); font-weight: 800; }
.pf-all-tv .pf-all-est { font-size: calc(clamp(13px, 1.2vw, 24px) * var(--pf-all-s)); }

.pf-all-tv .pf-all-lines { display: flex; flex-direction: column; gap: clamp(6px, 1vh, 16px); min-width: 0; }
.pf-all-tv .pf-all-line { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pf-all-tv .pf-all-line-top { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; min-width: 0; }
.pf-all-tv .pf-all-line-name { font-size: calc(clamp(16px, 1.5vw, 30px) * var(--pf-all-s)); font-weight: 900; color: var(--pftv-ink, #1A1410); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pf-all-tv .pf-all-line .pf-tv-live { font-size: calc(clamp(14px, 1.35vw, 27px) * var(--pf-all-s)); }
.pf-all-tv .pf-all-line-sku { font-size: calc(clamp(13px, 1.2vw, 24px) * var(--pf-all-s)); font-weight: 800; color: var(--pftv-purple, #5B2C8A); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-all-tv .pf-all-more { font-size: calc(clamp(13px, 1.1vw, 22px) * var(--pf-all-s)); font-weight: 800; color: var(--pftv-ink-2, #4A4038); align-self: center; }
.pf-all-tv .pf-all-idle { font-size: calc(clamp(16px, 1.45vw, 28px) * var(--pf-all-s)); align-self: flex-start; }
.pf-all-tv .pf-all-daystatus { font-size: calc(clamp(14px, 1.2vw, 24px) * var(--pf-all-s)); }

/* Needs-attention column: the REAL hold chip, made big. */
.pf-all-tv .pf-all-alerts { display: flex; flex-wrap: wrap; gap: clamp(8px, 1vw, 18px); align-items: stretch; min-width: 0; }
.pf-all-tv .pf-all-alerts .pf-chip {
  flex: 0 0 auto; min-width: calc(clamp(120px, 10.5vw, 210px) * var(--pf-all-s)); max-width: 260px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 12px 12px; border-radius: 12px;
}
.pf-all-tv .pf-all-alerts .pf-chip-hold::before { font-size: clamp(14px, 1.3vw, 26px); top: 6px; left: 8px; }
.pf-all-tv .pf-all-alerts .pf-chip-hold::after { border-width: 0 18px 18px 0; }
.pf-all-tv .pf-all-alert-line { font-size: calc(clamp(12px, 1vw, 20px) * var(--pf-all-s)); font-weight: 800; color: #ffe89a; letter-spacing: .04em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-all-tv .pf-all-alerts .pf-chip-no { font-size: calc(clamp(26px, 2.6vw, 52px) * var(--pf-all-s)); min-width: 1.4em; min-height: 1.4em; }
.pf-all-tv .pf-all-alerts .pf-chip-hold-left { font-size: calc(clamp(14px, 1.3vw, 26px) * var(--pf-all-s)); text-align: center; white-space: nowrap; }
.pf-all-tv .pf-all-none {
  font-size: calc(clamp(15px, 1.4vw, 28px) * var(--pf-all-s)); font-weight: 700; color: var(--pftv-ink-2, #4A4038);
  border: 2px dashed var(--pftv-rule, #E5D9C4); border-radius: 12px; padding: .5em .9em;
}
.pf-all .pf-all-none-ok::before { content: '\2713\00a0'; color: var(--pftv-done-edge, #2c6b41); font-weight: 900; }
/* Plant C honesty: no hold clock is NOT "checked and clear". Grey dashed, no tick. */
.pf-all-tv .pf-all-none-gap { border-color: var(--pftv-ink-3, #6B6560); }
.pf-all .pf-all-none-gap small { display: block; font-size: .7em; font-weight: 600; margin-top: .2em; color: var(--pftv-ink-3, #6B6560); }

/* Footer: colour key (only what this screen uses) + refresh. */
.pf-all-foot {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center;
  gap: clamp(6px, .8vw, 16px) clamp(14px, 1.4vw, 28px);
  border-top: 3px solid var(--pftv-gold, #D4A843); padding-top: clamp(6px, .9vh, 12px);
  font-size: calc(clamp(12px, .95vw, 19px) * var(--pf-all-s)); color: var(--pftv-ink-2, #4A4038); font-weight: 600;
}
.pf-all-foot b { color: var(--pftv-ink, #1A1410); font-weight: 800; }
.pf-all-foot .pf-all-key { display: inline-flex; align-items: center; gap: 8px; }
.pf-all-foot .pf-tv-legend-swatch { display: inline-flex; align-items: center; justify-content: center; width: 2.4em; height: 2em; padding: 0; border-radius: 6px; position: relative; flex: 0 0 auto; }
.pf-all-foot .pf-tv-legend-swatch .pf-chip-no { font-size: 1em; min-width: 1.4em; min-height: 1.4em; border-width: 2px; }
.pf-all-foot .pf-tv-legend-swatch.pf-chip-hold::before { font-size: .8em; top: 0; left: 2px; }
.pf-all-foot .pf-tv-legend-swatch.pf-chip-hold::after { border-width: 0 7px 7px 0; }
.pf-all-foot .pf-all-stale { font-size: .95em; }
.pf-all-foot-refresh { display: none; }

/* Floor tablet opened this screen: one calm card, a link to its own board. */
.pf-all-floor { align-items: center; justify-content: center; }
.pf-all-floor-card {
  max-width: 640px; margin: auto; text-align: center; background: var(--pftv-card, #FFFDF8);
  border: 2px solid var(--pftv-rule, #E5D9C4); border-left: 10px solid var(--pftv-gold, #D4A843);
  border-radius: 14px; padding: 24px 28px;
}
.pf-all-floor-title { font-size: clamp(20px, 2vw, 34px); font-weight: 900; margin: 0 0 8px; color: var(--pftv-ink, #1A1410); }
.pf-all-floor-body { font-size: clamp(16px, 1.4vw, 24px); margin: 0 0 16px; color: var(--pftv-ink-2, #4A4038); }
.pf-all-floor-link { min-height: 56px; display: inline-flex; align-items: center; }

/* ═══════════════════════ APP VARIANT (phone / laptop) ══════════════════════
   Same tokens; scrolls; per-line detail with the real chip classes. */
.pf-tv.pf-all-app { height: auto; max-height: none; min-height: 100vh; min-height: 100dvh; overflow: visible; }
.pf-all-app .pf-all-bands { display: flex; flex-direction: column; gap: 12px; }
.pf-all-app .pf-all-card {
  background: var(--pftv-card, #FFFDF8); border: 2px solid var(--pftv-rule, #E5D9C4);
  border-left: 8px solid var(--pftv-gold, #D4A843); border-radius: 12px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.pf-all-app .pf-all-card.is-stale,
.pf-all-app .pf-all-card.is-unread,
.pf-all-app .pf-all-card.is-unavailable { border-style: dashed; border-color: #4a3a00; border-left-style: solid; }
.pf-all-app .pf-all-card.is-stale .pf-all-dim,
.pf-all-app .pf-all-card.is-unread .pf-all-dim { opacity: .5; filter: grayscale(.6); }
.pf-all-app .pf-all-card.is-noaccess { border-left-color: var(--pftv-rule, #E5D9C4); background: var(--pftv-page, #FFF5E6); }
.pf-all-app .pf-all-card-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name count" "upd open"; align-items: center; gap: 4px 10px;
}
.pf-all-app .pf-all-plantname { grid-area: name; font-size: 26px; font-weight: 900; line-height: 1; color: var(--pftv-ink, #1A1410); }
.pf-all-app .pf-all-card-head .pf-all-noaccess { justify-self: end; font-size: 14px; }
.pf-all-app .pf-all-card-count { grid-area: count; text-align: right; color: var(--pftv-gold-ink, #6B4E00); font-weight: 900; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pf-all-app .pf-all-card-count small { font-size: .6em; color: var(--pftv-ink-2, #4A4038); font-weight: 800; }
.pf-all-app .pf-all-card-count .pf-all-count-l { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--pftv-ink-2, #4A4038); font-weight: 800; }
.pf-all-app .pf-all-upd { grid-area: upd; font-size: 13px; display: flex; flex-wrap: wrap; gap: 2px 12px; min-width: 0; }
.pf-all-app .pf-all-open { grid-area: open; justify-self: end; align-self: end; font-size: 14px; font-weight: 800; color: var(--pftv-gold-ink, #6B4E00); white-space: nowrap; min-height: 32px; display: inline-flex; align-items: center; }
.pf-all-app .pf-all-open::after { content: ' \203A'; font-size: 1.2em; white-space: pre; }
.pf-all-app .pf-all-noaccess-sub, .pf-all-app .pf-all-unread-msg { font-size: 14px; }

.pf-all-app .pf-all-alerts { display: flex; flex-direction: column; gap: 6px; }
.pf-all-app .pf-all-alert-row {
  display: flex; align-items: center; gap: 10px;
  background: #4a3a00; color: #ffe89a; border: 3px solid #e6b800; border-radius: 10px;
  padding: 6px 10px; font-weight: 800; font-size: 15px; position: relative;
}
.pf-all-app .pf-all-alert-row::before { content: '\26A0'; font-size: 18px; }
.pf-all-app .pf-all-alert-what { flex: 1 1 auto; min-width: 0; }
.pf-all-app .pf-all-alert-when { white-space: nowrap; text-decoration: underline; text-decoration-thickness: 2px; }
.pf-all-app .pf-all-alert-when.is-left { text-decoration: none; }
.pf-all-app .pf-all-none { font-size: 13px; color: var(--pftv-ink-2, #4A4038); font-weight: 650; }
.pf-all-app .pf-all-none-gap { border: 2px dashed var(--pftv-ink-3, #6B6560); border-radius: 10px; padding: 6px 10px; }
.pf-all-app .pf-all-none-gap small { font-size: 12px; }

.pf-all-app .pf-all-lines { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pf-all-app .pf-all-line { border-top: 1px solid var(--pftv-rule, #E5D9C4); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pf-all-app .pf-all-line-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.pf-all-app .pf-all-line-name { font-weight: 900; font-size: 15px; color: var(--pftv-ink, #1A1410); }
.pf-all-app .pf-all-line-sku { font-weight: 800; font-size: 15px; color: var(--pftv-purple, #5B2C8A); overflow-wrap: anywhere; }
.pf-all-app .pf-all-line .pf-tv-live, .pf-all-app .pf-all-line .pf-tv-ready { font-size: 13px; padding: 1px 10px; }
.pf-all-app .pf-all-line .pf-tv-pace { font-size: 13px; }
.pf-all-app .pf-tv-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 5px; }
.pf-all-app .pf-chip { padding: 4px 2px; border-radius: 7px; position: relative; min-width: 0; overflow: hidden; }
.pf-all-app .pf-chip-no { font-size: 15px; }
.pf-all-app .pf-chip-done .pf-chip-no, .pf-all-app .pf-chip-in_progress .pf-chip-no, .pf-all-app .pf-chip-live .pf-chip-no { min-width: 22px; min-height: 22px; border-width: 2px; }
.pf-all-app .pf-chip-time { font-size: 11px; }
.pf-all-app .pf-chip-hold-left, .pf-all-app .pf-chip-ready-mark { font-size: 9px; letter-spacing: 0; overflow-wrap: anywhere; }
.pf-all-app .pf-chip-hold::before { font-size: 10px; top: 1px; left: 3px; }
.pf-all-app .pf-chip-hold::after { border-width: 0 8px 8px 0; }
.pf-all-app .pf-all-foot { font-size: 12px; }
.pf-all-app .pf-all-attn-title, .pf-all-app .pf-all-attn-item { font-size: 14px; }
.pf-all-app .pf-all-attn-item { border-width: 2px; }
.pf-all-app .pf-tv-stale { font-size: 14px; }

/* Laptop: each plant is a row — summary left, alerts + lines and chips right. */
@media (min-width: 900px) {
  .pf-all-app .pf-all-card { padding: 10px 18px; display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 6px 22px; }
  .pf-all-app .pf-all-card.is-noaccess, .pf-all-app .pf-all-card.is-unavailable { display: flex; }
  .pf-all-app .pf-all-card-head { grid-column: 1; grid-row: 1 / span 3; align-self: start; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "name open" "count count" "upd upd"; gap: 6px 12px; }
  .pf-all-app .pf-all-open { align-self: center; font-size: 13px; }
  .pf-all-app .pf-all-plantname { font-size: 34px; }
  .pf-all-app .pf-all-card-count { text-align: left; font-size: 40px; }
  .pf-all-app .pf-all-upd { flex-direction: column; }
  .pf-all-app .pf-all-alerts, .pf-all-app .pf-all-lines, .pf-all-app .pf-all-none-wrap { grid-column: 2; }
  .pf-all-app .pf-all-alerts { flex-direction: row; flex-wrap: wrap; }
  .pf-all-app .pf-all-line { display: grid; grid-template-columns: minmax(220px, 330px) minmax(0, 1fr); gap: 4px 14px; align-items: center; }
  .pf-all-app .pf-all-line:first-child { border-top: 0; padding-top: 0; }
  .pf-all-app .pf-tv-chips { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
  .pf-all-app .pf-all-attn-title, .pf-all-app .pf-all-attn-item { font-size: 16px; }
}
/* Phone: the plant board's phone masthead rules (64-production-floor.css)
   apply; the title takes the clock's place (the phone already shows the time). */
@media (max-width: 600px) {
  .pf-all .pf-tv-head .pf-tv-plant { font-size: 18px; line-height: 1.1; overflow-wrap: anywhere; grid-row: 1; }
  .pf-all .pf-tv-head .pf-tv-date { font-size: 12px; }
  .pf-all .pf-all-refresh { display: none; }
  .pf-all .pf-tv-head .pf-tv-clock { display: none; }
  .pf-all .pf-tv-head { grid-template-areas: "back logo plant plant total" "back logo date date total"; }
  .pf-all-foot-refresh { display: inline; }
  .pf-all-app .pf-all-card { padding: 10px 12px; }
}
/* ── Deductions: the KeHE check tab (Slice 7, 2026-08-26) ──────────────
 *
 * Intake (who is this check?) and the rendered 28-row tab. This is the screen
 * where the analyst recognises his own workbook, so the grid deliberately reads
 * like a spreadsheet: monospace references, right-aligned money, sticky header.
 *
 * Authored here in public/css/src/. Never hand-edit public/css/main.css —
 * it is generated by scripts/build-css.sh and any direct edit is wiped by
 * the next `npm run build`.
 */

/* ── Intake: AR is the floor, evidence is gated ────────────────────────
 *
 * ded-intake-evidence (2026-08-27). The old .ded-tab-pair grid rendered two
 * file slots on the EMPTY workbench — a KeHE-only job standing in front of
 * every distributor. Those rules are gone with the markup. What replaces them
 * is deliberately asymmetric, because the workflow is asymmetric: AR is one
 * full-width primary door, and the distributor evidence drop only appears
 * after someone says who the check belongs to.
 */

.ded-upload-primary {
  margin: 12px 0;
}

.ded-upload-card-primary {
  border: 1px solid var(--border, #dadce0);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface, #fff);
}

/* The distributor picker + its one conditional slot. */
.ded-intake-evidence {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border, #dadce0);
}

.ded-intake-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ded-upload-card-evidence {
  margin-top: 12px;
  border: 1px solid var(--border, #dadce0);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface, #fff);
}

/* Honest-empty copy: a distributor with no second-file shape gets a sentence,
 * not a drop zone it can never fill. */
.ded-intake-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-alt, #f8f9fa);
  border: 1px solid var(--border, #dadce0);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-mute, #5f6368);
}

/* ── The KeHE closer, on the open check ───────────────────────────────
 * Hidden by default in markup; renderKeheCloser() unhides it only when
 * check.is_kehe is true. A non-KeHE check never paints this box. */
.ded-kehe-closer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #dadce0);
}

.ded-kehe-closer[hidden] { display: none; }

.ded-tab-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.ded-tab-stat {
  border: 1px solid var(--border, #dadce0);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 130px;
}

.ded-tab-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-mute, #5f6368);
}

.ded-tab-stat-value {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* The two merch-fee numbers sit side by side on purpose. Collapsing them
 * into one figure is how the tab silently goes short. */
.ded-tab-stat-dual {
  font-size: 12px;
  color: var(--text-mute, #5f6368);
  font-variant-numeric: tabular-nums;
}

.ded-tab-foot-ok    { color: #137333; font-weight: 600; }
.ded-tab-foot-break { color: #c5221f; font-weight: 600; }

.ded-tab-grid-wrap {
  max-height: 60vh;
  overflow: auto;
  border: 1px solid var(--border, #dadce0);
  border-radius: 8px;
}

.ded-tab-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ded-tab-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-alt, #f8f9fa);
  border-bottom: 1px solid var(--border, #dadce0);
  padding: 7px 8px;
  text-align: left;
  white-space: nowrap;
  font-weight: 600;
}

.ded-tab-grid td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle, #f1f3f4);
  white-space: nowrap;
}

.ded-tab-grid td.ded-tab-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
}

.ded-tab-grid td.ded-tab-ref {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
}

/* Row species. A payment is a settlement, a repayment is a note, and the
 * minted merch fee is not in the deduction bucket. Colour says so. */
.ded-tab-grid tr.ded-tab-row-payment   { background: #f2f9f4; }
.ded-tab-grid tr.ded-tab-row-repayment { background: #fef7e0; }
.ded-tab-grid tr.ded-tab-row-merge_fee { background: #f1f3fe; }

.ded-tab-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
  align-items: center;
}

/* kehe-leftovers-1022: a prefilled PO invoice is a heuristic, not something he
 * typed, so it carries a small marker. A typed Invoice value that is not one
 * invoice number stays visible, struck through, and is never replaced. */
.ded-tab-grid .ded-tab-prefill {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 8px;
  font-family: var(--font-sans, inherit);
  font-size: 10px;
  line-height: 16px;
  color: #8a5300;
  background: #fef3dc;
  border: 1px solid #f5d38f;
  cursor: help;
}
/* kehe-broker-invoice-1027: an Invoice cell the rule left blank says so;
 * the tooltip gives the reason. */
.ded-tab-grid .ded-tab-po-blank {
  display: inline-block;
  padding: 0 5px;
  border-radius: 8px;
  font-family: var(--font-sans, inherit);
  font-size: 10px;
  line-height: 16px;
  color: #a50e0e;
  background: #fce8e6;
  border: 1px solid #f5b5ae;
  cursor: help;
}
.ded-tab-grid .ded-tab-typed {
  color: var(--text-mute, #80868b);
  text-decoration: line-through;
  cursor: help;
}

/* fb-529: the GL column follows the investigation lines (display only). A GL
 * saved on a line shows plain; the system's own pick, not yet saved on any
 * line, is muted and tagged "suggested". */
.ded-tab-grid td.ded-tab-gl-suggested {
  color: var(--text-mute, #80868b);
  font-style: italic;
  cursor: help;
}
.ded-tab-grid .ded-tab-gl-suggested-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 8px;
  font-family: var(--font-sans, inherit);
  font-style: normal;
  font-size: 10px;
  line-height: 16px;
  color: var(--text-mute, #5f6368);
  background: #f1f3f4;
  border: 1px solid #dadce0;
}
.ded-tab-grid td.ded-tab-gl-saved { cursor: help; }

/* fb-536 round 2: the tab GL cell can be set from the tab. One GL for the
 * whole row (saved on all its lines), or a one-click Confirm on the minted
 * merch fee. Rows whose lines disagree are marked amber. */
.ded-tab-grid td.ded-tab-gl-edit {
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.ded-tab-grid td.ded-tab-gl-edit:hover,
.ded-tab-grid td.ded-tab-gl-edit:focus-visible {
  background: #f1f3f4;
  outline: none;
}
.ded-tab-grid td.ded-tab-gl-mixed { color: #b06000; }
/* fb-538: after a save the grid stays on the row she edited; that row is
 * marked for a moment so her eye lands on it. */
.ded-tab-grid tr.ded-tab-row-just-saved > td { background: #e8f0fe; transition: background 0.4s; }
.ded-tab-grid tr.ded-tab-row-just-saved td.ded-tab-gl-edit:focus { outline: 2px solid #1a73e8; outline-offset: -2px; }
.ded-tab-grid .ded-tab-gl-input {
  width: 9ch;
  font: inherit;
  padding: 1px 4px;
}
.ded-tab-grid .ded-tab-gl-confirm {
  margin-left: 4px;
  padding: 0 8px;
  font-size: 11px;
  line-height: 18px;
  font-style: normal;
}
.ded-tab-grid .ded-tab-gl-confirmed-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 8px;
  font-size: 10px;
  line-height: 16px;
  color: #137333;
  background: #e6f4ea;
  border: 1px solid #ceead6;
}
/* ============================================================
   67-deductions-desk-lamp.css
   Deductions: THE DESK LAMP (ded-desk-lamp, 2026-08-27)

   One lamp per check, answering one question: can this leave my desk?
     red    stuck        a blocking flag is open, approve is refused
     yellow need_evidence / need_human   someone still owes this check work
     green  ready / done same gate the Approve button already uses

   Scoping contract: every selector is prefixed .ded-desk-lamp, so nothing
   here can leak into another module.

   DELIBERATELY NOT REUSED:
     - the row confidence dots (🟢 auto / 🟡 review / 🔴 manual) still mean
       "how was this LINE categorized" and keep their own emoji rendering
     - .di-flag-chip severity chips still mean "what does this check owe"
   Three languages was the bug. This file adds the ONE that answers the
   workflow question, and it is a CSS disc so it reads at a glance in a
   column of hundreds, not a Unicode glyph that renders differently per OS.

   Dark mode lives at the bottom of this file (matches the 63- precedent).
   ============================================================ */

.ded-desk-lamp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 10px 2px 8px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.01em;
  white-space: nowrap;
  vertical-align: middle;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-soft, #555);
}

/* The disc. This is the scan target. */
.ded-desk-lamp__disc {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: currentColor;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.ded-desk-lamp__label {
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Colours ──────────────────────────────────────────
   Heritage-adjacent red, warm amber, deep green. Same family as the
   flag chips so the module still looks like one product. */

.ded-desk-lamp[data-color="red"] {
  background: rgba(204, 0, 0, 0.10);
  border-color: rgba(204, 0, 0, 0.26);
  color: #a30000;
}

.ded-desk-lamp[data-color="yellow"] {
  background: rgba(212, 168, 67, 0.16);
  border-color: rgba(212, 168, 67, 0.36);
  color: #8a6400;
}

.ded-desk-lamp[data-color="green"] {
  background: rgba(22, 122, 60, 0.11);
  border-color: rgba(22, 122, 60, 0.28);
  color: #127036;
}

/* A finished check is green but quiet. It is not asking for attention. */
.ded-desk-lamp[data-reason="done"] {
  background: rgba(22, 122, 60, 0.07);
  border-color: rgba(22, 122, 60, 0.18);
  opacity: 0.82;
}

/* ── The open check (workbench header) ────────────────
   Sits next to #ded-wb-status-badge, does not replace it. */

#ded-wb-desk-lamp {
  font-size: 0.78rem;
  padding: 3px 12px 3px 9px;
}

#ded-wb-desk-lamp .ded-desk-lamp__disc {
  width: 10px;
  height: 10px;
}

/* ── The checks list column ───────────────────────────
   One column, lamp only. Kept narrow on purpose: the point is to scan a
   vertical stripe of colour down hundreds of rows, not to read an essay. */

.ded-checks-table th.ded-desk-lamp-col,
.ded-checks-table td.ded-desk-lamp-cell {
  width: 1%;
  white-space: nowrap;
}

.ded-checks-table td.ded-desk-lamp-cell .ded-desk-lamp {
  font-size: 0.71rem;
  padding: 1px 9px 1px 7px;
}

/* Narrow viewports: keep the disc, drop the word. The colour is the
   signal; the label is the confirmation. */
@media (max-width: 720px) {
  .ded-checks-table td.ded-desk-lamp-cell .ded-desk-lamp__label,
  .ded-checks-table th.ded-desk-lamp-col .ded-desk-lamp-col-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .ded-checks-table td.ded-desk-lamp-cell .ded-desk-lamp {
    padding: 3px;
    gap: 0;
  }
}

/* ── Dark mode ────────────────────────────────────────
   Surface/text tokens are already retokenized by 90-dark-mode.css; only the
   hardcoded severity tints need explicit handling here. */

[data-theme="dark"] .ded-desk-lamp {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink-soft, #b9b9b9);
}

[data-theme="dark"] .ded-desk-lamp__disc {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .ded-desk-lamp[data-color="red"] {
  background: rgba(255, 107, 107, 0.15);
  border-color: rgba(255, 107, 107, 0.34);
  color: #ff8f8f;
}

[data-theme="dark"] .ded-desk-lamp[data-color="yellow"] {
  background: rgba(230, 190, 100, 0.16);
  border-color: rgba(230, 190, 100, 0.34);
  color: #e8c46a;
}

[data-theme="dark"] .ded-desk-lamp[data-color="green"] {
  background: rgba(80, 200, 130, 0.14);
  border-color: rgba(80, 200, 130, 0.30);
  color: #63d195;
}

[data-theme="dark"] .ded-desk-lamp[data-reason="done"] {
  background: rgba(80, 200, 130, 0.08);
  border-color: rgba(80, 200, 130, 0.18);
}

/* Reduced motion / high contrast: the disc must never be the ONLY cue on
   the open check, which is why the label ships beside it there. */
@media (prefers-contrast: more) {
  .ded-desk-lamp {
    border-width: 2px;
  }
}
/* ── ded-combined-desk (2026-08-28) ─────────────────────────────────────
 *
 * Two pieces of chrome for one idea: the first file does not throw you into
 * the check.
 *
 *   1. .ded-started-strip   the receipt that stays on the intake page after
 *                           the first file creates a real check. It is NOT a
 *                           second upload card and carries no file slot of its
 *                           own, so it can never be mistaken for the retired
 *                           pair card.
 *   2. .ded-wb-lines-wrap   the investigation lines, primary for a non-KeHE
 *                           check and secondary (collapsed) on a KeHE check
 *                           whose 28-row closer is already built.
 *
 * Source file only. public/css/main.css is generated by scripts/build-css.sh
 * and any hand edit there is wiped by the next npm run build.
 */

/* ── 1. the started strip ───────────────────────────────────────────── */

.ded-started-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid var(--gold, #d4a843);
  border-left: 4px solid var(--gold, #d4a843);
  border-radius: 8px;
  background: #fffdf7;
}

.ded-started-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ded-started-check {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink, #1a1a1a);
}

/* Who this check is for, when we know. Absent, not guessed, when we do not. */
.ded-started-dist {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f3fe;
  color: #3b4a8c;
}

/* The next step, in plain words. Never a claim that the check is ready. */
.ded-started-next {
  flex: 1 1 260px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft, #555);
}

.ded-started-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

/* ── 2. investigation lines: primary vs secondary ───────────────────── */

/* Default (non-KeHE, or KeHE with no tab yet): no wrapper chrome at all, so
 * the grid looks exactly as it did before this slice. */
.ded-wb-lines-wrap {
  display: block;
}

.ded-wb-lines-summary {
  cursor: pointer;
  list-style: none;
  margin-top: 18px;
  padding: 9px 14px;
  border: 1px solid var(--rule, #e3e3e3);
  border-radius: 8px;
  background: var(--paper-2, #fafafa);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft, #555);
  user-select: none;
}

.ded-wb-lines-summary::-webkit-details-marker { display: none; }

.ded-wb-lines-summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.15s ease;
}

.ded-wb-lines-wrap[open] > .ded-wb-lines-summary::before {
  transform: rotate(90deg);
}

.ded-wb-lines-summary:hover {
  border-color: var(--gold, #d4a843);
  color: var(--ink, #1a1a1a);
}

/* Secondary mode: the closer above is the work, these are supporting detail. */
.ded-wb-lines-wrap.ded-wb-lines-secondary[open] > #ded-wb-grid {
  border-top: 1px solid var(--rule, #e3e3e3);
  padding-top: 4px;
}

@media (max-width: 720px) {
  .ded-started-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .ded-started-actions {
    margin-left: 0;
    width: 100%;
  }

  .ded-started-actions .btn {
    flex: 1 1 auto;
  }
}
/* kehe-export-lock-1027: KeHE tab export status, diff confirm and foot override.
   Own file so the byte-pinned deductions tab styles stay untouched. */
.ded-tabx {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--border, #dadce0);
  border-radius: 8px;
  background: var(--surface-2, #f8f9fa);
  font-size: 13px;
}
.ded-tabx-line { margin: 2px 0; }
.ded-tabx-exported { font-weight: 600; }
.ded-tabx-changed { color: #b06000; font-weight: 600; }
.ded-tabx-same { color: var(--text-mute, #5f6368); }
.ded-tabx-override { color: #b06000; }
.ded-tabx-block {
  margin: 6px 0;
  padding: 6px 8px;
  border-left: 3px solid #c5221f;
  background: rgba(197, 34, 31, 0.06);
  color: #a50e0e;
}
.ded-tabx-open { margin-top: 6px; }
.ded-tabx-sub { color: var(--text-mute, #5f6368); font-size: 12px; }
.ded-tabx-list { margin: 4px 0 0 18px; padding: 0; }
.ded-tabx-list li { margin: 1px 0; }
.ded-tabx-diff { max-height: 50vh; overflow: auto; }
[data-theme="dark"] .ded-tabx { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .ded-tabx-block { color: #f28b82; background: rgba(242, 139, 130, 0.08); }
[data-theme="dark"] .ded-tabx-changed,
[data-theme="dark"] .ded-tabx-override { color: #fdd663; }
/* ============================================================
   69-deductions-onescreen.css
   ded-onescreen-1111: one-screen check view on the Deductions workbench.
   The lines sit in one table, a row opens in place (the Edit line window
   mounted under the row), filter chips, flagged-first, search, broker sums.

   Scoping contract: every selector starts with .ded-os (or targets the
   Edit line body only inside .ded-os-drawer), so nothing leaks.
   Kill switch off (localStorage aiop.deductions.oneScreen = off): none of
   these classes are rendered.
   ============================================================ */

.ded-os-host { margin-top: 14px; }

/* ── Toolbar: chips, flagged first, search, Download tab ── */
.ded-os-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0 8px; }
.ded-os-filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ded-os-chip {
  font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--rule, #E5D9C4); background: var(--warm-white, #FFFDF8);
  color: var(--ink-soft, #555); cursor: pointer; min-height: 32px;
}
.ded-os-chip b { margin-left: 4px; font-variant-numeric: tabular-nums; }
.ded-os-chip.is-on { background: var(--ink-strong, #1A1410); color: #fff; border-color: var(--ink-strong, #1A1410); }
.ded-os-chip:focus-visible { outline: 2px solid var(--heritage-gold, #D4A843); outline-offset: 2px; }
.ded-os-toggle { font-size: 13px; color: var(--ink-soft, #555); display: inline-flex; gap: 6px; align-items: center; margin-left: 6px; cursor: pointer; }
.ded-os-search { width: 280px; margin-left: auto; padding: 6px 10px; font-size: 13px; }
.ded-os-download-slot:empty { display: none; }

/* ── The table ── */
.ded-os-gridwrap { border: 1px solid var(--rule, #E5D9C4); border-radius: 10px; overflow: auto; background: var(--surface, #fff); }
.ded-os-grid { width: 100%; border-collapse: collapse; }
.ded-os-grid thead th { position: sticky; top: 0; z-index: 1; }
.ded-os-grid td { vertical-align: top; }
.ded-os-row.is-openable { cursor: pointer; }
.ded-os-row.is-openable:hover td { background: #fffaf0; }
.ded-os-row:focus-visible { outline: 2px solid var(--heritage-gold, #D4A843); outline-offset: -2px; }
.ded-os-row.is-flagged td,
.ded-os-flagrow.is-flagged td { background: #fffbf2; }
.ded-os-row.is-open td { background: #fff5e0; border-bottom-color: transparent; }
.ded-os-mark { width: 14px; padding-right: 0 !important; }
.ded-os-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warning, #C68A1F); }
.ded-os-reason { max-width: 340px; white-space: normal; }
.ded-os-lines-pill { margin-left: 4px; }
.ded-os-gl-label { font-size: 11px; color: var(--ink-mute, #888); font-family: var(--font-sans, inherit); }
.ded-os-gl-edit { cursor: pointer; }
.ded-os-po-add { color: var(--warning, #C68A1F); font-weight: 600; }
.ded-os-chev { color: var(--ink-mute, #888); width: 16px; }
.ded-os-hasnote { width: 18px; }
.ded-os-empty td { padding: 14px; text-align: center; }

/* Line under a row: flag chips + the latest change and its note */
.ded-os-flagrow td { padding-top: 0 !important; border-top: 0 !important; }
.ded-os-flags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 0 6px; white-space: normal; }
.ded-os-flag-new { background: rgba(204, 0, 0, .08); border-color: rgba(204, 0, 0, .25); color: var(--heritage-red-dark, #8B0000); }
.ded-os-note { font-size: 12px; color: var(--ink-soft, #555); background: rgba(0, 0, 0, .035); border-radius: 6px; padding: 2px 8px; }

/* ── Drawer (the Edit line window, mounted under the row) ── */
.ded-os-drawer-row > td { padding: 0 !important; background: #fff5e0; }
.ded-os-drawer {
  border-left: 4px solid var(--heritage-gold, #D4A843); background: var(--warm-white, #FFFDF8);
  margin: 0 8px 10px; padding: 12px 16px 10px; border-radius: 0 0 10px 10px;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, .08)); font-family: var(--font-sans, inherit);
  white-space: normal; cursor: default;
}
.ded-os-drawer-head { margin-bottom: 8px; }
.ded-os-h { display: block; font-weight: 700; font-size: 13px; margin-bottom: 8px; color: var(--ink-strong, #1A1410); }
.ded-os-linepick { display: flex; flex-wrap: wrap; gap: 6px; }
.ded-os-linebtn { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--rule, #E5D9C4); background: #fff; cursor: pointer; }
.ded-os-linebtn.is-on { background: var(--ink-strong, #1A1410); color: #fff; border-color: var(--ink-strong, #1A1410); }
.ded-os-linebtn.has-draft::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: #2F6FB3; vertical-align: middle; }

/* Unsaved drawer edit: a small chip on the row and in the drawer head */
.ded-os-draft-chip {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; white-space: nowrap;
  font-size: 11px; font-weight: 600; line-height: 18px; vertical-align: middle;
  background: #EAF2FB; color: #1F4E82; border: 1px solid #B9D0EA;
}
.ded-os-draft-chip[hidden] { display: none; }
.ded-os-drawer .ded-os-body { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.ded-os-drawer .ded-os-body[data-os-cols="1"] { grid-template-columns: minmax(0, 1fr); }
.ded-os-drawer .ded-os-body[data-os-cols="2"] { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.ded-os-col { min-width: 0; }
.ded-os-col-edit .form-grid { grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.ded-os-col-edit .form-input { width: 100%; }
/* The Invoice and PO invoice explanations stay in the Edit line window and
   the column tips; in the drawer they would push the fields off screen. */
.ded-os-col-edit .form-grid > .form-field:nth-child(-n+2) > div.text-mute { display: none; }
.ded-os-col-edit .ded-suggestion-cards { max-height: 260px; overflow: auto; }
.ded-os-lsplit { margin-top: 12px; font-size: 13px; }
.ded-os-lsplit summary { cursor: pointer; color: var(--ink-soft, #555); }
.ded-os-lsplit .ded-lcode-table { margin-top: 6px; }
.ded-os-why { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.ded-os-why .di-flag-chip { white-space: normal; }
.ded-os-fine { font-size: 11px; color: var(--ink-mute, #888); margin-top: 8px; }
.ded-os-comment { width: 100%; resize: vertical; font-size: 13px; }
.ded-os-timeline { margin: 0 0 6px; padding-left: 16px; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.ded-os-note-text { color: var(--ink-soft, #555); }
.ded-os-drawer-foot { border-top: 1px solid var(--rule-soft, #EFE5D2); padding-top: 10px; margin-top: 12px; }

/* ── Footer: broker sums and the total ── */
.ded-os-grid tfoot td { font-weight: 600; background: var(--paper, #FBF6EC); }
.ded-os-brokersum td { color: var(--ink-soft, #555); font-weight: 500 !important; }
.ded-os-total td { border-top: 2px solid var(--rule, #E5D9C4); font-weight: 700 !important; }
.ded-os-totals { margin-top: 12px; }

/* The panels folded under one line, so the rows stay the page */
.ded-os-more { margin-top: 12px; font-size: 13px; color: var(--ink-soft, #555); }
.ded-os-more > summary { cursor: pointer; padding: 6px 0; }

/* ── Tablet: no sideways scroll; DC and Invoice fold away, drawer stacks ── */
@media (max-width: 1100px) {
  .ded-os-search { width: 100%; margin-left: 0; }
  .ded-os-grid .ded-os-c-dc, .ded-os-grid .ded-os-c-inv { display: none; }
  .ded-os-grid td, .ded-os-grid th { white-space: normal; }
  .ded-os-reason { max-width: 220px; }
  .ded-os-drawer { margin: 0 4px 10px; padding: 12px; }
  .ded-os-drawer .ded-os-body,
  .ded-os-drawer .ded-os-body[data-os-cols="2"] { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .ded-os-col-edit .form-grid { grid-template-columns: 1fr; }
}

/* ── Dark mode ── */
[data-theme="dark"] .ded-os-row.is-flagged td,
[data-theme="dark"] .ded-os-flagrow.is-flagged td { background: rgba(198, 138, 31, .10); }
[data-theme="dark"] .ded-os-row.is-open td,
[data-theme="dark"] .ded-os-drawer-row > td { background: rgba(212, 168, 67, .12); }
[data-theme="dark"] .ded-os-row.is-openable:hover td { background: rgba(212, 168, 67, .08); }
[data-theme="dark"] .ded-os-chip { background: transparent; }
[data-theme="dark"] .ded-os-linebtn { background: transparent; color: inherit; }
[data-theme="dark"] .ded-os-draft-chip { background: rgba(80, 140, 210, .18); color: #CFE2F7; border-color: rgba(120, 170, 225, .45); }
[data-theme="dark"] .ded-os-chip.is-on,
[data-theme="dark"] .ded-os-linebtn.is-on { background: var(--heritage-gold, #D4A843); color: #1A1410; border-color: var(--heritage-gold, #D4A843); }
/* ============================================================
   69 - Weekly Planning Engine (Patrick, 2026-08-28)
   Cook left, fill right. The shape the planner already reads on paper.
   Tokens only; no hard-coded brand hex. Dark mode inherits from 90-dark-mode.
   ============================================================ */

/* Visual-audit F1 (2026-08-29): scoped token bridge, same class as
   58-heads-cockpit.css:20-33. Light mode does not define --surface,
   --border, --text-muted, --space-2/3/4, or --surface-2. Without this
   bridge a checked demand row is pixel-identical to an unchecked one
   and an archived week is pixel-identical to a draft. Scoped so nothing
   outside this desk changes. */
.wp-intake,
.wp-library-card,
.wp-emit,
.wp-weeks-card,
.wp-desk-head,
.wp-horizon,
.wp-cook,
.wp-fill,
.wp-holes,
.wp-grid {
  --surface: var(--warm-white, #FFFDF8);
  --surface-2: var(--eggshell-bright, #FFF5E6);
  --border: var(--rule, #E5D9C4);
  --text: var(--ink, #2C2520);
  --text-muted: var(--ink-mute, #6B6560);
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --radius-pill: 999px;
}

[data-theme="dark"] .wp-intake,
[data-theme="dark"] .wp-library-card,
[data-theme="dark"] .wp-emit,
[data-theme="dark"] .wp-weeks-card,
[data-theme="dark"] .wp-desk-head,
[data-theme="dark"] .wp-horizon,
[data-theme="dark"] .wp-cook,
[data-theme="dark"] .wp-fill,
[data-theme="dark"] .wp-holes,
[data-theme="dark"] .wp-grid {
  --surface: #1E2130;
  --surface-2: #252838;
  --border: #3B3F54;
  --text: #E8EAED;
  --text-muted: #9CA3AF;
}

.wp-library-head h3 { margin: 0; }
.wp-library-head .wp-sub { margin-bottom: var(--space-2); }

.wp-day-head td {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-2, var(--surface));
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.wp-week-more {
  margin: var(--space-2) 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.wp-sub {
  color: var(--text-muted);
  margin: 0 0 var(--space-3);
  font-size: 0.925rem;
}

/* ── Intake ───────────────────────────────────────────────── */

.wp-intake-grid {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: var(--space-3);
  align-items: end;
  margin-bottom: var(--space-3);
}

.wp-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
/* display:flex above beats the UA [hidden] rule, so a hidden field (the
   supply plan type picker while another file type is chosen) still showed. */
.wp-field[hidden] { display: none; }

.wp-field > span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.wp-field select,
.wp-field input[type="text"],
.wp-field input[type="file"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.wp-field select:disabled,
.wp-field input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Drops already collected on this visit. The visible proof that we stayed. */
.wp-drops {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0;
}

.wp-drop-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill, 999px);
  background: var(--surface-2, var(--surface));
  font-size: 0.85rem;
  max-width: 100%;
}

.wp-drop-file {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 22ch;
}

.wp-stay-note {
  margin: 0 0 var(--space-3);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.wp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.wp-reason {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Honest not-wired state ───────────────────────────────── */
/* Deliberately calm, not alarming: an unwired lane is an expected build
   state, not an incident. It must never look like a failed week. */

.wp-notwired {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin: 0 0 var(--space-3);
  background: var(--surface-2, transparent);
}

.wp-notwired strong { display: block; margin-bottom: 4px; }
.wp-notwired p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

/* Unreadable demand file: stays on screen until the next upload attempt. */
.wp-upload-error {
  border: 1px solid var(--danger, #c0392b);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin: var(--space-3) 0 0;
  background: var(--surface-2, transparent);
}

.wp-upload-error strong { display: block; margin-bottom: 4px; }
.wp-upload-error p { margin: 0 0 6px; font-size: 0.9rem; overflow-wrap: anywhere; }
.wp-upload-error p:last-child { margin-bottom: 0; }
.wp-upload-error-file,
.wp-upload-error-hint { color: var(--text-muted); }

/* Upload succeeded, but read from another tab / a lower header row. */
.wp-upload-notice {
  border: 1px solid var(--warning, #b7791f);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin: var(--space-3) 0 0;
  background: var(--surface-2, transparent);
}

.wp-upload-notice strong { display: block; margin-bottom: 4px; }
.wp-upload-notice p,
.wp-upload-notice li { font-size: 0.9rem; overflow-wrap: anywhere; }
.wp-upload-notice p { margin: 0 0 6px; }
.wp-upload-notice p:last-child { margin-bottom: 0; }
.wp-upload-notice-list { margin: 0 0 6px; padding-left: 1.2em; }
.wp-upload-notice-file,
.wp-upload-notice-hint { color: var(--text-muted); }

/* Badge and reason line text use the darker gold, not --warning: #C68A1F is
   about 2.8:1 on the cream rows, under WCAG AA 4.5:1 for small text.
   --heritage-gold-dark is 5.0:1 on --surface and 4.7:1 on the checked row;
   in dark mode --heritage-gold is 7.2:1 / 6.6:1. */
.badge-wp-notice {
  border-color: var(--warning, #b7791f);
  color: var(--heritage-gold-dark, #8B6914);
  font-weight: 600;
}

.wp-drop-notice {
  display: block;
  font-size: 0.8rem;
  color: var(--heritage-gold-dark, #8B6914);
  overflow-wrap: anywhere;
}

[data-theme="dark"] .badge-wp-notice { color: var(--heritage-gold, #D4A843); }
[data-theme="dark"] .wp-drop-notice { color: var(--heritage-gold, #D4A843); }

/* Same file uploaded twice (409): informational, not an error in the file. */
.wp-upload-duplicate {
  border: 1px solid var(--info, #2b6cb0);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin: var(--space-3) 0 0;
  background: var(--surface-2, transparent);
}

.wp-upload-duplicate strong { display: block; margin-bottom: 4px; }
.wp-upload-duplicate p { margin: 0 0 6px; font-size: 0.9rem; overflow-wrap: anywhere; }
.wp-upload-duplicate p:last-child { margin-bottom: 0; }
.wp-upload-duplicate-file,
.wp-upload-duplicate-hint { color: var(--text-muted); }

/* The library row the duplicate matched. Outline, so it never reads as
   "checked" (which is what Generate consumes). */
.wp-drop-row.is-duplicate {
  outline: 2px dashed var(--info, #2b6cb0);
  outline-offset: 2px;
}

.badge-wp-duplicate {
  border-color: var(--info, #2b6cb0);
  color: var(--info, #2b6cb0);
  font-weight: 600;
}

/* Dark mode for the duplicate notice. --info (heritage purple #5B2C8A) is
   only 1.65:1 on the dark surface. Lift the same brand purple toward the
   dark-mode text colour: #A995C0 is 5.89:1 on --surface #1E2130 and 5.38:1
   on --surface-2 #252838 (a checked row), so the badge text clears AA 4.5:1
   and the outline and border clear 3:1. Light mode is unchanged. */
[data-theme="dark"] .wp-upload-duplicate,
[data-theme="dark"] .wp-drop-row.is-duplicate,
[data-theme="dark"] .badge-wp-duplicate {
  --wp-duplicate-accent: color-mix(in srgb, var(--heritage-purple, #5B2C8A) 45%, #E8EAED);
}
[data-theme="dark"] .wp-upload-duplicate { border-color: var(--wp-duplicate-accent); }
[data-theme="dark"] .wp-drop-row.is-duplicate { outline-color: var(--wp-duplicate-accent); }
[data-theme="dark"] .badge-wp-duplicate {
  border-color: var(--wp-duplicate-accent);
  color: var(--wp-duplicate-accent);
}

/* ── Desk ─────────────────────────────────────────────────── */

.wp-desk-head { margin-bottom: var(--space-3); }

.wp-desk-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.wp-desk-title h3 { margin: 0; }

.wp-blocked {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-left: 3px solid var(--danger, #cc0000);
  border-radius: var(--radius-sm);
  background: var(--surface-2, transparent);
}

.wp-blocked strong { display: block; margin-bottom: 6px; }

.wp-reasons {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.wp-reasons li { margin: 2px 0; }

/* Cook left, fill right. */
.wp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}

.wp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.wp-table th,
.wp-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.wp-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
}

.wp-table tbody tr:last-child td { border-bottom: none; }

.wp-table .wp-num { text-align: right; font-variant-numeric: tabular-nums; }

.wp-empty-cell {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: var(--space-3);
}

.wp-holes { margin-top: var(--space-3); }

/* Horizon strip: every emitted week is a tab, not just week 1. */
.wp-horizon { margin-bottom: var(--space-3); }
.wp-horizon-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.wp-horizon-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.wp-horizon-tab.is-active {
  border-color: var(--text);
  font-weight: 600;
}
.wp-horizon-n { font-size: 0.8rem; }
.wp-horizon-iso { font-size: 0.85rem; color: var(--text-muted); }

/* ── Demand library ──────────────────────────────────────── */
/* A checklist, not a pile. The three books are three visually separate
   groups on purpose: rendering them as one list is the first step toward
   adding them together, which this module must never do. */

.wp-library {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.wp-kind-group { min-width: 0; }

.wp-kind-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.wp-kind-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wp-kind-empty {
  margin: 0;
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.wp-drop-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  min-width: 0;
}

.wp-drop-row:hover { border-color: var(--text-muted); }

/* A checked book is one Generate will actually read. Make that unmistakable,
   because the gap between what is on screen and what the engine consumed is
   exactly where a planner loses trust. */
.wp-drop-row.is-checked {
  border-color: var(--heritage-red, #CC0000);
  background: var(--surface-2, #FFF5E6);
  box-shadow: inset 3px 0 0 var(--heritage-red, #CC0000);
}

.wp-drop-check {
  flex: 0 0 auto;
  margin: 0;
}

.wp-drop-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.wp-drop-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.badge-newest {
  background: var(--heritage-red, #CC0000);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

.wp-selected-note {
  margin: var(--space-2) 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Week library ────────────────────────────────────────── */
/* The durable shelf. Archived actuals are listed and openable; they are
   dimmed so a planner can tell at a glance which rows are records of weeks
   that already ran, and which are weeks still open to decide. */

.wp-week-filters { margin-bottom: var(--space-3); }

.wp-week-table { width: 100%; }

.wp-week-row.is-archived td { color: var(--ink-mute, #6B6560); font-style: italic; }

.wp-week-row.is-archived .badge { opacity: 0.85; }

/* An archived week is openable and never publishable. This note replaces a
   dead grey button with the reason it is not available. */
.wp-archived-note {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2, var(--surface));
}

.wp-archived-note strong { display: block; margin-bottom: 4px; }

.wp-archived-note p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Week insights ────────────────────────────────────────── */
/* The desk used to show only `holes`, which the constraint engine writes onto
   an emitted draft. An archived actual has none, so an opened history week was
   a grid and nothing else while the board still carried the week's texture.
   This card states what the board already holds. It is deliberately quiet:
   nothing here is a verdict, so nothing here is alarm-coloured. */

.wp-insights {
  --surface: var(--warm-white, #FFFDF8);
  --surface-2: var(--eggshell-bright, #FFF5E6);
  --border: var(--rule, #E5D9C4);
  --text: var(--ink, #2C2520);
  --text-muted: var(--ink-mute, #6B6560);
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  margin-top: var(--space-4);
}
[data-theme="dark"] .wp-insights {
  --surface: #1E2130;
  --surface-2: #252838;
  --border: #3B3F54;
  --text: #E8EAED;
  --text-muted: #9CA3AF;
}

.wp-insight-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-3) 0 0;
}

.wp-insight-stat {
  flex: 1 1 120px;
  min-width: 0;
  padding: var(--space-3);
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--border);
  border-radius: 8px;
}

.wp-insight-n {
  display: block;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.wp-insight-label {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wp-insight-block { margin-top: var(--space-4); }
.wp-insight-block h4 {
  margin: 0 0 var(--space-2);
  font-size: 0.9rem;
  color: var(--text);
}

.wp-insight-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}
.wp-insight-list li { margin-bottom: 4px; }

/* Carry-in is the one line that changes what the planner does first, so it
   gets the heritage rule the checked demand rows already use. */
.wp-insight-carry {
  padding: var(--space-3);
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--border);
  border-left: 3px solid var(--heritage-red, #CC0000);
  border-radius: 6px;
}
.wp-insight-carry h4 { margin-bottom: 4px; }
.wp-insight-carry p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Mobile ───────────────────────────────────────────────── */
/* The planner reviews on a laptop, but the week must still be readable when
   he opens it on a phone from the plant floor. Stack, never scroll sideways. */

@media (max-width: 900px) {
  .wp-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .wp-intake-grid { grid-template-columns: minmax(0, 1fr); }
  .wp-desk-title { align-items: flex-start; }
  .wp-actions { width: 100%; }
  .wp-actions .btn { flex: 1 1 auto; }
  .wp-table { font-size: 0.8rem; }
  .wp-table th, .wp-table td { padding: 6px 5px; }
  .wp-drop-file { max-width: 14ch; }
  .wp-horizon-tabs { width: 100%; }
  .wp-horizon-tab { flex: 1 1 calc(50% - var(--space-2)); }

  /* The shelf must stay readable on a phone from the plant floor. The week
     table scrolls inside its own box rather than pushing the page sideways. */
  .wp-week-table { display: block; overflow-x: auto; }
  .wp-drop-row { align-items: flex-start; }
  .wp-drop-main { max-width: 100%; }

  .wp-insight-stat { flex: 1 1 calc(50% - var(--space-3)); }
}

/* ══ Discard a drafted week ═══════════════════════════════════════════════
   Kevin: "Is there a way to delete drafted weeks?"

   The destructive control is styled LOCALLY rather than through a generic
   .btn-danger, because the platform only defines .btn-danger as a .btn-link
   modifier (04-components.css): a bare `btn btn-danger` renders as an ordinary
   secondary button, and the one control on this page that removes data would
   be the least visually distinct thing on it. 44-redemption.css solved the
   same problem the same way.

   It is deliberately NOT loud. Discard is a routine tidy-up of a draft the
   engine produced, not an alarm, and a red button shouting next to Publish
   would make the safe action look like the dangerous one. Outline only, with
   the weight arriving on hover once the pointer is committed. */
#wp-discard,
.wp-week-discard {
  color: var(--danger, #c0392b);
  border-color: color-mix(in srgb, var(--danger, #c0392b) 35%, transparent);
}
#wp-discard:hover:not(:disabled),
.wp-week-discard:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger, #c0392b) 8%, transparent);
  border-color: var(--danger, #c0392b);
}
#wp-discard:focus-visible,
.wp-week-discard:focus-visible {
  outline: 2px solid var(--danger, #c0392b);
  outline-offset: 2px;
}

/* Open and Discard sit together on a shelf row. They stay on one line on a
   desktop and wrap rather than overflow the cell on a narrow screen. */
.wp-week-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Planner ratings (2026-10-08 Plant C call). One tap per line per day, like
   ticking a paper plan. The pressed verdict is filled; the rest stay outline. */
.wp-rate-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.wp-rate-btn.is-on { background: var(--accent, #2b6cb0); color: #fff; border-color: transparent; }
.wp-rate-btn[data-verdict="too_high"].is-on { background: var(--warning, #b7791f); }
.wp-rate-btn[data-verdict="too_low"].is-on { background: var(--info, #2c7a7b); }
.wp-rate-note { width: 100%; min-width: 140px; }
.wp-inputs textarea { width: 100%; font-family: inherit; }

/* Fill types (2026-10-20, Plants A/B). Cold / Hot / Repack / Unknown tag on a
   fill row, keyed by material number. Unknown is deliberately the loudest of
   the four (dashed outline): it is the one a planner has to act on. */
.wp-fill-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid transparent;
}
.wp-fill-tag--cold { background: color-mix(in srgb, var(--info, #2c7a7b) 14%, transparent); color: var(--info, #2c7a7b); }
.wp-fill-tag--hot { background: color-mix(in srgb, var(--danger, #c0392b) 12%, transparent); color: var(--danger, #c0392b); }
.wp-fill-tag--repack { background: color-mix(in srgb, var(--text-muted, #666) 14%, transparent); color: var(--text-muted, #555); }
.wp-fill-tag--unknown { background: transparent; color: var(--warning, #b7791f); border: 1px dashed var(--warning, #b7791f); }
.wp-fill-upload { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.wp-fill-preview { margin-top: 8px; }
.wp-fill-search { width: 100%; max-width: 360px; margin-bottom: 8px; }
.wp-fill-scroll { overflow-x: auto; }
.wp-fill-table select { min-width: 9ch; }

/* ── Lines card (2026-10-27, Ebru's RCCP answers) ───────────
   This week's use per line, repack tallied apart, a planner note per line.
   A line marked "over 100% reviewed, not a gap" reads amber (noted), never
   red. Repack reuses the neutral repack tone of the fill tag. */
.wp-lines-table td { vertical-align: top; }
.wp-line-kind { font-size: 0.75em; color: var(--text-muted); }
.wp-line-note { overflow-wrap: anywhere; }
.wp-line-note-text { display: inline; }
.wp-line-note-by { display: block; font-size: 0.75rem; color: var(--text-muted); }
.wp-line-row.is-reviewed td:first-child { box-shadow: inset 3px 0 0 var(--warning, #b7791f); }
.badge-wp-reviewed {
  border-color: var(--warning, #b7791f);
  color: var(--heritage-gold-dark, #8B6914);
  font-weight: 600;
  margin-right: 6px;
  white-space: normal;
}
[data-theme="dark"] .badge-wp-reviewed { color: var(--heritage-gold, #D4A843); }
.wp-line-repack {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.8em;
  font-weight: 600;
  background: color-mix(in srgb, var(--text-muted, #666) 14%, transparent);
  color: var(--text-muted, #555);
}
.wp-line-repack-noplant { margin-top: var(--space-2); }
.wp-line-note-form {
  margin-top: var(--space-3);
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: var(--space-2) var(--space-3);
  align-items: end;
}
.wp-line-note-form h4,
.wp-line-note-form .wp-line-note-check,
.wp-line-note-form .wp-actions { grid-column: 1 / -1; margin: 0; }
.wp-line-note-check > span { display: flex; align-items: center; gap: 6px; }
@media (max-width: 600px) {
  .wp-line-note-form { grid-template-columns: minmax(0, 1fr); }
}
.wp-requirement-label {
  margin: 0 0 var(--space-2);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--heritage-gold-dark, #8B6914);
}
[data-theme="dark"] .wp-requirement-label { color: var(--heritage-gold, #D4A843); }

/* ── Supply plan kind (2026-10-27) ───────────────────────────
   Constrained / unconstrained on every supply plan, the "in use" line and
   the warning when the newest plan is a different kind from the one before.
   Text colours reuse the AA-checked tokens above: --heritage-gold-dark for
   the warning tone, --text-muted for meta. */
.wp-plan-kind-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.badge-wp-plan { font-weight: 600; }
.badge-wp-plan-constrained {
  border-color: var(--success, #2D8C3C);
  color: var(--success-deep, #1F6B2B);
}
/* --success-deep is dark on the dark surface; lift it toward the text colour. */
[data-theme="dark"] .badge-wp-plan-constrained {
  color: color-mix(in srgb, var(--success, #2D8C3C) 55%, #E8EAED);
}
.badge-wp-plan-unconstrained,
.badge-wp-plan-unknown {
  border-color: var(--warning, #b7791f);
  color: var(--heritage-gold-dark, #8B6914);
}
[data-theme="dark"] .badge-wp-plan-unconstrained,
[data-theme="dark"] .badge-wp-plan-unknown { color: var(--heritage-gold, #D4A843); }

.wp-plan-in-use { margin: var(--space-3) 0 0; }
.wp-plan-in-use-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.wp-plan-in-use-label { font-weight: 600; }
.wp-plan-in-use-meta,
.wp-plan-none { color: var(--text-muted); }
.wp-plan-unknown-note {
  flex-basis: 100%;
  font-size: 0.8rem;
  color: var(--heritage-gold-dark, #8B6914);
}
[data-theme="dark"] .wp-plan-unknown-note { color: var(--heritage-gold, #D4A843); }

.wp-plan-changed {
  border: 1px solid var(--warning, #b7791f);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin: var(--space-2) 0 0;
  background: var(--surface-2, transparent);
}
.wp-plan-changed strong { display: block; margin-bottom: 4px; }
.wp-plan-changed p { margin: 0; font-size: 0.9rem; overflow-wrap: anywhere; }

/* ── Change a supply plan's type (2026-10-27) ────────────────
   A small control beside a supply plan row (never inside its <label>, so a
   click does not tick the checkbox) and on the "Supply plan in use" line.
   On a phone the control drops under the row instead of squeezing it. */
.wp-drop-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.wp-drop-item > .wp-drop-row { flex: 1 1 auto; }
.wp-drop-item.is-editing {
  flex-direction: column;
  align-items: stretch;
}
.wp-plan-relabel-slot { flex: 0 0 auto; }
.wp-plan-relabel-open { white-space: nowrap; }
.wp-plan-in-use-line .wp-plan-relabel-open { margin-left: auto; }

.wp-plan-relabel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2, transparent);
  min-width: 0;
}
.wp-plan-relabel-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  min-width: 0;
  flex: 1 1 14rem;
}
.wp-plan-relabel-field select { max-width: 100%; }
.wp-plan-relabel-confirm {
  margin: 0;
  flex: 1 1 100%;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.wp-plan-relabel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.wp-upload-duplicate-kind {
  margin: 4px 0 0;
  font-weight: 600;
}

@media (max-width: 640px) {
  .wp-drop-item { flex-direction: column; align-items: stretch; }
  .wp-plan-relabel-slot { align-self: flex-end; }
  .wp-plan-relabel-field { flex-basis: 100%; }
}

/* Fill row that comes only from the intercompany order book (2026-11-03). */
.wp-row-reason {
  display: inline-block;
  margin-left: var(--space-1, 4px);
  padding: 1px var(--space-2, 8px);
  border-radius: var(--radius-sm, 6px);
  font-size: 11px;
  line-height: 16px;
  color: var(--text-muted);
  background: var(--surface-2, #f3f4f6);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* Plant calendar on the Generate card (2026-11-03). Optional and quiet. */
.wp-calendar {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.wp-calendar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
}
.wp-calendar-head .wp-sub { margin: 0; }
.wp-calendar-empty {
  margin: var(--space-2) 0 0;
  color: var(--text-muted);
  font-size: 13px;
}
.wp-calendar-weeks {
  list-style: none;
  margin: var(--space-2) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}
.wp-calendar-week {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.wp-calendar-week-label {
  min-width: 72px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.wp-cal-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
  background: var(--surface-2, #f3f4f6);
  font-size: 13px;
}
.wp-cal-chip--closed { border-color: var(--danger); }
.wp-cal-chip--half_day { border-color: var(--warning); }
.wp-cal-chip--wet_cleaning { border-color: var(--info); }
/* 2026-11-24: a mark read from the plant's schedule upload. */
.wp-cal-source {
  font-size: 11px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 0 4px;
}
.wp-cal-remove {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.wp-cal-remove:hover { color: var(--danger); }
.wp-calendar-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.wp-calendar-add .wp-field { min-width: 150px; }
.wp-planned-calendar { margin: var(--space-2) 0 0; }
@media (max-width: 640px) {
  .wp-calendar-add { flex-direction: column; align-items: stretch; }
  .wp-calendar-week-label { min-width: 0; width: 100%; }
}
/* Admission: a local, CSS-built kitchen doorway. No DAM/network dependencies. */
body.admission-stage { background: #8B0000; }
body.admission-stage::before { display: none; }
.admission-doorway {
  --admission-cream: #FFF5E6;
  --admission-gold: #D4A843;
  --admission-depth: #8B0000;
  --admission-field: #CC0000;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  padding: max(28px, env(safe-area-inset-top)) max(6vw, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(6vw, env(safe-area-inset-left));
  background: var(--admission-field);
  color: var(--admission-cream);
  font-family: var(--font-sans);
}
.admission-doorway.is-denied { --admission-field: #5B2C8A; --admission-depth: #3D1A5C; }
.admission-doorway::before {
  content: ''; position: absolute; z-index: -1; inset: 0 0 0 50%;
  background: radial-gradient(ellipse at 55% 46%, #D4A84330, transparent 60%), linear-gradient(100deg, transparent, var(--admission-depth));
}
.admission-doorway::after {
  content: ''; position: absolute; z-index: -1; inset: 0; pointer-events: none; opacity: .14;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23FFF5E6' filter='url(%23n)' opacity='.5' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
}
.admission-doorway p { margin: 0; color: var(--admission-cream); }
.admission-doorway button { font: inherit; cursor: pointer; }
.admission-doorway button:focus-visible { outline: 3px solid var(--admission-cream); outline-offset: 5px; }
.admission-gateway { position: absolute; inset: 16px; pointer-events: none; border: 1px solid #D4A84355; }
.admission-gateway i { position: absolute; width: 32px; height: 32px; border-top: 3px solid var(--admission-gold); border-left: 3px solid var(--admission-gold); }
.admission-gateway i::after { content: ''; position: absolute; inset: 6px; border-top: 1px solid var(--admission-gold); border-left: 1px solid var(--admission-gold); }
.admission-gateway i:nth-child(1) { left: -1px; top: -1px; }
.admission-gateway i:nth-child(2) { right: -1px; top: -1px; transform: rotate(90deg); }
.admission-gateway i:nth-child(3) { right: -1px; bottom: -1px; transform: rotate(180deg); }
.admission-gateway i:nth-child(4) { left: -1px; bottom: -1px; transform: rotate(270deg); }
.admission-masthead { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.admission-brand { display: grid; place-items: center; padding: 20px 34px; background: var(--admission-cream); border-radius: 0 0 48% 48% / 0 0 20% 20%; box-shadow: 0 8px 24px #51000018; }
.admission-brand img { display: block; width: 112px; height: 80px; object-fit: contain; }
.admission-languages { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; border: 1px solid #D4A84399; border-radius: 30px; }
.admission-languages button { min-height: 44px; padding: 8px 16px; background: transparent; border: 0; border-radius: 24px; color: var(--admission-cream); font-size: 13px; }
.admission-languages button[aria-pressed='true'] { background: var(--admission-cream); color: var(--admission-depth); font-weight: 700; }
.admission-languages button:hover { box-shadow: inset 0 0 0 1px var(--admission-gold); }
.admission-composition { flex: 1; display: grid; grid-template-columns: 1.12fr 1fr; align-items: center; gap: 5vw; width: 100%; max-width: 1400px; margin: 32px auto; }
.admission-copy { max-width: 650px; padding: 16px 0; }
.admission-eyebrow { display: flex; align-items: center; gap: 14px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.admission-eyebrow span { color: var(--admission-gold); }
.admission-doorway .admission-status { display: flex; align-items: center; gap: 9px; margin-top: 35px; font-size: 13px; }
.admission-status > span { width: 7px; height: 7px; background: var(--admission-gold); border-radius: 50%; box-shadow: 0 0 0 4px #D4A84322; }
.admission-doorway h1 { margin: 16px 0 24px; max-width: 10ch; color: var(--admission-cream); font-family: 'ABC Arizona Flare', Georgia, serif; font-size: clamp(52px, 6.3vw, 96px); font-weight: 400; font-style: italic; line-height: 1.02; letter-spacing: -.045em; text-wrap: balance; }
.admission-doorway:lang(zh) h1 { font-family: var(--font-sans); font-style: normal; font-size: clamp(40px, 5vw, 68px); line-height: 1.22; letter-spacing: -.035em; max-width: 10em; }
.admission-invitation { max-width: 39ch; font-size: clamp(17px, 1.5vw, 20px); line-height: 1.6; }
.admission-account { display: flex; gap: 14px; align-items: flex-start; max-width: 460px; margin: 28px 0; padding-top: 22px; border-top: 1px solid #D4A84377; font-size: 13px; line-height: 1.55; }
.admission-account-mark { flex: 0 0 26px; display: grid; place-items: center; height: 26px; border: 1px solid var(--admission-gold); border-radius: 50%; font-size: 14px; }
.admission-doorway .admission-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; overflow-wrap: anywhere; }
.admission-name:empty { display: none; }
.admission-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 28px; }
.admission-check { position: relative; display: inline-flex; align-items: center; justify-content: space-between; gap: 40px; overflow: hidden; min-height: 54px; padding: 14px 23px; background: var(--admission-cream); color: var(--admission-depth); border: 1px solid var(--admission-gold); border-radius: 3px; box-shadow: 0 4px 0 #51000035; font-weight: 700 !important; transition: transform .18s ease, box-shadow .18s ease; }
.admission-check::after { content: ''; position: absolute; inset: -30%; transform: translateX(-110%) rotate(-20deg); background: linear-gradient(90deg, transparent, #D4A84366, transparent); transition: transform .55s ease; pointer-events: none; }
.admission-check:hover::after { transform: translateX(110%) rotate(-20deg); }
.admission-check:hover { box-shadow: 0 5px 26px #D4A84355; transform: translateY(-2px); }
.admission-check:active { transform: translateY(2px); box-shadow: none; }
.admission-signout { min-height: 48px; padding: 10px 0; border: 0; background: transparent; color: var(--admission-cream); text-decoration: underline; text-underline-offset: 5px; text-decoration-color: #D4A84399; }
.admission-signout:disabled { opacity: .65; cursor: wait; }
.admission-action-error:empty { display: none; }
.admission-doorway .admission-action-error { margin-top: 14px; }
.admission-scene { position: relative; display: grid; place-items: center; padding: 22px 18px 36px; }
.admission-halo { position: absolute; width: 110%; aspect-ratio: 1; border-radius: 50%; border: 1px solid #D4A84325; background: radial-gradient(circle, #D4A84315, transparent 67%); }
.admission-halo::before { content: ''; position: absolute; inset: 30px; border-radius: 50%; border: 1px solid #D4A84320; }
.admission-portal { position: relative; width: min(100%, 370px); height: clamp(400px, 42vw, 570px); padding: 13px 13px 0; border: 2px solid var(--admission-gold); border-bottom: 0; border-radius: 190px 190px 0 0; background: var(--admission-depth); box-shadow: 18px 25px 35px #30000033, inset 0 0 0 5px #D4A84328; transform: translate(var(--admission-x, 0px), var(--admission-y, 0px)); transition: transform .25s ease-out; }
.admission-door-panel { position: relative; height: 100%; overflow: hidden; border: 1px solid #D4A843AA; border-bottom: 0; border-radius: 180px 180px 0 0; background: linear-gradient(100deg, var(--admission-depth), var(--admission-field) 75%, var(--admission-depth)); box-shadow: inset 8px 0 25px #30000033; }
.admission-door-panel::before { content: ''; position: absolute; inset: 0 0 0 auto; width: 3px; background: var(--admission-cream); box-shadow: 0 0 20px 5px var(--admission-gold); opacity: .8; }
.is-denied .admission-door-panel::before { opacity: .12; box-shadow: none; }
.admission-door-number { margin: 48px auto 26px; text-align: center; color: var(--admission-cream); font-size: 13px; letter-spacing: .32em; }
.admission-porthole { position: relative; width: 52%; aspect-ratio: 1; margin: 0 auto; overflow: hidden; border: 6px solid var(--admission-gold); border-radius: 50%; background: radial-gradient(circle at 60% 30%, #D4A843AA, #8B0000 85%); box-shadow: 0 0 0 4px #30000055, 0 0 0 6px #D4A84377, inset 0 0 28px #300000AA; }
.admission-porthole::after { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, #FFF5E633, transparent 50%); }
.admission-wok { position: absolute; width: 72%; height: 26%; background: #560B09; border-radius: 10% 10% 50% 50% / 10% 10% 90% 90%; left: 14%; bottom: 12%; border-top: 3px solid var(--admission-gold); box-shadow: 0 10px 24px #D4A84399; }
.admission-wok::after { content: ''; position: absolute; width: 38%; height: 5px; background: #560B09; right: -28%; top: 3px; transform: rotate(-20deg); }
.admission-steam { position: absolute; inset: 8% 15% 35%; }
.admission-steam i { position: absolute; bottom: 0; left: 16%; width: 23%; height: 88%; border-left: 7px solid #FFF5E6AA; border-radius: 50%; filter: blur(4px); animation: admission-steam 6s ease-in-out infinite; }
.admission-steam i:nth-child(2) { left: 43%; animation-delay: -2s; height: 110%; }
.admission-steam i:nth-child(3) { left: 70%; animation-delay: -4s; }
.admission-door-plaque { position: relative; width: 76%; margin: 28px auto 0; padding: 13px 14px; text-align: center; border: 1px solid #D4A843AA; color: var(--admission-cream); background: var(--admission-depth); font-size: 13px; line-height: 1.5; box-shadow: 0 4px 10px #30000033; }
.admission-door-handle { position: absolute; right: 8%; bottom: 17%; width: 12px; height: 62px; border-radius: 8px; background: linear-gradient(90deg, #A07830, #FFF5E6, #D4A843); box-shadow: 5px 5px 7px #30000077; }
.admission-door-rule { position: absolute; bottom: 6%; left: 16%; right: 16%; width: auto; height: 12%; border: 1px solid #D4A84355; }
.admission-threshold { position: absolute; left: -8%; bottom: -6px; width: 116%; height: 6px; background: var(--admission-gold); box-shadow: 0 6px 32px #D4A843AA; }
.admission-doorway .admission-scene-caption { position: relative; margin-top: 30px; text-align: center; font-size: 13px; letter-spacing: .04em; }
.is-denied .admission-porthole { background: radial-gradient(circle at 40% 30%, #5B2C8A, #3D1A5C); }
.admission-still-light { position: absolute; inset: 20%; border: 1px solid #D4A84355; border-radius: 50%; }
.is-denied .admission-threshold { box-shadow: none; }
.admission-motes { position: absolute; inset: 0; pointer-events: none; }
.admission-motes i { position: absolute; left: 8%; top: 60%; width: 3px; height: 3px; border-radius: 50%; background: var(--admission-gold); animation: admission-mote 9s ease-in-out infinite; }
.admission-motes i:nth-child(2) { left: 90%; top: 37%; animation-delay: -2s; }
.admission-motes i:nth-child(3) { left: 80%; top: 75%; animation-delay: -4s; }
.admission-motes i:nth-child(4) { left: 21%; top: 20%; animation-delay: -6s; }
.admission-motes i:nth-child(5) { left: 95%; top: 18%; animation-delay: -8s; }
.admission-colophon { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 20px 0 4px; border-top: 1px solid #D4A84355; font-size: 12px; letter-spacing: .035em; }
.admission-quality { display: inline-flex; gap: 16px; }
.admission-quality > span { color: var(--admission-gold); }
@keyframes admission-steam { 0%, 100% { transform: translateY(5px) rotate(-5deg); opacity: .4; } 50% { transform: translateY(-12px) rotate(8deg); opacity: .8; } }
@keyframes admission-mote { 0%, 100% { transform: translateY(10px); opacity: .15; } 50% { transform: translateY(-22px); opacity: .8; } }
@media (min-width: 1500px) { .admission-masthead, .admission-colophon { width: 100%; max-width: 1400px; margin-inline: auto; } }
@media (max-width: 760px) {
  .admission-doorway { padding: max(24px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left)); }
  .admission-gateway { inset: 10px; }
  .admission-masthead { flex-direction: column; gap: 20px; }
  .admission-brand { padding: 15px 30px; }
  .admission-brand img { width: 100px; height: 64px; }
  .admission-languages { justify-content: center; }
  .admission-languages button { padding: 7px 10px; font-size: 12px; }
  .admission-composition { grid-template-columns: 1fr; gap: 24px; margin: 32px auto 12px; max-width: 540px; }
  .admission-copy { padding: 0; }
  .admission-doorway h1 { font-size: clamp(48px, 11vw, 74px); max-width: 12ch; }
  .admission-doorway:lang(zh) h1 { font-size: clamp(36px, 8vw, 54px); max-width: 10em; }
  .admission-doorway .admission-status { margin-top: 24px; }
  .admission-invitation { max-width: 42ch; }
  .admission-scene { padding-top: 8px; }
  .admission-portal { width: 255px; height: 395px; }
  .admission-door-number { margin-top: 36px; margin-bottom: 23px; }
  .admission-door-plaque { margin-top: 24px; font-size: 12px; }
  .admission-halo { width: 95%; }
  .admission-colophon { justify-content: center; text-align: center; }
}
@media (max-width: 360px) {
  .admission-doorway { padding-inline: max(22px, env(safe-area-inset-left)) max(22px, env(safe-area-inset-right)); }
  .admission-languages { gap: 0; padding: 3px; }
  .admission-languages button { padding-inline: 8px; }
  .admission-actions { gap: 12px; }
  .admission-check { gap: 24px; padding-inline: 18px; }
  .admission-quality { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .admission-doorway *, .admission-doorway *::before, .admission-doorway *::after { animation: none !important; transition: none !important; }
  .admission-portal { transform: none; }
  .admission-motes { display: none; }
  .admission-check:hover, .admission-check:active { transform: none; }
}
/* ── Filling Floor (operator tablet + supervisor desk) ─────────────────────
   Tokens only (no raw hex). Tablet targets: >= 56px tall, high contrast,
   state colour is always paired with a text label. */

/* The floor aliases are scoped in Cooking Floor and do not reach this module.
   Include body-mounted sheets/modals so they remain opaque and readable. */
.ff-tablet, .ff-login, .ff-sup, .ff-sheet, .ff-modal {
  --surface: var(--warm-white);
  --surface-2: var(--eggshell-bright);
  --border: var(--rule);
  --text: var(--ink);
  --muted: var(--ink-mute);
  --brand-red: var(--heritage-red);
  --brand-gold: var(--heritage-gold);
  color: var(--text);
}
[data-theme="dark"] :is(.ff-tablet, .ff-login, .ff-sup, .ff-sheet, .ff-modal) {
  --surface: var(--bg-secondary);
  --surface-2: var(--surface-alt);
  --border: var(--border-medium);
  --brand-red: var(--heritage-red-deep);
  --brand-gold: var(--heritage-gold-light);
}
.ff-tablet, .ff-login { max-width: 1100px; margin: 0 auto; padding: 16px; color: var(--text); }
.ff-eyebrow { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.ff-muted { color: var(--muted); }
.ff-warn { color: var(--danger); font-weight: 600; margin: 8px 0; }
.ff-tag { display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.ff-tag.is-ok { border-color: var(--success); color: var(--success); }
.ff-tag.is-off { border-color: var(--danger); color: var(--danger); }
.ff-net { font-weight: 600; color: var(--success); }
.ff-net.is-offline { color: var(--danger); }

/* Login */
.ff-login-head h1 { margin: 4px 0; font-size: 1.6rem; }
.ff-login-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-top: 16px; }
.ff-roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; align-content: start; }
.ff-roster-sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 12px; }
.ff-name { min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 1.05rem; text-align: left; cursor: pointer; }
.ff-name.is-picked { border-color: var(--brand-red); box-shadow: 0 0 0 2px var(--brand-red) inset; }
.ff-ini { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); font-weight: 700; flex: none; }
.ff-pin { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.ff-pin input, .ff-sheet input, .ff-sheet textarea { font-size: 1.4rem; min-height: 56px; padding: 8px 12px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); width: 100%; box-sizing: border-box; }
.ff-login-err { color: var(--danger); min-height: 1.4em; margin: 0; font-weight: 600; }

/* Header */
.ff-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.ff-machine { margin: 2px 0; font-size: 1.7rem; }
.ff-machine small { font-size: 0.95rem; font-weight: 400; }
.ff-who { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.ff-actions-sm { display: flex; gap: 8px; }
.ff-actions-sm .btn { min-height: 44px; }

/* Order + releases */
.ff-order { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ff-order-main { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 1.1rem; }
.ff-order-desc { font-weight: 600; }
.ff-releases { display: flex; gap: 6px; flex-wrap: wrap; }
.ff-rel { font-size: 0.85rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.ff-rel.is-confirmed, .ff-rel.is-na, .ff-rel.is-upstream { border-color: var(--success); }
.ff-rel.is-pending { border-color: var(--warning); }
.ff-rel.is-revoked, .ff-rel.is-hold, .ff-rel.is-na_not_allowed { border-color: var(--danger); color: var(--danger); font-weight: 700; }

/* State */
.ff-state { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.ff-state-badge { font-size: 1.3rem; font-weight: 800; padding: 10px 18px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); }
.ff-state-badge.is-filling { border-color: var(--success); color: var(--success); }
.ff-state-badge.is-stopped { border-color: var(--danger); color: var(--danger); }
.ff-state-badge.is-finished { border-color: var(--muted); color: var(--muted); }
.ff-state-badge.is-idle { border-color: var(--border); color: var(--muted); }
.ff-state-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 1.05rem; }
.ff-blockers { margin: 6px 0; padding-left: 20px; color: var(--danger); font-weight: 600; }

/* Buttons */
.ff-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
.ff-buttons .pf-bigbtn { min-height: 84px; font-size: 1.25rem; font-weight: 700; border-radius: 14px; border: 2px solid var(--muted); background: var(--surface); color: var(--text); }
.ff-buttons .ff-xl { grid-column: 1 / -1; min-height: 110px; font-size: 1.6rem; }
.ff-primary { background: var(--brand-red) !important; color: var(--warm-white) !important; border-color: var(--brand-red) !important; }
.ff-danger { background: var(--danger) !important; color: var(--warm-white) !important; border-color: var(--danger) !important; }
.ff-finish { border-color: var(--brand-gold) !important; }
.ff-incident { border-color: var(--warning) !important; }
.ff-unknown { border-style: dashed !important; }
.pf-bigbtn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Sync strip */
.ff-sync { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 8px; }
.ff-sync-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: 0.95rem; }
.ff-sync-pending { font-weight: 600; color: var(--success); }
.ff-sync-pending.has-pending { color: var(--warning); }
.ff-sync-foreign { color: var(--muted); }
.ff-recent { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; font-size: 0.95rem; }
.ff-recent li { display: flex; gap: 10px; padding: 4px 8px; border-left: 4px solid var(--border); }
.ff-recent li.is-accepted { border-left-color: var(--success); }
.ff-recent li.is-pending, .ff-recent li.is-error { border-left-color: var(--warning); }
.ff-recent li.is-observation { border-left-color: var(--brand-gold); }
.ff-recent li.is-rejected { border-left-color: var(--danger); }
.ff-recent-type { font-weight: 600; min-width: 90px; }

/* Sheet */
.ff-sheet-host:empty { display: none; }
.ff-sheet { position: fixed; inset: auto 0 0 0; max-height: 85vh; overflow: auto; background: var(--surface); border-top: 3px solid var(--brand-red); border-radius: 18px 18px 0 0; padding: 20px; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25); z-index: 60; display: flex; flex-direction: column; gap: 12px; }
.ff-sheet h2 { margin: 0; }
.ff-reasons { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.ff-reasons .pf-bigbtn { min-height: 72px; font-size: 1.15rem; }
.ff-sheet form { display: flex; flex-direction: column; gap: 10px; }
.ff-check { display: flex; align-items: center; gap: 10px; font-size: 1rem; }
.ff-check input { width: 28px; height: 28px; min-height: 0; }
.ff-sheet-cancel { min-height: 56px; }

/* Supervisor */
.ff-sup .ff-sup-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.ff-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.ff-readiness { padding: 12px 14px; border-radius: 12px; border: 2px solid var(--warning); margin-bottom: 14px; }
.ff-readiness.is-active { border-color: var(--success); }
.ff-readiness ul { margin: 4px 0 0; }
.ff-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.ff-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.ff-card h3, .ff-card h4 { margin: 4px 0 0; }
.ff-card label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }
.ff-card label.ff-inline { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.ff-card input, .ff-card select, .ff-card textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.ff-card fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.ff-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ff-wrap { flex-wrap: wrap; }
.ff-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ff-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.ff-table th, .ff-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ff-table tr.is-inactive td, .ff-table tr.is-superseded td, .ff-table tr.is-closed td, .ff-table tr.is-cancelled td { color: var(--muted); }
.ff-table tr.is-superseded td { text-decoration: line-through; }
.ff-table tr.is-correction td { background: var(--surface-2); }
.ff-table tr.is-invalidated td { color: var(--danger); }
.ff-kpis { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; font-weight: 600; }
.ff-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ff-mcard { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.ff-mcard.is-filling { border-color: var(--success); }
.ff-mcard.is-stopped { border-color: var(--danger); }
.ff-totals { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.ff-totals dt { color: var(--muted); }
.ff-totals dd { margin: 0; }
.ff-blockers2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ff-blockers2 ul { margin: 4px 0; padding-left: 18px; color: var(--danger); }
.ff-exc { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ff-exc li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 8px; border-left: 4px solid var(--warning); }
.ff-timeline td code { font-size: 0.8rem; }

@media (max-width: 860px) {
  .ff-login-grid, .ff-grid2, .ff-blockers2 { grid-template-columns: 1fr; }
  .ff-buttons { grid-template-columns: 1fr 1fr; }
  .ff-who { text-align: left; align-items: flex-start; }
}

.ff-pending-state { color: var(--warning); font-weight: 700; margin: 4px 0 0; flex-basis: 100%; }
.ff-state-badge.is-pending { border-style: dashed; }
.ff-state-badge small { display: block; font-size: 0.7rem; font-weight: 600; color: var(--warning); }
.ff-cache-banner { padding: 8px 12px; border: 1px dashed var(--warning); border-radius: 10px; color: var(--text); background: var(--surface-2); }

/* ── Simplified daily-work layer (2026-09-19) ──────────────────────────────
   Disclosures, counts, the floor bar, the attention queue, the job workspace
   and the compact tablet sync strip. Tokens only; tables scroll inside
   .ff-scroll-x so the page itself never overflows at 390px. */
.ff-disc { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin: 10px 0; }
.ff-disc > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; list-style: none; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 44px; }
.ff-disc > summary::-webkit-details-marker { display: none; }
.ff-disc > summary::before { content: '\25B8'; color: var(--brand-red); flex: none; }
.ff-disc[open] > summary::before { content: '\25BE'; }
.ff-disc > summary:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 2px; border-radius: 12px; }
.ff-disc-hint { font-weight: 400; font-size: 0.85rem; }
.ff-disc-body { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.ff-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--brand-red); color: var(--surface); font-size: 0.78rem; font-weight: 700; }
.ff-count.is-zero { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.ff-banner { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); margin: 0 0 12px; }
.ff-banner.is-warn { border-color: var(--warning); }
.ff-ok { color: var(--success); font-weight: 600; }
.ff-big { font-size: 1.5rem; }
.ff-po { overflow-wrap: anywhere; word-break: break-word; }
.ff-scroll-x { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ff-sup-bar .is-current { border-color: var(--brand-red); }
.ff-floor-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ff-attn-link { font-weight: 700; color: var(--danger); }
.ff-empty-floor .ui-empty-action .btn { min-height: 44px; }
.ff-mcard .ff-state-badge { align-self: flex-start; font-size: 1.05rem; padding: 6px 12px; }
.ff-mcard header { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }

/* Needs attention */
.ff-kpi { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 500; }
.ff-kpi.is-invalidated, .ff-kpi.is-active_exceptions { border-color: var(--danger); }
.ff-kpi.is-pending_observation { border-color: var(--brand-gold); }
.ff-attn { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.ff-attn-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-left: 5px solid var(--warning); border-radius: 12px; background: var(--surface); }
.ff-attn-item.is-invalidated, .ff-attn-item.is-active_exceptions, .ff-attn-item.is-finished_exceptions { border-left-color: var(--danger); }
.ff-attn-item.is-pending_observation { border-left-color: var(--brand-gold); }
.ff-attn-main { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; flex: 1 1 260px; }
.ff-attn-main .ff-state-badge { font-size: 0.85rem; padding: 2px 8px; }
.ff-attn-kind { font-weight: 700; }
.ff-attn-page { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Job workspace */
.ff-job-head { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.ff-job-title { min-width: 0; flex: 1 1 260px; }
.ff-job-title h3 { margin: 0; overflow-wrap: anywhere; }
.ff-job-title p { margin: 4px 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ff-job-title .ff-state-badge { font-size: 0.9rem; padding: 3px 10px; }
.ff-job { display: grid; gap: 12px; max-width: 1100px; }
.ff-job h5 { margin: 6px 0 0; font-size: 0.95rem; }
.ff-scopes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.ff-scopes > div { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ff-blockers-list { margin: 4px 0; padding-left: 18px; color: var(--danger); }
.ff-current-snapshot { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--success); background: var(--surface-2); }
.ff-current-snapshot.is-invalidated { border-color: var(--danger); }
.ff-current-snapshot p { margin: 0 0 6px; }
.ff-paper { background: var(--surface-2); }
.ff-tech dd code { font-size: 0.8rem; overflow-wrap: anywhere; }
.ff-agg h4 { margin: 0; }
.ff-selfpin { margin-bottom: 12px; }

/* Tablet: More + compact sync strip */
.ff-buttons .ff-more { border-style: dashed !important; }
.ff-sync-issue { font-weight: 700; }
.ff-sync-issue.is-rejected { color: var(--danger); }
.ff-sync-issue.is-observation { color: var(--brand-gold); }
.ff-sync-issue.is-error { color: var(--warning); }
.ff-sync-details { margin: 8px 0 0; }
.ff-sync-details > summary { min-height: 40px; padding: 6px 12px; font-size: 0.95rem; }

@media (max-width: 640px) {
  .ff-scopes { grid-template-columns: 1fr; }
  .ff-buttons { grid-template-columns: 1fr; }
  .ff-buttons .ff-xl { min-height: 96px; }
  .ff-sup .ff-sup-bar, .ff-floor-bar { flex-direction: column; align-items: stretch; }
  .ff-sup .ff-sup-bar .ff-row .btn, .ff-floor-bar .btn { flex: 1 1 auto; }
  .ff-tabs .btn { flex: 1 1 auto; min-height: 44px; }
  .ff-totals { grid-template-columns: 1fr; gap: 2px 0; }
  .ff-totals dt { margin-top: 6px; }
  .ff-attn-item, .ff-job-head { flex-direction: column; align-items: stretch; }
  .ff-attn-item .ff-row-actions .btn, .ff-job-head .btn { width: 100%; }
  .ff-modal-card { min-width: 0; width: 92vw; }
  .ff-mcard .ff-row-actions .btn { flex: 1 1 auto; }
}

.ff-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.ff-modal-card { background: var(--surface, #fff); border-radius: 14px; padding: 20px 22px; min-width: 300px; max-width: 92vw; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.ff-modal-card label { display: block; margin: 8px 0 6px; font-weight: 600; }
.ff-modal-card input { width: 100%; font-size: 1.25rem; letter-spacing: .3em; padding: 10px 12px; }
.ff-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* ── PET line pilot (pilot-flags.js): stop clock, reason chips, one-tap reason sheet ── */
.ff-stopbox { margin: 4px 0 12px; display: flex; flex-direction: column; gap: 8px; }
.ff-stopclock { display: flex; align-items: baseline; gap: 14px; }
.ff-stopclock-num { font-size: 2.6rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.ff-stop-hint { margin: 0; font-weight: 700; color: var(--success); }
.ff-stop-hint.is-over { color: var(--warning); }
.ff-chips-label { margin: 0; }
.ff-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.ff-chip { min-height: 48px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font-size: 1rem; font-weight: 600; cursor: pointer; }
.ff-chip.is-picked { border-color: var(--brand-red); box-shadow: 0 0 0 2px var(--brand-red) inset; }
.ff-reasons-ask .pf-bigbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.ff-reasons-ask .pf-bigbtn small { font-size: 0.8rem; font-weight: 400; }
.ff-recent-reason { color: var(--muted); }
.ff-pilot-banner { margin: 0 0 10px; padding: 10px 14px; border: 2px dashed var(--brand-gold); border-radius: 10px; background: var(--surface-2); font-weight: 700; }
.ff-start-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.ff-field { display: flex; flex-direction: column; gap: 6px; }
.ff-field label { font-weight: 600; }

/* ── Official downtime codes (FF_DT_CODES): grouped one-tap list, drop-down while stopped ── */
.ff-dt-drop { display: flex; flex-direction: column; gap: 6px; }
.ff-dt-dropbtn { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; width: 100%; text-align: left; font-size: 1.15rem; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); padding: 8px 16px; }
.ff-dt-dropbtn.is-picked { border-color: var(--brand-red); box-shadow: 0 0 0 2px var(--brand-red) inset; }
.ff-dt-caret { font-size: 1.4rem; line-height: 1; }
.ff-dt-note-shown { margin: 0; font-style: italic; }
.ff-dt-body { display: flex; flex-direction: column; gap: 14px; }
.ff-dt-group { display: flex; flex-direction: column; gap: 8px; }
.ff-dt-group + .ff-dt-group { margin-top: 6px; }
.ff-dt-group-title { margin: 0; font-size: 1rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ff-dt-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ff-dt-list .ff-dt-item { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 64px; padding: 8px 14px; text-align: left; font-size: 1.1rem; }
.ff-dt-list .ff-dt-item small { font-size: 0.8rem; font-weight: 400; }
.ff-dt-list .ff-dt-item.is-picked { border-color: var(--brand-red); box-shadow: 0 0 0 2px var(--brand-red) inset; }
.ff-dt-body .ff-unknown { margin-top: 6px; min-height: 64px; width: 100%; }
.ff-dt-detail { display: flex; flex-direction: column; gap: 10px; }
.ff-dt-detail label { font-weight: 700; }
.ff-dt-picked { margin: 0; font-size: 1.2rem; }
@media (max-width: 640px) {
  .ff-dt-list { grid-template-columns: 1fr; }
  .ff-dt-list .ff-dt-item { min-height: 56px; }
}

/* ── Tablet setup link (FF_SETUP_LINK): desk dialog + sign-in card code form ── */
.ff-setup-state { margin-top: 4px; font-size: .85rem; font-weight: 600; }
.ff-setup-state.is-pending { color: var(--warning, #b45309); }
.ff-setup-state.is-used { color: var(--success); }
.ff-setup-card { width: 560px; }
.ff-setup-card .ff-setup-urlrow { display: flex; gap: 8px; align-items: center; }
.ff-setup-card .ff-setup-urlrow input { font-size: .9rem; letter-spacing: normal; padding: 8px 10px; flex: 1 1 auto; min-width: 0; }
.ff-setup-grid { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: center; margin-top: 14px; }
.ff-setup-qr { margin: 0; text-align: center; }
.ff-setup-qr svg { width: 170px; height: 170px; display: block; margin: 0 auto 4px; background: #fff; }
.ff-setup-code { font-size: 2.2rem; font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; margin: 4px 0 6px; }
.ff-setup { margin: 12px 0; text-align: left; }
.ff-setup > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.ff-setup-form label { display: block; font-weight: 600; margin: 8px 0 6px; }
.ff-setup-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.ff-setup-input { font-size: 1.5rem; letter-spacing: .15em; text-transform: uppercase; padding: 10px 12px; min-height: 52px; flex: 1 1 200px; }
.ff-setup-row .btn { min-height: 52px; min-width: 120px; }
.ff-setup-confirm { max-width: 560px; margin: 24px auto; }
.ff-setup-confirm h2 { margin: 0 0 10px; }
@media (max-width: 640px) {
  .ff-setup-grid { grid-template-columns: 1fr; }
}
/* ── Filling Floor run sheet (pilot S4) ─────────────────────────────────────
   Read-only paper layout (F/PMC/002) on the desk and the tablet. Tokens only.
   Row state is always paired with text (the Check column), never colour alone. */

.rs {
  --rs-surface: var(--warm-white);
  --rs-surface-2: var(--eggshell-bright);
  --rs-border: var(--rule);
  --rs-text: var(--ink);
  --rs-muted: var(--ink-mute);
  color: var(--rs-text);
  max-width: 1280px; margin: 0 auto; padding: 4px 0 24px;
}
[data-theme="dark"] .rs {
  --rs-surface: var(--bg-secondary);
  --rs-surface-2: var(--surface-alt);
  --rs-border: var(--border-medium);
}
.rs-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.rs-bar .btn { min-height: 44px; }
.rs-eyebrow { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--rs-muted); }
.rs-title { margin: 2px 0 2px; font-size: 1.45rem; }
.rs-readonly { margin: 0 0 10px; font-size: 0.88rem; }
.rs-muted { color: var(--rs-muted); }
.rs-warn { color: var(--danger); }
.rs-banner { margin: 8px 0; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--rs-border); background: var(--rs-surface-2); font-weight: 600; }
.rs-banner.is-warn { border-color: var(--warning); }

/* Answer strip: the numbers people came for, before the paper layout. */
.rs-answer { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 10px; margin: 10px 0 12px; }
.rs-answer > div { border: 1px solid var(--rs-border); border-radius: 12px; padding: 10px 14px; background: var(--rs-surface); display: flex; flex-direction: column; gap: 2px; }
.rs-answer strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.rs-answer-label { font-size: 0.82rem; color: var(--rs-muted); }
.rs-answer-main { border-color: var(--heritage-red) !important; }
.rs-answer-big { font-size: 2.2rem !important; line-height: 1.1; }
.rs-answer-sub { font-size: 0.95rem; color: var(--rs-muted); font-variant-numeric: tabular-nums; }
.rs-answer-warn { border-color: var(--warning) !important; }
.rs-answer-warn strong { color: var(--danger); }
.rs-answer-ok strong { color: var(--success); }

/* Paper header block */
.rs-head { display: grid; grid-template-columns: 1.2fr 1.6fr 1.2fr; gap: 6px 22px; border: 1px solid var(--rs-border); border-radius: 10px; padding: 10px 14px; margin: 0 0 10px; background: var(--rs-surface-2); font-size: 0.95rem; }
.rs-head b { display: inline-block; min-width: 128px; color: var(--rs-muted); font-weight: 600; }

/* Paper body */
.rs-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rs-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--rs-surface); min-width: 980px; }
.rs-table th { background: var(--rs-surface-2); font-weight: 700; text-align: left; padding: 6px; border: 1px solid var(--rs-border); line-height: 1.15; vertical-align: bottom; }
.rs-table th small { display: block; font-weight: 500; color: var(--rs-muted); }
.rs-table td { padding: 5px 6px; border: 1px solid var(--rs-border); vertical-align: top; font-variant-numeric: tabular-nums; }
.rs-row.is-stop td { background: color-mix(in srgb, var(--danger) 6%, var(--rs-surface)); }
.rs-row.is-minor td { background: var(--rs-surface-2); color: var(--rs-muted); }
.rs-row.is-gap td { background: color-mix(in srgb, var(--warning) 16%, var(--rs-surface)); }
.rs-row.is-attendance td, .rs-row.is-remark td { color: var(--rs-muted); }
.rs-day { color: var(--rs-muted); font-size: 0.75rem; }
.rs-col { display: inline-block; font-size: 0.72rem; padding: 0 6px; border-radius: 999px; border: 1px solid var(--rs-border); color: var(--rs-muted); }
.rs-flag { min-width: 120px; }
.rs-flagtag { display: inline-block; font-size: 0.78rem; font-weight: 700; color: var(--danger); }
.rs-flagtag.is-batch_open, .rs-flagtag.is-stop_open { color: var(--rs-text); }

/* Pencil math + workbook strip */
.rs-grid { display: grid; grid-template-columns: 1fr 1.35fr; gap: 16px; margin-top: 12px; }
.rs-card { border: 1px solid var(--rs-border); border-radius: 10px; padding: 10px 14px; background: var(--rs-surface); min-width: 0; }
.rs-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.rs-calc { display: grid; grid-template-columns: max-content max-content max-content; gap: 3px 18px; font-variant-numeric: tabular-nums; }
.rs-calc > span:nth-child(3n) { text-align: right; }
.rs-calc-sub { color: var(--rs-muted); font-size: 0.9rem; padding-left: 10px; }
.rs-calc .tot { font-weight: 800; border-top: 1px solid var(--rs-text); padding-top: 3px; }
.rs-wb { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.rs-wb th, .rs-wb td { border: 1px solid var(--rs-border); padding: 4px 6px; text-align: center; }
.rs-wb th { background: var(--rs-surface-2); }
.rs-wb th small { display: block; font-weight: 500; color: var(--rs-muted); }
.rs-wb-extra { color: var(--danger); }
.rs-legend { font-size: 0.82rem; color: var(--rs-muted); margin: 8px 0 0; }
.rs-legend.rs-warn { color: var(--danger); }

/* Footer */
.rs-foot { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; font-size: 0.88rem; }
.rs-foot > div { border: 1px solid var(--rs-border); border-radius: 8px; padding: 6px 8px; background: var(--rs-surface); }

/* Tablet: bigger targets, the strip and math stack. */
.rs-tablet .rs-bar .btn { min-height: 56px; font-size: 1.05rem; }
@media (max-width: 1100px) {
  .rs-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .rs-answer { grid-template-columns: 1fr 1fr; }
  .rs-answer-main { grid-column: 1 / -1; }
  .rs-head { grid-template-columns: 1fr; }
  .rs-grid { grid-template-columns: 1fr; }
  .rs-foot { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .rs-calc { grid-template-columns: minmax(0, 1fr) minmax(0, auto) max-content; gap: 3px 10px; font-size: 0.92rem; }
}
@media (max-width: 480px) {
  .rs-foot { grid-template-columns: 1fr; }
  .rs-title { font-size: 1.2rem; }
}
/* ── Filling Floor in the Cooking Floor look (FF_UNIFIED_LOOK, 2026-11-11) ──
   Owner 11/11: the two floors "look and feel different when they shouldn't".
   Filling follows Cooking (Cooking is live on every plant; Filling starts its
   PET pilot Mon 11/16). Every rule here is scoped under `.ff-unified`, the
   class filling-floor-look.js puts on the tablet, sign-in card, sheets and
   supervisor desk when the switch is on. Switch off = no class = this file
   does nothing and 71-filling-floor.css paints the old look.

   Values come from the Cooking Floor itself, never new hues:
     - Cooking tokens: --gl-ok* (go / done), --gl-check* (clock / waiting),
       --gl-stop* (stop), --gl-ink (64z-production-floor-glance.css :root);
     - Cooking sizes: .pf-bigbtn (10px radius, 2px rule border), the glance
       64px glove floor, .pf-sheet (backdrop, 720px, 18px radius, 56px X),
       .pf-outbox-badge (the amber "waiting to send" pill).
   The sign-in card and the top bar reuse Cooking's own classes (.pf-login-*,
   .pf-floorhead*) in the markup, so they need almost nothing here.
   Tap targets are never smaller than Cooking's (64px controls, 84px+ actions). */

.ff-unified {
  /* .pf-outbox-badge values (64-production-floor.css), kept in one place. */
  --ffu-wait-bg: #fff6d6;
  --ffu-wait-ink: #6b4e00;
  --ffu-wait-edge: #e8c572;
}

/* ── Sign-in card (markup: .pf-login / .pf-login-card / .pf-login-*) ───── */
.pf-login.ff-unified .ff-login-machine { margin: -12px 0 8px; font-size: 15px; color: var(--muted, #6b7280); }
.pf-login.ff-unified form { margin: 0; }
.pf-login.ff-unified .pf-login-step label { font: inherit; color: inherit; }
.pf-login.ff-unified .ff-pin-help { margin: 8px 0 0; font-size: 15px; color: var(--muted, #6b7280); }
.pf-login.ff-unified .pf-login-code { box-sizing: border-box; }

/* ── Top bar (markup: .pf-floorhead + .ff-head) ─────────────────────────── */
.ff-unified .ff-head.pf-floorhead {
  align-items: center; justify-content: flex-start; gap: 12px;
  padding: 10px 0 14px; margin-bottom: 4px;
  border-bottom: 2px solid var(--border);
}
.ff-unified .ff-head .pf-floorhead-date { font-size: 1.15rem; }
.ff-unified .ff-head .pf-who-name { color: var(--text); font-weight: 700; }
.ff-unified .ff-head .ff-tag { font-size: 0.8rem; }
/* Online / offline: like Cooking, nothing is shown while online; offline is a
   pill in the Cooking "waiting to send" amber. */
.ff-unified .ff-net:not(.is-offline) { display: none; }
.ff-unified .ff-net {
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 700; letter-spacing: 0; text-transform: none;
  color: var(--gl-ok-ink); background: var(--gl-ok-bg); border: 1px solid var(--gl-ok-edge);
}
.ff-unified .ff-net.is-offline { color: var(--ffu-wait-ink); background: var(--ffu-wait-bg); border-color: var(--ffu-wait-edge); }

/* Pilot banner: the Cooking notice palette (solid, not dashed). */
.ff-unified .ff-pilot-banner { border: 2px solid var(--gl-check-edge); background: var(--gl-check-bg); color: var(--gl-check-ink); border-radius: 10px; }

/* ── State badge: the Cooking colour key ───────────────────────────────── */
.ff-unified .ff-state-badge { border-width: 3px; border-radius: 12px; }
.ff-unified .ff-state-badge.is-filling { background: var(--gl-ok-bg); border-color: var(--gl-ok-edge); color: var(--gl-ok-ink); }
.ff-unified .ff-state-badge.is-stopped { background: var(--gl-stop-bg); border-color: var(--gl-stop); color: var(--gl-stop); }
.ff-unified .ff-state-badge.is-pending { border-style: dashed; }

/* ── Stop clock: the Cooking hold-clock box (amber, 3px, big dark digits) ── */
.ff-unified .ff-stopbox {
  padding: 10px 14px; border-radius: 10px;
  border: 3px solid var(--gl-check-edge); background: var(--gl-check-bg); color: var(--gl-check-ink);
}
.ff-unified .ff-stopbox .ff-muted { color: var(--gl-check-ink); }
.ff-unified .ff-stopclock { align-items: center; flex-wrap: wrap; }
.ff-unified .ff-stopclock-num { font-size: 3.4rem; color: var(--gl-ink); }
.ff-unified .ff-stop-hint { color: var(--gl-ok-ink); }
.ff-unified .ff-stop-hint.is-over { color: var(--gl-check-ink); }

/* Reason chips: the Cooking sheet chips (64px, picked = green with a tick). */
.ff-unified .ff-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 64px; padding: 8px 18px; border-radius: 10px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 1.05rem; font-weight: 700;
}
.ff-unified .ff-chip.is-picked { border: 3px solid var(--gl-ok); background: var(--gl-ok-bg); color: var(--gl-ok-ink); box-shadow: none; }
.ff-unified .ff-chip.is-picked::before {
  content: ''; display: inline-block; width: 1em; height: 1em; background: currentColor;
  -webkit-mask: var(--ico-check) center / contain no-repeat; mask: var(--ico-check) center / contain no-repeat;
}

/* ── Big buttons: Cooking .pf-bigbtn; go = Cooking green, stop = Cooking red ── */
.ff-unified .ff-buttons .pf-bigbtn,
.ff-unified .ff-reasons .pf-bigbtn,
.ff-sheet.ff-unified form .pf-bigbtn,
.ff-sheet.ff-unified > .pf-bigbtn {
  border: 2px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font-weight: 700;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .06);
}
.ff-unified .ff-primary { background: var(--gl-ok) !important; border-color: var(--gl-ok) !important; color: #fff !important; }
.ff-unified .ff-primary:active { background: var(--gl-ok-ink) !important; }
.ff-unified .ff-danger { background: var(--gl-stop) !important; border-color: var(--gl-stop) !important; color: #fff !important; }
.ff-unified .ff-buttons .ff-finish,
.ff-unified .ff-buttons .ff-incident,
.ff-unified .ff-buttons .ff-more { border-color: var(--border) !important; border-style: solid !important; }
/* In a sheet the Finish / Report confirm button is the sheet's Save: green. */
.ff-sheet.ff-unified .ff-finish,
.ff-sheet.ff-unified .ff-incident { background: var(--gl-ok) !important; border-color: var(--gl-ok) !important; color: #fff !important; }
.ff-unified .pf-bigbtn[disabled] { opacity: 0.45; }

/* ── Sync strip: "waiting to send" is the Cooking amber pill ───────────── */
.ff-unified .ff-sync { border-top: 2px solid var(--border); }
.ff-unified .ff-sync-pending { color: var(--gl-ok-ink); font-weight: 700; }
.ff-unified .ff-sync-pending.has-pending {
  display: inline-block; padding: 8px 14px; border-radius: 999px;
  background: var(--ffu-wait-bg); color: var(--ffu-wait-ink); border: 1px solid var(--ffu-wait-edge);
  font-weight: 600; font-size: 15px;
}

/* ── Sheets: the Cooking .pf-sheet ──────────────────────────────────────── */
.ff-sheet-backdrop.ff-unified {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(20, 24, 32, .55);
  display: flex; align-items: flex-end; justify-content: center;
}
.ff-sheet.ff-unified {
  position: relative; inset: auto; z-index: auto;
  width: 100%; max-width: 720px; max-height: 92vh; box-sizing: border-box;
  border-top: 0; border-radius: 18px 18px 0 0;
  padding: 14px 18px 22px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
}
.ff-sheet.ff-unified h2 {
  margin: 0; padding-right: 68px; min-height: 56px; display: flex; align-items: center;
  font-family: var(--font-sans); font-style: normal; font-size: 22px; font-weight: 800; line-height: 1.25;
}
.ff-sheet.ff-unified > .ff-muted { margin: 0; font-size: 15px; }
.ff-sheet.ff-unified .ff-sheet-x {
  position: absolute; top: 14px; right: 18px;
  width: 56px; height: 56px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 22px; font-weight: 800; cursor: pointer;
}
.ff-sheet.ff-unified .ff-sheet-cancel { min-height: 72px; font-size: 22px; font-weight: 700; border-radius: 10px; }
.ff-sheet.ff-unified form .pf-bigbtn { min-height: 72px; font-size: 22px; }
.ff-sheet.ff-unified input,
.ff-sheet.ff-unified textarea { min-height: 64px; font-size: 22px; border-radius: 10px; border: 2px solid var(--border); }
.ff-sheet.ff-unified input:focus,
.ff-sheet.ff-unified textarea:focus { outline: none; border-color: var(--brand-red); }
.ff-sheet.ff-unified .ff-reasons .pf-bigbtn { min-height: 72px; }
/* Handover names in a sheet: the Cooking name buttons. */
.ff-sheet.ff-unified .ff-name {
  min-height: 56px; padding: 10px 16px; gap: 10px; justify-content: space-between;
  border: 2px solid var(--border); border-radius: 10px; background: var(--surface-2);
  font-size: 18px; font-weight: 700;
}
.ff-sheet.ff-unified .ff-name .ff-ini {
  order: 2; width: auto; height: auto; border-radius: 6px; padding: 3px 8px;
  font-size: 13px; font-weight: 800; color: var(--brand-red); background: var(--surface); border: 1px solid var(--border);
}
.ff-sheet.ff-unified .ff-name.is-picked { border-color: var(--brand-red); background: #fff7f7; box-shadow: none; }

/* ── Supervisor desk: the Cooking supervisor's pill switches ────────────── */
.ff-sup.ff-unified .ff-tabs .ff-tab { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.ff-sup.ff-unified .ff-tabs .ff-tab .ff-count { background: var(--brand-red); color: #fff; }
.ff-sup.ff-unified .ff-tabs .ff-tab.is-on .ff-count { background: #fff; color: var(--text); }

@media (max-width: 640px) {
  .ff-unified .ff-head .pf-floorhead-who { margin-left: 0; }
  .ff-sheet.ff-unified { border-radius: 16px 16px 0 0; }
  .ff-unified .ff-stopclock-num { font-size: 2.8rem; }
}

/* Official downtime codes (FF_DT_CODES): the same Cooking big buttons, picked = green. */
.ff-unified .ff-dt-dropbtn { font-weight: 700; color: var(--gl-ink); }
.ff-unified .ff-dt-dropbtn.is-picked,
.ff-sheet.ff-unified .ff-dt-list .ff-dt-item.is-picked { border: 3px solid var(--gl-ok); background: var(--gl-ok-bg); color: var(--gl-ok-ink); box-shadow: none; }
.ff-sheet.ff-unified .ff-dt-list .ff-dt-item { border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 700; box-shadow: 0 2px 0 rgba(0, 0, 0, .06); }

/* ── Today on the filling lines (FF_SCHEDULE_FIRST, 2026-11-16) ───────────
   One card per schedule work center today, above the tablet sign-in card and
   at the top of the desk's Live floor; the Start sheet's order buttons. The
   tablet's own line is Cooking green; lines not on the tablet are grey
   "Paper only" and never tappable. 64px+ tap targets like Cooking. */
.ff-unified .ff-today { margin: 0 0 18px; }
.ff-unified .ff-today-title { margin: 0 0 4px; font-size: 1.6rem; font-weight: 800; color: var(--gl-ink, var(--text)); }
.ff-unified .ff-today-src { margin: 0 0 12px; }
.ff-unified .ff-today-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ff-unified .ff-today-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); min-width: 0; }
.ff-unified .ff-today-card.is-mine { border: 3px solid var(--gl-ok, #17552A); }
.ff-unified .ff-today-card.is-paper { background: var(--surface-2, #f3f1ea); color: var(--muted, #6b7280); }
.ff-unified .ff-today-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ff-unified .ff-today-name { font-size: 1.2rem; overflow-wrap: anywhere; }
.ff-unified .ff-today-wc { font-family: ui-monospace, Menlo, monospace; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted, #6b7280); }
.ff-unified .ff-today-tag { display: inline-block; padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface); white-space: nowrap; }
.ff-unified .ff-today-tag.is-mine { border-color: var(--gl-ok-edge, #2c6b41); background: var(--gl-ok-bg, #E3F1E5); color: var(--gl-ok-ink, #14451F); }
.ff-unified .ff-today-tag.is-warn { border-color: var(--ffu-wait-edge, #e8c572); background: var(--ffu-wait-bg, #fff6d6); color: var(--ffu-wait-ink, #6b4e00); }
.ff-unified .ff-today-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ff-unified .ff-today-row { display: flex; flex-direction: column; gap: 3px; }
.ff-unified .ff-today-row + .ff-today-row { border-top: 1px solid var(--border); padding-top: 10px; }
.ff-unified .ff-today-item { font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.ff-unified .ff-today-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; }
.ff-unified .ff-today-po { font-family: ui-monospace, Menlo, monospace; font-weight: 700; font-size: 14px; }
.ff-unified .ff-today-paper, .ff-unified .ff-today-none { margin: 4px 0 0; font-size: 14px; }
.ff-unified .ff-today-plan { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ff-unified .ff-today-plan .btn, .ff-unified .ff-today-setup { min-height: 44px; }
.ff-unified .ff-today-setup { display: inline-flex; align-items: center; font-weight: 700; }
.ff-unified .ff-today-mine { margin-top: 8px; min-height: 64px; width: 100%; background: var(--gl-ok, #17552A); border-color: var(--gl-ok, #17552A); color: #fff; font-weight: 800; }
.ff-unified .ff-today-picks { display: flex; flex-direction: column; gap: 12px; margin: 0 0 12px; }
.ff-unified .ff-today-pick { border: 3px solid var(--gl-ok, #17552A); border-radius: 14px; padding: 14px 16px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.ff-unified .ff-today-pick-po .ff-po { font-size: 1.6rem; overflow-wrap: anywhere; }
.ff-unified .ff-today-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 15px; }
.ff-unified .ff-today-dl dt { font-weight: 700; }
.ff-unified .ff-today-dl dd { margin: 0; overflow-wrap: anywhere; }
.ff-unified .ff-today-pick .pf-bigbtn { min-height: 72px; background: var(--gl-ok, #17552A); border-color: var(--gl-ok, #17552A); color: #fff; font-weight: 800; }
.ff-unified .ff-today-other { min-height: 64px; width: 100%; font-weight: 700; }
@media (max-width: 640px) {
  .ff-unified .ff-today-grid { grid-template-columns: 1fr; }
  .ff-unified .ff-today-dl { grid-template-columns: 1fr; gap: 0; }
  .ff-unified .ff-today-dl dd { margin-bottom: 6px; }
}
/* ============================================================
   Change log (2026-10-31). Read-only list of the changes in the
   running version. Additive only: every selector is namespaced
   under .chl-* and uses brand tokens (no raw hex).
   ============================================================ */

.chl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.chl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  min-width: 0;
}

.chl-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.chl-field-label {
  font-size: 0.78rem;
  color: var(--ink-mute);
}

.chl-field-search .form-input {
  min-width: 220px;
}

.chl-actions {
  display: flex;
  gap: 8px;
}

.chl-table td {
  vertical-align: top;
}

.chl-when,
.chl-pr {
  white-space: nowrap;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.chl-title {
  min-width: 280px;
  color: var(--ink-strong);
}

.chl-title.is-generic {
  color: var(--ink-soft);
  font-style: italic;
}

.chl-generic {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule-soft);
  font-size: 0.75rem;
  font-style: normal;
  color: var(--ink-mute);
  white-space: nowrap;
}

.chl-area {
  white-space: nowrap;
}

.chl-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px 0;
}

.chl-count {
  font-size: 0.85rem;
  color: var(--ink-mute);
}

.chl-note {
  margin: 12px 4px 0;
  font-size: 0.8rem;
  color: var(--ink-mute);
}

@media (max-width: 640px) {
  .chl-toolbar {
    align-items: stretch;
  }
  .chl-filters,
  .chl-field,
  .chl-field-search .form-input,
  .chl-field .form-select {
    width: 100%;
    min-width: 0;
  }
  .chl-actions {
    width: 100%;
  }
  .chl-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .chl-title {
    min-width: 220px;
  }
}
/* ── Agent mode (2026-11-01): read-only test account indicator ──────
   Rendered by ui/shell.js ONLY when /api/auth/me reports user.agent (an
   account in AIOP_AGENT_ACCOUNTS). Small, quiet, never blocks a tap
   (pointer-events: none). Normal users never get these elements.

   Both forms sit IN the page flow, so they never cover content
   (2026-11-02: the old phone form floated at the bottom-left and hid the
   last card's text while scrolling):
     .agent-mode-pill   desktop/tablet: inside the topbar row
     .agent-mode-strip  phones: a slim line under the topbar, above the page */

.agent-mode-pill,
.agent-mode-strip {
  border: 1px dashed #b45309;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 600;
  line-height: 1.4;
  pointer-events: none;
}

.agent-mode-pill {
  flex: 0 0 auto;
  align-self: center;
  margin: 0 8px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.agent-mode-strip {
  display: none;
}

[data-theme="dark"] .agent-mode-pill,
[data-theme="dark"] .agent-mode-strip {
  background: rgba(180, 83, 9, 0.18);
  color: #fdba74;
  border-color: #fdba74;
}

@media (max-width: 640px) {
  /* Phones: the topbar row is full (menu, title, search, help, avatar), so
     the label moves to its own line under it instead of floating. */
  .agent-mode-pill {
    display: none;
  }
  .agent-mode-strip {
    display: block;
    margin: 8px 14px 0;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
/* ============================================================
   SKU Rationalization (2026-11-19). Additive only: every selector
   is namespaced under .skr-* and uses brand tokens (no raw hex).
   ============================================================ */

.skr-toolbar { margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; }
.skr-toolbar-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.skr-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--ink-soft); font-size: 0.85rem; }
.skr-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.skr-field > span { font-size: 0.78rem; color: var(--ink-mute); }
.skr-export { margin-left: auto; }
.skr-muted { color: var(--ink-mute); font-size: 0.85rem; }
.skr-warn { color: var(--warning); font-size: 0.9rem; }
.skr-note { padding: 12px 16px; margin-bottom: 12px; color: var(--ink-soft); }
/* 2026-11-25: Hurdles picker note + what-changed line after a switch. */
.skr-scn-note { margin: 0 0 8px; max-width: 34ch; }
.skr-scn-diff { margin: 0; color: var(--ink-soft); font-size: 0.85rem; }
/* The status line stays in the page while empty so screen readers announce the fill. */
.skr-hq-tip { margin: 8px 0 0; }
.skr-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.skr-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--rule-soft); }
.skr-tab {
  border: 0; background: none; padding: 8px 12px; min-height: 44px; cursor: pointer;
  color: var(--ink-soft); border-bottom: 2px solid transparent; font: inherit;
}
.skr-tab.is-active { color: var(--ink-strong); border-bottom-color: var(--heritage-red); font-weight: 600; }

.skr-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.skr-pill {
  border: 1px solid var(--rule); background: var(--paper); border-radius: 999px; padding: 4px 12px;
  min-height: 36px; cursor: pointer; color: var(--ink-soft); font: inherit; font-size: 0.85rem;
}
.skr-pill.is-active { border-color: var(--heritage-red); color: var(--ink-strong); font-weight: 600; }
.skr-search { margin-left: auto; min-width: 220px; }

.skr-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.skr-table td, .skr-table th { vertical-align: top; }
.skr-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.skr-table .mono { font-variant-numeric: tabular-nums; white-space: nowrap; }
.skr-row { cursor: pointer; }
.skr-row:hover, .skr-row:focus-visible { background: var(--eggshell-bright); outline: none; }
.skr-hurdles { max-width: 420px; font-size: 0.82rem; color: var(--ink-soft); }

.skr-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 16px; }
.skr-card { padding: 16px; margin-bottom: 16px; }
.skr-card h3 { margin: 0 0 8px; }
.skr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.skr-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.skr-set { border: 1px solid var(--rule-soft); border-radius: var(--radius-sm); padding: 12px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.skr-set legend { font-weight: 600; padding: 0 4px; }
.skr-check { display: flex; gap: 8px; align-items: center; }
.skr-num { max-width: 180px; }
.skr-map { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.skr-map-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.skr-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.skr-file { cursor: pointer; }

.skr-detail section { margin-bottom: 16px; }
.skr-detail h4 { margin: 0 0 8px; }
.skr-desc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.skr-flags { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.skr-flag-global { color: var(--ink-strong); font-weight: 600; }
.skr-flag-zone { color: var(--ink-strong); }
.skr-flag-benchmark, .skr-flag-info { color: var(--ink-soft); }
.skr-history { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.skr-history li { border-left: 3px solid var(--rule-gold); padding-left: 10px; }
.skr-dec { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--rule-soft); padding-top: 12px; }
.skr-dec h5 { margin: 0; }
.skr-ai-card { border: 1px dashed var(--info); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.skr-ai-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

@media (max-width: 640px) {
  .skr-export, .skr-search { margin-left: 0; }
  .skr-search { min-width: 0; width: 100%; }
  .skr-hurdles { max-width: 260px; }
}

/* ── v1.1 (2026-11-20): Decision Board, Scenario compare, hurdle bars ── */
.skr-detail .skr-table { width: 100%; }
.skr-board { display: flex; flex-direction: column; gap: 0; }
.skr-board-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 12px; }
.skr-group-pick { flex: 1 1 420px; }
.skr-group-pick select { width: 100%; }
.skr-board-scope { flex: 1 1 280px; margin: 0; }
.skr-board-title { margin: 4px 0 8px; font-size: 1rem; }
.skr-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 8px; }
.skr-kpi { border: 1px solid var(--rule-soft); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--paper); }
.skr-kpi.is-cut { border-left: 4px solid var(--heritage-red); }
.skr-kpi-value { font-size: 1.35rem; font-weight: 700; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.skr-kpi-label { font-size: 0.82rem; color: var(--ink-soft); }
.skr-kpi-sub { font-size: 0.78rem; color: var(--ink-mute); margin-top: 2px; }
.skr-board-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
.skr-chart-card { margin: 0 0 16px; }
.skr-chart-title { font-weight: 600; margin-bottom: 6px; color: var(--ink-strong); }
.skr-chart { width: 100%; height: 420px; }
.skr-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 4px; }
.skr-legend-item { display: inline-flex; align-items: center; gap: 6px; }
/* Dot colour comes from the chart palette (sap-chart-data.js PALETTE) inline. */
.skr-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--ink-mute); }

.skr-cmp-pick { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 8px; }
.skr-cmp-pick .skr-field { min-width: 220px; }
.skr-cmp-vs { padding-bottom: 10px; color: var(--ink-mute); font-weight: 600; }
.skr-cmp-table { width: 100%; }
.skr-cmp-table th { font-weight: 500; text-align: left; }
.skr-cmp-table th.num { text-align: right; padding-left: 16px; }
.skr-cmp-table td.num { padding-left: 16px; }
.skr-table thead th { text-align: left; }
.skr-table thead th.num { text-align: right; }
.skr-row-cont td { border-top: 0; }

.skr-bullets { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.skr-bullet { display: grid; grid-template-columns: minmax(120px, 180px) minmax(160px, 1fr) minmax(200px, 1.4fr); gap: 10px; align-items: center; }
.skr-bullet-label { font-size: 0.85rem; color: var(--ink-soft); }
.skr-bullet-track { position: relative; height: 14px; background: var(--eggshell-bright); border-radius: 3px; border: 1px solid var(--rule-soft); }
.skr-bullet-fill { position: absolute; top: 2px; bottom: 2px; background: var(--ink-mute); border-radius: 2px; }
.skr-bullet.is-fail .skr-bullet-fill { background: var(--heritage-red); }
.skr-bullet-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--ink-strong); border-radius: 1px; }
.skr-bullet-zero { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--rule); }
.skr-bullet-text { font-size: 0.82rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.skr-bullet.is-fail .skr-bullet-text { color: var(--ink-strong); font-weight: 600; }
.skr-bullet-group { font-size: 0.82rem; font-weight: 600; color: var(--ink-strong); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.skr-bullet-key { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; }
.skr-key-fill { display: inline-block; width: 18px; height: 8px; background: var(--ink-mute); border-radius: 2px; }
.skr-key-mark { display: inline-block; width: 3px; height: 14px; background: var(--ink-strong); }

@media (max-width: 960px) {
  .skr-board-grid { grid-template-columns: 1fr; }
  .skr-bullet { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 640px) {
  .skr-chart { height: 320px; }
}

/* v1.2 (2026-11-20): HQ / Zone framework */
.skr-period { margin: 4px 0 0; }
.skr-v2-sub { color: var(--danger); font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.skr-bu { font-size: 0.78rem; color: var(--ink-soft); margin-top: 2px; }
.skr-fw { margin: 12px 0 6px; color: var(--ink-strong); }
.skr-unmapped-row td { color: var(--ink-mute); font-style: italic; }
.skr-rewrite .skr-map-row { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)) auto; width: 100%; }
.skr-map-head span { font-size: 0.78rem; color: var(--ink-mute); }
.skr-chart-sm { height: 260px; }
.skr-zone-table td { vertical-align: top; }
@media (max-width: 640px) {
  .skr-rewrite .skr-map-row { grid-template-columns: 1fr; }
}

/* 2026-11-29 (feedback #623-#625): Zone V2 colour definitions, board buttons, one-chart board */
.skr-v2-flag { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-right: 12px; vertical-align: top; }
.skr-v2-def { display: block; font-size: 0.74rem; color: var(--ink-soft); line-height: 1.3; }
.skr-v2-legend { display: flex; flex-wrap: wrap; gap: 8px 4px; align-items: flex-start; margin: 4px 0 8px; }
.skr-board-filters { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1 1 auto; }
.skr-btn-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.skr-btn-group-label { font-size: 0.82rem; font-weight: 600; color: var(--ink-strong); margin-right: 4px; min-width: 9rem; }
.skr-pill[disabled] { opacity: 0.45; cursor: not-allowed; }
.skr-board-combine { margin: 0; }
.skr-board-grid.is-single { grid-template-columns: minmax(0, 1fr); }
#skr-chart-modes { margin-bottom: 6px; }
@media (max-width: 640px) {
  .skr-btn-group-label { min-width: 0; width: 100%; }
}

/* 2026-11-30 (feedback #633): Compare grid lines and a wider first column, VCM% source note */
.skr-cmp-grid { border-collapse: collapse; }
.skr-cmp-grid th, .skr-cmp-grid td { border: 1px solid var(--line, rgba(0, 0, 0, 0.12)); padding: 6px 10px; }
.skr-cmp-grid tbody th:first-child, .skr-cmp-grid thead th:first-child { min-width: 14rem; white-space: normal; text-align: left; }
.skr-cmp-impact tbody th:first-child { min-width: 16rem; }
.skr-cmp-diff { background: var(--surface-muted, rgba(0, 0, 0, 0.03)); }
.skr-cmp-why + .skr-cmp-why { margin-top: 6px; }
.skr-vcm-note { margin-top: 6px; }

/* #640 (Cindy's v3 review): the "why" text on a result tag as a small
   popover (hover, keyboard focus, tap), instead of a wide column. Fixed, so
   the sideways-scrolling table wrap never clips it; placePop() sets top/left. */
.skr-pop { position: relative; display: inline-block; }
.skr-pop-btn { border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: help; border-radius: 999px; }
.skr-pop-btn:focus-visible { outline: 2px solid var(--heritage-red); outline-offset: 2px; }
.skr-pop-body {
  display: none; position: fixed; z-index: 1000;
  width: max-content; max-width: min(340px, 80vw); padding: 8px 10px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: 0.82rem; color: var(--ink-soft);
  text-align: left; white-space: normal;
}
.skr-pop-body .skr-cmp-why { display: block; }
.skr-pop-body .skr-cmp-why + .skr-cmp-why { margin-top: 6px; }
@media (hover: hover) { .skr-pop:hover .skr-pop-body { display: block; } }
.skr-pop-btn:focus-visible + .skr-pop-body, .skr-pop.is-open .skr-pop-body { display: block; }
/* Hover bridge over the 4px gap, so the pointer can move from the tag onto the popover (WCAG 1.4.13). */
.skr-pop-body::before { content: ''; position: absolute; left: 0; right: 0; top: -6px; height: 6px; }
.skr-pop-body[data-side="above"]::before { top: auto; bottom: -6px; }
/* Escape hides it (hover, focus or tap) until the pointer leaves or the tag gets focus again. Kept after the show rules. */
.skr-pop.is-dismissed .skr-pop-body { display: none; }

/* #648 (Cindy's v4 review, server switch SKU_RAT_V4_LAYOUT): a fixed top
   section, pinned left-aligned table headers, tables that use the full card.
   Every rule is scoped to .skr-top / .skr-v4 / .skr-v4-table / .skr-pin,
   which the page adds only when the switch is on (off = the page as before). */
.skr-top {
  position: sticky; top: var(--skr-top-y, 0px); z-index: 4;
  background: var(--eggshell-bright); padding: 4px 0 12px; margin-bottom: 0;
}
.skr-top .page-hero { margin: 0 0 8px; padding: 14px 22px 12px; }
.skr-top .page-hero-desc { max-width: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skr-top .page-hero-metrics { margin-top: 8px; }
.skr-top .skr-toolbar { margin-bottom: 0; padding: 10px 16px 0; gap: 8px; }
.skr-v4-controls { align-items: flex-end; }
.skr-v4-filters { display: flex; flex-direction: column; gap: 6px; }
.skr-v4-filters .skr-pill { min-height: 32px; padding: 2px 12px; }
.skr-v4-na { margin: 0; }
.skr-v4 .skr-v4-card { padding-top: 12px; }
.skr-v4-table { width: 100%; font-size: 0.88rem; }
.skr-v4-table th, .skr-v4-table td, .skr-v4-table .num, .skr-v4-table thead th.num { text-align: left; }
.skr-v4-table th, .skr-v4-table td { padding: 6px 8px; }
.skr-v4-table .skr-v4-desc { min-width: 11rem; }
/* Pinned header: the header row sticks under the fixed top section while the
   page scrolls (the wrap is not a scroll box, so the page is). */
.skr-pin { overflow: visible; }
.skr-pin thead th {
  position: sticky; top: calc(var(--skr-top-y, 0px) + var(--skr-top-h, 0px)); z-index: 2;
  background: var(--paper); box-shadow: inset 0 -1px 0 var(--rule);
}
/* A table wider than its card (v4FitTables) scrolls sideways in its own box.
   The box is as tall as its table, so the page scrolls it up and down, and
   v4PinWide moves the header row down (--skr-pin-dy) to stay under the
   fixed top section. A box that also scrolled up and down slid its header
   under the top section once the page scrolled (PR #782 review). */
.skr-pin.is-wide { overflow: auto; max-height: none; }
.skr-pin.is-wide thead th { top: 0; }
.skr-pin.is-wide thead th { transform: translateY(var(--skr-pin-dy, 0px)); }
/* The wide box's own scrollbar is at the end of a long list. v4SideBar adds
   a copy that stays at the bottom of the screen while the table is in view
   (a plain mouse can drag it), and the box's own bar is hidden. */
@media (min-width: 761px) and (min-height: 641px) {
  .skr-pin-box > .skr-pin.is-wide { scrollbar-width: none; }
  .skr-pin-box > .skr-pin.is-wide::-webkit-scrollbar { display: none; }
}
.skr-pin-bar {
  position: sticky; bottom: 0; z-index: 3; height: 16px; overflow-x: scroll; overflow-y: hidden;
  background: var(--paper); box-shadow: 0 -1px 0 var(--rule);
}
.skr-pin-bar > div { height: 1px; }
.skr-pin-bar[hidden] { display: none; }
.skr-pin-bar::-webkit-scrollbar { height: 14px; }
.skr-pin-bar::-webkit-scrollbar-track { background: var(--paper); }
.skr-pin-bar::-webkit-scrollbar-thumb { background: var(--ink-mute); border-radius: 7px; border: 3px solid var(--paper); }
/* Laptop screens up to 820 tall (1366x650, 1536x730, 1280x800): the whole
   top section left room for 1 to 3 list rows (PR #782 review). There the
   title, subtitle and KPI numbers scroll away: the section sticks
   --skr-top-off higher (v4Measure: the height above the toolbar), so only
   Hurdles, Data, Export, the Channel / segment buttons and the tabs stay on
   screen, in a tighter toolbar. --skr-top-short tells v4Measure. Taller
   screens keep the whole top section. */
@media (min-width: 761px) and (min-height: 641px) and (max-height: 820px) {
  .skr-top { --skr-top-short: 1; top: calc(var(--skr-top-y, 0px) - var(--skr-top-off, 0px)); padding-bottom: 4px; }
  .skr-top .skr-toolbar { padding-top: 2px; gap: 4px; }
  .skr-v4-controls { align-items: center; }
  .skr-v4-controls .skr-field { flex-direction: row; align-items: center; gap: 8px; }
  .skr-v4-controls .form-input, .skr-v4-controls .btn { height: 32px; min-height: 32px; padding-top: 4px; padding-bottom: 4px; }
  .skr-v4-filters { gap: 4px; }
  .skr-v4-filters .skr-pill { min-height: 26px; }
  .skr-top .skr-tab { min-height: 30px; padding: 2px 12px; }
}
/* Small or short screens: the top section scrolls away (it would cover the page). */
@media (max-width: 760px), (max-height: 640px) {
  .skr-top { position: static; }
  .skr-top .page-hero-desc { white-space: normal; }
  .skr-pin { overflow-x: auto; }
  .skr-pin thead th { top: 0; }
  .skr-pin.is-wide { max-height: 80vh; }
  .skr-pin.is-wide thead th { transform: none; }
  .skr-pin-bar { display: none; }
}
/* ============================================================
   Food Show Requests (FB #596, 2026-11-20). Additive only: every
   selector is namespaced under .fs / .fs-* and uses brand tokens
   (no raw hex). Mobile first; checked at 390px.
   ============================================================ */

.fs { display: flex; flex-direction: column; gap: 16px; padding-bottom: 96px; }
/* Conditional parts are toggled with the hidden attribute; the display rules
   below (flex / grid) would otherwise override it and show every question. */
.fs [hidden] { display: none !important; }
.fs-muted { color: var(--ink-mute); font-size: 0.85rem; }
.fs-hint { color: var(--ink-mute); font-size: 0.8rem; margin-top: 4px; }
.fs-note { color: var(--ink-soft); font-size: 0.85rem; margin: 8px 0 0; }
.fs-req { color: var(--heritage-red); }

/* buttons */
.fs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-strong);
  font: inherit; font-size: 0.9rem; text-decoration: none;
}
.fs-btn:hover { border-color: var(--ink-mute); }
.fs-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.fs-btn--primary { background: var(--heritage-red); border-color: var(--heritage-red); color: var(--warm-white); font-weight: 600; }
.fs-btn--ghost { background: transparent; }
.fs-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* list */
.fs-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.fs-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fs-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--rule-soft); }
.fs-tab { border: 0; background: none; padding: 8px 12px; min-height: 44px; cursor: pointer; color: var(--ink-soft); border-bottom: 2px solid transparent; font: inherit; }
.fs-tab.is-active { color: var(--ink-strong); border-bottom-color: var(--heritage-red); font-weight: 600; }
.fs-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.fs-filters input, .fs-filters select { min-height: 40px; flex: 1 1 180px; }
.fs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.fs-card {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 10px;
  border: 1px solid var(--rule-soft); background: var(--paper); color: inherit; text-decoration: none;
}
.fs-card:hover, .fs-card:focus-visible { border-color: var(--heritage-gold); outline: none; }
.fs-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fs-card-title { font-weight: 600; color: var(--ink-strong); }
.fs-card-meta { color: var(--ink-soft); font-size: 0.85rem; }
.fs-id { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.02em; }
.fs-pending-tag { color: var(--warning); font-weight: 600; }

/* status chips */
.fs-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; border: 1px solid var(--rule); color: var(--ink-soft); }
.fs-chip--ok { border-color: var(--success); color: var(--success-deep); }
.fs-chip--warn { border-color: var(--warning); color: var(--ink-strong); background: var(--warning-bg, var(--surface-alt)); }
.fs-chip--info { border-color: var(--heritage-gold); color: var(--ink-strong); }

/* form */
.fs-form { display: flex; flex-direction: column; gap: 16px; }
/* FB #605: each form section is its own card, the same box as the FSV Promotions
   form sections (.fsvp-card: warm-white, --rule border, 12px radius), so the
   sections stand out from the page and from each other. The title sits inside
   the card like the FSV section heading (serif italic, 1.05rem). Floating the
   legend at full width takes it out of the border line, so it gets the full
   card width and does not wrap; the fields below clear it. */
.fs-section { border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; margin: 0; background: var(--warm-white); min-width: 0; }
.fs-section > legend {
  float: left; width: 100%; box-sizing: border-box; padding: 0; margin: 0 0 10px;
  font-family: var(--font-serif); font-size: 1.05rem; font-style: italic; font-weight: 700;
  line-height: 1.2; letter-spacing: -0.02em; color: var(--ink-strong);
}
.fs-section > legend ~ * { clear: both; }
.fs-subsection { border-left: 3px solid var(--heritage-gold); padding: 4px 0 4px 12px; margin: 10px 0; }
.fs-subsection h4 { margin: 0 0 6px; font-size: 0.95rem; }
.fs-field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; min-width: 0; }
.fs-field.is-missing > .fs-label { color: var(--danger); }
.fs-field.is-missing input, .fs-field.is-missing select, .fs-field.is-missing textarea, .fs-field.is-missing .fs-checks { outline: 2px solid var(--danger); outline-offset: 1px; }
.fs-label { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.fs-field input, .fs-field select, .fs-field textarea, .fs-prod-row input, .fs-prod-row select { min-height: 40px; width: 100%; box-sizing: border-box; font: inherit; }
.fs-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.fs-row--ync { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.fs-row--money { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.fs-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.fs-check { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: 0.9rem; }
.fs-check input { width: 20px; height: 20px; }
.fs-pend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 4px; font-size: 0.85rem; }
.fs-pend-date { display: inline-flex; align-items: center; gap: 6px; }
.fs-pend-date input { min-height: 36px; width: auto; }
.fs-prod-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 110px 44px; gap: 6px; align-items: center; margin-bottom: 6px; }
.fs-prod-name { font-size: 0.9rem; }
.fs-total { margin: 8px 0; font-size: 0.95rem; }
.fs-missing, .fs-dupes { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--warning); background: var(--warning-bg, var(--surface-alt)); }
.fs-missing ul, .fs-dupes ul { margin: 6px 0; padding-left: 20px; }
.fs-form-actions {
  position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
  padding: 10px 0; background: var(--surface, var(--paper)); border-top: 1px solid var(--rule-soft);
}

/* detail */
.fs-detail { display: flex; flex-direction: column; gap: 14px; }
.fs-detail-head h2 { margin: 6px 0 2px; }
.fs-detail-title { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.fs-back { color: var(--ink-soft); text-decoration: none; font-size: 0.85rem; }
.fs-next { margin: 8px 0 0; font-weight: 600; color: var(--ink-strong); }
.fs-panel { border: 1px solid var(--rule-soft); border-radius: 10px; padding: 14px 16px; background: var(--paper); }
.fs-panel h3 { margin: 0 0 8px; font-size: 1.02rem; }
.fs-panel--action { border-color: var(--heritage-gold); }
.fs-panel--action textarea, .fs-panel--action input { width: 100%; box-sizing: border-box; min-height: 40px; font: inherit; margin-bottom: 6px; }
.fs-dl { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 6px 12px; margin: 0; }
.fs-dl dt { color: var(--ink-mute); font-size: 0.85rem; }
.fs-dl dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.fs-sub h4 { margin: 8px 0 4px; font-size: 0.92rem; }
.fs-callout { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface-alt); }
.fs-callout ul { margin: 6px 0 0; padding-left: 20px; }
.fs-callout--warn { border-color: var(--warning); background: var(--warning-bg, var(--surface-alt)); }
.fs-callout--ok { border-color: var(--success); }
.fs-ws-list { display: flex; flex-direction: column; gap: 10px; }
.fs-ws { border: 1px solid var(--rule-soft); border-radius: 8px; padding: 10px 12px; }
.fs-ws.is-done { border-color: var(--success); }
.fs-ws-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fs-ws-edit { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-top: 8px; align-items: end; }
.fs-ws-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--ink-soft); }
.fs-ws-edit select, .fs-ws-edit input, .fs-ws-edit textarea { min-height: 40px; font: inherit; width: 100%; box-sizing: border-box; }
.fs-ws-evidence { grid-column: 1 / -1; }
.fs-evidence { margin-top: 4px; white-space: pre-line; font-size: 0.88rem; }
.fs-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fs-history li { border-left: 2px solid var(--rule); padding-left: 10px; font-size: 0.88rem; }
.fs-when { color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.fs-comment { color: var(--ink-soft); margin-top: 2px; white-space: pre-line; }

@media (max-width: 600px) {
  .fs-section { padding: 12px; }
  .fs-cards { grid-template-columns: 1fr; }
  .fs-dl { grid-template-columns: 1fr; }
  .fs-dl dt { margin-top: 6px; }
  .fs-prod-row { grid-template-columns: 1fr 1fr 44px; }
  .fs-prod-row select[data-prod="upc"], .fs-prod-row .fs-prod-name { grid-column: 1 / -1; }
  /* FB #646: with the search box on, the product picker's wrapper is the grid item. */
  .fs-prod-row > div:has(> select[data-prod="upc"]) { grid-column: 1 / -1; }
  .fs-form-actions { justify-content: stretch; }
  .fs-form-actions .fs-btn { flex: 1 1 auto; }
  .fs-toolbar-actions { width: 100%; }
  .fs-toolbar-actions .fs-btn { flex: 1 1 auto; }
}
/* ============================================================
   Retail Promotions (FB #583, 2026-11-23, Jenna Yang's layout).
   Additive only: every selector is namespaced under .rp / .rp-*
   and uses brand tokens (no raw hex). Mobile first; 390px safe
   (tables scroll inside .rp-table-wrap).
   ============================================================ */

.rp { display: flex; flex-direction: column; gap: 16px; padding-bottom: 96px; }
.rp [hidden] { display: none !important; }
.rp-muted { color: var(--ink-mute); font-size: 0.85rem; }
.rp-hint { color: var(--ink-mute); font-size: 0.8rem; margin-top: 4px; }

/* tabs (Deal Request / Promotion Case / Deal Library / Lists) */
.rp-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--rule-soft); }
.rp-tab { padding: 10px 14px; min-height: 44px; display: inline-flex; align-items: center; color: var(--ink-soft); text-decoration: none; border-bottom: 3px solid transparent; }
.rp-tab.is-active { color: var(--ink-strong); border-bottom-color: var(--heritage-red); font-weight: 600; }

.rp-card { background: var(--paper); border: 1px solid var(--rule-soft); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.rp-h2 { font-size: 1.2rem; margin: 0; color: var(--ink-strong); }
.rp-h3 { font-size: 1rem; margin: 12px 0 4px; color: var(--ink-strong); }
.rp-crumb { margin: 0; font-size: 0.85rem; color: var(--ink-mute); }
.rp-crumb a { color: var(--heritage-red); }

/* buttons */
.rp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-strong);
  font: inherit; font-size: 0.9rem; text-decoration: none;
}
.rp-btn:hover { border-color: var(--ink-mute); }
.rp-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.rp-btn--primary { background: var(--heritage-red); border-color: var(--heritage-red); color: var(--warm-white); font-weight: 600; }
.rp-btn--ghost { background: transparent; }
.rp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* filters */
.rp-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rp-filters input[type="search"], .rp-filters select { min-height: 40px; flex: 1 1 180px; }
.rp-filters .rp-new { margin-left: auto; }
.rp-count { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: 999px; background: var(--heritage-red); color: var(--warm-white); font-size: 0.75rem; text-align: center; }

/* tables */
.rp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.rp-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-mute); background: var(--paper-2, var(--paper)); padding: 8px; border-bottom: 1px solid var(--rule-soft); white-space: nowrap; }
.rp-table td { padding: 10px 8px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.rp-row { cursor: pointer; }
.rp-row:hover, .rp-row:focus { background: var(--paper-2, var(--paper)); outline: none; }
.rp-row.is-waiting td:first-child { box-shadow: inset 3px 0 0 var(--heritage-red); }
.rp-id { font-weight: 600; white-space: nowrap; }
.rp-nowrap { white-space: nowrap; }
tr.is-bad td { background: color-mix(in srgb, var(--heritage-red) 6%, transparent); }

/* status chips */
.rp-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; white-space: nowrap; border: 1px solid var(--rule-soft); }
.rp-chip--neutral { background: var(--paper-2, var(--paper)); color: var(--ink-soft); }
.rp-chip--warn { background: color-mix(in srgb, var(--gold, var(--heritage-red)) 18%, transparent); color: var(--ink-strong); }
.rp-chip--bad { background: color-mix(in srgb, var(--heritage-red) 14%, transparent); color: var(--heritage-red); }
.rp-chip--ok { background: color-mix(in srgb, var(--jade, var(--ink-soft)) 16%, transparent); color: var(--ink-strong); }
.rp-chip--info { background: color-mix(in srgb, var(--ink-soft) 10%, transparent); color: var(--ink-strong); }

/* form */
.rp-form { display: flex; flex-direction: column; gap: 14px; }
.rp-field { display: flex; flex-direction: column; gap: 4px; }
.rp-label { font-weight: 600; font-size: 0.88rem; color: var(--ink-strong); }
.rp-field input, .rp-field select, .rp-field textarea, .rp-form > .rp-field output { min-height: 40px; font: inherit; }
.rp-readonly { display: block; padding: 8px 10px; border-radius: 6px; background: var(--paper-2, var(--paper)); border: 1px solid var(--rule-soft); color: var(--ink-soft); }
.rp-row2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .rp-row2 { grid-template-columns: 1fr 1fr; } .rp-field { display: grid; grid-template-columns: 200px 1fr; column-gap: 16px; align-items: start; } .rp-field > .rp-label { padding-top: 10px; } .rp-field > :not(.rp-label) { grid-column: 2; } .rp-row2 .rp-field { display: flex; } }
.rp-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; }
.rp-checks--states { max-height: 180px; overflow-y: auto; }
.rp-check { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-size: 0.9rem; }
.rp-chip-input { display: flex; gap: 8px; }
.rp-chip-input input { flex: 1 1 auto; }
.rp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.rp-person { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--paper-2, var(--paper)); border: 1px solid var(--rule-soft); font-size: 0.85rem; }
.rp-x { border: 0; background: none; cursor: pointer; font-size: 1rem; min-width: 28px; min-height: 28px; color: var(--ink-mute); }
.rp-lines input { width: 100%; min-width: 80px; min-height: 36px; }
.rp-line-err { color: var(--heritage-red); font-size: 0.78rem; }
.rp-upload { position: relative; }
.rp-deal-pick { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.rp-deal { align-items: flex-start; }

/* detail */
.rp-detail-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.rp-dl { display: grid; grid-template-columns: 1fr; gap: 8px 24px; margin: 0; }
@media (min-width: 640px) { .rp-dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rp-dl div { display: flex; flex-direction: column; gap: 2px; }
.rp-dl dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-mute); }
.rp-dl dd { margin: 0; color: var(--ink-strong); overflow-wrap: anywhere; }
.rp-status-strip { padding: 10px 12px; border-radius: 8px; background: var(--paper-2, var(--paper)); border: 1px solid var(--rule-soft); }
.rp-status-strip .rp-dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rp-banner { padding: 10px 12px; border-radius: 8px; background: var(--paper-2, var(--paper)); border-left: 3px solid var(--ink-mute); margin: 0; }
.rp-banner--warn { border-left-color: var(--heritage-red); }
.rp-review, .rp-sub { border-top: 1px solid var(--rule-soft); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.rp-review textarea { min-height: 72px; font: inherit; }
.rp-events { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; }
.rp-comment { margin-top: 2px; color: var(--ink-soft); white-space: pre-wrap; }
.rp-files { margin: 0; padding-left: 20px; }
.rp-preview, .rp-history { border-top: 1px solid var(--rule-soft); padding-top: 8px; }
/* Food Show Requests, Phase 1 updates (FB #606): CC pickers, automatic
   routing box, Current status / Pending with / Next action. Brand tokens
   only. Kept apart from 75-food-show.css; shown only with
   FOOD_SHOW_CC_AUTOROUTE on. */
.fs-cc-chips { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.fs-cc-chips:empty { display: none; }
.fs-cc-chip { display: inline-flex; align-items: center; gap: 2px; padding: 0 0 0 10px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); color: var(--ink-strong); font-size: 0.85rem; }
.fs-cc-x { border: 0; background: none; color: var(--ink-mute); cursor: pointer; min-width: 44px; min-height: 44px; font: inherit; }
.fs-cc-x:hover, .fs-cc-x:focus-visible { color: var(--heritage-red); }
.fs-auto { border-left: 3px solid var(--heritage-gold); padding: 6px 0 6px 12px; margin: 10px 0; }
.fs-progress { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 16px; margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--rule-soft); border-radius: 8px; background: var(--surface-alt, var(--paper)); }
.fs-progress dt { font-size: 0.75rem; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.03em; }
.fs-progress dd { margin: 2px 0 0; font-weight: 600; color: var(--ink-strong); }
/* ─────────────────────────────────────────────────────────────────────────
 * Employee Store (phase 1): storefront (mobile first), order desk console,
 * pickup scan and printable poster. Brand tokens from 00-reset.css only
 * (no hex here). Gateway corners mark product imagery, the budget card, the
 * pickup QR, the scanner viewfinder and the poster, never plain data tables.
 * Status colour is semantic: green = paid / ok, red = unpaid / over / blocked,
 * and always comes with a word and an icon.
 * ───────────────────────────────────────────────────────────────────────── */

.es, .es-console { --es-radius: 16px; --es-serif: 'Playfair Display', Georgia, 'Songti SC', 'Noto Serif SC', serif; color: var(--ink); }
.es-app { max-width: 560px; margin: 0 auto; background: var(--eggshell-bright); min-height: 100%; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); position: relative; }
.es-main { padding: 0 18px 24px; }
.es-h1 { font-family: var(--es-serif); font-style: italic; letter-spacing: -0.02em; font-size: 30px; line-height: 1.15; margin: 16px 0 8px; }
.es-h2 { font-family: var(--es-serif); font-style: italic; letter-spacing: -0.02em; font-size: 22px; margin: 22px 0 10px; }
.es-eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute); margin: 0 0 4px; font-weight: 700; }
.es-muted { color: var(--ink-mute); }
.es-small { font-size: 13px; }
.es-nowrap { white-space: nowrap; }
.es-ok { color: var(--success); font-weight: 700; }
.es-bad { color: var(--heritage-red); font-weight: 700; }

/* header */
.es-head { background: linear-gradient(180deg, var(--heritage-red) 0%, var(--heritage-red-dark) 100%); color: var(--warm-white); padding: 14px 18px 56px; }
.es-head--compact { padding-bottom: 14px; }
.es-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.es-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.es-mark { display: inline-grid; place-items: center; background: var(--warm-white); color: var(--heritage-red); border-radius: 50% 50% 8px 8px; font-weight: 800; font-size: 12px; padding: 6px 8px; }
.es-brand-name { display: block; font-family: var(--es-serif); font-style: italic; font-size: 20px; }
.es-brand-sub { display: block; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--heritage-gold-light); }
.es-head-actions { display: flex; gap: 8px; align-items: center; }
.es-pill { border: 1px solid var(--heritage-gold-light); color: inherit; border-radius: 999px; padding: 6px 12px; font-size: 13px; text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.es-cart-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--heritage-red-deep); color: inherit; text-decoration: none; }
.es-badge { position: absolute; top: -2px; right: -2px; background: var(--heritage-gold); color: var(--ink-strong); border-radius: 999px; font-size: 11px; font-weight: 800; min-width: 18px; padding: 1px 5px; text-align: center; }
.es-greet { margin: 10px 0 0; font-size: 15px; color: var(--warm-white); }

/* gateway corners */
.es-gw-frame, .es-art { position: relative; }
.es-gw-frame::before, .es-gw-frame::after, .es-gw::before, .es-gw::after { content: ''; position: absolute; width: 14px; height: 14px; border-color: var(--heritage-gold); border-style: solid; pointer-events: none; }
.es-gw-frame::before, .es-gw::before { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.es-gw-frame::after, .es-gw::after { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

/* budget meter */
.es-budget { background: var(--warm-white); border-radius: 22px; padding: 16px 18px; margin: -42px 0 14px; box-shadow: 0 6px 20px color-mix(in srgb, var(--ink) 12%, transparent); }
.es-budget-fig { margin: 0 0 10px; }
.es-budget-fig strong { font-family: var(--es-serif); font-style: italic; font-size: 34px; color: var(--heritage-red); white-space: nowrap; }
:lang(zh) .es-budget-fig strong, :lang(zh-HK) .es-budget-fig strong { font-size: 30px; }
.es-meter { position: relative; height: 12px; background: var(--eggshell-shade); border-radius: 999px; overflow: hidden; display: flex; }
.es-meter-paid { background: var(--heritage-gold); }
.es-meter-pending { background: repeating-linear-gradient(135deg, var(--heritage-red) 0 6px, var(--heritage-red-deep) 6px 12px); opacity: 0.85; }
.es-meter-preview { background: color-mix(in srgb, var(--heritage-red) 40%, transparent); }
.es-meter-grace { position: absolute; top: 0; bottom: 0; right: 0; background: color-mix(in srgb, var(--warm-white) 55%, transparent); border-left: 2px dashed var(--heritage-gold-dark); }
.es-budget-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink-soft); margin-top: 8px; }
.es-budget-pending { font-size: 12.5px; color: var(--heritage-red-dark); margin: 6px 0 0; }

.es-banner { background: var(--heritage-purple); color: var(--warm-white); border-radius: var(--es-radius); padding: 12px 14px; margin: 10px 0; font-size: 14.5px; }
.es-banner--warn { background: var(--warning); color: var(--ink-strong); }
.es-search input { width: 100%; min-height: 48px; border-radius: 999px; border: 1px solid var(--rule); padding: 0 18px; background: var(--warm-white); font-size: 15px; margin: 10px 0; }
.es-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.es-chip { flex: none; border-radius: 999px; border: 1px solid var(--rule); background: var(--warm-white); padding: 8px 16px; min-height: 40px; color: var(--ink); text-decoration: none; font-weight: 600; }
.es-chip.is-on { background: var(--ink); color: var(--warm-white); border-color: var(--ink); }

/* cards */
/* product photo tile: one square everywhere; the photo is contained (never
   cropped) and centred on white; no photo = product name on a category tint */
/* A true square at every size (card, sm, xs, hero, photo card). The photo is
   taken out of flow (absolute, inset 0), so a tall or wide image can never
   size the tile: before, the in-flow <img> (height 100%) grew the grid item
   past its aspect ratio and tall photos made tall, zoomed-looking tiles. */
.es-art { border-radius: var(--es-radius); aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden; background: white; min-width: 0; min-height: 0; height: auto; }
.es-art img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; object-position: center; padding: 8%; box-sizing: border-box; display: block; }
.es-art--photo { background: white; box-shadow: inset 0 0 0 1px var(--rule-soft); }
.es-art--ph { background: var(--es-tint, var(--eggshell-shade)); padding: 10%; box-sizing: border-box; text-align: center; align-content: center; gap: 6px; }
.es-ph-mark { font-family: var(--es-serif); font-weight: 800; font-size: 12px; letter-spacing: 0.08em; color: var(--heritage-red); opacity: 0.7; }
.es-ph-name { font-family: var(--es-serif); font-style: italic; font-size: 15px; line-height: 1.2; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.es-art--sm { width: 96px; flex: none; }
.es-art--sm .es-ph-name { font-size: 11px; }
.es-art--xs { width: 48px; flex: none; border-radius: 10px; }
.es-art--xs img { padding: 4%; }
.es-art--xs.es-art--ph { padding: 4px; }
.es-art--xs .es-ph-name { font-size: 8px; -webkit-line-clamp: 2; }
.es-art--xs .es-ph-mark, .es-art--xs .es-gw, .es-art--sm .es-gw { display: none; }
.es-art--hero { margin: 8px auto; width: 100%; max-width: 320px; }
.es-art--hero .es-ph-name { font-size: 22px; }
.es-oline { display: flex; align-items: center; gap: 10px; list-style: none; margin: 6px 0; }
.es-order-lines:has(.es-oline) { padding-left: 0; }
.es-split header { display: flex; align-items: center; gap: 10px; }
.es-deals { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.es-deal { flex: none; width: 280px; display: flex; gap: 12px; background: var(--warm-white); border-radius: var(--es-radius); border: 1px solid var(--rule); padding: 12px; color: inherit; text-decoration: none; }
.es-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .es-app { max-width: 900px; } .es-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.es-card { position: relative; background: var(--warm-white); border-radius: var(--es-radius); border: 1px solid var(--rule); padding: 8px 8px 12px; }
.es-card-link { color: inherit; text-decoration: none; display: block; }
.es-card-name { font-weight: 700; margin: 8px 0 2px; font-size: 15px; line-height: 1.25; }
.es-card-tag { position: absolute; top: 14px; left: 14px; }
.es-price { font-weight: 800; font-size: 16px; margin: 4px 0; }
.es-price s { color: var(--ink-mute); font-weight: 500; }
.es-price--big { font-size: 30px; }
.es-fav { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--warm-white); color: var(--heritage-red); font-size: 18px; cursor: pointer; }
.es-add { position: absolute; right: 10px; bottom: 10px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--heritage-red); color: var(--warm-white); font-size: 24px; cursor: pointer; }
.es-add:disabled { background: var(--eggshell-deep); color: var(--ink-mute); cursor: not-allowed; }
.es-cap { font-size: 12.5px; color: var(--ink-soft); margin: 4px 52px 0 0; }
.es-cap.is-full, .es-capline.is-full { color: var(--heritage-red); }
.es-capbox { display: inline-flex; gap: 3px; vertical-align: middle; }
.es-capbox i { width: 10px; height: 10px; border: 1.5px solid var(--heritage-gold-dark); border-radius: 2px; display: inline-block; }
.es-capbox i.on { background: var(--heritage-gold-dark); }
.es-capbox i.part { background: linear-gradient(90deg, var(--heritage-gold-dark) 50%, transparent 50%); }
.es-tag { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 8px; background: var(--eggshell-shade); color: var(--ink-soft); }
.es-tag--red { background: var(--heritage-red); color: var(--warm-white); }
.es-tag--ok { background: color-mix(in srgb, var(--success) 15%, var(--warm-white)); color: var(--success-deep); }
.es-bestby { color: var(--warning); font-weight: 700; font-size: 13px; margin: 4px 0; }

/* buttons + forms */
.es-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--rule); background: var(--warm-white); color: var(--ink); font-weight: 700; cursor: pointer; text-decoration: none; }
.es-btn--primary { background: var(--heritage-red); border-color: var(--heritage-red); color: var(--warm-white); }
.es-btn--ok { background: var(--success); border-color: var(--success); color: var(--warm-white); }
.es-btn--danger { color: var(--heritage-red); border-color: var(--heritage-red); }
.es-btn--ghost { background: transparent; }
.es-btn--small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.es-btn--wide { width: 100%; min-height: 54px; }
.es-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.es-x { border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--ink-mute); text-decoration: none; min-width: 44px; min-height: 44px; }
.es-field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 13px; color: var(--ink-soft); }
.es-field input, .es-field select, .es-field textarea { min-height: 40px; border: 1px solid var(--rule); border-radius: 10px; padding: 6px 10px; background: var(--warm-white); font: inherit; color: var(--ink); }
.es-field--wide { grid-column: 1 / -1; }
.es-form--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; align-items: end; }
.es-check { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0; }
.es-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; align-items: center; }
.es-back { display: inline-block; margin: 12px 0 4px; color: var(--heritage-red); text-decoration: none; font-weight: 600; }
.es-stepper { display: inline-flex; align-items: center; border: 1px solid var(--rule); border-radius: 999px; background: var(--warm-white); }
.es-stepper button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 20px; cursor: pointer; }
.es-stepper output { min-width: 28px; text-align: center; font-weight: 800; }
.es-stepper--sm button { width: 36px; height: 36px; }
.es-sticky { position: sticky; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 10px; align-items: center; padding: 18px 0 10px; background: linear-gradient(180deg, transparent, var(--eggshell-bright) 40%); }
.es-sticky .es-btn--primary { flex: 1; min-height: 54px; }

/* recipe, cart, orders */
.es-recipe { background: var(--warm-white); border-radius: 22px; padding: 16px 18px; margin: 16px 0; }
.es-recipe ol { padding-left: 20px; }
.es-recipes { background: var(--warm-white); border-radius: 22px; padding: 16px 18px; margin: 16px 0; }
.es-recipe-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.es-recipe-idea { display: flex; gap: 12px; align-items: center; }
.es-recipe-idea img { width: 120px; height: 93px; object-fit: cover; border-radius: 12px; flex: none; }
.es-lines { list-style: none; padding: 0; margin: 12px 0; }
.es-line { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 8px; align-items: center; background: var(--warm-white); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.es-total { display: flex; justify-content: space-between; font-size: 17px; padding: 10px 0; border-top: 1px solid var(--rule); }
.es-alert { border-radius: var(--es-radius); padding: 12px 14px; margin: 10px 0; }
.es-alert--bad { background: color-mix(in srgb, var(--heritage-red) 10%, var(--warm-white)); color: var(--heritage-red-dark); border: 1px solid color-mix(in srgb, var(--heritage-red) 35%, transparent); }
.es-flag { font-size: 13.5px; margin: 6px 0; }
.es-flag--block { color: var(--heritage-red-dark); font-weight: 700; }
.es-flag--review, .es-flag--info { color: var(--warning); }
.es-order { background: var(--warm-white); border-radius: var(--es-radius); border: 1px solid var(--rule); padding: 14px; margin: 12px 0; }
.es-order-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.es-order-lines { padding-left: 18px; margin: 8px 0; }
.es-timeline { list-style: none; padding: 0; margin: 10px 0; }
.es-step { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; color: var(--ink-mute); }
.es-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--rule); display: grid; place-items: center; font-size: 12px; }
.es-step.is-done { color: var(--ink); }
.es-step.is-done .es-dot { background: var(--success); border-color: var(--success); color: var(--warm-white); }
.es-step.is-now .es-dot { border-color: var(--heritage-red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--heritage-red) 20%, transparent); }
.es-now { font-style: normal; font-size: 11px; background: var(--heritage-red); color: var(--warm-white); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }

/* pickup pass */
.es-pass { border-radius: 26px; padding: 18px; margin: 14px 0; color: var(--warm-white); }
.es-pass--paid { background: var(--success); }
.es-pass--unpaid { background: var(--heritage-red); }
.es-pass-state { font-size: 40px; font-weight: 900; letter-spacing: 0.04em; margin: 0 0 12px; text-align: center; }
.es-ticket { background: var(--warm-white); color: var(--ink); border-radius: 22px; padding: 16px; }
.es-qr-wrap { background: white; border-radius: 16px; padding: 18px; margin: 12px auto; max-width: 280px; position: relative; }
.es-qr svg { width: 100%; height: auto; display: block; }
.es-qr-wrap.is-locked .es-qr { filter: grayscale(1) opacity(0.25); }
.es-qr-lock { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; color: var(--heritage-red); font-size: 18px; text-align: center; }

/* not eligible + split */
.es-inelig { background: var(--warm-white); border-radius: 22px; padding: 28px 22px; margin: 20px 0; text-align: center; }
.es-inelig-icon { font-size: 48px; }
.es-inelig-date { font-weight: 800; color: var(--heritage-purple); }
.es-split, .es-split-start { background: var(--warm-white); border-radius: var(--es-radius); border: 1px solid var(--rule); padding: 14px; margin: 12px 0; }
.es-split-start { display: flex; gap: 14px; }
.es-slots { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.es-slot { min-width: 64px; min-height: 44px; display: grid; place-items: center; border-radius: 12px; border: 2px dashed var(--rule); font-size: 13px; color: var(--ink-mute); padding: 4px 8px; }
.es-slot.is-filled { border-style: solid; border-color: var(--heritage-gold); color: var(--ink); background: var(--paper); }

/* bottom tabs */
/* The bar's size lives in ONE place: --es-tab-h is the tab row and
   --es-tabbar-h the whole bar (1px top border + 6px + tab row + 6px + the
   safe area). The bar takes its height from --es-tabbar-h, so the footer
   reserve below is the bar's real height, not a guess. Labels stay on one
   line (the longest, "Compartir" / "Favoritos", fits a 320px screen). */
:root { --es-tab-h: 44px; --es-tabbar-h: calc(1px + 6px + var(--es-tab-h) + 6px + env(safe-area-inset-bottom)); }
.es-tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(560px, 100%); height: var(--es-tabbar-h); box-sizing: border-box; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--warm-white); border-top: 1px solid var(--rule); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
/* The fixed bar covered the shell footer ("Lee Kum Kee · AI Operations" /
   disclaimer) at every scroll position (visual sweep 11-26..11-28, desktop,
   tablet and phone): .es-app's own bottom padding does not reach the footer,
   which sits after #view in the shell. While the bar is on the page the
   footer keeps its own bottom padding (24px from 03-shell.css; the compact
   16px that 97-mobile-optimize.css gives it at <=880px) as the gap above
   the bar, plus exactly the bar's height (safe area included). */
body:has(.es-tabbar) .app-footer { padding-bottom: calc(24px + var(--es-tabbar-h)); }
@media (max-width: 880px) {
  body:has(.es-tabbar) .app-footer { padding-bottom: calc(16px + var(--es-tabbar-h)); }
}
.es-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--ink-mute); text-decoration: none; min-height: var(--es-tab-h); white-space: nowrap; justify-content: center; }
.es-tab.is-active { color: var(--heritage-red); font-weight: 700; }
.es-feedback { padding: 0 18px; }

/* Help tab (EMPLOYEE_STORE_HELP_TAB): on shopper pages the global feedback and
   Ask buttons sat on top of the bottom bar (Orders, Pass). The store renderer
   sets body.es-shopper on shopper pages only (never the order desk, scan or
   poster); app.js route() drops it everywhere else. Help lives in the bar. */
body.es-shopper .feedback-fab,
body.es-shopper .feedback-fab-tooltip,
body.es-shopper .agent-fab,
body.es-shopper .agent-fab-tooltip { display: none !important; }
.es-chip--fav { color: var(--heritage-red); border-color: var(--heritage-red); }
.es-faq { display: flex; flex-direction: column; gap: 8px; }
.es-faq-item { background: var(--warm-white); border: 1px solid var(--rule); border-radius: var(--es-radius); padding: 0 16px; }
.es-faq-item summary { min-height: 48px; display: flex; align-items: center; font-weight: 700; cursor: pointer; list-style: none; }
.es-faq-item summary::-webkit-details-marker { display: none; }
.es-faq-item summary::after { content: '+'; margin-left: auto; padding-left: 12px; color: var(--heritage-red); font-size: 20px; }
.es-faq-item[open] summary::after { content: '−'; }
.es-faq-item p { margin: 0 0 14px; line-height: 1.45; }
.es-help-card { background: var(--warm-white); border-radius: 22px; padding: 16px 18px; margin: 18px 0; }
.es-help-card .es-h2 { margin-top: 0; }

/* ── console ── */
.es-console { padding: 0 0 40px; position: relative; }
.es-ctabs, .es-stabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); margin: 8px 0 14px; }
.es-ctab, .es-stab { padding: 10px 14px; color: var(--ink-soft); text-decoration: none; border-bottom: 3px solid transparent; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.es-ctab.is-active, .es-stab.is-active { color: var(--heritage-red); border-bottom-color: var(--heritage-red); }
.es-count { background: var(--eggshell-shade); border-radius: 999px; font-size: 11.5px; padding: 1px 7px; }
.es-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.es-kpi { background: var(--warm-white); border: 1px solid var(--rule); border-radius: var(--es-radius); padding: 14px 16px; }
.es-kpi-v { font-family: var(--es-serif); font-size: 28px; margin: 2px 0; color: var(--heritage-red); }
.es-kpi--gold { background: linear-gradient(135deg, var(--paper), var(--eggshell-shade)); border-color: var(--heritage-gold); }
.es-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.es-csearch { flex: 1 1 260px; }
.es-csearch input { width: 100%; min-height: 44px; border-radius: 999px; border: 1px solid var(--rule); padding: 0 16px; background: var(--warm-white); }
.es-fchips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.es-fchip { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; text-decoration: none; border: 1px solid transparent; white-space: nowrap; }
a.es-fchip { min-height: 32px; }
.es-fchip.is-on { outline: 2px solid var(--ink); }
.es-fchip--quota { background: color-mix(in srgb, var(--heritage-red) 12%, var(--warm-white)); color: var(--heritage-red-dark); }
.es-fchip--cap { background: color-mix(in srgb, var(--warning) 18%, var(--warm-white)); color: var(--heritage-gold-dark); }
.es-fchip--dup { background: color-mix(in srgb, var(--heritage-purple) 14%, var(--warm-white)); color: var(--heritage-purple-dark); }
.es-fchip--elig { background: var(--ink-strong); color: var(--warm-white); }
.es-fchip--unpaid { background: var(--heritage-red); color: var(--warm-white); }
.es-fchip--info { background: var(--eggshell-shade); color: var(--ink-soft); }
.es-schip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; background: var(--eggshell-shade); white-space: nowrap; }
.es-schip--new { background: color-mix(in srgb, var(--heritage-purple) 14%, var(--warm-white)); color: var(--heritage-purple-dark); }
.es-schip--paid, .es-schip--released { background: color-mix(in srgb, var(--success) 15%, var(--warm-white)); color: var(--success-deep); }
.es-schip--cancelled { color: var(--ink-mute); text-decoration: line-through; }
.es-bulk { display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--warm-white); border-radius: 14px; padding: 8px 14px; margin: 8px 0; }
.es-table-wrap { overflow-x: auto; background: var(--warm-white); border: 1px solid var(--rule); border-radius: var(--es-radius); }
.es-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.es-table th { background: var(--paper); text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-mute); padding: 10px; white-space: nowrap; }
.es-table td { padding: 10px; border-top: 1px solid var(--rule-soft); vertical-align: top; }
.es-table tr.is-flagged td { background: color-mix(in srgb, var(--heritage-red) 5%, var(--warm-white)); }
.es-table tr.is-muted td { color: var(--ink-mute); }
.es-table--tight td { padding: 6px 8px; }
.es-table input[type="number"], .es-table input[type="date"], .es-table select { min-height: 36px; border: 1px solid var(--rule); border-radius: 8px; padding: 2px 6px; max-width: 150px; }
.es-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--warm-white); border-left: 1px solid var(--rule); box-shadow: -10px 0 30px color-mix(in srgb, var(--ink) 15%, transparent); padding: 16px 18px 40px; overflow-y: auto; z-index: 60; }
.es-drawer-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.es-flagbox { background: var(--paper); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.es-flagbox ul { list-style: none; padding: 0; margin: 6px 0; }
.es-flow { display: flex; list-style: none; padding: 0; gap: 4px; font-size: 11.5px; }
.es-flow li { flex: 1; border-top: 4px solid var(--eggshell-shade); padding-top: 4px; text-align: center; color: var(--ink-mute); }
.es-flow li.is-done { border-top-color: var(--heritage-red); color: var(--ink); }
.es-audit { list-style: none; padding: 0; font-size: 12.5px; }
.es-audit li { padding: 3px 0; }
.es-lrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.es-lrow select { flex: 1 1 200px; min-height: 40px; }
.es-lrow input[type="number"] { width: 80px; min-height: 40px; }
/* order desk lines editor: live estimated total (EMPLOYEE_STORE_STAFF_LIVE_TOTAL) */
.es-ltotal { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 10px 0 2px; padding: 8px 12px; background: var(--paper); border-radius: 8px; font-size: 14px; }
.es-ltotal strong { font-size: 16px; }
.es-ltotal-note { margin: 0 0 8px; }
/* order on behalf: employee search box (#637); 16px keeps phones from zooming in on focus */
.es-field input.es-emp-q { font-size: 16px; }
.es-emp-count { margin: 0 0 6px; min-height: 1em; }
.es-emp-count:empty { display: none; }
.es-panel { background: var(--warm-white); border: 1px solid var(--rule); border-radius: var(--es-radius); padding: 12px 16px; margin: 12px 0; }
.es-panel summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.es-preview { background: var(--paper); border-left: 3px solid var(--heritage-gold); padding: 8px 12px; border-radius: 6px; }
.es-errors { color: var(--heritage-red-dark); font-size: 13px; max-height: 200px; overflow: auto; }

/* scan */
.es-scan { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.4fr); gap: 20px; padding: 10px 0 40px; }
@media (max-width: 860px) { .es-scan { grid-template-columns: 1fr; } }
.es-scan-form { display: flex; gap: 10px; align-items: end; }
.es-scan-form .es-field { flex: 1; }
.es-viewfinder { border-radius: 16px; overflow: hidden; background: var(--ink-strong); margin: 10px 0; }
.es-viewfinder video { width: 100%; display: block; }
.es-recent { list-style: none; padding: 0; }
.es-scan-result { background: var(--warm-white); border-radius: 22px; border: 1px solid var(--rule); padding: 22px; min-height: 360px; }
.es-scan-result.is-paid { border: 6px solid var(--success); }
.es-scan-result.is-unpaid { border: 6px solid var(--heritage-red); }
.es-scan-state { font-size: 72px; font-weight: 900; margin: 0; line-height: 1; }
.is-paid .es-scan-state { color: var(--success); }
.is-unpaid .es-scan-state { color: var(--heritage-red); }
.es-scan-dont { font-size: 22px; }
.es-checklist { list-style: none; padding: 0; font-size: 16px; }
.es-checklist li { padding: 6px 0; }

/* poster (US Letter) */
.es-poster { width: 8.5in; min-height: 11in; max-width: 100%; margin: 12px auto; background: var(--eggshell-bright); border-radius: 12px; padding: 0.8in 0.7in; text-align: center; box-sizing: border-box; }
.es-mark--big { font-size: 28px; padding: 12px 18px; }
.es-poster .es-brand-name { color: var(--heritage-red); font-size: 30px; }
.es-poster-h { font-family: var(--es-serif); font-style: italic; font-size: 54px; line-height: 1.1; color: var(--heritage-red-dark); margin: 24px 0; }
.es-poster-qr { background: white; width: 4in; max-width: 80%; margin: 0 auto; padding: 0.25in; border-radius: 16px; }
.es-poster-sub { font-size: 22px; margin: 24px 0 8px; }
.es-poster-link { font-size: 14px; color: var(--ink-mute); word-break: break-all; }
@media print {
  /* print only the poster: everything else (shell, actions, feedback button) is
     made invisible, never display:none'd, so no rule hides the feedback FAB */
  body:has(.es-poster-page) * { visibility: hidden; }
  body:has(.es-poster-page) .es-poster, body:has(.es-poster-page) .es-poster * { visibility: visible; }
  body:has(.es-poster-page) .es-poster { position: absolute; left: 0; top: 0; }
  .es-noprint { display: none !important; }
  .es-poster { margin: 0; border-radius: 0; box-shadow: none; }
  @page { size: letter; margin: 0; }
}
@media (prefers-reduced-motion: reduce) { .es-app * { transition: none !important; animation: none !important; } }

/* staff: product photos (Products tab, "Photos to check", picker) */
.es-photo-cell { display: flex; align-items: center; gap: 8px; min-width: 170px; flex-wrap: wrap; }
.es-photo-chip { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 700; background: var(--paper); color: var(--ink-mute); }
.es-photo-chip--live { background: color-mix(in srgb, var(--success) 14%, var(--warm-white)); color: var(--success); }
.es-photo-chip--check { background: color-mix(in srgb, var(--heritage-gold) 22%, var(--warm-white)); color: var(--ink-strong); }
.es-photo-check { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.es-photo-card { background: var(--warm-white); border: 1px solid var(--rule); border-radius: var(--es-radius); padding: 10px; display: grid; gap: 6px; }
.es-photo-card .es-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.es-photo-card .es-art { width: 100%; max-width: 200px; }
.es-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 10px; }
.es-picker-item { border: 1px solid var(--rule); border-radius: 12px; background: var(--warm-white); padding: 6px; text-align: left; cursor: pointer; font: inherit; }
.es-picker-item:hover, .es-picker-item:focus-visible { border-color: var(--heritage-gold); }
.es-picker-item .es-small { display: block; margin-top: 4px; overflow-wrap: anywhere; }

/* walkthrough fixes (2026-11): bulk bar, held split shares, wide export panel */
/* the bulk "Mark paid" bar: display:flex above must not beat [hidden] */
.es-bulk[hidden] { display: none; }
.es-alert--warn { background: color-mix(in srgb, var(--heritage-gold) 16%, var(--warm-white)); color: var(--ink-strong); border: 1px solid color-mix(in srgb, var(--heritage-gold) 45%, transparent); font-size: 13.5px; }
.es-fchip--held { background: color-mix(in srgb, var(--heritage-gold) 26%, var(--warm-white)); color: var(--ink-strong); }
.es-why { margin: 4px 0 0; color: var(--heritage-red-dark); }
/* SAP export / weekly DN list: a wide panel so every column shows at 1440 px;
   below that the table scrolls sideways with the first column pinned */
.es-drawer.es-drawer--wide { width: min(1320px, calc(100vw - 24px)); }
.es-table-wrap--export { max-width: 100%; overflow-x: auto; }
.es-table--sticky1 th:first-child, .es-table--sticky1 td:first-child { position: sticky; left: 0; z-index: 1; background: var(--warm-white); box-shadow: 1px 0 0 var(--rule-soft); }
.es-table--sticky1 th:first-child { background: var(--paper); }

/* DN no. (release #): typed inline in the queue / DN list / release step,
   shown big on the pickup pass, the order and the warehouse scan */
.es-dn-input { width: 17ch; min-height: 32px; border: 1px solid var(--rule); border-radius: 8px; padding: 2px 8px; font: inherit; font-size: 13px; background: var(--warm-white); color: var(--ink-strong); }
.es-dn-input:focus-visible { outline: 2px solid var(--heritage-gold); outline-offset: 1px; }
.es-dn-input.is-saved { border-color: var(--success); }
.es-dn-release { display: flex; flex-wrap: wrap; align-items: end; gap: 4px 12px; margin: 8px 0; }
.es-dn-release .es-field { max-width: 240px; }
.es-dn-release input { font-size: 16px; letter-spacing: 0.04em; }
.es-dn-release p { margin: 0 0 8px; }
.es-pass-dn { font-size: 18px; font-weight: 800; letter-spacing: 0.04em; color: var(--ink-strong); margin: 0 0 6px; }
.es-dn-no { margin: 6px 0; font-size: 15px; color: var(--ink-strong); }
.es-scan-dn { font-size: 22px; margin: 4px 0 10px; letter-spacing: 0.04em; }
/* a paid share whose split did not fill: staff refund or complete it */
.es-fchip--refund { font-weight: 700; }
/* FB #629 Food Show Requests: product table (SKU / Qty / Unit) in Product
   samples and Free goods / giveaway. Rows reuse .fs-prod-row (same columns as
   the products in section 2); this file adds the column header row and the
   phone layout. Brand tokens only. */
.fs-samp-head { margin-bottom: 2px; }
.fs-samp-head span { color: var(--ink-mute); font-size: 0.8rem; font-weight: 600; }

@media (max-width: 600px) {
  .fs-samp-head { display: none; }
  .fs-samp-row select[data-samp="upc"] { grid-column: 1 / -1; }
  /* FB #646: with the search box on, the SKU picker's wrapper is the grid item. */
  .fs-samp-row > div:has(> select[data-samp="upc"]) { grid-column: 1 / -1; }
}
/* FB #634 Food Show Requests: the "Pending follow-ups" box pinned at the top
   of the list page (FOOD_SHOW_PENDING_PINNED). One row per Pending item or
   workstream accepted as pending; overdue rows get a warning edge. Brand
   tokens only; rows wrap on a phone (checked at 390px). */
.fs-pinned { border: 1px solid var(--rule); border-left: 3px solid var(--heritage-gold); border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; background: var(--warm-white); }
.fs-pinned-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.fs-pinned-head h3 { margin: 0; font-size: 1rem; color: var(--ink-strong); }
.fs-pinned > .fs-muted { margin: 4px 0 8px; }
.fs-pin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fs-pin-link {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.5fr) minmax(0, 1.5fr); gap: 2px 12px; align-items: center;
  min-height: 44px; padding: 6px 10px; border: 1px solid var(--rule-soft); border-radius: 8px;
  background: var(--paper); color: inherit; text-decoration: none; font-size: 0.9rem;
}
.fs-pin-link:hover, .fs-pin-link:focus-visible { border-color: var(--heritage-gold); outline: none; }
.fs-pin-row.is-overdue .fs-pin-link { border-left: 3px solid var(--warning); }
.fs-pin-main, .fs-pin-item, .fs-pin-meta { min-width: 0; overflow-wrap: anywhere; }
.fs-pin-event { color: var(--ink-strong); font-weight: 600; }
.fs-pin-meta { color: var(--ink-soft); font-size: 0.85rem; }
.fs-pin-row.is-overdue .fs-pin-date { color: var(--danger); font-weight: 600; }
.fs-pin-overdue { margin-left: 4px; }
.fs-pinned [data-pin-more] { margin-top: 8px; }

@media (max-width: 600px) {
  .fs-pin-link { grid-template-columns: 1fr; }
}
/* FB #635 Food Show Requests, Phase 2: the preparation milestones panel
   (M1-M4) on the request page, the reminder icon with its count, and the
   milestone rows in the pinned "Pending follow-ups" box
   (FOOD_SHOW_MILESTONES). Brand tokens only; one column on a phone
   (checked at 390px). */
.fs-ms-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fs-ms-item { border: 1px solid var(--rule-soft); border-left: 3px solid var(--rule); border-radius: 10px; padding: 10px 14px; background: var(--paper); }
.fs-ms-item.is-in_progress { border-left-color: var(--heritage-gold); }
.fs-ms-item.is-completed { border-left-color: var(--success); }
.fs-ms-item.is-overdue { border-left-color: var(--warning); }
.fs-ms-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.fs-ms-name { color: var(--ink-strong); font-size: 1rem; }
.fs-ms-item.is-overdue .fs-ms-due { color: var(--danger); font-weight: 600; }
.fs-ms-bell { display: inline-flex; align-items: center; gap: 3px; min-height: 24px; padding: 0 8px; border: 1px solid var(--heritage-gold); border-radius: 12px; color: var(--ink-soft); font-size: 0.8rem; background: var(--warm-white); }
.fs-ms-bell-ico { flex: none; }
.fs-ms-bell-n { font-weight: 600; color: var(--ink-strong); }
.fs-ms-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 4px 16px; margin: 8px 0 0; }
.fs-ms-facts div { min-width: 0; }
.fs-ms-facts dt { font-size: 0.75rem; color: var(--ink-soft); }
.fs-ms-facts dd { margin: 0; overflow-wrap: anywhere; }
.fs-ms-edit { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; margin-top: 10px; }
.fs-ms-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; min-width: 0; }
.fs-ms-edit select, .fs-ms-edit input { min-height: 44px; }
.fs-ms-remarks { margin-top: 10px; }
.fs-ms-remark-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fs-ms-remark-list li { border-top: 1px solid var(--rule-soft); padding-top: 6px; overflow-wrap: anywhere; }
.fs-ms-remark-add { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.fs-ms-remark-add textarea { flex: 1; min-width: 0; }
.fs-ms-remark-add .fs-btn, .fs-ms-edit .fs-btn { min-height: 44px; }
.fs-pin-row--ms .fs-pin-link { border-style: dashed; }
.fs-pin-row--ms.is-overdue .fs-pin-link { border-style: solid; }

@media (max-width: 600px) {
  .fs-ms-edit { flex-direction: column; align-items: stretch; }
  .fs-ms-remark-add { flex-direction: column; align-items: stretch; }
}
/* ============================================================
   QA Supplier Documents (US Plant QA, 2026-11-23). Additive only:
   every selector is namespaced under .qsd-* and uses brand tokens
   (no raw hex). Mobile first; checked at 390px.
   ============================================================ */

.qsd-page { display: flex; flex-direction: column; gap: 16px; padding-bottom: 96px; }
.qsd-muted { color: var(--ink-mute); font-size: 0.85rem; }
.qsd-warn { color: var(--danger); font-size: 0.85rem; }
.qsd-grow { flex: 1 1 220px; min-width: 0; }
.qsd-num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-strong); text-align: right; min-width: 2.5em; }
.qsd-link { background: none; border: 0; padding: 4px 0; color: var(--heritage-red); font: inherit; font-size: 0.85rem; cursor: pointer; min-height: 32px; }

/* tabs */
.qsd-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--rule-soft); scrollbar-width: none; }
.qsd-tab { border: 0; background: none; padding: 8px 12px; min-height: 44px; cursor: pointer; color: var(--ink-soft); border-bottom: 2px solid transparent; font: inherit; white-space: nowrap; }
.qsd-tab.is-active { color: var(--ink-strong); border-bottom-color: var(--heritage-red); font-weight: 600; }
.qsd-hero-badge { cursor: pointer; font: inherit; }

/* KPI tiles: answers first */
.qsd-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .qsd-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.qsd-kpi {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--rule-soft); background: var(--paper);
  font: inherit; cursor: pointer; min-height: 88px;
}
.qsd-kpi:hover, .qsd-kpi:focus-visible { border-color: var(--heritage-gold); outline: none; }
.qsd-kpi-label { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 0.8rem; }
.qsd-kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--ink-strong); font-variant-numeric: tabular-nums; line-height: 1.2; }
.qsd-kpi-sub { color: var(--ink-mute); font-size: 0.75rem; }
.qsd-kpi-expired .qsd-kpi-value, .qsd-kpi-missing .qsd-kpi-value { color: var(--danger); }
.qsd-kpi-due .qsd-kpi-value, .qsd-kpi-renewal .qsd-kpi-value { color: var(--warning); }
.qsd-scope { margin: 0; }

/* status colours (dots, bar segments, matrix cells) */
.qsd-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--rule); flex: none; }
.qsd-dot-expired, .qsd-seg-expired, .qsd-st-expired { background: var(--danger); }
.qsd-dot-missing, .qsd-seg-missing, .qsd-st-missing { background: var(--heritage-red); }
.qsd-dot-due, .qsd-seg-due, .qsd-st-due { background: var(--warning); }
.qsd-dot-renewal, .qsd-seg-renewal, .qsd-st-renewal { background: var(--heritage-gold); }
.qsd-dot-review, .qsd-seg-review, .qsd-st-review { background: var(--info); }
.qsd-dot-requested, .qsd-seg-requested, .qsd-st-requested { background: var(--ink-mute); }
.qsd-st-valid { background: var(--success); }
.qsd-st-na, .qsd-st-notPurchased, .qsd-st-inactive { background: var(--rule-soft); }

/* layout */
.qsd-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 960px) { .qsd-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.qsd-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.qsd-card { padding: 14px 16px; min-width: 0; }
.qsd-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.qsd-card-head h2 { font-size: 1rem; margin: 0; color: var(--ink-strong); }
.qsd-foot { margin: 0; }

/* lists */
.qsd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.qsd-list > li { border-top: 1px solid var(--rule-soft); padding: 10px 0; }
.qsd-list > li:first-child { border-top: 0; }
.qsd-item, .qsd-sup-row, .qsd-sup-card { cursor: pointer; }
.qsd-item:focus-visible, .qsd-sup-row:focus-visible, .qsd-sup-card:focus-visible { outline: 2px solid var(--heritage-gold); outline-offset: 2px; }
.qsd-item-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.qsd-item-doc { font-weight: 600; color: var(--ink-strong); }
.qsd-due { margin-left: auto; color: var(--ink-soft); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.qsd-tier { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--heritage-red); font-weight: 700; }
.qsd-item-mat { color: var(--ink-strong); font-size: 0.9rem; margin-top: 4px; overflow-wrap: anywhere; }
.qsd-item-sup { margin-top: 2px; }
.qsd-item-why { color: var(--ink-soft); font-size: 0.85rem; margin-top: 4px; }
.qsd-sup-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 35%) auto; gap: 10px; align-items: center; }
.qsd-sup-name { display: flex; flex-direction: column; min-width: 0; }
.qsd-sup-name strong { overflow-wrap: anywhere; }
.qsd-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-alt); min-width: 0; }
.qsd-seg { display: block; height: 100%; }
.qsd-months { display: flex; flex-direction: column; gap: 6px; }
.qsd-month { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.qsd-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--ink-soft); font-size: 0.8rem; margin-top: 8px; align-items: center; }
.qsd-legend > span { display: inline-flex; align-items: center; gap: 4px; }

/* filters */
.qsd-filters { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; }
.qsd-filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qsd-filter-row .form-input { min-height: 40px; }
.qsd-filter-row select.form-input { flex: 1 1 150px; min-width: 0; }
.qsd-seg { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.qsd-seg button { border: 1px solid var(--rule); background: var(--paper); color: var(--ink-soft); border-radius: 999px; padding: 6px 12px; min-height: 36px; font: inherit; font-size: 0.85rem; white-space: nowrap; cursor: pointer; }
.qsd-seg button.on { border-color: var(--heritage-red); color: var(--ink-strong); font-weight: 600; background: var(--surface-alt); }

/* matrix */
.qsd-matrix-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--rule-soft); border-radius: 8px; }
.qsd-matrix { border-collapse: separate; border-spacing: 0; font-size: 0.8rem; }
.qsd-matrix th, .qsd-matrix td { padding: 4px; border-bottom: 1px solid var(--rule-soft); text-align: center; background: var(--paper); }
.qsd-matrix thead th { position: sticky; top: 0; z-index: 2; height: 92px; vertical-align: bottom; }
.qsd-matrix thead th span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; color: var(--ink-soft); font-weight: 600; }
.qsd-matrix .qsd-mat-col { position: sticky; left: 0; z-index: 1; text-align: left; min-width: 150px; max-width: 220px; font-weight: 400; }
.qsd-matrix thead .qsd-mat-col { z-index: 3; }
.qsd-mat-name { display: block; color: var(--ink-strong); font-weight: 600; overflow-wrap: anywhere; }
.qsd-matrix tr[data-material] { cursor: pointer; }
.qsd-matrix tr.qsd-inactive .qsd-mat-name { color: var(--ink-mute); }
/* Vendor / Manufacturer / Contact / Storage on the row, edited in place (QA 2026-12-03) */
.qsd-matrix thead .qsd-det-th { text-align: left; min-width: 110px; }
.qsd-matrix thead .qsd-det-th span { writing-mode: horizontal-tb; transform: none; }
.qsd-matrix td.qsd-det { text-align: left; min-width: 110px; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-strong); cursor: default; }
.qsd-matrix td.qsd-det.is-editable { cursor: text; }
.qsd-matrix td.qsd-det.is-editable:hover { box-shadow: inset 0 0 0 1px var(--rule); }
.qsd-matrix td.qsd-det:focus-visible { outline: 2px solid var(--heritage-gold); outline-offset: -2px; }
.qsd-matrix td.qsd-det.is-editing { padding: 1px; overflow: visible; }
.qsd-matrix td.qsd-det.is-saving { opacity: 0.6; }
.qsd-det-input { width: 100%; min-width: 180px; font: inherit; padding: 2px 4px; }
.qsd-det-empty { color: var(--ink-mute); }
.qsd-det-flag { display: inline-block; margin-left: 4px; padding: 0 4px; border-radius: 4px; font-size: 0.7rem; border: 1px solid var(--warning); color: var(--ink-soft); }
.qsd-cell { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; }
.qsd-cell:not([class*="qsd-st-"]), .qsd-cell.qsd-st- { background: transparent; }
.qsd-cell.qsd-follow { box-shadow: 0 0 0 2px var(--warning); }

/* suppliers */
.qsd-sup-card { display: flex; flex-direction: column; gap: 6px; }
.qsd-sup-head { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.qsd-sup-head strong { color: var(--ink-strong); margin-right: auto; overflow-wrap: anywhere; }
.qsd-sup-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.qsd-sup-stats > span { display: flex; flex-direction: column; background: var(--surface-alt); border-radius: 8px; padding: 6px 8px; }
.qsd-sup-stats b { font-size: 1rem; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.qsd-sup-stats small { color: var(--ink-mute); font-size: 0.7rem; }
.qsd-contact { overflow-wrap: anywhere; }

/* requests & receipts */
.qsd-rc { cursor: default; }
.qsd-rc-dates { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; margin-top: 6px; font-size: 0.8rem; color: var(--ink-soft); }
.qsd-rc-dates label { display: flex; flex-direction: column; gap: 2px; }
.qsd-rc-dates input { min-height: 36px; }
.qsd-log { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.85rem; color: var(--ink-soft); }
.qsd-log strong { color: var(--ink-strong); }

/* panels (material, supplier, draft) */
.qsd-panel { display: flex; flex-direction: column; gap: 10px; }
.qsd-panel h3 { margin: 8px 0 0; font-size: 0.95rem; color: var(--ink-strong); }
.qsd-mat-meta { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.qsd-state { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.qsd-doc.is-focus { background: var(--surface-alt); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.qsd-edit summary { cursor: pointer; color: var(--heritage-red); font-size: 0.85rem; min-height: 32px; display: flex; align-items: center; }
.qsd-edit-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 8px 0; }
@media (min-width: 600px) { .qsd-edit-grid { grid-template-columns: 2fr 1fr 1fr; } }
.qsd-edit-grid label, .qsd-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--ink-soft); }
.qsd-contact-row { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; overflow-wrap: anywhere; }
.qsd-stmt { border: 1px solid var(--rule-soft); border-radius: 10px; padding: 10px 12px; }
.qsd-stmt-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--rule-soft); }
.qsd-stmt-row > span:first-child { font-weight: 600; color: var(--ink-strong); }
.qsd-stmt-btns { display: flex; gap: 6px; margin-left: auto; }
.qsd-pick-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.qsd-pick-row input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.qsd-foot-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.qsd-banner { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-alt); border-left: 3px solid var(--heritage-gold); color: var(--ink-strong); font-size: 0.85rem; }
.qsd-mail { font-family: inherit; min-height: 260px; }
.qsd-preview { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.qsd-warnings { margin: 6px 0; padding-left: 18px; font-size: 0.85rem; color: var(--ink-soft); }
.qsd-warnings li { margin: 2px 0; }

@media (max-width: 420px) {
  .qsd-sup-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qsd-sup-row { grid-template-columns: minmax(0, 1fr) auto; }
  .qsd-sup-row .qsd-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* lists (2026-12-04, QA_SUPPLIER_DOCS_LISTS): Storage Classes, allergen list */
.qsd-kpi.is-active { outline: 2px solid var(--heritage-gold); outline-offset: -2px; }
.qsd-ls-chilled .qsd-kpi-value, .qsd-ls-frozen .qsd-kpi-value { color: var(--ink-strong); }
.qsd-ls-table tr[data-material] { cursor: pointer; }
.qsd-ls-group th { text-align: left; background: var(--surface-alt); font-weight: 600; color: var(--ink-strong); }
.qsd-ls-head h3 { margin: 0 0 4px; font-size: 1rem; color: var(--ink-strong); }
.qsd-ls-head p { margin: 2px 0; font-size: 0.9rem; }
.qsd-ls-diff li { font-size: 0.85rem; padding: 2px 0; }
.qsd-ls-add b { color: var(--success, #2e7d32); }
.qsd-ls-rem b { color: var(--danger); }
.qsd-ls-chg b { color: var(--heritage-gold); }
/* ============================================================
   C&SA Reports (2026-11-24). Additive only: every selector is
   namespaced under .csa-* and uses brand tokens (no raw hex).
   Mobile first; wide tables scroll inside their own wrapper.
   ============================================================ */

.csa-page { display: flex; flex-direction: column; gap: 16px; padding-bottom: 96px; }
.csa-muted { color: var(--ink-mute); font-size: 0.85rem; }
.csa-warn { color: var(--danger); font-size: 0.85rem; }
.csa-privacy { margin: 0; }

/* tabs */
.csa-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--rule-soft); scrollbar-width: none; }
.csa-tab { border: 0; background: none; padding: 8px 12px; min-height: 44px; cursor: pointer; color: var(--ink-soft); border-bottom: 2px solid transparent; font: inherit; white-space: nowrap; }
.csa-tab.is-active { color: var(--ink-strong); border-bottom-color: var(--heritage-red); font-weight: 600; }

/* steps */
.csa-steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 900px) { .csa-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.csa-step { padding: 12px 14px; border: 1px solid var(--rule-soft); border-radius: 10px; background: var(--paper); min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.csa-step h3 { margin: 0; font-size: 1rem; color: var(--ink-strong); }
.csa-step p { margin: 0; }
.csa-file { align-self: flex-start; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
.csa-label { font-size: 0.85rem; color: var(--ink-soft); }
.csa-select { width: 100%; min-height: 44px; font: inherit; }
.csa-actions { display: flex; justify-content: flex-end; }
@media (min-width: 900px) { .csa-actions { grid-column: 1 / -1; } }

/* result */
.csa-result { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.csa-result h4 { margin: 8px 0 0; font-size: 0.95rem; color: var(--ink-strong); }
.csa-result-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.csa-result-head h3 { margin: 0; font-size: 1.05rem; color: var(--ink-strong); }
.csa-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .csa-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.csa-tile { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--rule-soft); background: var(--paper); min-width: 0; }
.csa-tile-label { color: var(--ink-soft); font-size: 0.8rem; }
.csa-tile-value { font-size: 1.4rem; font-weight: 700; color: var(--ink-strong); font-variant-numeric: tabular-nums; line-height: 1.25; overflow-wrap: anywhere; }
.csa-tile-sub { color: var(--ink-mute); font-size: 0.75rem; }
.csa-tile.is-important .csa-tile-value { color: var(--warning); }
.csa-notes { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.csa-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }

/* tables */
.csa-table-wrap { overflow-x: auto; border: 1px solid var(--rule-soft); border-radius: 8px; }
.csa-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.csa-table th, .csa-table td { padding: 6px 8px; border-bottom: 1px solid var(--rule-soft); text-align: left; vertical-align: top; }
.csa-table thead th { color: var(--ink-soft); font-weight: 600; white-space: nowrap; background: var(--paper); position: sticky; top: 0; }
.csa-table tfoot th, .csa-table tfoot td { font-weight: 700; color: var(--ink-strong); }
.csa-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.csa-table .mono { font-variant-numeric: tabular-nums; white-space: nowrap; }
.csa-pre { white-space: pre-line; min-width: 180px; }

/* 2026-11-25: source toggle (Upload | Live) and the KPI result checks. */
.csa-source { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.csa-source .csa-muted { flex-basis: 100%; margin: 0; }
.csa-checks { border-left: 3px solid var(--danger); padding: 8px 12px; margin: 12px 0; background: var(--paper); }
.csa-checks h4 { margin: 0 0 6px; }
.csa-checks ul { margin: 0; padding-left: 18px; }
.csa-strong { font-weight: 600; }

/* 2026-11-30: saved files strip (the team's latest file of each kind). */
.csa-saved { border: 1px solid var(--rule-soft); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; background: var(--paper); }
.csa-saved h3 { margin: 0 0 6px; font-size: 0.95rem; }
.csa-saved-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.csa-saved-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.csa-saved-kind { font-weight: 600; min-width: 140px; }
.csa-keep { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; }
/* ============================================================
   QA Supplier Documents Phase 2 (2026-11-24): side page list
   (QA's own page order), Document Inbox, Review & File, Annual
   Campaign, Review Report (print), Rules, Risk, Activity Log.
   Additive: every selector is under .qsd-*; brand tokens only.
   Mobile first; checked at 390px.
   ============================================================ */

/* Page list: a left column like QA's own app on wide screens, a scrolling strip on phones. */
@media (min-width: 1100px) {
  .qsd-page { display: grid; grid-template-columns: 210px minmax(0, 1fr); align-items: start; column-gap: 20px; }
  .qsd-page > .qsd-tabs { flex-direction: column; gap: 2px; border-bottom: 0; border-right: 1px solid var(--rule-soft); position: sticky; top: 72px; padding-right: 8px; overflow: visible; }
  .qsd-page > .qsd-tabs .qsd-tab { text-align: left; border-bottom: 0; border-left: 3px solid transparent; border-radius: 0 8px 8px 0; display: flex; justify-content: space-between; align-items: center; }
  .qsd-page > .qsd-tabs .qsd-tab.is-active { border-left-color: var(--heritage-red); background: var(--paper-2, var(--paper)); }
  .qsd-page > #qsd-body { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
}
#qsd-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.qsd-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px; background: var(--info); color: var(--paper); font-size: 0.72rem; font-weight: 700; }

/* shared */
/* The hidden attribute must win over the display rules below (found on the
   review screenshots: hidden tick boxes showed). */
[class*="qsd-"][hidden], .qsd-panel [hidden] { display: none !important; }
.qsd-subbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.qsd-tag { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--rule-soft); color: var(--ink-soft); font-size: 0.72rem; }
.qsd-tag-warn { color: var(--warning); }
.qsd-tag-bad { color: var(--danger); }
.qsd-banner.is-ok { border-left: 3px solid var(--success); }
.qsd-banner.is-warn { border-left: 3px solid var(--warning); }
.qsd-check { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }
.qsd-check input { width: 18px; height: 18px; flex: none; }
.qsd-fieldset { border: 1px solid var(--rule-soft); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.qsd-fieldset legend { padding: 0 4px; color: var(--ink-soft); font-size: 0.85rem; }
.qsd-inline-date { width: auto; display: inline-block; margin-left: 6px; }
.qsd-wide { grid-column: 1 / -1; }

/* Dashboard: this week */
.qsd-week h3 { font-size: 0.85rem; margin: 8px 0 2px; color: var(--ink-soft); }
.qsd-week-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .qsd-week-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .qsd-week-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.qsd-wtile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; min-height: 84px; border: 1px solid var(--rule-soft); border-radius: 10px; background: var(--paper); font: inherit; cursor: pointer; }
.qsd-wtile b { font-size: 1.5rem; color: var(--ink-strong); line-height: 1.1; font-variant-numeric: tabular-nums; }
.qsd-wtile span { color: var(--ink-strong); font-size: 0.85rem; font-weight: 600; }
.qsd-wtile small { color: var(--ink-mute); font-size: 0.75rem; }
.qsd-wtile.is-hot b { color: var(--danger); }
.qsd-wtile.is-warm b { color: var(--warning); }
.qsd-wtile:hover, .qsd-wtile:focus-visible { border-color: var(--heritage-gold); outline: none; }
.qsd-week-lists { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 20px; }
@media (min-width: 960px) { .qsd-week-lists { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.qsd-scanline { margin: 8px 0 0; }

/* Document Inbox */
.qsd-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 22px 12px; border: 2px dashed var(--rule); border-radius: 12px; text-align: center; cursor: pointer; color: var(--ink-soft); }
.qsd-drop.is-over { border-color: var(--heritage-gold); background: var(--paper-2, var(--paper)); }
.qsd-drop-sm { padding: 14px 10px; }
.qsd-processing { display: flex; flex-direction: column; gap: 4px; }
.qsd-spin { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--rule); border-top-color: var(--heritage-red); border-radius: 50%; animation: qsd-spin 0.8s linear infinite; vertical-align: middle; }
@keyframes qsd-spin { to { transform: rotate(360deg); } }
.qsd-inbox-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 960px) { .qsd-inbox-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) minmax(0, 1.2fr) auto; align-items: start; } }
.qsd-inbox-file a { font-weight: 600; word-break: break-word; }
.qsd-inbox-btns { display: flex; gap: 6px; align-items: flex-end; padding-top: 18px; }
.qsd-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--ink-soft); min-width: 0; }

/* Review & File */
.qsd-review-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.qsd-review-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 900px) { .qsd-review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.qsd-review-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.qsd-review-col h3 { margin: 4px 0 0; font-size: 0.95rem; }
.qsd-preview { display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow: auto; border: 1px solid var(--rule-soft); border-radius: 8px; padding: 6px; background: var(--paper); }
.qsd-preview img { width: 100%; height: auto; display: block; background: #fff; }
.qsd-chk { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-top: 1px solid var(--rule-soft); }
.qsd-chk:first-child { border-top: 0; }
.qsd-chk-ic { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; color: var(--paper); background: var(--ink-mute); }
.qsd-chk-pass .qsd-chk-ic { background: var(--success); }
.qsd-chk-warn .qsd-chk-ic { background: var(--warning); }
.qsd-chk-fail .qsd-chk-ic { background: var(--danger); }
.qsd-chk-info .qsd-chk-ic { background: var(--info); }
.qsd-snip { margin-top: 4px; padding: 4px 8px; border-left: 3px solid var(--rule); background: var(--paper-2, var(--paper)); font-size: 0.8rem; color: var(--ink-soft); white-space: pre-wrap; word-break: break-word; }
.qsd-p65, .qsd-bulk { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--rule-soft); display: flex; flex-direction: column; gap: 4px; }
.qsd-p65.is-risk { border-color: var(--danger); }
.qsd-ack { padding: 8px 10px; border: 1px solid var(--danger); border-radius: 8px; color: var(--ink-strong); }
.qsd-datepick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qsd-foot-hint { flex: 1 1 260px; font-size: 0.8rem; }
.qsd-ocr-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qsd-doc-files { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.qsd-filed { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
.qsd-filed a { word-break: break-word; }
.qsd-history summary { cursor: pointer; color: var(--ink-soft); }

/* Annual Campaign */
.qsd-camp-setup { display: flex; flex-direction: column; gap: 12px; }
.qsd-camp-groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 900px) { .qsd-camp-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.qsd-camp-group { border: 1px solid var(--rule-soft); border-radius: 10px; padding: 8px 12px; }
.qsd-camp-group h3 { margin: 0; font-size: 0.9rem; }
.qsd-camp-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.qsd-camp-top h2 { margin: 0; font-size: 1.05rem; }
.qsd-camp-pct { display: flex; flex-direction: column; align-items: flex-end; }
.qsd-camp-pct b { font-size: 1.8rem; color: var(--ink-strong); line-height: 1; }
.qsd-bar-lg { height: 12px; margin: 10px 0; }
.qsd-kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .qsd-kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.qsd-kpi-static { cursor: default; }
.qsd-camp-row { display: flex; flex-direction: column; gap: 4px; }
.qsd-camp-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.85rem; color: var(--ink-soft); }
.qsd-camp-prog { display: flex; align-items: center; gap: 8px; }
.qsd-camp-prog .qsd-bar { flex: 1; }

/* Document Matrix column filters */
.qsd-th-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.qsd-th-crit .qsd-th-btn { color: var(--heritage-red); font-weight: 700; }
.is-filtered .qsd-th-btn { text-decoration: underline; text-decoration-color: var(--heritage-gold); text-decoration-thickness: 2px; }
.qsd-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.qsd-ftag { border: 1px solid var(--heritage-gold); background: var(--paper); border-radius: 14px; padding: 4px 10px; font: inherit; font-size: 0.8rem; cursor: pointer; min-height: 32px; }
.qsd-colmenu { position: absolute; z-index: 1200; display: flex; flex-direction: column; min-width: 200px; padding: 6px; gap: 2px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }
.qsd-colmenu button { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 8px; min-height: 36px; text-align: left; font: inherit; cursor: pointer; border-radius: 6px; }
.qsd-colmenu button.on, .qsd-colmenu button:hover { background: var(--rule-soft); }

/* Review Report: white page, prints clean */
.qsd-report { background: #fff; color: #111; padding: 20px; border-radius: 10px; border: 1px solid var(--rule-soft); }
.qsd-report h1 { font-size: 1.3rem; margin: 0; color: #111; }
.qsd-report h2 { font-size: 1rem; margin: 16px 0 6px; color: #111; }
.qsd-report h3 { font-size: 0.95rem; margin: 14px 0 4px; color: #111; }
.qsd-rp-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid #111; padding-bottom: 8px; }
.qsd-rp-meta { font-size: 0.8rem; text-align: right; }
.qsd-rp-scroll { overflow-x: auto; }
.qsd-rp-table, .qsd-risk-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.qsd-rp-table th, .qsd-rp-table td, .qsd-risk-table th, .qsd-risk-table td { border-bottom: 1px solid var(--rule-soft); padding: 5px 6px; text-align: left; vertical-align: top; }
.qsd-risk-table tbody tr { cursor: pointer; }
.qsd-rp-sign-row { display: grid; grid-template-columns: auto 1fr auto 1fr auto 100px; gap: 8px; align-items: end; margin: 22px 0; font-size: 0.85rem; }
.qsd-rp-line { border-bottom: 1px solid #111; height: 20px; }
@media print {
  .qsd-printing body * { visibility: hidden; }
  .qsd-printing .qsd-report, .qsd-printing .qsd-report * { visibility: visible; }
  .qsd-printing .qsd-report { position: absolute; left: 0; top: 0; width: 100%; border: 0; padding: 0; }
  .qsd-printing .qsd-rp-scroll { overflow: visible; }
  .qsd-rp-sup { break-inside: avoid-page; }
}

/* Rules & Settings */
.qsd-rules > li { display: flex; flex-direction: column; gap: 8px; }
.qsd-rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 960px) { .qsd-rule-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Wide screens: one compact row per document type, like QA's own rules table. */
@media (min-width: 1280px) {
  .qsd-rules > li { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px; align-items: start; }
  .qsd-rule-grid { grid-template-columns: 120px 170px 90px 80px minmax(0, 1fr) minmax(0, 1fr); }
  .qsd-rule-grid .qsd-wide { grid-column: auto; }
}
.qsd-rule-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--ink-soft); min-width: 0; }
.qsd-grid-even { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .qsd-grid-even { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Activity Log */
.qsd-logrow { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
@media (min-width: 720px) { .qsd-logrow { grid-template-columns: 170px 90px minmax(0, 1fr) 160px; gap: 10px; align-items: baseline; } }
.qsd-log-text { color: var(--ink-strong); word-break: break-word; }
/* ============================================================
   QA Supplier Documents, supplier audits (2026-11-25, QSD_AUDITS):
   the audit columns on Supplier Risk, the Audits section of the
   supplier panel, and the Supplier Audits page (Audit Plans,
   My Audits, Rectification, Archives).
   Additive: every selector is under .qsd-au-* or reuses the QSD
   classes; brand tokens only. Mobile first; checked at 390px.
   ============================================================ */

.qsd-au-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.qsd-au-table th, .qsd-au-table td { border-bottom: 1px solid var(--rule-soft); padding: 7px 8px; text-align: left; vertical-align: top; }
.qsd-au-table th { color: var(--ink-soft); font-weight: 600; font-size: 0.78rem; background: var(--surface-alt); }
.qsd-au-table tbody tr[role="button"] { cursor: pointer; }
.qsd-au-table tbody tr[role="button"]:hover, .qsd-au-table tbody tr[role="button"]:focus-visible { background: var(--paper-2, var(--surface-alt)); outline: none; }
.qsd-au-problem { max-width: 38ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.qsd-au-problem-big { font-size: 1rem; color: var(--ink-strong); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 8px; }

/* Supplier Risk: level select + audit cell */
.qsd-au-riskbar { margin-bottom: 8px; }
.qsd-au-level { min-width: 120px; min-height: 36px; font-size: 0.8rem; }
.qsd-au-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 150px; font-size: 0.78rem; }
.qsd-au-cell .btn { margin-top: 2px; }

/* Filters */
.qsd-au-date { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--ink-soft); }
.qsd-au-date .form-input { min-height: 40px; }
.qsd-au-chips button .qsd-muted { margin-left: 4px; font-variant-numeric: tabular-nums; }

/* Lists */
.qsd-au-task { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 10px 4px; border-bottom: 1px solid var(--rule-soft); cursor: pointer; }
.qsd-au-task:hover, .qsd-au-task:focus-visible { background: var(--paper-2, var(--surface-alt)); outline: none; }
.qsd-au-li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--rule-soft); }
.qsd-au-li[role="button"] { cursor: pointer; }

/* Supplier panel */
.qsd-au-sup { border: 1px solid var(--rule-soft); border-radius: 10px; padding: 8px 12px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.qsd-au-sup h3 { margin: 0; font-size: 0.95rem; }

/* Dialogs */
.qsd-au-edit summary, .qsd-au-hist summary { cursor: pointer; color: var(--ink-soft); font-size: 0.85rem; padding: 6px 0; }
.qsd-au-kv { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.qsd-au-kv th { text-align: left; color: var(--ink-soft); font-weight: 600; padding: 4px 8px 4px 0; width: 34%; vertical-align: top; }
.qsd-au-kv td { padding: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 600px) {
  .qsd-au-sup .qsd-sup-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qsd-au-date { flex: 1 1 140px; }
}
/* ============================================================
   90-dark-mode.css
   ALL [data-theme="dark"] rules consolidated. Grouped by module.
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* Dark-mode (only when explicitly enabled via [data-theme="dark"]) */

[data-theme="dark"] .page-hero {
  background:
    linear-gradient(135deg, rgba(212, 168, 67, 0.10), rgba(204, 0, 0, 0.06) 65%, transparent),
    rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.10);
}

[data-theme="dark"] .page-hero-badge { background: rgba(255, 255, 255, 0.05); }

[data-theme="dark"] .page-hero-badge.urgent { background: rgba(204, 0, 0, 0.18); }

[data-theme="dark"] .page-hero-badge.important { background: rgba(212, 168, 67, 0.20); }

[data-theme="dark"] .page-hero-badge.success { background: rgba(45, 140, 60, 0.18); }

[data-theme="dark"] .page-hero-badge.info { background: rgba(91, 44, 138, 0.20); }

[data-theme="dark"] .theme-icon-light { display: none; }

[data-theme="dark"] .theme-icon-dark { display: block; }

/* ── Dark Mode ───────────────────────────────────────── */

[data-theme="dark"] {
  --bg-primary: #0F1117;
  --bg-secondary: #1A1D27;
  --surface: #1E2130;
  --surface-alt: #252838;
  --surface-hover: #2A2D3D;
  --text-primary: #E5E7EB;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --border-light: #2D3044;
  --border-medium: #3B3F54;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  color-scheme: dark;
}

[data-theme="dark"] body { background: var(--bg-primary); color: var(--text-primary); }

[data-theme="dark"] .sidebar { background: var(--bg-secondary); border-color: var(--border-light); }

[data-theme="dark"] .brand-name .name-en { color: var(--text-primary); }

[data-theme="dark"] .brand-tag { color: var(--text-secondary); }

[data-theme="dark"] .nav-link { color: var(--text-secondary); }

[data-theme="dark"] .nav-link:hover { background: var(--surface-hover); color: var(--text-primary); }

[data-theme="dark"] .nav-link.active { background: rgba(204, 0, 0, 0.15); color: #FF6B6B; }

[data-theme="dark"] .nav-section-title { color: var(--text-muted); }

[data-theme="dark"] .topbar { background: var(--bg-secondary); border-color: var(--border-light); }

[data-theme="dark"] .topbar-title { color: var(--text-primary); }

[data-theme="dark"] .topbar-subtitle { color: var(--text-secondary); }

[data-theme="dark"] .main { background: var(--bg-primary); }

[data-theme="dark"] .view-container { background: var(--bg-primary); }

[data-theme="dark"] .dash-hero { background: linear-gradient(135deg, #1A0A0A, #0F1117 70%); border-color: var(--border-light); }

[data-theme="dark"] .dash-title { color: #F5F5F5; }

[data-theme="dark"] .dash-subtitle { color: var(--text-secondary); }

[data-theme="dark"] .stat-card, [data-theme="dark"] .kpi-card { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .kpi-label { color: var(--text-secondary); }

[data-theme="dark"] .kpi-value { color: var(--text-primary); }

[data-theme="dark"] .viz-card { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .viz-title { color: var(--text-primary); }

[data-theme="dark"] .section-title { color: var(--text-primary); }

[data-theme="dark"] .section-subtitle { color: var(--text-secondary); }

[data-theme="dark"] .section-header { border-color: var(--border-light); }

[data-theme="dark"] .ops-table { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .ops-table th { background: var(--surface-alt); color: var(--text-secondary); border-color: var(--border-light); }

[data-theme="dark"] .ops-table td { border-color: var(--border-light); color: var(--text-primary); }

[data-theme="dark"] .ops-table tr:hover td { background: var(--surface-hover); }

[data-theme="dark"] .kanban-col { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .kanban-card { background: var(--surface-alt); border-color: var(--border-light); }

[data-theme="dark"] .kanban-card:hover { background: var(--surface-hover); }

[data-theme="dark"] .card { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.7); }

[data-theme="dark"] .modal-content { background: var(--bg-secondary); border-color: var(--border-light); color: var(--text-primary); }

[data-theme="dark"] .filter-bar { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] input, [data-theme="dark"] textarea { background: var(--surface-alt); color: var(--text-primary); border-color: var(--border-medium); }
/* selects use background-COLOR (not shorthand) so the branded chevron
   SVG background-image + no-repeat/position from 95-polish-v3 survive.
   Shorthand `background:` was resetting those → tiled/repeating arrow. */
[data-theme="dark"] select { background-color: var(--surface-alt); color: var(--text-primary); border-color: var(--border-medium); }

[data-theme="dark"] .btn-secondary { background: var(--surface-alt); color: var(--text-primary); border-color: var(--border-medium); }

[data-theme="dark"] .btn-ghost { color: var(--text-secondary); }

[data-theme="dark"] .btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); }

[data-theme="dark"] .sidebar-footer { border-color: var(--border-light); color: var(--text-muted); }

[data-theme="dark"] .theme-toggle { border-color: var(--border-medium); color: var(--text-secondary); }

[data-theme="dark"] .theme-toggle:hover { background: var(--surface-hover); color: var(--text-primary); }

/* Page hero dark */

[data-theme="dark"] .page-hero { border-color: var(--border-light); }

[data-theme="dark"] .page-hero-title { color: var(--text-primary); }

[data-theme="dark"] .page-hero-desc { color: var(--text-secondary); }

[data-theme="dark"] .page-hero-badge { background: var(--surface-alt); border-color: var(--border-medium); color: var(--text-primary); }

[data-theme="dark"] .page-hero-badge.urgent { background: rgba(220,38,38,0.15); border-color: rgba(220,38,38,0.3); color: #FCA5A5; }

[data-theme="dark"] .page-hero-badge.important { background: rgba(217,119,6,0.15); border-color: rgba(217,119,6,0.3); color: #FDE68A; }

[data-theme="dark"] .page-hero-badge.success { background: rgba(22,163,74,0.15); border-color: rgba(22,163,74,0.3); color: #86EFAC; }

[data-theme="dark"] .page-hero-badge.info { background: rgba(37,99,235,0.15); border-color: rgba(37,99,235,0.3); color: #93C5FD; }

[data-theme="dark"] .page-hero-timestamp { color: var(--text-muted); }

/* mi-signals stale badge (W2 freshness fix, 2026-08-03) — lift the amber so it
   stays legible on the dark hero surface, and soften the fill so it reads as a
   caution marker rather than an error. */
[data-theme="dark"] .mi-sig-stale-badge {
  color: #E8C878;
  background: rgba(212, 168, 67, 0.16);
  border-color: rgba(212, 168, 67, 0.45);
}

/* MI cards dark */

[data-theme="dark"] .mi-cmp-card { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .mi-cmp-card:hover { background: var(--surface-hover); border-color: var(--border-medium); }

[data-theme="dark"] .mi-cmp-name { color: var(--text-primary); }

/* Knowledge base dark */

[data-theme="dark"] .kb-landing-hero { background: linear-gradient(135deg, #1A0A0A, #0F1117 70%); }

[data-theme="dark"] .kb-cat-card { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .kb-item { border-color: var(--border-light); }

[data-theme="dark"] .kb-item:hover { background: var(--surface-hover); }

/* Dark mode help-panel overrides */

[data-theme="dark"] .help-panel {
  background: var(--surface, #1A1410);
  border-left-color: var(--border-medium);
}

[data-theme="dark"] .help-panel-header { border-bottom-color: var(--border-light); }

[data-theme="dark"] .help-panel-footer { background: var(--surface-alt); border-top-color: var(--border-light); }

[data-theme="dark"] .help-panel-title { color: var(--text-primary); }

[data-theme="dark"] .help-section-body,
[data-theme="dark"] .help-glossary dd { color: var(--text-secondary); }

[data-theme="dark"] .help-glossary dt { color: var(--text-primary); }

[data-theme="dark"] .help-panel-close { color: var(--text-secondary); border-color: var(--border-medium); }

[data-theme="dark"] .help-panel-close:hover { background: var(--surface-hover); color: var(--text-primary); }

[data-theme="dark"] .topbar-help-btn { color: var(--text-secondary); border-color: var(--border-medium); }

[data-theme="dark"] .topbar-help-btn:hover { background: var(--surface-hover); color: var(--text-primary); }

[data-theme="dark"] .help-shortcut kbd { background: var(--surface); color: var(--text-primary); border-color: var(--border-medium); }

/* Dark mode */

[data-theme="dark"] .compliance-banner {
  background: linear-gradient(0deg, rgba(212, 168, 67, 0.12), rgba(212, 168, 67, 0.06));
  border-color: rgba(212, 168, 67, 0.4);
  color: var(--text-primary);
}

[data-theme="dark"] .compliance-banner-title { color: var(--text-primary); }

[data-theme="dark"] .compliance-banner-text,
[data-theme="dark"] .compliance-banner-list { color: var(--text-secondary); }

[data-theme="dark"] .compliance-banner-text strong { color: var(--text-primary); }

[data-theme="dark"] .compliance-banner-more summary { color: var(--text-secondary); }

[data-theme="dark"] .compliance-note {
  background: rgba(212, 168, 67, 0.1);
  border-color: rgba(212, 168, 67, 0.32);
}

[data-theme="dark"] .compliance-note-title { color: var(--text-primary); }

[data-theme="dark"] .compliance-note-text { color: var(--text-secondary); }

[data-theme="dark"] .ca-badge.inline-badge { color: var(--text-primary); }

/* Dark theme */

[data-theme="dark"] .change-card {
  background: var(--surface, #1f1a16);
  border-color: var(--rule, #3a3128);
}

[data-theme="dark"] .change-card-before {
  background: rgba(192, 57, 43, 0.14);
}

[data-theme="dark"] .change-card-after {
  background: rgba(45, 140, 60, 0.14);
}

[data-theme="dark"] .change-card-section {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .change-card-action {
  background: rgba(212, 168, 67, 0.08);
}

[data-theme="dark"] .impact-banner-critical { color: #F2BFB7; }

[data-theme="dark"] .impact-banner-major    { color: #F5C9A2; }

[data-theme="dark"] .impact-banner-minor    { color: #F2D88E; }

[data-theme="dark"] .impact-banner-cosmetic { color: #D7C0E8; }

[data-theme="dark"] .impact-banner-none     { color: #B4E2C0; }

[data-theme="dark"] .vc-chip-expired  { background: rgba(229, 115, 115, 0.18); color: #F2A8A0; border-color: rgba(229, 115, 115, 0.35); }

[data-theme="dark"] .vc-chip-expiring { background: rgba(232, 197, 114, 0.18); color: #E8C572; border-color: rgba(232, 197, 114, 0.35); }

[data-theme="dark"] .vc-chip-total    { background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.75); border-color: rgba(255, 255, 255, 0.12); }

[data-theme="dark"] .vc-badge-expired  { background: rgba(229, 115, 115, 0.16); color: #F2A8A0; border-color: rgba(229, 115, 115, 0.32); }

[data-theme="dark"] .vc-badge-expiring { background: rgba(232, 197, 114, 0.20); color: #F1D08E; border-color: rgba(232, 197, 114, 0.40); }

[data-theme="dark"] .vc-badge-active   { background: rgba(96, 200, 120, 0.16); color: #A8E5B0; border-color: rgba(96, 200, 120, 0.32); }

[data-theme="dark"] .vc-badge-pending  { background: rgba(160, 130, 200, 0.14); color: #C9A8E0; border-color: rgba(160, 130, 200, 0.30); }

/* Dark-mode tweaks (the platform supports a dark theme via [data-theme="dark"]) */

[data-theme="dark"] .formulation-bot-input-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%);
  border-left-color: var(--heritage-purple);
}

[data-theme="dark"] .formulation-bot-empty {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .fb-exchange {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .fb-source-card {
  background: var(--surface-alt);
  border-color: var(--border-light);
}

[data-theme="dark"] .fb-source-card-body {
  background: var(--surface);
}

[data-theme="dark"] .fb-followup-chip {
  background: var(--surface-alt);
  border-color: var(--border-light);
  color: var(--text-primary);
}

/* Dark theme support for new modules */

[data-theme="dark"] .et-badge-high   { background: rgba(229,115,115,0.18); color: #F2A8A0; border-color: rgba(229,115,115,0.32); }

[data-theme="dark"] .et-badge-medium { background: rgba(212,168,67,0.18); color: #E5C580; border-color: rgba(212,168,67,0.35); }

[data-theme="dark"] .et-badge-low    { background: rgba(96,200,120,0.16); color: #A8E5B0; border-color: rgba(96,200,120,0.32); }

[data-theme="dark"] .et-status-pending   { background: rgba(160,130,200,0.14); color: #C9A8E0; border-color: rgba(160,130,200,0.30); }

[data-theme="dark"] .et-status-approved  { background: rgba(96,200,120,0.16); color: #A8E5B0; border-color: rgba(96,200,120,0.32); }

[data-theme="dark"] .et-status-escalated { background: rgba(229,115,115,0.16); color: #F2A8A0; border-color: rgba(229,115,115,0.32); }

[data-theme="dark"] .et-cat-badge { background: rgba(160,130,200,0.14); color: #C9A8E0; border-color: rgba(160,130,200,0.30); }

[data-theme="dark"] .seo-response-box { background: rgba(255,255,255,0.04); }

[data-theme="dark"] .seo-comp-chip { background: rgba(255,255,255,0.06); color: #ddd; }

[data-theme="dark"] .ded-status-pending   { background: rgba(212,168,67,0.18); color: #E5C580; border-color: rgba(212,168,67,0.35); }

[data-theme="dark"] .ded-status-disputed  { background: rgba(229,115,115,0.16); color: #F2A8A0; border-color: rgba(229,115,115,0.32); }

[data-theme="dark"] .ded-status-resolved  { background: rgba(96,200,120,0.16); color: #A8E5B0; border-color: rgba(96,200,120,0.32); }

/* Dark theme — keep the icon tile readable */

[data-theme="dark"] .ai-tools-hub .module-icon,
[data-theme="dark"] .module-card .module-icon {
  /* Pillar-tinted tile — mirrors the light theme's var(--pillar-bg) wash
     so the pillar color-coding survives dark mode. */
  background: color-mix(in srgb, var(--pillar-color, var(--heritage-purple)) 14%, var(--surface));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.30);
}

[data-theme="dark"] .sidebar .nav-section-title + .nav-section-title,
[data-theme="dark"] .sidebar .nav-link + .nav-section-title {
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* ====================================================================
 * DARK MODE AUDIT — 2026-05-22 (PWA + Dark Mode Sprint)
 * Append-only. Fills gaps in dark-mode coverage for the three modules
 * added today (email-triage .et-*, seo-intelligence .seo-*,
 * deductions .ded-*) plus the icon tiles and sidebar headers from the
 * UI polish pass earlier today.
 *
 * Palette references (from existing dark theme tokens):
 *   bg-primary: #1a1a1a, bg-secondary: #242424, surface-alt: #2a2a2a
 *   text-primary: #e0e0e0, text-secondary: #a0a0a0
 *   border-light: #333, border-medium: #3a3a3a
 *   accent: Heritage Red #CC0000 (kept; brand element)
 * ==================================================================== */

/* ── Email Triage (.et-*) — fill remaining gaps ─────────────────── */

/* Urgency row strips: light theme used a near-white border for low; in dark
   that disappears. Bump to a visible muted grey. */

[data-theme="dark"] .et-table tbody tr.et-row-urg-low td {
  box-shadow: inset 3px 0 0 #3a3a3a;
}

/* High/medium use heritage tokens that already read well on dark, but the
   row hover/background can be slightly tinted to keep the urgency cue. */

[data-theme="dark"] .et-table tbody tr.et-row-urg-high td {
  background: rgba(229,115,115,0.06);
}

[data-theme="dark"] .et-table tbody tr.et-row-urg-medium td {
  background: rgba(212,168,67,0.05);
}

[data-theme="dark"] .et-status-archived {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary, #a0a0a0);
  border-color: rgba(255,255,255,0.12);
}

[data-theme="dark"] .et-chip {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary, #a0a0a0);
}

[data-theme="dark"] .et-chip-high {
  background: rgba(229,115,115,0.18);
  color: #F2A8A0;
}

[data-theme="dark"] .et-chip-pending {
  background: rgba(160,130,200,0.14);
  color: #C9A8E0;
}

[data-theme="dark"] .et-chip-total {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary, #a0a0a0);
}

[data-theme="dark"] .et-classify-row {
  background: var(--surface-alt, #2a2a2a);
  border: 1px solid var(--border-light, #333);
}

[data-theme="dark"] .et-route-chip {
  color: var(--text-secondary, #a0a0a0);
}

/* ── SEO Intelligence (.seo-*) — fill remaining gaps ────────────── */

/* Big score cards — the score colors keep their semantic meaning,
   just need a slightly stronger background on dark for legibility. */

[data-theme="dark"] .seo-score-high {
  background: rgba(96,200,120,0.18);
  color: #A8E5B0;
  border-color: rgba(96,200,120,0.32);
}

[data-theme="dark"] .seo-score-mid {
  background: rgba(212,168,67,0.18);
  color: #E5C580;
  border-color: rgba(212,168,67,0.35);
}

[data-theme="dark"] .seo-score-low {
  background: rgba(229,115,115,0.18);
  color: #F2A8A0;
  border-color: rgba(229,115,115,0.32);
}

/* Mini score (inline numeric chip) inherits seo-score-* so it's covered. */

[data-theme="dark"] .seo-badge-first {
  background: rgba(96,200,120,0.20);
  color: #B8E5C0;
  border-color: rgba(96,200,120,0.34);
}

[data-theme="dark"] .seo-badge-top {
  background: rgba(96,200,120,0.12);
  color: #A8E5B0;
  border-color: rgba(96,200,120,0.26);
}

[data-theme="dark"] .seo-badge-ok {
  background: rgba(160,130,200,0.14);
  color: #C9A8E0;
  border-color: rgba(160,130,200,0.26);
}

[data-theme="dark"] .seo-badge-miss {
  background: rgba(229,115,115,0.16);
  color: #F2A8A0;
  border-color: rgba(229,115,115,0.30);
}

[data-theme="dark"] .seo-acc-high { color: #A8E5B0; }

[data-theme="dark"] .seo-acc-mid  { color: #E5C580; }

[data-theme="dark"] .seo-acc-low  { color: #F2A8A0; }

[data-theme="dark"] .seo-comp-chip-lkk {
  background: rgba(229,115,115,0.16);
  color: #F2A8A0;
}

[data-theme="dark"] .seo-gap-card {
  background: rgba(212,168,67,0.08);
  border-left-color: #D4A843;
}

[data-theme="dark"] .seo-brief-card {
  background: rgba(160,130,200,0.08);
  border-left-color: #A082C8;
}

[data-theme="dark"] .seo-gap-body,
[data-theme="dark"] .seo-brief-body {
  color: var(--text-primary, #e0e0e0);
}

[data-theme="dark"] .seo-gap-title,
[data-theme="dark"] .seo-brief-title {
  color: var(--text-primary, #e0e0e0);
}

[data-theme="dark"] .seo-aggregate-stats {
  color: var(--text-primary, #e0e0e0);
}

[data-theme="dark"] .seo-aggregate-stats strong {
  color: #C9A8E0;
}

[data-theme="dark"] .seo-chip-first {
  background: rgba(96,200,120,0.18);
  color: #A8E5B0;
}

[data-theme="dark"] .seo-chip-mention {
  background: rgba(160,130,200,0.14);
  color: #C9A8E0;
}

[data-theme="dark"] .seo-chip-total {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary, #a0a0a0);
}

/* Response box border — purple translates fine; just bump body bg slightly. */

[data-theme="dark"] .seo-response-box {
  border-left-color: #A082C8;
  color: var(--text-primary, #e0e0e0);
}

/* ── Deductions (.ded-*) — fill remaining gaps ──────────────────── */

[data-theme="dark"] .ded-table tbody tr.ded-row-dispute td,
[data-theme="dark"] .ded-extract-table tbody tr.ded-row-dispute td {
  box-shadow: inset 3px 0 0 #E57373;
  background: rgba(229,115,115,0.06);
}

[data-theme="dark"] .ded-status-accepted {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary, #a0a0a0);
  border-color: rgba(255,255,255,0.12);
}

[data-theme="dark"] .ded-reason-chip {
  background: rgba(160,130,200,0.14);
  color: #C9A8E0;
}

[data-theme="dark"] .ded-reason-unknown {
  background: rgba(229,115,115,0.14);
  color: #F2A8A0;
}

[data-theme="dark"] .ded-dispute-flag {
  background: rgba(229,115,115,0.16);
  color: #F2A8A0;
}

[data-theme="dark"] .ded-chip-dispute {
  background: rgba(229,115,115,0.18);
  color: #F2A8A0;
}

[data-theme="dark"] .ded-chip-pending {
  background: rgba(212,168,67,0.18);
  color: #E5C580;
}

[data-theme="dark"] .ded-chip-total {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary, #a0a0a0);
}

[data-theme="dark"] .ded-mini-input {
  background: var(--surface-alt, #2a2a2a);
  color: var(--text-primary, #e0e0e0);
  border-color: var(--border-light, #333);
}

[data-theme="dark"] .ded-mini-input:focus {
  background: var(--surface, #242424);
  border-color: #A082C8;
}

/* ── PWA force-update bar/block — ensure dark mode readability ───── */

[data-theme="dark"] .pwa-update-bar,
[data-theme="dark"] .pwa-update-block-card {
  background: var(--surface, #242424);
  color: var(--text-primary, #e0e0e0);
  border-color: var(--border-light, #333);
}

[data-theme="dark"] .pwa-update-bar-body,
[data-theme="dark"] .pwa-update-block-card h2,
[data-theme="dark"] .pwa-update-block-card p {
  color: var(--text-primary, #e0e0e0);
}

[data-theme="dark"] .pwa-update-bar-btn,
[data-theme="dark"] .pwa-update-block-btn {
  background: var(--heritage-red, #CC0000);
  color: #fff;
}

/* ── Implemented-feedback sticky toast — dark mode (mirrors PWA toast) ── */

[data-theme="dark"] .feedback-notify-toast {
  background: var(--surface, #242424);
  color: var(--text-primary, #e0e0e0);
  border-color: var(--border-light, #333);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .feedback-notify-toast-body {
  color: var(--text-primary, #e0e0e0);
}

[data-theme="dark"] .feedback-notify-toast-btn {
  background: var(--heritage-gold, #D4A843);
  color: #1a1a1a;
}

[data-theme="dark"] .feedback-notify-toast-btn:hover {
  background: #e0b955;
}

[data-theme="dark"] .search-results {
  background: #242424;
  border-color: #3a3a3a;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

[data-theme="dark"] .search-result-item:hover,
[data-theme="dark"] .search-result-item.selected {
  background: #2a2a2a;
}

[data-theme="dark"] .ai-tools-filter-input {
  background: var(--surface-alt);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

[data-theme="dark"] .pillar-chip {
  border-color: var(--border-medium);
  color: var(--text-secondary);
}

[data-theme="dark"] .pillar-chip.active {
  color: #fff;
}

/* Dark mode */

[data-theme="dark"] .uz-batch-list {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.10);
}

[data-theme="dark"] .uz-batch-row { background: rgba(255,255,255,0.05); }

[data-theme="dark"] .uz-batch-row[data-status="extracting"],
[data-theme="dark"] .uz-batch-row[data-status="analyzing"] {
  background: rgba(91, 44, 138, 0.14);
  border-color: rgba(91, 44, 138, 0.40);
}

[data-theme="dark"] .uz-batch-row[data-status="complete"] {
  background: rgba(45, 140, 60, 0.14);
  border-color: rgba(45, 140, 60, 0.40);
}

[data-theme="dark"] .uz-batch-row[data-status="failed"],
[data-theme="dark"] .uz-batch-row[data-status="cancelled"] {
  background: rgba(192, 57, 43, 0.14);
  border-color: rgba(192, 57, 43, 0.40);
}

[data-theme="dark"] .uz-batch-progress { background: rgba(255,255,255,0.10); }

[data-theme="dark"] .uz-batch-review {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .uz-review-card { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.10); }

[data-theme="dark"] .uz-review-card-approved {
  background: rgba(45, 140, 60, 0.12);
  border-color: var(--success, #2D8C3C);
}

[data-theme="dark"] .uz-review-card-failed {
  background: rgba(192, 57, 43, 0.12);
  border-color: rgba(192, 57, 43, 0.50);
}

[data-theme="dark"] .uz-mode-toggle { background: rgba(255,255,255,0.06); }

[data-theme="dark"] .uz-mode-toggle button[aria-pressed="true"] {
  background: rgba(255,255,255,0.10);
  color: #fff;
}

[data-theme="dark"] .ai-tools-empty {
  background: linear-gradient(180deg, rgba(123, 80, 144, 0.08), rgba(212, 168, 67, 0.05));
  border-color: var(--border-light);
}

[data-theme="dark"] .ai-tools-empty h3 { color: var(--text-primary); }

[data-theme="dark"] .ai-tools-empty p  { color: var(--text-secondary); }

/* ── AI Tools hub — dark mode (front door, top demo priority) ───── */

[data-theme="dark"] .ai-tools-hero {
  background:
    radial-gradient(ellipse at top, rgba(212, 175, 55, 0.10), transparent 70%),
    radial-gradient(ellipse at bottom, rgba(123, 80, 144, 0.14), transparent 70%);
  border-color: rgba(212, 168, 67, 0.22);
}

[data-theme="dark"] .ai-tools-title {
  /* Heritage red reads slightly hot on black — lift via a softer red */
  color: #FF6B6B;
}

[data-theme="dark"] .ai-tools-subtitle { color: var(--text-secondary); }

[data-theme="dark"] .ai-tools-subtitle strong { color: #C9A4DD; }

[data-theme="dark"] .ai-tool-stat .stat-num { color: #FF6B6B; }

[data-theme="dark"] .ai-tool-stat .stat-label { color: var(--text-muted); }

[data-theme="dark"] .ai-tools-eyebrow-badge {
  background: linear-gradient(135deg, #6B3F82, #4A2B5A);
  border-color: rgba(212, 168, 67, 0.35);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .pillar-section { /* spacing only — no change needed */ }

[data-theme="dark"] .pillar-header { border-color: var(--border-light); border-left-color: #FF6B6B; }

[data-theme="dark"] .pillar-title  { color: var(--text-primary); }

[data-theme="dark"] .pillar-count  { color: var(--text-muted); }

[data-theme="dark"] .module-card {
  background: var(--surface);
  border-color: var(--border-light);
  border-top-color: var(--pillar-color, var(--heritage-purple));
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .module-card.module-live:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px var(--pillar-bg);
  border-color: var(--pillar-color);
}

[data-theme="dark"] .module-card.module-coming-soon {
  background: linear-gradient(180deg, var(--surface), rgba(255, 255, 255, 0.03));
}

[data-theme="dark"] .module-name        { color: var(--text-primary); }

[data-theme="dark"] .module-tagline     { color: color-mix(in srgb, var(--pillar-color, var(--heritage-purple)) 55%, #E8EAED); }

[data-theme="dark"] .module-description { color: var(--text-secondary); }

[data-theme="dark"] .module-meta        { color: var(--text-muted); }

[data-theme="dark"] .module-dept        { color: color-mix(in srgb, var(--pillar-color, var(--heritage-purple)) 55%, #E8EAED); }

[data-theme="dark"] .module-stakeholder { color: var(--text-muted); }

[data-theme="dark"] .capability-chip {
  /* Keep the pillar color-coding alive in dark mode — tinted bg, tinted
     border, and text lifted toward white from the card's --pillar-color
     (previously a flat grey chip that dropped the pillar identity). */
  background: color-mix(in srgb, var(--pillar-color, var(--heritage-purple)) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--pillar-color, var(--heritage-purple)) 38%, transparent);
  color: color-mix(in srgb, var(--pillar-color, var(--heritage-purple)) 55%, #E8EAED);
}

[data-theme="dark"] .module-status.status-live {
  background: rgba(45, 140, 60, 0.16);
  color: #6EE7A2;
  border-color: rgba(45, 140, 60, 0.35);
}

[data-theme="dark"] .module-status.status-coming {
  background: rgba(212, 168, 67, 0.14);
  color: #F2D27A;
  border-color: rgba(212, 168, 67, 0.35);
}

[data-theme="dark"] .module-status.status-planned {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: var(--border-light);
}

[data-theme="dark"] .module-preview-badge {
  background: rgba(123, 80, 144, 0.18);
  color: #D6B4EC;
  border-color: rgba(123, 80, 144, 0.45);
}

[data-theme="dark"] .module-preview-badge.module-preview-sim {
  background: rgba(31, 111, 235, 0.18);
  color: #93C2FF;
  border-color: rgba(31, 111, 235, 0.40);
}

/* ── AI Tools hub — dark polish (2026-07-16) ─────────────────────────
   Covers what the original 5/23 dark pass missed: the Agents gold
   supersection band, the department-scope note, and the Request a
   Module ghost button. Hub-scoped only — no unrelated rules touched. */

[data-theme="dark"] .ai-tools-dept-note {
  background: rgba(212, 168, 67, 0.10);
  border-left-color: var(--heritage-gold);
  color: #EBD9A8;
}

[data-theme="dark"] .hub-supersection-agents {
  background: linear-gradient(180deg, rgba(212, 168, 67, 0.07) 0%, rgba(212, 168, 67, 0.015) 100%);
  border-color: rgba(212, 168, 67, 0.28);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .hub-supersection-agents .hub-supersection-title {
  /* #B8860B reads muddy on the dark surface — lift to gold-light */
  color: var(--heritage-gold-light, #E8C572);
}

[data-theme="dark"] .hub-agents-section .module-card {
  border-left-color: var(--heritage-gold, #D4A843);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .hub-agents-section .module-card.module-live:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.50), 0 2px 8px rgba(212, 168, 67, 0.18);
}

[data-theme="dark"] .ai-tools-request-btn {
  color: #FF6B6B;
  border-color: rgba(255, 107, 107, 0.55);
}

[data-theme="dark"] .ai-tools-request-btn:hover {
  background: var(--heritage-red);
  border-color: var(--heritage-red);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* ── Login page — dark mode (full coverage) ─────────────────────── */

[data-theme="dark"] .login-page {
  background:
    radial-gradient(circle at 20% 0%, rgba(212, 168, 67, 0.10), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(204, 0, 0, 0.10), transparent 50%),
    var(--bg-primary);
}

[data-theme="dark"] .login-bg {
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 60px,
      rgba(212, 168, 67, 0.030) 60px,
      rgba(212, 168, 67, 0.030) 61px
    );
}

[data-theme="dark"] .login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 4px 16px rgba(0, 0, 0, 0.35);
  color: var(--text-primary);
}

[data-theme="dark"] .login-mark + .login-title { color: var(--text-secondary); }

[data-theme="dark"] .login-title       { color: var(--text-primary); }

[data-theme="dark"] .login-title em    { color: #FF6B6B; }

[data-theme="dark"] .login-subtitle    { color: var(--text-secondary); }

[data-theme="dark"] .login-tagline     { color: var(--text-muted); }

[data-theme="dark"] .login-divider     { color: var(--text-muted); }

[data-theme="dark"] .login-divider::before,
[data-theme="dark"] .login-divider::after {
  border-top-color: var(--border-light);
}

[data-theme="dark"] .login-demo-title  { color: var(--text-secondary); }

[data-theme="dark"] .login-footer      { color: var(--text-muted); }

[data-theme="dark"] .btn-leespace {
  background: linear-gradient(135deg, #3370FF, #1F58D8);
  color: #fff;
  border-color: #1F58D8;
}

[data-theme="dark"] .btn-leespace:hover:not(:disabled) {
  background: linear-gradient(135deg, #4A85FF, #2C66E5);
}

[data-theme="dark"] .btn-leespace-disabled,
[data-theme="dark"] .btn-leespace:disabled {
  background: var(--surface-alt);
  color: var(--text-muted);
  border-color: var(--border-medium);
}

[data-theme="dark"] .btn-leespace-status {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

[data-theme="dark"] .persona-card {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .persona-card:hover {
  background: var(--surface-hover);
  border-color: var(--heritage-purple);
}

[data-theme="dark"] .persona-card.selecting {
  background: rgba(91, 44, 138, 0.18);
  border-color: var(--heritage-purple);
}

[data-theme="dark"] .persona-name { color: var(--text-primary); }

[data-theme="dark"] .persona-meta { color: var(--text-muted); }

[data-theme="dark"] .login-error {
  background: rgba(192, 57, 43, 0.18);
  border: 1px solid rgba(192, 57, 43, 0.40);
  color: #FCA5A5;
}

/* ── Upload zone (.lv-dropzone family) — dark mode coverage ──────── */

[data-theme="dark"] .lv-dropzone {
  border-color: rgba(212, 168, 67, 0.30);
  background: linear-gradient(135deg, rgba(123, 80, 144, 0.10), rgba(212, 168, 67, 0.05));
  color: var(--text-secondary);
}

[data-theme="dark"] .lv-dropzone:hover,
[data-theme="dark"] .lv-dropzone:focus {
  border-color: var(--heritage-gold);
  background: linear-gradient(135deg, rgba(123, 80, 144, 0.18), rgba(212, 168, 67, 0.10));
}

[data-theme="dark"] .lv-dropzone-hover {
  border-color: var(--heritage-gold) !important;
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.20), rgba(123, 80, 144, 0.14)) !important;
}

[data-theme="dark"] .lv-dropzone-filled {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .lv-dropzone-prompt { color: var(--text-secondary); }

[data-theme="dark"] .lv-dropzone-text   { color: var(--text-primary); }

[data-theme="dark"] .lv-dropzone-sub    { color: var(--text-muted); }

[data-theme="dark"] .uz-extracted-by    { color: var(--text-muted); }

[data-theme="dark"] .uz-extracted-by strong { color: var(--text-secondary); }

[data-theme="dark"] .uz-meta            { color: var(--text-secondary); }

[data-theme="dark"] .uz-meta-error      { color: #FCA5A5; }

[data-theme="dark"] .uz-meta-success    { color: #6EE7A2; }

[data-theme="dark"] .uz-divider::before,
[data-theme="dark"] .uz-divider::after {
  border-top-color: rgba(255, 255, 255, 0.10);
}

[data-theme="dark"] .uz-source-chip {
  background: rgba(212, 168, 67, 0.08);
  border-color: rgba(212, 168, 67, 0.30);
  color: var(--heritage-gold, #D4A843);
}

[data-theme="dark"] .lv-preview-img {
  background: var(--surface-alt);
  border-color: var(--border-light);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .lv-preview-meta { color: var(--text-secondary); }

[data-theme="dark"] {
  --surface-elevated: rgba(255, 255, 255, 0.04);
  --border-subtle:    rgba(255, 255, 255, 0.08);
  --text-mute:        var(--text-muted, #6B7280);
  --accent:           #D4A843;
}

[data-theme="dark"] .rfp-lifecycle-card .metric,
[data-theme="dark"] .rfp-rules-card .metric,
[data-theme="dark"] .et-inline-card .metric,
[data-theme="dark"] .et-inline-card .et-template-row,
[data-theme="dark"] .vc-inline-card .metric,
[data-theme="dark"] .ded-inline-card .metric {
  background: rgba(0, 0, 0, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .vc-inline-card input,
[data-theme="dark"] .vc-inline-card select,
[data-theme="dark"] .vc-inline-card textarea,
[data-theme="dark"] .lv-inline-card input,
[data-theme="dark"] .lv-inline-card select,
[data-theme="dark"] .lv-inline-card textarea,
[data-theme="dark"] .fb-inline-card input,
[data-theme="dark"] .fb-inline-card select,
[data-theme="dark"] .fb-inline-card textarea {
  color: var(--text-primary, #E5E7EB) !important;
  background: rgba(0, 0, 0, 0.20) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .rfp-lifecycle-card,
[data-theme="dark"] .rfp-rules-card,
[data-theme="dark"] .et-inline-card,
[data-theme="dark"] .lv-inline-card,
[data-theme="dark"] .qc-inline-card,
[data-theme="dark"] .vc-inline-card,
[data-theme="dark"] .fb-inline-card,
[data-theme="dark"] .ded-inline-card {
  color: var(--text-primary, #E5E7EB);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .rfp-lifecycle-card .badge-critical,
[data-theme="dark"] .rfp-rules-card .badge-critical,
[data-theme="dark"] .et-inline-card .badge-critical,
[data-theme="dark"] .lv-inline-card .badge-critical,
[data-theme="dark"] .qc-inline-card .badge-critical,
[data-theme="dark"] .vc-inline-card .badge-critical,
[data-theme="dark"] .fb-inline-card .badge-critical,
[data-theme="dark"] .ded-inline-card .badge-critical {
  background: rgba(204, 0, 0, 0.18) !important;
  color: #FF6B6B !important;
}

[data-theme="dark"] .rfp-lifecycle-card .badge-ok,
[data-theme="dark"] .et-inline-card .badge-ok,
[data-theme="dark"] .qc-inline-card .badge-ok,
[data-theme="dark"] .vc-inline-card .badge-ok {
  background: rgba(46, 204, 113, 0.15) !important;
  color: #2ECC71 !important;
}

[data-theme="dark"] .rfp-lifecycle-card .badge-warning,
[data-theme="dark"] .qc-inline-card .badge-warning,
[data-theme="dark"] .vc-inline-card .badge-warning,
[data-theme="dark"] .fb-inline-card .badge-warning {
  background: rgba(212, 168, 67, 0.15) !important;
  color: var(--heritage-gold-light, #E8C572) !important;
}

[data-theme="dark"] .rfp-lifecycle-card .stage-pip {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-secondary, #9CA3AF);
}

[data-theme="dark"] .rfp-lifecycle-card .stage-pip.active {
  background: var(--heritage-gold, #D4A843) !important;
  color: #000 !important;
}

[data-theme="dark"] .et-inline-card .et-template-row pre {
  color: var(--text-secondary, #9CA3AF) !important;
}

/* ════════════════════════════════════════════════════════════════════
   DARK-MODE QA PASS (2026-05-23) — coverage backfill
   ════════════════════════════════════════════════════════════════════
   Audit found 125 module class selectors without dark-mode rules. This
   block fills the gaps using the established pattern (override --rule,
   `background: white`, hardcoded `#fff` panels, and any ink-on-paper
   color combos that go invisible on the dark canvas). Tokens used:
   --surface, --surface-alt, --surface-hover, --text-primary,
   --text-secondary, --text-muted, --border-light, --border-medium.
   ──────────────────────────────────────────────────────────────────── */

/* ── Generic chips & meta ──────────────────────────────────────────── */

[data-theme="dark"] .ai-meta-chip {
  background: var(--surface-alt);
  color: var(--text-primary);
  border-color: var(--border-light);
}

/* ── VC (Vendor Compliance) ────────────────────────────────────────── */

[data-theme="dark"] .vc-chip { color: var(--text-secondary); }

[data-theme="dark"] .vc-status-badge { color: var(--text-primary); }

[data-theme="dark"] .vc-summary-chips { color: var(--text-secondary); }

[data-theme="dark"] .vc-days-warning   { color: #E8C572; opacity: 0.9; }

[data-theme="dark"] .vc-days-active    { color: var(--text-secondary); }

[data-theme="dark"] .vc-table tbody tr.vc-row-expired  { background: linear-gradient(90deg, rgba(229,115,115,0.10) 0%, rgba(229,115,115,0.04) 4px, transparent 4px); }

[data-theme="dark"] .vc-table tbody tr.vc-row-expiring { background: linear-gradient(90deg, rgba(232,197,114,0.12) 0%, rgba(232,197,114,0.04) 4px, transparent 4px); }

[data-theme="dark"] .vc-table tbody tr.vc-row-warning  { background: linear-gradient(90deg, rgba(232,197,114,0.06) 0%, rgba(232,197,114,0.02) 4px, transparent 4px); }

[data-theme="dark"] .vc-table tbody tr.vc-row-unknown  { opacity: 0.65; }

[data-theme="dark"] .vc-table tbody tr:hover { background-color: rgba(232,197,114,0.08); }

/* ── ET (Email Triage) ─────────────────────────────────────────────── */

[data-theme="dark"] .et-badge { color: var(--text-primary); }

[data-theme="dark"] .et-status-badge { color: var(--text-primary); }

[data-theme="dark"] .et-summary-chips { color: var(--text-secondary); }

[data-theme="dark"] .et-template-row {
  background: var(--surface-alt);
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .et-table tbody tr.et-row-urg-low td    { box-shadow: inset 3px 0 0 var(--border-medium); }

[data-theme="dark"] .et-table tbody tr.et-row-urg-medium td { box-shadow: inset 3px 0 0 #D4A843; }

[data-theme="dark"] .et-table tbody tr.et-row-urg-high td   { box-shadow: inset 3px 0 0 #E57373; }

/* ── SEO (SEO Intelligence) ────────────────────────────────────────── */

[data-theme="dark"] .seo-bigscore { color: var(--text-primary); }

[data-theme="dark"] .seo-bigscore-label { color: var(--text-secondary); opacity: 0.85; }

[data-theme="dark"] .seo-badge { color: var(--text-primary); }

[data-theme="dark"] .seo-acc { color: var(--text-primary); }

[data-theme="dark"] .seo-mini-score { color: var(--text-primary); }

[data-theme="dark"] .seo-chip {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}

[data-theme="dark"] .seo-summary-chips { color: var(--text-secondary); }

/* ── DED (Deductions) ──────────────────────────────────────────────── */

[data-theme="dark"] .ded-chip { color: var(--text-primary); }

[data-theme="dark"] .ded-status-badge { color: var(--text-primary); }

[data-theme="dark"] .ded-summary-chips { color: var(--text-secondary); }

[data-theme="dark"] .ded-mini-num {
  color: var(--text-primary);
  background: var(--surface-alt);
  border-color: var(--border-light);
}

[data-theme="dark"] .ded-row-dispute { background: rgba(229,115,115,0.06); }

/* ── FB (Formulation Bot) ──────────────────────────────────────────── */

[data-theme="dark"] .fb-exchange-header { border-bottom-color: var(--border-light); }

[data-theme="dark"] .fb-exchange-q-label { color: #B89AE0; }

[data-theme="dark"] .fb-exchange-question { color: var(--text-primary); }

[data-theme="dark"] .fb-exchange-loading { color: var(--text-secondary); }

[data-theme="dark"] .fb-exchange-loading strong { color: #B89AE0; }

[data-theme="dark"] .fb-exchange-error-body strong { color: #F2A8A0; }

[data-theme="dark"] .fb-answer-body { color: var(--text-primary); }

[data-theme="dark"] .fb-answer-empty {
  background: rgba(232,197,114,0.06);
  border-left-color: #E8C572;
  color: var(--text-secondary);
}

[data-theme="dark"] .fb-inline-form-id {
  background: rgba(91,44,138,0.20);
  border-color: rgba(91,44,138,0.40);
  color: #C9A8E0;
}

[data-theme="dark"] .fb-sources { border-top-color: var(--border-light); }

[data-theme="dark"] .fb-sources-title { color: var(--text-secondary); }

[data-theme="dark"] .fb-sources-title svg { color: #B89AE0; }

[data-theme="dark"] .fb-sources-sub { color: var(--text-muted); }

[data-theme="dark"] .fb-sources-empty {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

[data-theme="dark"] .fb-source-card-header:hover { background: rgba(91,44,138,0.12); }

[data-theme="dark"] .fb-source-card-id {
  background: rgba(91,44,138,0.20);
  color: #C9A8E0;
}

[data-theme="dark"] .fb-source-card-meta { color: var(--text-primary); }

[data-theme="dark"] .fb-source-card-customer { color: var(--text-primary); }

[data-theme="dark"] .fb-source-card-product { color: var(--text-secondary); }

[data-theme="dark"] .fb-source-card-date { color: var(--text-muted); }

[data-theme="dark"] .fb-source-card-sep { color: var(--text-muted); opacity: 0.6; }

[data-theme="dark"] .fb-source-card-chevron { color: var(--text-muted); }

[data-theme="dark"] .fb-source-card-relevance {
  color: var(--text-secondary);
  background: rgba(91,44,138,0.08);
  border-top-color: var(--border-light);
}

[data-theme="dark"] .fb-source-card-relevance strong { color: #C9A8E0; }

[data-theme="dark"] .fb-source-card-section-label { color: #B89AE0; }

[data-theme="dark"] .fb-source-card-text { color: var(--text-primary); }

[data-theme="dark"] .fb-source-tag {
  background: rgba(232,197,114,0.14);
  border-color: rgba(232,197,114,0.30);
  color: #E8C572;
}

[data-theme="dark"] .fb-followups { border-top-color: var(--border-light); }

[data-theme="dark"] .fb-followups-label { color: var(--text-secondary); }

[data-theme="dark"] .fb-followups-chips { color: var(--text-primary); }

[data-theme="dark"] .fb-followup-chip svg { color: #B89AE0; }

[data-theme="dark"] .fb-sample-chip {
  background: rgba(91,44,138,0.15);
  border-color: rgba(91,44,138,0.35);
  color: #C9A8E0;
}

[data-theme="dark"] .fb-sample-chip:hover {
  background: rgba(91,44,138,0.25);
  border-color: #B89AE0;
}

/* ── LV (Label Verify) ─────────────────────────────────────────────── */

[data-theme="dark"] .lv-dropzone-filled {
  background: var(--surface-alt);
  border-color: rgba(91,44,138,0.35);
}

[data-theme="dark"] .lv-dropzone-icon { color: var(--text-secondary); }

[data-theme="dark"] .lv-preview-img {
  background: var(--surface-alt);
  border-color: var(--border-light);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

[data-theme="dark"] .lv-preview-title { color: #B89AE0; }

[data-theme="dark"] .lv-preview-text {
  background: var(--surface-alt);
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .lv-spec-tabs { border-bottom-color: var(--border-light); }

[data-theme="dark"] .lv-spec-tab { color: var(--text-secondary); }

[data-theme="dark"] .lv-spec-tab:hover { color: var(--text-primary); }

[data-theme="dark"] .lv-spec-tab.active {
  color: #B89AE0;
  border-bottom-color: #B89AE0;
}

[data-theme="dark"] .lv-demo-card {
  background: var(--surface-alt);
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .lv-demo-card:hover {
  border-color: #B89AE0;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

[data-theme="dark"] .lv-demo-card-active {
  border-color: #B89AE0;
  background: linear-gradient(135deg, rgba(91,44,138,0.18), rgba(212,168,67,0.10));
}

[data-theme="dark"] .lv-demo-label { color: var(--text-primary); }

[data-theme="dark"] .lv-demo-sub   { color: var(--text-secondary); }

[data-theme="dark"] .lv-demo-icon  { color: var(--text-primary); }

[data-theme="dark"] .lv-demo-expected-fail    { background: rgba(229,115,115,0.18); color: #F2A8A0; }

[data-theme="dark"] .lv-demo-expected-warning { background: rgba(232,197,114,0.18); color: #E8C572; }

[data-theme="dark"] .lv-demo-expected-pass    { background: rgba(96,200,120,0.16); color: #A8E5B0; }

[data-theme="dark"] .lv-loading-card { border-left-color: #B89AE0; }

[data-theme="dark"] .lv-status-banner {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .lv-status-pass    { background: linear-gradient(90deg, rgba(96,200,120,0.10), var(--surface)); border-left-color: #6BC97A; }

[data-theme="dark"] .lv-status-warning { background: linear-gradient(90deg, rgba(232,197,114,0.14), var(--surface)); border-left-color: #E8C572; }

[data-theme="dark"] .lv-status-fail    { background: linear-gradient(90deg, rgba(229,115,115,0.10), var(--surface)); border-left-color: #F2A8A0; }

[data-theme="dark"] .lv-status-label   { color: var(--text-primary); }

[data-theme="dark"] .lv-status-summary { color: var(--text-secondary); }

[data-theme="dark"] .lv-section-h { color: #B89AE0; }

[data-theme="dark"] .lv-finding {
  background: var(--surface-alt);
  border-color: var(--border-light);
  border-left-color: var(--text-muted);
  color: var(--text-primary);
}

[data-theme="dark"] .lv-finding-field { color: var(--text-primary); }

[data-theme="dark"] .lv-finding-issue,
[data-theme="dark"] .lv-finding-action { color: var(--text-secondary); }

[data-theme="dark"] .lv-finding-action {
  background: rgba(91,44,138,0.14);
  border-left-color: #B89AE0;
}

[data-theme="dark"] .lv-compare-col {
  background: rgba(255,255,255,0.04);
  border-color: var(--border-light);
}

[data-theme="dark"] .lv-compare-label { color: var(--text-muted); }

[data-theme="dark"] .lv-compare-value { color: var(--text-primary); }

[data-theme="dark"] .lv-compare-label-val { color: #F2A8A0; }

[data-theme="dark"] .lv-compare-spec-val  { color: #A8E5B0; }

[data-theme="dark"] .lv-compare-arrow { color: var(--text-muted); }

[data-theme="dark"] .lv-elements-card {
  background: rgba(96,200,120,0.06);
  border-color: rgba(96,200,120,0.22);
}

[data-theme="dark"] .lv-element-chip {
  background: var(--surface-alt);
  border-color: rgba(96,200,120,0.35);
  color: #A8E5B0;
}

[data-theme="dark"] .lv-severity-badge { color: var(--text-primary); }

[data-theme="dark"] .lv-replace-btn { color: var(--text-secondary); }

[data-theme="dark"] .lv-drop-card { color: var(--text-primary); }

/* ── FC (File Converter) ───────────────────────────────────────────── */

[data-theme="dark"] .fc-format-card {
  background: var(--surface-alt);
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .fc-format-card:hover {
  background: var(--surface-hover);
  border-color: #B89AE0;
}

[data-theme="dark"] .fc-format-card-active {
  background: rgba(91,44,138,0.18);
  border-color: #B89AE0;
  box-shadow: 0 0 0 3px rgba(91,44,138,0.20);
}

[data-theme="dark"] .fc-format-name { color: var(--text-primary); }

[data-theme="dark"] .fc-format-desc { color: var(--text-secondary); }

[data-theme="dark"] .fc-format-ext  { color: var(--text-muted); }

[data-theme="dark"] .fc-table-wrap {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .fc-table thead th {
  background: var(--surface-alt);
  border-bottom-color: var(--border-medium);
  color: var(--text-secondary);
}

[data-theme="dark"] .fc-table tbody td {
  border-bottom-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .fc-table tbody tr:hover { background: var(--surface-hover); }

[data-theme="dark"] .fc-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }

[data-theme="dark"] .fc-raw-preview {
  background: var(--surface-alt);
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .fc-drive-chip {
  background: rgba(91,44,138,0.18);
  border-color: rgba(91,44,138,0.40);
  color: #C9A8E0 !important;
}

[data-theme="dark"] .fc-drive-chip:hover { background: rgba(91,44,138,0.28); }

[data-theme="dark"] .fc-drive-link { color: #B89AE0; }

[data-theme="dark"] .fc-history-wrap {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .fc-history-table thead th {
  background: var(--surface-alt);
  border-bottom-color: var(--border-medium);
  color: var(--text-secondary);
}

[data-theme="dark"] .fc-history-table tbody td {
  border-bottom-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .fc-history-table tbody tr:hover { background: var(--surface-hover); }

[data-theme="dark"] .fc-fmt-pill {
  background: rgba(91,44,138,0.20);
  color: #C9A8E0;
}

/* ── RFP (Inbox) — additional metric/badge coverage ────────────────── */

[data-theme="dark"] .rfp-rules-card { color: var(--text-primary); }

/* ── Spec Diff (sd-* equivalent, lives under .spec-diff-* prefix) ──── */

[data-theme="dark"] .spec-diff-text { color: var(--text-primary); }

[data-theme="dark"] .spec-diff-loading {
  background: linear-gradient(180deg, rgba(91,44,138,0.14), rgba(91,44,138,0.04));
  border-color: rgba(91,44,138,0.35);
  color: var(--text-secondary);
}

[data-theme="dark"] .spec-diff-error { border-left-color: #F2A8A0; }

[data-theme="dark"] .spec-diff-empty {
  background: linear-gradient(180deg, rgba(96,200,120,0.10), rgba(96,200,120,0.03));
  border-color: rgba(96,200,120,0.30);
  color: var(--text-primary);
}

/* Dark mode */

[data-theme="dark"] .status-dot.status-green { box-shadow: 0 0 0 3px rgba(45, 140, 60, 0.3); }

[data-theme="dark"] .status-dot.status-yellow { box-shadow: 0 0 0 3px rgba(200, 155, 26, 0.3); }

[data-theme="dark"] .status-dot.status-red { box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.3); }

/* ── Dark mode polish pass #3: user chip, view toggle, HR, dashboard, forms ── */

/* User chip + dropdown */

[data-theme="dark"] .user-chip {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

[data-theme="dark"] .user-chip:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .user-chip-name { color: var(--text-primary); }

[data-theme="dark"] .user-chip-caret { stroke: var(--text-secondary); }

[data-theme="dark"] .user-dropdown {
  background: var(--surface);
  border-color: var(--border-medium);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .user-dropdown-header {
  border-bottom-color: var(--border-light);
}

[data-theme="dark"] .user-dropdown-name { color: var(--text-primary); }

[data-theme="dark"] .user-dropdown-email { color: var(--text-secondary); }

[data-theme="dark"] .user-dropdown-item {
  color: var(--text-primary);
}

[data-theme="dark"] .user-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .role-pill {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

[data-theme="dark"] .user-dropdown-dept { color: var(--text-mute); }

/* View toggle (table/kanban switcher) */

[data-theme="dark"] .view-toggle {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-light);
}

[data-theme="dark"] .view-toggle button {
  color: var(--text-secondary);
  background: transparent;
}

[data-theme="dark"] .view-toggle button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .view-toggle button.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* HR content */

[data-theme="dark"] .hr-mini-grid { border-color: var(--border-light); }

[data-theme="dark"] .hr-mini-stat {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .hr-mini-label { color: var(--text-secondary); }

[data-theme="dark"] .hr-mini-num { color: var(--text-primary); }

[data-theme="dark"] .hr-mini-num.purple { color: #b388ff; }

[data-theme="dark"] .hr-mini-num.green { color: #66bb6a; }

[data-theme="dark"] .hr-mini-num.red { color: #ef5350; }

[data-theme="dark"] .hr-mini-num.gold { color: #ffd54f; }

/* Dashboard extras */

[data-theme="dark"] .dash-eyebrow { color: var(--text-mute); }

[data-theme="dark"] .dash-title { color: var(--text-primary); }

[data-theme="dark"] .dash-subtitle { color: var(--text-secondary); }

[data-theme="dark"] .dash-hero-actions .btn {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

[data-theme="dark"] .activity-feed-empty-hint { color: var(--text-mute); }

[data-theme="dark"] .due-date-cell { color: var(--text-secondary); }

[data-theme="dark"] .due-date-cell.overdue { color: #ef5350; }

[data-theme="dark"] .due-date-cell .due-relative { color: var(--text-mute); }

/* Form fields — catch-all for any missed inputs */

[data-theme="dark"] .intake-form input,
[data-theme="dark"] .intake-form select,
[data-theme="dark"] .intake-form textarea,
[data-theme="dark"] .form-field input,
[data-theme="dark"] .form-field select,
[data-theme="dark"] .form-field textarea {
  background-color: var(--surface-alt, #1a1a2e);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

[data-theme="dark"] .intake-form label,
[data-theme="dark"] .form-field label {
  color: var(--text-secondary);
}

[data-theme="dark"] .intake-form input::placeholder,
[data-theme="dark"] .form-field input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--text-mute);
}

[data-theme="dark"] .intake-form input:focus,
[data-theme="dark"] .form-field input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--heritage-red);
  box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.15);
}

/* Search bar in topbar */

[data-theme="dark"] .search-bar {
  background: var(--surface);
  border-color: var(--border-medium);
}

[data-theme="dark"] .search-bar input {
  background: transparent;
  color: var(--text-primary);
}

/* Cards and tables catch-all */

[data-theme="dark"] .card {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .data-table th {
  background: var(--surface-alt, #1a1a2e);
  color: var(--text-secondary);
  border-color: var(--border-light);
}

[data-theme="dark"] .data-table td {
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .data-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* App footer dark mode */

[data-theme="dark"] .app-footer {
  background: var(--surface);
  border-top-color: var(--border-light);
  color: var(--text-mute);
}

[data-theme="dark"] .app-footer .footer-mark {
  color: var(--text-secondary);
}

[data-theme="dark"] .app-footer .footer-mark svg {
  fill: var(--text-mute);
  opacity: 0.6;
}

/* ── Dark mode polish pass #4: QC, Complaint Video, HR, Dashboard ─────── */

/* QC Intelligence — KPI grid */

[data-theme="dark"] .kpi-grid-ops .kpi-card {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .kpi-grid-ops .kpi-label { color: var(--text-secondary); }

[data-theme="dark"] .kpi-grid-ops .kpi-value { color: var(--text-primary); }

[data-theme="dark"] .kpi-grid-ops .kpi-sub { color: var(--text-mute); }

/* QC predictions */

[data-theme="dark"] .qc-predictions-block { border-color: var(--border-light); }

[data-theme="dark"] .qc-predictions { background: transparent; }

[data-theme="dark"] .qc-pred-card {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .qc-pred-card strong { color: var(--text-primary); }

[data-theme="dark"] .qc-pred-card .text-mute { color: var(--text-secondary); }

/* QC charts */

[data-theme="dark"] .qc-charts-grid { gap: 16px; }

[data-theme="dark"] .qc-chart-card {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .qc-chart-title { color: var(--text-primary); }

[data-theme="dark"] .qc-chart-legend { color: var(--text-secondary); }

[data-theme="dark"] .qc-chart-card svg text { fill: var(--text-secondary); }

[data-theme="dark"] .qc-chart-card svg line,
[data-theme="dark"] .qc-chart-card svg .grid-line { stroke: var(--border-light); }

/* QC tables */

[data-theme="dark"] .qc-inline-card {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .qc-inline-card th {
  background: var(--surface-alt, #1a1a2e);
  color: var(--text-secondary);
}

[data-theme="dark"] .qc-inline-card td {
  color: var(--text-primary);
  border-color: var(--border-light);
}

[data-theme="dark"] .qc-inline-card tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* QC loading state */

[data-theme="dark"] .qc-loading {
  background: rgba(91, 44, 138, 0.08);
  border-color: rgba(91, 44, 138, 0.25);
}

[data-theme="dark"] .qc-loading strong { color: var(--text-primary); }

/* Complaint Video — demo cards */

[data-theme="dark"] .cv-demo-grid { gap: 12px; }

[data-theme="dark"] .cv-demo-card {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .cv-demo-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-medium);
}

[data-theme="dark"] .cv-demo-icon { opacity: 0.9; }

[data-theme="dark"] .cv-demo-name { color: var(--text-primary); }

[data-theme="dark"] .cv-demo-customer { color: var(--text-secondary); }

[data-theme="dark"] #cv-demo-detail {
  background: var(--surface);
  border-color: var(--border-light);
}

/* HR Forms — data table */

[data-theme="dark"] .hr-mini {
  background: var(--surface);
  border-color: var(--border-light);
}

/* Dashboard — alerts */

[data-theme="dark"] .dash-section-title { color: var(--text-primary); }

[data-theme="dark"] .dash-section-subtitle { color: var(--text-secondary); }

[data-theme="dark"] .alert-card,
[data-theme="dark"] .due-soon-card {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .alert-card.critical {
  border-left-color: #ef5350;
  background: rgba(239, 83, 80, 0.06);
}

[data-theme="dark"] .alert-card.warning {
  border-left-color: #ffd54f;
  background: rgba(255, 213, 79, 0.06);
}

[data-theme="dark"] .alert-card .alert-title { color: var(--text-primary); }

[data-theme="dark"] .alert-card .alert-meta { color: var(--text-mute); }

/* Dashboard — disruption heatmap */

[data-theme="dark"] .heatmap-cell {
  border-color: var(--border-light);
}

[data-theme="dark"] .heatmap-label { color: var(--text-secondary); }

/* Dashboard — pipeline / activity */

[data-theme="dark"] .pipeline-card {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .pipeline-card .pipeline-label { color: var(--text-secondary); }

[data-theme="dark"] .pipeline-card .pipeline-value { color: var(--text-primary); }

/* Plan card — hidden now but dark mode for safety */

[data-theme="dark"] .plan-mini {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .plan-mini-phase {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .plan-mini-phase:hover { background: rgba(255, 255, 255, 0.04); }

[data-theme="dark"] .plan-mini-label { color: var(--text-mute); }

[data-theme="dark"] .plan-mini-title { color: var(--text-primary); }

[data-theme="dark"] .plan-mini-meta { color: var(--text-secondary); }

/* Admin sidebar dark mode */

[data-theme="dark"] .admin-sidebar {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .admin-sidebar-title {
  color: var(--text-primary);
}

[data-theme="dark"] .admin-tab {
  color: var(--text-secondary);
}

[data-theme="dark"] .admin-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

[data-theme="dark"] .admin-tab.active {
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: white;
}

/* =====================================================================
 * DARK MODE FINAL AUDIT — 2026-05-23
 * APPEND-ONLY. Fills remaining light-mode-only rules with [data-theme="dark"]
 * overrides. Uses existing dark tokens:
 *   --bg-primary, --bg-secondary, --surface, --surface-alt, --surface-hover,
 *   --text-primary, --text-secondary, --text-mute (compat alias), --text-muted,
 *   --border-light, --border-medium, --heritage-red, --heritage-gold, --heritage-purple
 *
 * Scope:
 *   1. Typography roots (h1-h6, p body color)
 *   2. Utility classes (.text-mute, .text-strong, .uppercase-label)
 *   3. Admin panel (tables, role-select, entity-pill, user-cell, info/stat rows)
 *   4. Form components (.form-input/.form-textarea/.form-select class-based, labels, helpers)
 *   5. Modal dialog (.modal, header/footer, close button, title/subtitle)
 *   6. Toast notifications (.toast)
 *   7. Alerts banner (.alert + .alerts-* family)
 *   8. KPI tiles + dashboard viz (legend, donut, status-bar, heatmap, region, demand)
 *   9. Tables — .data-table class-based, .table-wrap
 *  10. Cards (.card, .kanban-*, .empty-state)
 *  11. Tabs (.tab)
 *  12. Activity feed + icons + spinner
 *  13. KB reader + landing (titles, summaries, meta, blockquote)
 *  14. Plan view (.phase-*, .kr-*, .risk-*, .stakeholder-*)
 *  15. Sidebar polish (.brand-name .small, .nav-badge, .nav-link.active .nav-badge)
 *  16. Search bar placeholder + svg
 *  17. Confidence/badge variants that fell through (.badge-confidence, .conf-pill.conf-mute)
 *  18. Lark/intake (.lark-panel .null)
 *  19. .change-* group (Lark Base records review surface)
 *  20. .cv-* gap fillers (status-pass/warning/fail, match-yes/no, demo-sev-*, frame-thumb)
 *  21. Misc (.formulation-bot-empty-title, .kanban-empty, .ai-risk-hint, role pills)
 * ===================================================================== */

/* ── 1. Typography roots ──────────────────────────────────────── */

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 { color: var(--text-primary); }

[data-theme="dark"] p  { color: var(--text-primary); }

/* ── 2. Utility classes ───────────────────────────────────────── */

[data-theme="dark"] .text-mute       { color: var(--text-mute); }

[data-theme="dark"] .text-strong     { color: var(--text-primary); }

[data-theme="dark"] .uppercase-label { color: var(--text-mute); }

/* ── 3. Admin panel — content surface, tables, badges ─────────── */

[data-theme="dark"] .admin-h2                  { color: var(--text-primary); }

[data-theme="dark"] .admin-h2 em               { color: #F2A8A0; }

[data-theme="dark"] .admin-stat-card           { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .admin-stat-value          { color: var(--text-primary); }

[data-theme="dark"] .admin-stat-label          { color: var(--text-mute); }

[data-theme="dark"] .admin-stat-icon           { color: var(--heritage-gold); }

[data-theme="dark"] .card-h3                   { color: #C9A8E0; }

[data-theme="dark"] .admin-role-row,
[data-theme="dark"] .admin-info-row            { border-bottom-color: var(--border-light); }

[data-theme="dark"] .admin-info-label          { color: var(--text-mute); }

[data-theme="dark"] .admin-info-value          { color: var(--text-primary); }

[data-theme="dark"] .role-count                { color: #F2A8A0; }

/* Status badges — keep semantic tint, brighten on dark */

[data-theme="dark"] .status-badge.status-ok    { background: rgba(96,200,120,0.16); color: #A8E5B0; border-color: rgba(96,200,120,0.34); }

[data-theme="dark"] .status-badge.status-warn  { background: rgba(212,168,67,0.18); color: #E8C572; border-color: rgba(212,168,67,0.38); }

[data-theme="dark"] .status-badge.status-err   { background: rgba(229,115,115,0.18); color: #F2A8A0; border-color: rgba(229,115,115,0.36); }

/* User cell (in admin tables) */

[data-theme="dark"] .user-cell-name            { color: var(--text-primary); }

/* Role select (inline editable) */

[data-theme="dark"] .role-select               { background-color: var(--surface-alt); color: var(--text-primary); border-color: var(--border-medium); }

[data-theme="dark"] .users-search-input        { background-color: var(--surface-alt); color: var(--text-primary); border-color: var(--border-medium); }

[data-theme="dark"] .users-search-input:hover  { border-color: var(--heritage-gold); }

[data-theme="dark"] .role-select:hover:not(:disabled) { border-color: var(--heritage-gold); }

[data-theme="dark"] .role-select:disabled     { background-color: var(--surface); color: var(--text-mute); }

/* Entity pill */

[data-theme="dark"] .entity-pill               { background: var(--surface-alt); border-color: var(--border-medium); color: #C9A8E0; }

/* Btn link (Save/Reset etc. in admin) */

[data-theme="dark"] .btn-link                  { color: #F2A8A0; text-decoration-color: rgba(242,168,160,0.4); }

[data-theme="dark"] .btn-link:hover            { background: rgba(229,115,115,0.10); text-decoration-color: #F2A8A0; }

[data-theme="dark"] .btn-link.btn-danger       { color: #F4A8A0; }

[data-theme="dark"] .btn-link.btn-danger:hover { background: rgba(229,115,115,0.10); }

/* Role pill viewer-variant — gets lost on dark */

[data-theme="dark"] .role-pill.role-viewer            { color: var(--text-secondary); border-color: var(--border-medium); background: rgba(255,255,255,0.04); }

[data-theme="dark"] .persona-role-pill.role-viewer    { color: var(--text-secondary); border-color: var(--border-medium); background: rgba(255,255,255,0.04); }

/* ── 4. Form components (class-based) ─────────────────────────── */

[data-theme="dark"] .form-label                { color: var(--text-mute); }

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-textarea,
[data-theme="dark"] .form-select               { background-color: var(--surface-alt); color: var(--text-primary); border-color: var(--border-medium); }

[data-theme="dark"] .form-input::placeholder,
[data-theme="dark"] .form-textarea::placeholder { color: var(--text-mute); }

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-textarea:focus,
[data-theme="dark"] .form-select:focus         { border-color: var(--heritage-gold); box-shadow: 0 0 0 3px rgba(212,168,67,0.22); }

[data-theme="dark"] .form-textarea.intake      { background: var(--surface); }

[data-theme="dark"] .form-help                 { color: var(--text-mute); }

/* Btn leespace disabled state */

[data-theme="dark"] .btn-leespace-disabled,
[data-theme="dark"] .btn-leespace:disabled     { background: var(--surface-alt); color: var(--text-mute); border-color: var(--border-medium); }

[data-theme="dark"] .btn-leespace-disabled .btn-leespace-status,
[data-theme="dark"] .btn-leespace:disabled .btn-leespace-status { background: var(--surface); color: var(--text-mute); }

/* ── 5. Modal dialog ──────────────────────────────────────────── */

[data-theme="dark"] .modal                     { background: var(--bg-secondary); border-color: var(--border-light); color: var(--text-primary); }

[data-theme="dark"] .modal-header              { border-bottom-color: var(--border-light); }

[data-theme="dark"] .modal-title               { color: var(--text-primary); }

[data-theme="dark"] .modal-subtitle            { color: var(--text-mute); }

[data-theme="dark"] .modal-close               { color: var(--text-secondary); }

[data-theme="dark"] .modal-close:hover         { background: var(--surface-hover); color: #F2A8A0; }

[data-theme="dark"] .modal-footer              { background: var(--surface); border-top-color: var(--border-light); }

/* Detail view (read-only field rows inside modal) */

[data-theme="dark"] .detail-label              { color: var(--text-mute); }

[data-theme="dark"] .detail-value              { color: var(--text-primary); }

/* Confidence meter readout */

[data-theme="dark"] .confidence-meter          { color: var(--text-secondary); }

/* ── 6. Toast notifications ───────────────────────────────────── */

[data-theme="dark"] .toast                     { background: var(--bg-secondary); border-color: var(--border-light); color: var(--text-primary); box-shadow: 0 12px 32px rgba(0,0,0,0.5); }

[data-theme="dark"] .toast.toast-ok            { background: linear-gradient(135deg, #1F6B2B, #15521F); color: #E8F5EA; }

[data-theme="dark"] .toast.toast-error         { background: linear-gradient(135deg, #8B1F15, #5C140D); color: #FBE6E2; }

/* ── 7. Alerts banner ─────────────────────────────────────────── */

[data-theme="dark"] .alerts-banner             { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .alerts-head               { color: var(--text-primary); border-bottom-color: var(--border-light); }

[data-theme="dark"] .alerts-title              { color: var(--text-primary); }

[data-theme="dark"] .alert                    { background: var(--surface-alt); border-color: var(--border-light); }

[data-theme="dark"] .alert:hover               { background: var(--surface-hover); }

[data-theme="dark"] .alert-icon                { background: var(--surface); border-color: var(--border-medium); }

[data-theme="dark"] .alert-title               { color: var(--text-primary); }

[data-theme="dark"] .alert-detail              { color: var(--text-secondary); }

[data-theme="dark"] .alert-cta                 { color: var(--text-mute); }

/* ── 8. KPI tiles + dashboard viz ─────────────────────────────── */

[data-theme="dark"] .kpi-tile                  { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .kpi-tile:hover            { background: var(--surface-hover); border-color: var(--border-medium); }

[data-theme="dark"] .kpi-value                 { color: var(--text-primary); }

[data-theme="dark"] .kpi-suffix                { color: var(--text-secondary); }

[data-theme="dark"] .kpi-meta                  { color: var(--text-secondary); }

[data-theme="dark"] .kpi-trend.flat            { color: var(--text-mute); }

[data-theme="dark"] .viz-sub                   { color: var(--text-secondary); }

/* Donut + legends */

[data-theme="dark"] .donut-legend              { color: var(--text-secondary); }

[data-theme="dark"] .donut-legend strong       { color: var(--text-primary); }

[data-theme="dark"] .legend-label              { color: var(--text-secondary); }

[data-theme="dark"] .legend-val                { color: var(--text-primary); }

/* Status bars */

[data-theme="dark"] .status-bar-val            { color: var(--text-secondary); }

[data-theme="dark"] .status-bar-val strong     { color: var(--text-primary); }

[data-theme="dark"] .status-bar-foot           { color: var(--text-mute); }

/* Heatmap */

[data-theme="dark"] .heatmap-col-head          { color: var(--text-secondary); }

[data-theme="dark"] .heatmap-row-head          { color: var(--text-primary); }

[data-theme="dark"] .heatmap-cell.empty::before { color: var(--text-mute); }

[data-theme="dark"] .heatmap-total             { color: var(--text-primary); }

[data-theme="dark"] .heatmap-legend            { color: var(--text-mute); }

/* Region + demand widgets */

[data-theme="dark"] .region-name               { color: var(--text-secondary); }

[data-theme="dark"] .region-count              { color: var(--text-primary); }

[data-theme="dark"] .demand-recent-head        { color: var(--text-mute); }

[data-theme="dark"] .demand-customer           { color: var(--text-primary); }

[data-theme="dark"] .demand-sku                { color: var(--text-mute); }

/* Activity feed */

[data-theme="dark"] .activity-icon             { background: var(--surface-alt); border-color: var(--border-light); color: var(--text-secondary); }

[data-theme="dark"] .activity-verb             { color: var(--text-primary); }

[data-theme="dark"] .activity-entity           { color: var(--text-secondary); }

[data-theme="dark"] .activity-text             { color: var(--text-primary); }

[data-theme="dark"] .activity-time             { color: var(--text-mute); }

/* ── 9. Tables (.data-table class-based) + table-wrap ─────────── */

[data-theme="dark"] .data-table                { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .data-table thead th       { background: var(--surface-alt); color: var(--text-secondary); border-color: var(--border-light); }

[data-theme="dark"] .data-table tbody td       { color: var(--text-primary); border-color: var(--border-light); }

[data-theme="dark"] .data-table tbody tr:hover td { background: var(--surface-hover); }

[data-theme="dark"] .data-table .customer-cell { color: var(--text-primary); }

[data-theme="dark"] .data-table .customer-cell .customer-meta { color: var(--text-mute); }

[data-theme="dark"] .data-table .due-date-cell .due-relative  { color: var(--text-mute); }

[data-theme="dark"] .assignee-cell.unassigned  { color: var(--text-mute); }

[data-theme="dark"] .unassigned-avatar         { color: var(--text-mute); background: var(--surface-alt); border-color: var(--border-medium); }

[data-theme="dark"] .table-wrap                { background: var(--surface); border-color: var(--border-light); }

/* ── 10. Cards + kanban + empty-state ─────────────────────────── */

[data-theme="dark"] .card-title                { color: var(--text-primary); }

[data-theme="dark"] .card-subtitle             { color: var(--text-mute); }

[data-theme="dark"] .big-num                   { color: var(--text-primary); }

[data-theme="dark"] .stat-label                { color: var(--text-secondary); }

[data-theme="dark"] .stat-value                { color: var(--text-primary); }

[data-theme="dark"] .stat-value .pct-symbol    { color: var(--text-secondary); }

[data-theme="dark"] .stat-meta                 { color: var(--text-secondary); }

[data-theme="dark"] .empty-state               { color: var(--text-mute); }

[data-theme="dark"] .empty-state .empty-icon   { color: var(--text-mute); opacity: 0.5; }

[data-theme="dark"] .kanban-col-title          { color: var(--text-secondary); }

[data-theme="dark"] .kanban-col-count          { background: var(--surface); border-color: var(--border-medium); color: var(--text-primary); }

[data-theme="dark"] .kanban-card-customer      { color: var(--text-primary); }

[data-theme="dark"] .kanban-card-products      { color: var(--text-secondary); }

[data-theme="dark"] .kanban-card-meta          { color: var(--text-mute); }

/* Kanban empty state */

[data-theme="dark"] .kanban-empty              { color: var(--text-mute); }

[data-theme="dark"] .kanban-empty svg          { color: var(--text-mute); opacity: 0.5; }

/* AI risk column hint */

[data-theme="dark"] .ai-risk-hint              { color: var(--text-mute); }

/* Badge variants */

[data-theme="dark"] .badge-status-lost         { color: var(--text-mute); border-color: var(--border-medium); background: rgba(255,255,255,0.04); }

[data-theme="dark"] .badge-priority-low        { color: var(--text-mute); border-color: var(--border-medium); background: rgba(255,255,255,0.04); }

[data-theme="dark"] .badge-confidence          { background: var(--surface-alt); border-color: var(--border-medium); color: var(--text-secondary); }

[data-theme="dark"] .conf-pill.conf-mute       { background: var(--surface-alt); color: var(--text-mute); }

/* View toggle + filter dropdowns */

[data-theme="dark"] .view-toggle               { background: var(--surface-alt); border-color: var(--border-medium); }

[data-theme="dark"] .filter-select             { background-color: var(--surface-alt); color: var(--text-primary); border-color: var(--border-medium); }

/* ── 11. Tabs ─────────────────────────────────────────────────── */

[data-theme="dark"] .tab                       { color: var(--text-secondary); border-color: transparent; }

[data-theme="dark"] .tab:hover                 { color: var(--text-primary); }

[data-theme="dark"] .tab.active                { color: #F2A8A0; }

/* ── 12. Spinner + loading shimmer ────────────────────────────── */

[data-theme="dark"] .spinner                   { border-color: var(--border-medium); border-top-color: var(--heritage-gold); }

[data-theme="dark"] .loading-shimmer           { background: linear-gradient(90deg, var(--surface-alt), var(--surface-hover), var(--surface-alt)); }

/* ── 13. KB reader + landing ──────────────────────────────────── */

[data-theme="dark"] .kb-cat-title              { color: var(--text-mute); border-bottom-color: var(--border-light); }

[data-theme="dark"] .kb-item-title             { color: var(--text-primary); }

[data-theme="dark"] .kb-item-summary           { color: var(--text-secondary); }

[data-theme="dark"] .kb-item-meta              { color: var(--text-mute); }

[data-theme="dark"] .kb-reader                 { border-color: var(--border-light); }

[data-theme="dark"] .kb-article-title          { color: var(--text-primary); }

[data-theme="dark"] .kb-article-meta           { color: var(--text-mute); }

[data-theme="dark"] .kb-article-body           { color: var(--text-primary); }

[data-theme="dark"] .kb-article-body h1,
[data-theme="dark"] .kb-article-body h2,
[data-theme="dark"] .kb-article-body h3        { color: var(--text-primary); }

[data-theme="dark"] .kb-article-body blockquote { color: var(--text-secondary); border-left-color: var(--heritage-gold); }

[data-theme="dark"] .kb-landing-sub            { color: var(--text-secondary); }

[data-theme="dark"] .kb-landing-pin-title      { color: var(--text-primary); }

[data-theme="dark"] .kb-landing-pin-summary    { color: var(--text-secondary); }

[data-theme="dark"] .kb-landing-pin-meta       { color: var(--text-mute); }

[data-theme="dark"] .kb-landing-card           { border-color: var(--border-light); }

[data-theme="dark"] .kb-landing-card-title     { color: var(--text-primary); }

[data-theme="dark"] .kb-landing-card-summary   { color: var(--text-secondary); }

[data-theme="dark"] .kb-landing-card-meta      { color: var(--text-mute); }

/* ── 14. Plan view (phase/KR/risk/stakeholder) ────────────────── */

[data-theme="dark"] .phase-card                { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .phase-card-title          { color: var(--text-primary); }

[data-theme="dark"] .phase-card-meta           { color: var(--text-secondary); }

[data-theme="dark"] .phase-section-title       { color: var(--text-primary); border-bottom-color: var(--border-light); }

[data-theme="dark"] .kr-card                   { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .kr-title                  { color: var(--text-primary); }

[data-theme="dark"] .kr-definition             { color: var(--text-secondary); }

[data-theme="dark"] .kr-status-badge.kr-status-not_started { color: var(--text-mute); border-color: var(--border-medium); background: rgba(255,255,255,0.04); }

[data-theme="dark"] .risk-item                 { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .risk-title                { color: var(--text-primary); }

[data-theme="dark"] .risk-mitigation           { color: var(--text-secondary); }

[data-theme="dark"] .stakeholder-item          { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .stakeholder-name          { color: var(--text-primary); }

/* ── 15. Sidebar polish (the bits that fell through) ──────────── */

[data-theme="dark"] .brand-name .name-en .small { color: var(--text-mute); }

[data-theme="dark"] .nav-badge                  { background: var(--surface-alt); color: var(--text-primary); border-color: var(--border-medium); }

[data-theme="dark"] .nav-link.active .nav-badge { background: var(--surface); color: #FF6B6B; border-color: rgba(255,107,107,0.30); }

/* Sidebar close button (mobile drawer) */

[data-theme="dark"] .sidebar-close-btn         { color: var(--text-secondary); }

[data-theme="dark"] .sidebar-close-btn:hover   { background: var(--surface-hover); color: var(--text-primary); }

/* Mobile-only search trigger */

[data-theme="dark"] .topbar-search-btn         { color: var(--text-secondary); border-color: var(--border-medium); }

[data-theme="dark"] .topbar-search-btn:hover   { background: var(--surface-hover); color: var(--text-primary); }

/* ── 16. Search bar (placeholder + svg icon) ──────────────────── */

[data-theme="dark"] .search-bar input::placeholder { color: var(--text-mute); }

[data-theme="dark"] .search-bar svg            { color: var(--text-mute); }

/* User dropdown SVG icons (covered above for items but svg fill needs explicit token) */

[data-theme="dark"] .user-dropdown-item svg    { color: var(--text-mute); }

[data-theme="dark"] .user-dropdown-item:hover svg { color: #F2A8A0; }

/* ── 17. Lark intake panel ────────────────────────────────────── */

[data-theme="dark"] .lark-panel .null          { color: var(--text-mute); }

/* ── 18. Change Review cards (Lark Base records) ─────────────── */

[data-theme="dark"] .change-group-title        { color: var(--text-primary); }

[data-theme="dark"] .change-group-sub          { color: var(--text-mute); }

[data-theme="dark"] .change-card               { background: var(--surface); border-color: var(--border-light); }

[data-theme="dark"] .change-card-field         { color: var(--text-primary); }

[data-theme="dark"] .change-card-label         { color: var(--text-mute); }

[data-theme="dark"] .change-card-text          { color: var(--text-primary); }

[data-theme="dark"] .change-card-arrow         { color: var(--text-mute); }

[data-theme="dark"] .change-card-impact,
[data-theme="dark"] .change-card-action        { color: var(--text-secondary); }

[data-theme="dark"] .change-card-impact strong { color: var(--text-primary); }

/* ── 19. Complaint Video (.cv-*) — final gap fillers ──────────── */

[data-theme="dark"] .cv-demo-sev-high          { background: rgba(229,115,115,0.16); color: #F2A8A0; }

[data-theme="dark"] .cv-demo-sev-medium        { background: rgba(212,168,67,0.18); color: #E8C572; }

[data-theme="dark"] .cv-demo-sev-low           { background: rgba(91,155,213,0.16); color: #9CC9F0; }

[data-theme="dark"] .cv-status-pass            { background: linear-gradient(90deg, rgba(96,200,120,0.10), var(--surface)); border-left-color: #6BC97A; }

[data-theme="dark"] .cv-status-warning         { background: linear-gradient(90deg, rgba(212,168,67,0.12), var(--surface)); border-left-color: #E8C572; }

[data-theme="dark"] .cv-status-fail            { background: linear-gradient(90deg, rgba(229,115,115,0.10), var(--surface)); border-left-color: #F2A8A0; }

[data-theme="dark"] .cv-match-yes              { background: rgba(96,200,120,0.14); color: #A8E5B0; border-color: rgba(96,200,120,0.30); }

[data-theme="dark"] .cv-match-no               { background: var(--surface-alt); color: var(--text-secondary); border-color: var(--border-medium); }

[data-theme="dark"] .cv-frame-thumb            { background: var(--surface-alt); border-color: var(--border-light); }

[data-theme="dark"] .cv-demo-card-active       { background: var(--surface-hover); }

[data-theme="dark"] .cv-demo-line              { color: var(--text-primary); }

[data-theme="dark"] .cv-demo-time              { color: var(--text-mute); }

[data-theme="dark"] .cv-detail-time            { color: var(--text-mute); }

[data-theme="dark"] .cv-detail-line            { color: var(--text-primary); }

[data-theme="dark"] .cv-detail-meta dt         { color: var(--text-mute); }

[data-theme="dark"] .cv-detail-meta dd         { color: var(--text-primary); }

[data-theme="dark"] .cv-context-body           { color: var(--text-primary); }

[data-theme="dark"] .cv-context-meta           { color: var(--text-mute); }

[data-theme="dark"] .cv-context-notes          { color: var(--text-secondary); }

[data-theme="dark"] .cv-action-body            { color: var(--text-primary); }

/* ── 20. Label Validator (.lv-*) — final gap fillers ──────────── */

[data-theme="dark"] .lv-elements-card          { background: rgba(96,200,120,0.06); border-color: rgba(96,200,120,0.22); }

[data-theme="dark"] .lv-preview-title          { color: #C9A8E0; }

/* ── 21. Formulation Bot empty state ──────────────────────────── */

[data-theme="dark"] .formulation-bot-empty-title { color: var(--text-primary); }

[data-theme="dark"] .formulation-bot-empty-sub  { color: var(--text-secondary); }

[data-theme="dark"] .formulation-bot-empty-examples ul { color: var(--text-secondary); }

[data-theme="dark"] .fb-answer-body            { color: var(--text-primary); }

/* ── 22. Help panel — shortcut keycaps + help section body ────── */

[data-theme="dark"] .help-shortcut             { color: var(--text-mute); }

[data-theme="dark"] .help-section-title        { color: var(--text-primary); }

[data-theme="dark"] .help-section-body         { color: var(--text-secondary); }

[data-theme="dark"] .help-panel-eyebrow        { color: #F2A8A0; }

/* ── 23. Page hero — neutral badge variant ────────────────────── */

[data-theme="dark"] .page-hero-badge.neutral   { background: var(--surface-alt); border-color: var(--border-medium); color: var(--text-secondary); }

[data-theme="dark"] .page-hero-badge-label     { color: var(--text-secondary); }

[data-theme="dark"] .page-section-note         { color: var(--text-secondary); }

/* ── 24. PO + disrupted row tinting ───────────────────────────── */

[data-theme="dark"] .po-card.po-disrupted      { background: rgba(229,115,115,0.06); border-left-color: #F2A8A0; }

[data-theme="dark"] .po-warn                   { background: rgba(229,115,115,0.08); border-left-color: #F2A8A0; color: #F2A8A0; }

[data-theme="dark"] tr.row-disrupted           { background: rgba(229,115,115,0.06); }

[data-theme="dark"] tr.row-disrupted:hover     { background: rgba(229,115,115,0.10); }

/* ── 25. Login page polish (eggshell gradient fallback) ───────── */

[data-theme="dark"] .login-page {
  background:
    radial-gradient(circle at 20% 0%, rgba(212, 168, 67, 0.10), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(204, 0, 0, 0.06), transparent 50%),
    var(--bg-primary);
}

/* ── 26. Final orphan token rescues (background/border only) ──── */

/* Several legacy CSS variables are used by many rules; if we re-point
   the *background*-only ones in dark mode, every untouched light rule
   that uses them for a background or border will auto-convert.
   We deliberately DO NOT remap the ink-* tokens here because they're
   also used as color values on red/gold buttons where the dark surface
   color would reduce contrast. Color tokens are handled per-rule above. */

[data-theme="dark"] {
  /* Background tokens — safe to remap; only used as backgrounds/borders */
  --surface-soft:        var(--surface-hover);
  --rule:                var(--border-light);
  --rule-soft:           var(--border-light);
  --rule-gold:           rgba(212, 168, 67, 0.30);
}

/* ── End DARK MODE FINAL AUDIT 2026-05-23 ─────────────────────── */

/* ── Dark mode pass #5: QC recent batches + dashboard alerts/tiles ────── */

/* QC recent batches section */

[data-theme="dark"] .qc-recent-wrap {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .qc-recent-wrap table {
  color: var(--text-primary);
}

[data-theme="dark"] .qc-recent-wrap th {
  background: var(--surface-alt, #1a1a2e);
  color: var(--text-secondary);
  border-color: var(--border-light);
}

[data-theme="dark"] .qc-recent-wrap td {
  color: var(--text-primary);
  border-color: var(--border-light);
}

[data-theme="dark"] .qc-recent-wrap tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] #qc-recent h2 { color: var(--text-primary); }

/* QC line cards */

[data-theme="dark"] .qc-line-card {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .qc-line-card-name { color: var(--text-primary); }

[data-theme="dark"] .qc-line-card-meta { color: var(--text-secondary); }

/* Dashboard — mi-dash-tiles (market intel tiles) */

[data-theme="dark"] .mi-dash-tile {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .mi-dash-tile:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-medium);
}

[data-theme="dark"] .mi-dash-tile-red {
  background: rgba(239, 83, 80, 0.08);
  border-color: rgba(239, 83, 80, 0.25);
}

[data-theme="dark"] .mi-dash-tile-red:hover {
  background: rgba(239, 83, 80, 0.12);
}

[data-theme="dark"] .mi-dash-tile-icon { color: var(--text-secondary); }

[data-theme="dark"] .mi-dash-tile-value { color: var(--text-primary); }

[data-theme="dark"] .mi-dash-tile-label { color: var(--text-secondary); }

[data-theme="dark"] .mi-dash-tile-meta { color: var(--text-mute); }

/* Dashboard — card-bg fallback override */

[data-theme="dark"] [style*="var(--card-bg"] {
  background: var(--surface) !important;
  border-color: var(--border-light) !important;
}

[data-theme="dark"] [style*="color: var(--ink-strong"] { color: var(--text-primary) !important; }

[data-theme="dark"] [style*="color: var(--ink,"] { color: var(--text-secondary) !important; }

/* Dashboard — text-danger in dark */

[data-theme="dark"] .text-danger { color: #ef5350; }

/* ── Dark mode pass #6: Dashboard alerts container + level variants ────── */

/* Parent .alerts container */

[data-theme="dark"] .alerts {
  background: var(--surface);
  border-color: var(--border-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .alerts-head {
  border-bottom-color: var(--border-light);
}

[data-theme="dark"] .alerts-dot {
  background: #ef5350;
  box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.2);
}

[data-theme="dark"] .alerts-title {
  color: var(--text-primary);
}

[data-theme="dark"] .alerts-list {
  background: transparent;
}

/* Individual alert rows */

[data-theme="dark"] .alert {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .alert:hover {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .alert-body {}

[data-theme="dark"] .alert-title { color: var(--text-primary); }

[data-theme="dark"] .alert-detail { color: var(--text-secondary); }

[data-theme="dark"] .alert-cta { color: var(--text-mute); }

/* Level variants */

[data-theme="dark"] .alert-critical {
  border-left-color: #ef5350;
  background: rgba(239, 83, 80, 0.06);
}

[data-theme="dark"] .alert-critical .alert-icon {
  background: rgba(239, 83, 80, 0.15);
  color: #ef5350;
}

[data-theme="dark"] .alert-warning {
  border-left-color: #ffd54f;
  background: rgba(255, 213, 79, 0.06);
}

[data-theme="dark"] .alert-warning .alert-icon {
  background: rgba(255, 213, 79, 0.15);
  color: #ffd54f;
}

[data-theme="dark"] .alert-info {
  border-left-color: #b388ff;
  background: rgba(179, 136, 255, 0.06);
}

[data-theme="dark"] .alert-info .alert-icon {
  background: rgba(179, 136, 255, 0.15);
  color: #b388ff;
}

/* Empty alerts state */

[data-theme="dark"] .alerts-empty {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .alerts-empty-inner {
  color: var(--text-mute);
}

/* Activity list */

[data-theme="dark"] .activity-list { border-color: var(--border-light); }

[data-theme="dark"] .activity-item { border-bottom-color: var(--border-light); }

[data-theme="dark"] .activity-verb { color: var(--text-primary); }

[data-theme="dark"] .activity-entity { color: var(--text-secondary); }

[data-theme="dark"] .activity-ref { color: var(--text-mute); }

[data-theme="dark"] .activity-time { color: var(--text-mute); }

[data-theme="dark"] .activity-icon { border-color: var(--border-light); }

/* QC recent batches table */

[data-theme="dark"] .qc-recent-table {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .qc-recent-table th {
  background: var(--surface-alt, #1a1a2e);
  color: var(--text-secondary);
  border-color: var(--border-light);
}

[data-theme="dark"] .qc-recent-table td {
  color: var(--text-primary);
  border-color: var(--border-light);
}

[data-theme="dark"] .qc-recent-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* ============================================================
   Extracted from public/js/ui/activity-feed.js — pageStyles()
   Activity feed dark-mode tweaks. The platform already has
   theme-toggle; these override base styles in 23-activity.css.
   ============================================================ */

[data-theme="dark"] .af-event,
[data-theme="dark"] .af-stat-card {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .af-module {
  background: rgba(255, 255, 255, 0.06);
  color: #ddd;
}

[data-theme="dark"] .af-event-entity,
[data-theme="dark"] .af-user {
  color: #eee;
}

/* ──────────────────────────────────────────────────────────────────────────
   AUDIT POLISH 3 — Dark mode coverage for new components (2026-05-24)

   Covers: Ask AIOP agent drawer + Agentic Search engine cards.
   Both shipped without dark-mode rules in their initial drops; this pass
   maps the warm-tone tokens (`--ink*`, `--eggshell*`, `--paper`) onto the
   dark surface tokens that the rest of the platform already uses.
   ────────────────────────────────────────────────────────────────────── */

/* === Ask AIOP — agent drawer ============================================ */

[data-theme="dark"] .agent-drawer {
  background: var(--surface);
  color: var(--text-primary);
  border-left-color: var(--border-light);
}

[data-theme="dark"] .agent-drawer-header {
  background: linear-gradient(180deg, rgba(204, 0, 0, 0.10), transparent);
  border-bottom-color: var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .agent-drawer-title { color: var(--text-primary); }
[data-theme="dark"] .agent-drawer-subtitle { color: var(--text-secondary); }

[data-theme="dark"] .agent-icon-btn {
  color: var(--text-secondary);
}
[data-theme="dark"] .agent-icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

[data-theme="dark"] .agent-thread-list {
  background: var(--surface-alt);
  border-color: var(--border-light);
}
[data-theme="dark"] .agent-thread-item { color: var(--text-secondary); }
[data-theme="dark"] .agent-thread-item:hover { background: var(--surface-hover); color: var(--text-primary); }
[data-theme="dark"] .agent-thread-item.active { background: var(--surface-hover); color: var(--text-primary); }
[data-theme="dark"] .agent-thread-item-title { color: var(--text-primary); }
[data-theme="dark"] .agent-thread-item-delete { color: var(--text-secondary); }
[data-theme="dark"] .agent-thread-item-delete:hover { background: rgba(192, 57, 43, 0.18); color: #FF6B6B; }

[data-theme="dark"] .agent-empty { color: var(--text-secondary); }
[data-theme="dark"] .agent-empty-title { color: var(--text-primary); }
[data-theme="dark"] .agent-empty-desc { color: var(--text-secondary); }
[data-theme="dark"] .agent-suggestion {
  background: var(--surface-alt);
  color: var(--text-primary);
  border-color: var(--border-light);
}
[data-theme="dark"] .agent-suggestion:hover {
  background: var(--surface-hover);
  border-color: var(--border-medium);
}

[data-theme="dark"] .agent-msg.assistant .agent-msg-bubble {
  background: var(--surface-alt);
  color: var(--text-primary);
  border-color: var(--border-light);
}
/* user bubble keeps the red gradient — same as light. */

[data-theme="dark"] .agent-msg-bubble code {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

[data-theme="dark"] .agent-msg-meta { color: var(--text-muted); }

[data-theme="dark"] .agent-tool-pill {
  background: rgba(170, 130, 220, 0.14);
  color: #B388F0;
  border-color: rgba(170, 130, 220, 0.25);
}
[data-theme="dark"] .agent-tool-pill.error {
  background: rgba(255, 107, 107, 0.14);
  color: #FF8A8A;
  border-color: rgba(255, 107, 107, 0.25);
}

/* Ask AIOP → Feedback Hub proposal card (S3).
   The card is built on --rule / --paper / --ink-* tokens, which this file
   already remaps for dark, so only the hardcoded rgba() accents and the two
   tinted surfaces need explicit overrides here. */
[data-theme="dark"] .agent-fb-card {
  background: var(--surface-alt);
  border-color: var(--border-light);
  border-left-color: var(--heritage-red-deep);
  box-shadow: none;
}
[data-theme="dark"] .agent-fb-chip {
  background: var(--bg-secondary);
  border-color: var(--border-light);
  color: var(--text-secondary);
}
[data-theme="dark"] .agent-fb-chip-type[data-fb-type="bug"] {
  background: rgba(255, 107, 107, 0.14);
  border-color: rgba(255, 107, 107, 0.3);
  color: #FF8A8A;
}
[data-theme="dark"] .agent-fb-chip-type[data-fb-type="suggestion"] {
  background: rgba(212, 168, 67, 0.16);
  border-color: rgba(212, 168, 67, 0.32);
  color: var(--heritage-gold-light);
}
[data-theme="dark"] .agent-fb-chip-type[data-fb-type="capability_request"] {
  background: rgba(170, 130, 220, 0.16);
  border-color: rgba(170, 130, 220, 0.3);
  color: #B388F0;
}
[data-theme="dark"] .agent-fb-chip-warn {
  background: rgba(212, 168, 67, 0.18);
  border-color: rgba(212, 168, 67, 0.35);
  color: var(--heritage-gold-light);
}
[data-theme="dark"] .agent-fb-dupe {
  background: rgba(212, 168, 67, 0.12);
  border-color: rgba(212, 168, 67, 0.28);
  color: var(--text-secondary);
}
[data-theme="dark"] .agent-fb-more,
[data-theme="dark"] .agent-fb-link { color: #FF8A8A; }
[data-theme="dark"] .agent-fb-input,
[data-theme="dark"] .agent-fb-select,
[data-theme="dark"] .agent-fb-textarea {
  background: var(--bg-secondary);
  border-color: var(--border-medium);
  color: var(--text-primary);
}
[data-theme="dark"] .agent-fb-btn {
  background: var(--bg-secondary);
  border-color: var(--border-medium);
  color: var(--text-primary);
}
[data-theme="dark"] .agent-fb-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong, var(--border-medium));
}
[data-theme="dark"] .agent-fb-btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
/* primary keeps the red gradient — same as the user bubble. */
[data-theme="dark"] .agent-fb-error {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.3);
}
[data-theme="dark"] .agent-fb-error-title { color: #FF8A8A; }
[data-theme="dark"] .agent-fb-card.agent-fb-filed {
  background: rgba(46, 204, 113, 0.1);
  border-left-color: #6FD89A;
}
[data-theme="dark"] .agent-tool-pill.complete {
  background: rgba(46, 204, 113, 0.14);
  color: #6FD89A;
  border-color: rgba(46, 204, 113, 0.25);
}

[data-theme="dark"] .agent-typing span { background: var(--text-muted); }

[data-theme="dark"] .agent-drawer-footer,
[data-theme="dark"] .agent-drawer-composer {
  background: var(--surface);
  border-top-color: var(--border-light);
}
[data-theme="dark"] .agent-drawer-composer textarea,
[data-theme="dark"] #agent-input {
  background: var(--surface-alt);
  color: var(--text-primary);
  border-color: var(--border-medium);
}
[data-theme="dark"] .agent-drawer-composer textarea::placeholder,
[data-theme="dark"] #agent-input::placeholder { color: var(--text-muted); }

[data-theme="dark"] .agent-fab {
  /* keep the red gradient — same as light */
  box-shadow: 0 6px 22px rgba(204, 0, 0, 0.45);
}

/* === Agentic Search — engine cards + composite block ==================== */

[data-theme="dark"] .seo-probe-shell {
  background: var(--surface-alt);
  border-color: var(--border-light);
}
[data-theme="dark"] .seo-probe-shell-title { color: #FF6B6B; }
[data-theme="dark"] .seo-probe-shell-meta { color: var(--text-secondary); }

[data-theme="dark"] .seo-engine-card {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}
[data-theme="dark"] .seo-engine-card-done:hover {
  background: var(--surface-hover);
}
[data-theme="dark"] .seo-engine-card-error {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border-light);
}
[data-theme="dark"] .seo-engine-name { color: var(--text-primary); }
[data-theme="dark"] .seo-engine-body { color: var(--text-secondary); }
[data-theme="dark"] .seo-engine-deploy { color: var(--text-secondary); }
[data-theme="dark"] .seo-engine-loading { color: var(--text-secondary); }
[data-theme="dark"] .seo-engine-section-label { color: var(--text-muted); }
[data-theme="dark"] .seo-engine-response summary { color: var(--text-secondary); }
[data-theme="dark"] .seo-engine-response-body {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  border-color: var(--border-light);
}
[data-theme="dark"] .seo-engine-gap {
  background: rgba(212, 168, 67, 0.10);
  color: var(--text-primary);
  border-left-color: #D4A843;
}
[data-theme="dark"] .seo-engine-brief {
  background: rgba(170, 130, 220, 0.08);
  color: var(--text-primary);
  border-left-color: #B388F0;
}
[data-theme="dark"] .seo-engine-latency { color: var(--text-muted); }
[data-theme="dark"] .seo-engine-status-label { color: var(--text-secondary); }
[data-theme="dark"] .seo-engine-error { color: #FF8A8A; }
[data-theme="dark"] .seo-engine-done-badge { color: #6FD89A; }

[data-theme="dark"] .seo-comp-chip {
  background: var(--surface-hover);
  color: var(--text-secondary);
  border-color: var(--border-medium);
}
[data-theme="dark"] .seo-comp-chip-lkk {
  background: rgba(204, 0, 0, 0.18);
  color: #FF8A8A;
  border-color: rgba(204, 0, 0, 0.35);
}

[data-theme="dark"] .seo-composite {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}
[data-theme="dark"] .seo-composite-label,
[data-theme="dark"] .seo-composite-stat-label { color: var(--text-muted); }
[data-theme="dark"] .seo-composite-stat-num { color: var(--text-primary); }
[data-theme="dark"] .seo-composite-insight,
[data-theme="dark"] .seo-composite-rec {
  background: var(--surface-alt);
  color: var(--text-primary);
  border-color: var(--border-light);
}
[data-theme="dark"] .seo-composite-insight-label,
[data-theme="dark"] .seo-composite-rec-label { color: var(--text-secondary); }
[data-theme="dark"] .seo-composite-lift { color: #6FD89A; }
[data-theme="dark"] .seo-composite-actions {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}
[data-theme="dark"] .seo-composite-actions summary { color: var(--text-secondary); }
[data-theme="dark"] .seo-composite-consensus {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}
[data-theme="dark"] .seo-composite-consensus-label { color: var(--text-muted); }
[data-theme="dark"] .seo-batch-progress { background: rgba(255, 255, 255, 0.08); }

[data-theme="dark"] .seo-consistency-high { color: #6FD89A; }
[data-theme="dark"] .seo-consistency-medium { color: #D4A843; }
[data-theme="dark"] .seo-consistency-low { color: #FF8A8A; }

/* === Knowledge Base disclaimer banners ================================ */
/* Both KB disclaimers hardcoded warning yellow (#fff8e1) which reads OK on
   dark but with low contrast on the text. Bump the surface to match. */

[data-theme="dark"] .kb-disclaimer,
[data-theme="dark"] .kb-article-disclaimer {
  background: rgba(212, 168, 67, 0.10) !important;
  color: var(--text-primary) !important;
  border-left-color: #D4A843 !important;
}
[data-theme="dark"] .kb-disclaimer strong,
[data-theme="dark"] .kb-article-disclaimer strong { color: #E5C875; }

/* ====================================================================
   AI WORKSPACE (.ws-*) — dark mode (2026-06-17 mobile dark sweep)
   The full-screen workspace takeover (33-workspace.css) shipped with ZERO
   dark rules. It is built entirely on the warm design-system tokens
   (--eggshell-*, --warm-white, --paper, --ink-*, --rule) which are NOT
   remapped globally in dark mode. Because .ws-root is a self-contained
   fixed full-screen surface (and its buttons use hardcoded #fff text, not
   ink tokens), we can safely remap BOTH the warm background tokens AND the
   ink text tokens *scoped to .ws-root* — this dark-converts the whole module
   (rail, chat, composer, artifacts, mobile drawer/overlay) at every width
   without the global button-contrast risk that blocked a global ink remap.
   ==================================================================== */
[data-theme="dark"] .ws-root {
  /* Warm surface/paper tokens → dark surfaces */
  --eggshell-bright: var(--bg-primary);
  --eggshell-shade:  var(--surface-hover);
  --eggshell-deep:   var(--surface-alt);
  --warm-white:      var(--surface);
  --paper:           var(--bg-secondary);
  /* Warm ink tokens → dark text (scoped: safe here, buttons use #fff) */
  --ink-strong: var(--text-primary);
  --ink:        var(--text-primary);
  --ink-soft:   var(--text-secondary);
  --ink-mute:   var(--text-muted);
  --ink-faint:  var(--text-muted);
  /* Rules/borders */
  --rule:      var(--border-light);
  --rule-soft: var(--border-light);
  background:
    radial-gradient(ellipse at top left, rgba(212,168,67,0.06), transparent 55%),
    var(--bg-primary);
}
/* Rail + panes: paint the structural surfaces explicitly (some use
   gradients/rgba that the token remap alone doesn't fully catch). */
[data-theme="dark"] .ws-rail {
  background: linear-gradient(180deg, var(--surface), var(--bg-secondary));
  border-right-color: var(--border-light);
}
/* HEADER BAND (2026-07-28): the chat topbar and the artifacts panel header form
   ONE continuous horizontal band across the split (shared --ws-head-h height +
   the same translucent fill, see 33/34). They MUST be restyled together here:
   34-artifacts.css sets a literal rgba() light fill on .artifacts-header to tone
   match the topbar, and a literal cannot follow the .ws-root token remap. Style
   one without the other and the band splits into a light bar meeting a dark bar
   in dark mode — the exact "two colliding planes" defect this band fixed. */
[data-theme="dark"] .ws-topbar,
[data-theme="dark"] .ws-root .artifacts-header {
  background: rgba(26,29,39,0.85);
  border-bottom-color: var(--border-light);
}
[data-theme="dark"] .ws-convo-item.active { background: var(--surface-alt); color: var(--text-primary); }
[data-theme="dark"] .ws-convo-item:hover { background: var(--surface-hover); }
[data-theme="dark"] .ws-convos-search input,
[data-theme="dark"] .ws-convo-rename-input {
  background: var(--surface-alt); color: var(--text-primary); border-color: var(--border-medium);
}
/* Assistant bubble: explicit surface (uses --warm-white + --rule-soft). */
[data-theme="dark"] .ws-msg.assistant .ws-msg-bubble {
  background: var(--surface-alt); border-color: var(--border-light);
}
/* User bubble + send button keep the heritage-red treatment (white text on
   red reads fine in dark) — no override needed. */
[data-theme="dark"] .ws-avatar-user { background: var(--surface-alt); color: var(--text-primary); }
[data-theme="dark"] .ws-chip,
[data-theme="dark"] .ws-artifact-chip,
[data-theme="dark"] .ws-attachment-chip {
  background: var(--surface-alt); border-color: var(--border-light); color: var(--text-secondary);
}
[data-theme="dark"] .ws-chip:hover,
[data-theme="dark"] .ws-artifact-chip:hover { border-color: var(--heritage-gold); }
[data-theme="dark"] .ws-composer {
  background: var(--surface); border-color: var(--border-medium);
}
[data-theme="dark"] .ws-input { color: var(--text-primary); }
[data-theme="dark"] .ws-input::placeholder { color: var(--text-muted); }
[data-theme="dark"] .ws-artifacts-pane {
  background: var(--surface); border-left-color: var(--border-light);
}
[data-theme="dark"] .ws-artifacts-head { background: var(--bg-secondary); border-bottom-color: var(--border-light); }
[data-theme="dark"] .ws-artifact-tab.active { background: var(--surface); border-color: var(--border-light); color: var(--text-primary); }
[data-theme="dark"] .ws-tool-pill { background: var(--surface-alt); border-color: var(--border-light); color: var(--text-secondary); }
/* A3/A4/B3 (2026-08-07): dark tokens for the new chat-UX surfaces. */
[data-theme="dark"] .ws-tools-used > summary { color: var(--text-secondary); }
[data-theme="dark"] .ws-tools-used > summary:hover { color: var(--text-primary); }
[data-theme="dark"] .ws-msg-budget { background: rgba(212,168,67,0.14); color: var(--text-secondary); }
[data-theme="dark"] .ws-msg-verify { color: #6FCF97; }
[data-theme="dark"] .ws-msg-verify.skipped { color: var(--text-secondary); }
[data-theme="dark"] .ws-msg-verify.uncorrected { color: #E0B04A; }
[data-theme="dark"] .ws-convo-snippet { color: var(--text-secondary); }
/* A1/A5/A6 (2026-08-07): durable errors, capability notices, empty tool pill. */
[data-theme="dark"] .ws-msg-notice {
  background: var(--surface-alt); border-left-color: var(--border-light);
  color: var(--text-secondary);
}
[data-theme="dark"] .ws-tool-pill.empty {
  background: transparent; border-color: var(--border-light); color: var(--text-secondary);
}
[data-theme="dark"] .ws-markdown code { background: var(--surface-alt); color: #FF8A8A; }
[data-theme="dark"] .ws-markdown th { background: var(--surface-alt); color: var(--text-primary); }
[data-theme="dark"] .ws-markdown th,
[data-theme="dark"] .ws-markdown td { border-color: var(--border-light); }
/* Mobile drawer + full-screen artifact overlay surfaces. */
[data-theme="dark"] .ws-view-toggle { background: var(--surface-alt) !important; border-color: var(--border-light) !important; }
[data-theme="dark"] .ws-view-tab.active { background: var(--surface) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .ws-drop-overlay { background: rgba(15,17,23,0.86); }
[data-theme="dark"] .ws-drop-overlay-inner { background: var(--surface); }
/* Frontier parity (2026-07-08): export button + hover-action affordances. */
[data-theme="dark"] .ws-export-trigger { color: var(--text-secondary); }
[data-theme="dark"] .ws-export-trigger:hover { background: var(--surface-alt); }
[data-theme="dark"] .ws-msg-action:hover,
[data-theme="dark"] .ws-feedback-thumb:hover { background: var(--surface-alt); }
[data-theme="dark"] .ws-artifacts-pane.art-fullscreen { background: var(--bg-primary, var(--surface)); }
/* Frontier polish (2026-07-08): hardcoded-color stragglers the .ws-root token
   remap can't reach. Catch-up pill + collapsible-code body shipped with light
   literals; the "Copied" tooltips used ink tokens that INVERT in dark. */
[data-theme="dark"] .ws-catchup { background: rgba(26,29,39,0.92); border-color: var(--border-medium); }
[data-theme="dark"] .ws-markdown .ws-code pre { background: var(--bg-secondary); color: var(--text-primary); }
[data-theme="dark"] .ws-code-copy.copied::after,
[data-theme="dark"] .ws-msg-copy.copied::after { background: var(--surface-alt); color: var(--text-primary); }
[data-theme="dark"] .ws-shortcuts-overlay { background: rgba(0,0,0,0.6); }
[data-theme="dark"] .ws-shortcut-keys kbd { border-color: var(--border-medium); }
[data-theme="dark"] .ws-editing-banner { background: color-mix(in srgb, var(--heritage-gold) 14%, var(--surface)); }
[data-theme="dark"] .ws-attachment-thumb { border-color: var(--border-light); background: var(--surface-alt); }
[data-theme="dark"] .ws-markdown tbody tr:nth-child(even) { background: rgba(212,168,67,.07); }

/* ====================================================================
   DEDUCTIONS / EMAIL-TRIAGE — dark gap fill (low-contrast gold text +
   light input borders that the 22 existing ded-/et- rules missed)
   ==================================================================== */
/* #8a6a1f dark-gold text is unreadable on dark pill tints — lighten it. */
[data-theme="dark"] .ded-status-pending,
[data-theme="dark"] .ded-chip-pending,
[data-theme="dark"] .et-badge-medium { color: #E5C580; }
[data-theme="dark"] .ded-status-accepted { color: var(--text-secondary); }
[data-theme="dark"] .ded-chip-total { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
[data-theme="dark"] .ded-mini-input {
  border-color: var(--border-medium); color: var(--text-primary);
}
[data-theme="dark"] .et-classify-row { background: var(--surface-alt); }
[data-theme="dark"] .et-route-chip { color: var(--text-secondary); }

/* ====================================================================
   MARKET MONITOR (.mm-*) — dark mode mobile+desktop coverage
   (2026-06-17 mobile dark sweep). Cards use `background: var(--bg-card,#fff)`
   which is NOT remapped in dark mode (stays white); text uses --ink-* tokens
   (also not remapped). These rules paint surfaces + remap text per-rule. The
   `var(--rule)` borders are already remapped globally so they're skipped.
   ==================================================================== */

/* ── Card & container backgrounds (--bg-card #fff → --surface) ── */
[data-theme="dark"] .mm-action-group { background: var(--surface); }
[data-theme="dark"] .mm-action-item { background: var(--surface); }
[data-theme="dark"] .mm-health-card { background: var(--surface); }
[data-theme="dark"] .mm-market-card { background: var(--surface); }
[data-theme="dark"] .mm-signal-card { background: var(--surface); }

/* ── Primary text (--ink-strong #1A1410 → --text-primary) ── */
[data-theme="dark"] .mm-action-group-label,
[data-theme="dark"] .mm-action-item-product,
[data-theme="dark"] .mm-action-title,
[data-theme="dark"] .mm-health-card-name,
[data-theme="dark"] .mm-health-stat strong,
[data-theme="dark"] .mm-market-card-name,
[data-theme="dark"] .mm-market-stat strong,
[data-theme="dark"] .mm-detail-h4,
[data-theme="dark"] .mm-signal-title,
[data-theme="dark"] .mm-signals-header,
[data-theme="dark"] .mm-catalog-toggle,
[data-theme="dark"] .mm-admin-toggle,
[data-theme="dark"] .mm-admin-block-title,
[data-theme="dark"] .mm-import-stat-val { color: var(--text-primary); }

/* ── Secondary text (--ink / --ink-soft / #5A554F → --text-secondary) ── */
[data-theme="dark"] .mm-intel-loading,
[data-theme="dark"] .mm-scrape-pending,
[data-theme="dark"] .mm-import-pending,
[data-theme="dark"] .mm-review-body,
[data-theme="dark"] .mm-promo,
[data-theme="dark"] .mm-action-item-context { color: var(--text-secondary); }

/* ── Muted text (--ink-mute → --text-muted) ── */
[data-theme="dark"] .mm-action-breakdown,
[data-theme="dark"] .mm-action-group-hint,
[data-theme="dark"] .mm-action-item-sub,
[data-theme="dark"] .mm-health-label,
[data-theme="dark"] .mm-health-stat span,
[data-theme="dark"] .mm-market-stat span,
[data-theme="dark"] .mm-expand-caret,
[data-theme="dark"] .mm-import-stat-label,
[data-theme="dark"] .mm-mover-flat,
[data-theme="dark"] .mm-sev-low,
[data-theme="dark"] .mm-sent-neutral,
[data-theme="dark"] .mm-stock-badge.stock-not-found,
[data-theme="dark"] .mm-stock-badge.stock-unknown { color: var(--text-muted); }

/* ── Hardcoded eggshell separator (#E8DFC9) → dark border ── */
[data-theme="dark"] .mm-action-group .mm-action-item { border-bottom-color: var(--border-light); }

/* ── Green text (--success-deep too dark on dark) → lightened ── */
[data-theme="dark"] .mm-intel-clear,
[data-theme="dark"] .mm-action-empty,
[data-theme="dark"] .mm-price-down,
[data-theme="dark"] .mm-signal-logged,
[data-theme="dark"] .mm-stock-badge.stock-in,
[data-theme="dark"] .mm-mover-down,
[data-theme="dark"] .mm-sent-positive { color: #6FD89A; }

/* ── Gold/warning text (too dark) → lightened ── */
[data-theme="dark"] .mm-sev-medium { background: rgba(212, 168, 67, 0.16); color: #E5C580; }
/* Feedback #18: Low Stock stays warm orange in dark mode (not gold — gold collides with Unknown/muted). */
[data-theme="dark"] .mm-stock-badge.stock-low {
  background: rgba(230, 126, 34, 0.22);
  color: #f0a060;
  border-color: rgba(230, 126, 34, 0.5);
}

/* ── Purple accent (--heritage-purple / hardcoded #5B2C8A) → lightened ── */
[data-theme="dark"] .mm-manager-badge {
  background: rgba(167, 139, 250, 0.14);
  color: #A78BFA;
  border-color: rgba(167, 139, 250, 0.30);
}
[data-theme="dark"] .mm-review-lang {
  background: rgba(167, 139, 250, 0.14);
  color: #A78BFA;
}
[data-theme="dark"] .mm-action-more { color: #A78BFA; }

/* ── Card hover shadows (lighten for dark bg) ── */
[data-theme="dark"] .mm-health-card:hover,
[data-theme="dark"] .mm-market-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* ── Schedule card forms (hardcoded #5B2C8A purple labels + light inputs) ── */
[data-theme="dark"] .mm-schedule-card .form-label { color: #A78BFA; }
[data-theme="dark"] .mm-schedule-card .form-input,
[data-theme="dark"] .mm-schedule-card .form-select {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}
[data-theme="dark"] .mm-schedule-card #mm-sched-mine .data-table th { color: #A78BFA; }

/* ── Product picker dropdown (hardcoded #fff bg + light borders) ── */
[data-theme="dark"] .mm-pp-results {
  background: var(--surface-alt);
  border-color: var(--border-medium);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
[data-theme="dark"] .mm-pp-item { border-bottom-color: var(--border-light); }
[data-theme="dark"] .mm-pp-item:hover { background: rgba(204, 0, 0, 0.12); }

/* ── Danger zone (slightly stronger tint for dark visibility) ── */
[data-theme="dark"] .mm-danger-zone { background: rgba(239, 83, 80, 0.08); }
[data-theme="dark"] .mm-danger-body { border-top-color: rgba(239, 83, 80, 0.25); }

/* ── Dark-mode select chevron (2026-06-17, Kevin: "tiled dropdown arrow") ──
   Two-part fix for the bugged-looking dropdown arrow in dark mode:
   (1) The dark-mode select rules above now use background-COLOR (not the
       `background:` shorthand) so the chevron SVG + no-repeat/position from
       95-polish-v3 are no longer reset (the reset caused the tiled arrow).
   (2) The light chevron stroke (#5B2C8A purple) is near-invisible on dark
       surfaces, so re-assert a lighter caret here. Gold (#D4A843) reads on
       the dark surface and stays on-brand. background-color stays intact. */
[data-theme="dark"] .filter-select,
[data-theme="dark"] .form-select,
[data-theme="dark"] .af-filter {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23D4A843' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
}

/* ════════════════════════════════════════════════════════════════
   Market Monitor (.mm-) — dark mode (2026-06-17, Kevin: "dark mode
   missing on mobile … market monitor"). Completed by parent session
   after the sweep sub-agent's grandchild died before writing this
   block (disk-verified: 0 .mm- dark rules existed). MM is built on
   warm tokens: card surfaces use var(--bg-card,#fff) and text uses
   --ink-strong/--ink-mute/--ink-soft — none remapped in dark mode,
   so every MM card stayed white. Fix = explicit dark surfaces +
   readable text on all .mm- components (applies at ALL widths;
   "missing on mobile" = mobile card-stacks had no dark paint).
   ════════════════════════════════════════════════════════════════ */
/* Card surfaces (the 5 selectors that use var(--bg-card,#fff)) */
[data-theme="dark"] .mm-action-group,
[data-theme="dark"] .mm-action-item,
[data-theme="dark"] .mm-health-card,
[data-theme="dark"] .mm-market-card,
[data-theme="dark"] .mm-signal-card,
[data-theme="dark"] .mm-sev-card {
  background: var(--surface-alt);
  border-color: var(--border-light);
}
/* Ink text → readable on dark */
[data-theme="dark"] .mm-action-group-label,
[data-theme="dark"] .mm-action-item-title,
[data-theme="dark"] .mm-health-title,
[data-theme="dark"] .mm-market-title,
[data-theme="dark"] .mm-signal-title,
[data-theme="dark"] .mm-sev-card-title {
  color: var(--text-primary);
}
[data-theme="dark"] .mm-action-item-sub,
[data-theme="dark"] .mm-mover-flat,
[data-theme="dark"] .mm-page-info,
[data-theme="dark"] .mm-sent-neutral,
[data-theme="dark"] .mm-sev-low {
  color: var(--text-secondary);
}
/* Broad ink remap inside MM cards (catches the many --ink-* usages
   without globally remapping ink-* — scoped to .mm- only). */
[data-theme="dark"] [class^="mm-"],
[data-theme="dark"] [class*=" mm-"] {
  --ink-strong: var(--text-primary);
  --ink-soft: var(--text-secondary);
  --ink-mute: var(--text-mute);
  --bg-card: var(--surface-alt);
  --rule-soft: var(--border-light);
}
/* Sentiment / severity tint chips — keep semantic hue, lift text */
[data-theme="dark"] .mm-sent-positive { background: rgba(39,174,96,0.18); color: #6ee7a8; }
[data-theme="dark"] .mm-sent-negative { background: rgba(192,57,43,0.20); color: #f3a097; }
[data-theme="dark"] .mm-sent-neutral  { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .mm-sev-high      { background: rgba(192,57,43,0.22); color: #f3a097; }
[data-theme="dark"] .mm-sev-medium    { background: rgba(212,168,67,0.22); color: #E5C580; }
[data-theme="dark"] .mm-sev-low       { background: rgba(255,255,255,0.06); }
/* White-on-white catalog cell fix (line ~1032 used #fff bg) */
[data-theme="dark"] .mm-catalog-cell,
[data-theme="dark"] .mm-expand-panel,
[data-theme="dark"] .mm-detail-panel {
  background: var(--surface-alt);
  border-color: var(--border-light);
  color: var(--text-primary);
}

/* ── Order Intelligence semantic-tint vars (2026-06-17) ──
   OI's detail/completeness/status panels use inline-style hardcoded
   LIGHT tints in the JS (#dff5e6 green / #fde5e5 red / #fff8d8 yellow /
   #f0f0f0 grey / #e8f4fd blue) that CSS couldn't reach → bright cards
   in dark mode. JS now reads var(--oi-tint-*, <light-default>); define
   the dark values here (alpha-blended tints + readable text). Also
   remaps the --accent-soft / --border-soft fallbacks OI uses for its
   side-list + multi-order chips. */
[data-theme="dark"] {
  --oi-tint-green: rgba(39, 174, 96, 0.16);
  --oi-tint-red: rgba(192, 57, 43, 0.18);
  --oi-tint-red-text: #f3a097;
  --oi-tint-yellow: rgba(212, 168, 67, 0.18);
  --oi-tint-yellow-text: #E5C580;
  --oi-tint-grey: rgba(255, 255, 255, 0.06);
  --oi-tint-blue: rgba(25, 118, 210, 0.18);
  --accent-soft: rgba(212, 168, 67, 0.14);
  --border-soft: var(--border-light);
}

/* ── Ask AIOP rich-text (.agent-markdown) dark mode (2026-06-17) ── */
[data-theme="dark"] .agent-markdown h1,
[data-theme="dark"] .agent-markdown h2,
[data-theme="dark"] .agent-markdown h3,
[data-theme="dark"] .agent-markdown h4,
[data-theme="dark"] .agent-markdown strong { color: var(--text-primary); }
[data-theme="dark"] .agent-markdown code { background: var(--surface-alt); color: #FF8A8A; }
[data-theme="dark"] .agent-markdown a { color: #FF8A8A; }
[data-theme="dark"] .agent-markdown blockquote { color: var(--text-secondary); border-left-color: var(--heritage-gold); }
[data-theme="dark"] .agent-markdown hr { border-top-color: var(--border-light); }
[data-theme="dark"] .agent-markdown th { background: var(--surface-alt); color: var(--text-primary); }
[data-theme="dark"] .agent-markdown th,
[data-theme="dark"] .agent-markdown td { border-color: var(--border-light); }

/* ── System status details modal (2026-07-03) ── */
[data-theme="dark"] .status-modal { background: var(--surface); }
[data-theme="dark"] .status-modal-head,
[data-theme="dark"] .status-modal-foot { border-color: var(--border-light); }
[data-theme="dark"] .status-modal-head h3 { color: var(--text-primary); }
[data-theme="dark"] .status-modal-close { color: var(--text-secondary); }
[data-theme="dark"] .status-modal-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
[data-theme="dark"] .status-modal-loading { color: var(--text-secondary); }
[data-theme="dark"] .status-modal-foot a { color: var(--heritage-gold); }
[data-theme="dark"] .svc-overall { color: var(--text-primary); }
[data-theme="dark"] .svc-overall-ok   { background: rgba(45, 140, 60, 0.18); }
[data-theme="dark"] .svc-overall-warn { background: rgba(200, 155, 26, 0.16); }
[data-theme="dark"] .svc-overall-down { background: rgba(204, 0, 0, 0.20); }
[data-theme="dark"] .svc-row { border-color: var(--border-light); }
[data-theme="dark"] .svc-name { color: var(--text-primary); }
[data-theme="dark"] .svc-detail { color: var(--text-secondary); }
[data-theme="dark"] .svc-meta { color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════════
   MARKET RESEARCH (.mr-*) — dark mode (polish pass 2026-07-07)
   ════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .mr-tabs { border-bottom-color: var(--border-light); }
[data-theme="dark"] .mr-tab { color: var(--text-secondary); }
[data-theme="dark"] .mr-tab:hover { color: var(--text-primary); }
[data-theme="dark"] .mr-tab.active { color: #FF6B6B; border-bottom-color: #FF6B6B; }
[data-theme="dark"] .mr-intro,
[data-theme="dark"] .mr-region-label { color: var(--text-secondary); }
[data-theme="dark"] .mr-tpl-name,
[data-theme="dark"] .mr-comp-name,
[data-theme="dark"] .mr-job-topic,
[data-theme="dark"] .mr-lib-topic,
[data-theme="dark"] .mr-launch-tpl-name { color: var(--text-primary); }
[data-theme="dark"] .mr-tpl-desc,
[data-theme="dark"] .mr-comp-focus,
[data-theme="dark"] .mr-lib-meta,
[data-theme="dark"] .mr-empty-msg { color: var(--text-secondary); }
[data-theme="dark"] .mr-tpl-card:hover { border-color: rgba(212, 168, 67, 0.55); }
[data-theme="dark"] .mr-tpl-card.selected { border-color: #FF6B6B; box-shadow: 0 0 0 1px #FF6B6B; }
[data-theme="dark"] .mr-tpl-badge { color: var(--heritage-gold-light); background: rgba(212, 168, 67, 0.14); border-color: rgba(212, 168, 67, 0.35); }
[data-theme="dark"] .mr-comp-region { color: var(--heritage-gold-light); }
[data-theme="dark"] .mr-comp-posture { background: rgba(212, 168, 67, 0.10); color: var(--text-secondary); }
[data-theme="dark"] .mr-badge-queued  { color: var(--text-secondary); background: rgba(156, 163, 175, 0.14); }
[data-theme="dark"] .mr-badge-running { color: var(--heritage-gold-light); background: rgba(212, 168, 67, 0.16); }
[data-theme="dark"] .mr-badge-done    { color: #6EE7A2; background: rgba(45, 140, 60, 0.18); }
[data-theme="dark"] .mr-badge-failed  { color: #FF6B6B; background: rgba(204, 0, 0, 0.18); }
[data-theme="dark"] .mr-prog-step { color: var(--text-secondary); }
[data-theme="dark"] .mr-prog-step.done { color: #6EE7A2; }
[data-theme="dark"] .mr-prog-step.active { color: var(--text-primary); }
[data-theme="dark"] .mr-error,
[data-theme="dark"] .mr-error-text { color: #FF6B6B; }
[data-theme="dark"] .mr-empty-error .empty-icon { color: #FF6B6B; }
[data-theme="dark"] .mr-lib-row:hover,
[data-theme="dark"] .mr-comp-card:hover { border-color: rgba(212, 168, 67, 0.45); }
[data-theme="dark"] .mr-report-md th { background: rgba(212, 168, 67, 0.12); }
[data-theme="dark"] .mr-report-md th,
[data-theme="dark"] .mr-report-md td { border-color: var(--border-light); }
[data-theme="dark"] .mr-badge-pipeline { color: var(--text-secondary); background: rgba(156, 163, 175, 0.14); border-color: rgba(156, 163, 175, 0.28); }
[data-theme="dark"] .mr-view-run { color: #93C5FD; }

/* ── Email Triage P1 Inbox (2026-07-08) ─────────────────────── */

[data-theme="dark"] .et-root { background: var(--surface, #1E2130); border-color: rgba(255,255,255,0.10); }
[data-theme="dark"] .et-rail { background: rgba(255,255,255,0.02); border-right-color: rgba(255,255,255,0.10); }
[data-theme="dark"] .et-item { border-bottom-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .et-item:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .et-item.selected { background: rgba(204,0,0,0.14); }
[data-theme="dark"] .et-item-urg-low { border-left-color: rgba(255,255,255,0.14); }
[data-theme="dark"] .et-item-sender { color: var(--text-primary, #E5E7EB); }
[data-theme="dark"] .et-item-subject { color: var(--text-secondary, #9CA3AF); }
[data-theme="dark"] .et-item.unread .et-item-sender,
[data-theme="dark"] .et-item.unread .et-item-subject { color: #fff; }
[data-theme="dark"] .et-item-snippet, [data-theme="dark"] .et-item-date { color: var(--text-muted, #6B7280); }
[data-theme="dark"] .et-list-footer { border-top-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .et-tab { color: var(--text-secondary, #9CA3AF); }
[data-theme="dark"] .et-tab:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .et-tab.active { background: rgba(229,115,115,0.16); color: #F2A8A0; }
[data-theme="dark"] .et-tab-count.has-count { background: rgba(255,255,255,0.10); }
[data-theme="dark"] .et-detail-sender, [data-theme="dark"] .et-detail-subject { color: var(--text-primary, #E5E7EB); }
[data-theme="dark"] .et-detail-badges { border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .et-body-card { border-color: rgba(255,255,255,0.10); }
[data-theme="dark"] .et-body-label { background: rgba(255,255,255,0.04); border-bottom-color: rgba(255,255,255,0.08); color: var(--text-muted, #6B7280); }
[data-theme="dark"] .et-body-pre { background: transparent; color: var(--text-secondary, #C4C9D4); }
[data-theme="dark"] .et-detail-actions { border-top-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .et-detail-empty-title { color: var(--text-primary, #E5E7EB); }
[data-theme="dark"] .et-dup-badge { background: rgba(76,160,190,0.16); color: #8FCADD; border-color: rgba(76,160,190,0.32); }
[data-theme="dark"] .et-star { color: var(--text-muted, #6B7280); }
[data-theme="dark"] .et-star.starred, [data-theme="dark"] .et-star:hover { color: #E5C580; }
/* P2: human loop (assignment / corrections / bulk bar) */
[data-theme="dark"] .et-rail-select { background: rgba(255,255,255,0.04); border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .et-select-label { color: var(--text-muted, #6B7280); }
[data-theme="dark"] .et-assignee-chip { background: rgba(229,197,128,0.14); color: #E5C580; border-color: rgba(229,197,128,0.35); }
[data-theme="dark"] .et-mine-btn.active { background: #A83232; border-color: #A83232; color: #fff; }
[data-theme="dark"] .et-bulk-bar { background: var(--surface-2, #1C2230); border-color: rgba(255,255,255,0.14); box-shadow: 0 8px 28px rgba(0,0,0,0.5); }
[data-theme="dark"] .et-bulk-count { color: #F2A8A0; }
[data-theme="dark"] .et-bulk-archive { color: #F2A8A0; }
[data-theme="dark"] .et-trends-subhead { color: var(--text-muted, #6B7280); }
[data-theme="dark"] .et-trends-table th { color: var(--text-muted, #6B7280); border-bottom-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .et-trends-table td { border-bottom-color: rgba(255,255,255,0.07); }

/* ════════════════════════════════════════════════════════════════
   LTO TRACKER (.lto-*) — dark mode (Grok 4.5 audit fix 2026-07-08)
   ════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .lto-tracker { color: var(--text-primary); }
[data-theme="dark"] .lto-card { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .lto-card:hover { border-color: rgba(212, 168, 67, 0.45); }
[data-theme="dark"] .lto-card-header { color: var(--text-primary); }
[data-theme="dark"] .lto-card-meta { color: var(--text-secondary); }
[data-theme="dark"] .lto-name { color: var(--text-primary); }
[data-theme="dark"] .lto-product { color: var(--text-secondary); }
[data-theme="dark"] .lto-dates { color: var(--text-muted); }
[data-theme="dark"] .lto-chain { color: var(--text-secondary); }
[data-theme="dark"] .lto-notes { color: var(--text-secondary); }
[data-theme="dark"] .lto-toolbar { border-bottom-color: var(--border-light); }
[data-theme="dark"] .lto-search { background: var(--surface-alt); color: var(--text-primary); border-color: var(--border-light); }
[data-theme="dark"] .lto-tab { color: var(--text-secondary); }
[data-theme="dark"] .lto-tab:hover { color: var(--text-primary); }
[data-theme="dark"] .lto-tab.active { color: #FF6B6B; border-bottom-color: #FF6B6B; }
[data-theme="dark"] .lto-tab-count { background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); }
[data-theme="dark"] .lto-filter-tabs { border-bottom-color: var(--border-light); }

/* ════════════════════════════════════════════════════════════════
   LOGISTICS INTELLIGENCE (.li-*) — dark mode (Grok 4.5 audit fix 2026-07-08)
   ════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .li-metric-card { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .li-metric-value { color: var(--text-primary); }
[data-theme="dark"] .li-metric-label { color: var(--text-secondary); }
[data-theme="dark"] .li-metric-sub { color: var(--text-muted); }
[data-theme="dark"] .li-attention-item { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .li-attention-item:hover { border-color: rgba(212, 168, 67, 0.45); }
[data-theme="dark"] .li-attention-title { color: var(--text-primary); }
[data-theme="dark"] .li-attention-dot { }
[data-theme="dark"] .li-attention-action { color: var(--heritage-gold-light, #E5C580); }
[data-theme="dark"] .li-tab { color: var(--text-secondary); }
[data-theme="dark"] .li-tab:hover { color: var(--text-primary); }
[data-theme="dark"] .li-tab.active { color: #FF6B6B; border-bottom-color: #FF6B6B; }
[data-theme="dark"] .li-tabs { border-bottom-color: var(--border-light); }
[data-theme="dark"] .li-toolbar { border-bottom-color: var(--border-light); }
[data-theme="dark"] .li-pane { color: var(--text-primary); }
[data-theme="dark"] .li-briefing-body { color: var(--text-secondary); }
[data-theme="dark"] .li-brief-section { border-color: var(--border-light); }
[data-theme="dark"] .li-brief-h2 { color: var(--text-primary); }
[data-theme="dark"] .li-brief-meta { color: var(--text-muted); }
[data-theme="dark"] .li-table th { background: var(--surface-alt); color: var(--text-primary); }
[data-theme="dark"] .li-table th,
[data-theme="dark"] .li-table td { border-color: var(--border-light); color: var(--text-secondary); }
[data-theme="dark"] .li-history-table th { background: var(--surface-alt); }
[data-theme="dark"] .li-history-table th,
[data-theme="dark"] .li-history-table td { border-color: var(--border-light); }
[data-theme="dark"] .li-glance-tile { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .li-progress-track { background: var(--surface-alt); }
[data-theme="dark"] .li-progress-label { color: var(--text-secondary); }
[data-theme="dark"] .li-rate-pill { color: var(--text-secondary); background: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .li-trend { color: var(--text-muted); }
[data-theme="dark"] .li-trend-good { color: #6EE7A2; }
[data-theme="dark"] .li-trend-bad { color: #FF6B6B; }
[data-theme="dark"] .li-period-banner { background: rgba(212, 168, 67, 0.10); color: var(--text-secondary); }
[data-theme="dark"] .li-sheet-chip { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
[data-theme="dark"] .li-empty { color: var(--text-secondary); }
[data-theme="dark"] .li-empty-title { color: var(--text-primary); }
[data-theme="dark"] .li-upload-success { background: rgba(45, 140, 60, 0.12); }
[data-theme="dark"] .li-success-head { color: var(--text-primary); }
[data-theme="dark"] .li-md-table th { background: var(--surface-alt); }
[data-theme="dark"] .li-md-table th,
[data-theme="dark"] .li-md-table td { border-color: var(--border-light); }
[data-theme="dark"] .li-rootcause { border-color: var(--border-light); }
[data-theme="dark"] .li-share-fill { background: rgba(212, 168, 67, 0.35); }

/* ════════════════════════════════════════════════════════════════
   I&Q BRIEF (.inq-*) — dark mode (Grok 4.5 audit fix 2026-07-08)
   ════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .inq-brief { color: var(--text-primary); }
[data-theme="dark"] .inq-tabs { border-bottom-color: var(--border-light); }
[data-theme="dark"] .inq-tab { color: var(--text-secondary); }
[data-theme="dark"] .inq-tab:hover { color: var(--text-primary); }
[data-theme="dark"] .inq-tab.active { color: #FF6B6B; border-bottom-color: #FF6B6B; }
[data-theme="dark"] .inq-section { border-color: var(--border-light); }
[data-theme="dark"] .inq-section-head { color: var(--text-primary); }
[data-theme="dark"] .inq-item { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .inq-item:hover { border-color: rgba(212, 168, 67, 0.45); }
[data-theme="dark"] .inq-item-headline { color: var(--text-primary); }
[data-theme="dark"] .inq-item-sowhat { color: var(--text-secondary); }
[data-theme="dark"] .inq-item-foot { color: var(--text-muted); border-top-color: var(--border-light); }
[data-theme="dark"] .inq-src-name { color: var(--text-secondary); }
[data-theme="dark"] .inq-src-link { color: var(--heritage-gold-light, #E5C580); }
[data-theme="dark"] .inq-masthead { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .inq-masthead-eyebrow { color: var(--text-muted); }
[data-theme="dark"] .inq-masthead-theme { color: var(--text-primary); }
[data-theme="dark"] .inq-masthead-meta { color: var(--text-muted); }
[data-theme="dark"] .inq-masthead-bullets { color: var(--text-secondary); }
[data-theme="dark"] .inq-archive-row { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .inq-archive-row:hover { border-color: rgba(212, 168, 67, 0.45); }
[data-theme="dark"] .inq-archive-row-head { color: var(--text-primary); }
[data-theme="dark"] .inq-archive-row-meta { color: var(--text-muted); }
[data-theme="dark"] .inq-archive-date { color: var(--text-secondary); }
[data-theme="dark"] .inq-archive-theme { color: var(--text-secondary); }
[data-theme="dark"] .inq-archive-caret { color: var(--text-muted); }
[data-theme="dark"] .inq-archive-num { color: var(--text-muted); }
[data-theme="dark"] .inq-pane { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .inq-comp-card { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .inq-comp-card:hover { border-color: rgba(212, 168, 67, 0.45); }
[data-theme="dark"] .inq-comp-card-head { color: var(--text-primary); }
[data-theme="dark"] .inq-comp-name { color: var(--text-primary); }
[data-theme="dark"] .inq-comp-name-zh { color: var(--text-secondary); }
[data-theme="dark"] .inq-comp-posture { color: var(--text-secondary); background: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .inq-comp-intro { color: var(--text-secondary); }
[data-theme="dark"] .inq-comp-signals { color: var(--text-secondary); }
[data-theme="dark"] .inq-comp-nosignals { color: var(--text-muted); }
[data-theme="dark"] .inq-comp-foot { border-top-color: var(--border-light); color: var(--text-muted); }
[data-theme="dark"] .inq-comp-anchor-card { background: rgba(212, 168, 67, 0.08); border-color: rgba(212, 168, 67, 0.25); }
[data-theme="dark"] .inq-conf-badge { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
[data-theme="dark"] .inq-conf-confirmed { background: rgba(45, 140, 60, 0.16); color: #6EE7A2; }
[data-theme="dark"] .inq-conf-reported { background: rgba(212, 168, 67, 0.14); color: var(--heritage-gold-light, #E5C580); }
[data-theme="dark"] .inq-conf-rumor { background: rgba(204, 0, 0, 0.14); color: #FF6B6B; }
[data-theme="dark"] .inq-status-badge { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
[data-theme="dark"] .inq-status-draft { background: rgba(156, 163, 175, 0.14); }
[data-theme="dark"] .inq-status-review { background: rgba(212, 168, 67, 0.14); color: var(--heritage-gold-light, #E5C580); }
[data-theme="dark"] .inq-status-approved { background: rgba(45, 140, 60, 0.14); color: #6EE7A2; }
[data-theme="dark"] .inq-status-published { background: rgba(45, 140, 60, 0.20); color: #6EE7A2; }
[data-theme="dark"] .inq-draft-item { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .inq-draft-headline { color: var(--text-primary); }
[data-theme="dark"] .inq-draft-sowhat { color: var(--text-secondary); }
[data-theme="dark"] .inq-draft-meta { color: var(--text-muted); }
[data-theme="dark"] .inq-draft-section-head { color: var(--text-primary); border-bottom-color: var(--border-light); }
[data-theme="dark"] .inq-ed-card { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .inq-role-chip { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
[data-theme="dark"] .inq-pick-toggle { color: var(--text-muted); }
[data-theme="dark"] .inq-pool-row { border-color: var(--border-light); }
[data-theme="dark"] .inq-pool-title { color: var(--text-primary); }
[data-theme="dark"] .inq-pool-sowhat { color: var(--text-secondary); }
[data-theme="dark"] .inq-pool-foot { color: var(--text-muted); }
[data-theme="dark"] .inq-empty { color: var(--text-secondary); }
[data-theme="dark"] .inq-empty-title { color: var(--text-primary); }
[data-theme="dark"] .inq-empty-icon { color: var(--text-muted); }
[data-theme="dark"] .inq-gold { color: var(--heritage-gold-light, #E5C580); }
[data-theme="dark"] .inq-red { color: #FF6B6B; }
[data-theme="dark"] .inq-mute { color: var(--text-muted); }
[data-theme="dark"] .inq-zh-label { color: var(--text-muted); }
[data-theme="dark"] .inq-zh-tldr { color: var(--text-secondary); }
[data-theme="dark"] .inq-border { border-color: var(--border-light); }
[data-theme="dark"] .inq-issue-footer { border-top-color: var(--border-light); color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════════
   MI COMPETITORS (.mi-cmp-*) — dark mode (Grok 4.5 audit fix 2026-07-08)
   ════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .mi-cmp-page { color: var(--text-primary); }
[data-theme="dark"] .mi-cmp-toolbar { border-bottom-color: var(--border-light); }
[data-theme="dark"] .mi-cmp-search { background: var(--surface-alt); color: var(--text-primary); border-color: var(--border-light); }
[data-theme="dark"] .mi-cmp-card { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .mi-cmp-card:hover { border-color: rgba(212, 168, 67, 0.45); }
[data-theme="dark"] .mi-cmp-card-head { color: var(--text-primary); }
[data-theme="dark"] .mi-cmp-card-title { color: var(--text-primary); }
[data-theme="dark"] .mi-cmp-card-foot { color: var(--text-muted); border-top-color: var(--border-light); }
[data-theme="dark"] .mi-cmp-content { color: var(--text-secondary); }
[data-theme="dark"] .mi-cmp-badge-row span { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
[data-theme="dark"] .mi-cmp-dossier { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .mi-cmp-dossier-head { color: var(--text-primary); }
[data-theme="dark"] .mi-cmp-dossier-name { color: var(--text-primary); }
[data-theme="dark"] .mi-cmp-dossier-hq { color: var(--text-secondary); }
[data-theme="dark"] .mi-cmp-dossier-badges span { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
[data-theme="dark"] .mi-cmp-block { border-color: var(--border-light); }
[data-theme="dark"] .mi-cmp-block-label { color: var(--text-muted); }
[data-theme="dark"] .mi-cmp-block-text { color: var(--text-secondary); }
[data-theme="dark"] .mi-cmp-block-moat { border-left-color: var(--heritage-gold, #D4A843); }
[data-theme="dark"] .mi-cmp-block-weak { border-left-color: #FF6B6B; }
[data-theme="dark"] .mi-cmp-block-counter { border-left-color: #6EE7A2; }
[data-theme="dark"] .mi-cmp-block-rationale { color: var(--text-muted); }
[data-theme="dark"] .mi-cmp-compare-wrap { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .mi-cmp-compare-table th { background: var(--surface-alt); color: var(--text-primary); }
[data-theme="dark"] .mi-cmp-compare-table th,
[data-theme="dark"] .mi-cmp-compare-table td { border-color: var(--border-light); }
[data-theme="dark"] .mi-cmp-compare-bar { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .mi-cmp-compare-count { color: var(--heritage-gold-light, #E5C580); }
[data-theme="dark"] .mi-cmp-stat-card { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .mi-cmp-stat-val { color: var(--text-primary); }
[data-theme="dark"] .mi-cmp-stat-label { color: var(--text-secondary); }
[data-theme="dark"] .mi-cmp-stat-meta { color: var(--text-muted); }
[data-theme="dark"] .mi-cmp-monogram { color: var(--text-primary); }

/* ════════════════════════════════════════════════════════════════
   CREATIVE STUDIO (.cs-*) — dark mode extended (Grok 4.5 audit fix 2026-07-08)
   ════════════════════════════════════════════════════════════════ */
/* Existing 4 rules cover .cs-upload-*; extend to full module */
[data-theme="dark"] .cs-detail-section { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .cs-detail-section-sm { border-color: var(--border-light); }
[data-theme="dark"] .cs-detail-created { color: var(--text-muted); }
[data-theme="dark"] .cs-card-actions { border-top-color: var(--border-light); }
[data-theme="dark"] .cs-btn-label { color: var(--text-secondary); }
[data-theme="dark"] .cs-empty-heading { color: var(--text-primary); }
[data-theme="dark"] .cs-empty-body { color: var(--text-secondary); }
[data-theme="dark"] .cs-banner { background: rgba(212, 168, 67, 0.08); border-color: rgba(212, 168, 67, 0.25); }
[data-theme="dark"] .cs-banner-pill { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
[data-theme="dark"] .cs-banner-detail { color: var(--text-secondary); }
[data-theme="dark"] .cs-9010-banner { background: rgba(204, 0, 0, 0.08); border-color: rgba(204, 0, 0, 0.20); }
[data-theme="dark"] .cs-9010-pill { background: rgba(204, 0, 0, 0.16); color: #FF6B6B; }
[data-theme="dark"] .cs-8020-note { color: var(--text-muted); }
[data-theme="dark"] .cs-cap-note { color: var(--text-muted); }
[data-theme="dark"] .cs-detail-img-wrap { background: var(--surface-alt); border-color: var(--border-light); }
[data-theme="dark"] .cs-card-skeleton { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .cs-add-product { border-color: var(--border-light); color: var(--text-secondary); }
[data-theme="dark"] .cs-add-product:hover { border-color: rgba(212, 168, 67, 0.45); color: var(--text-primary); }

/* ── Donut legend icon shapes (accessibility, Grok 4.5 M8 fix) ─ */
.dot-icon { font-size: 11px; margin-right: 2px; display: inline; }
.dot-green + .dot-icon { color: var(--success, #1F8A4C); }
.dot-gold + .dot-icon { color: var(--heritage-gold, #D4A843); }
.dot-red + .dot-icon { color: var(--heritage-red, #CC0000); }
[data-theme="dark"] .dot-green + .dot-icon { color: #6EE7A2; }
[data-theme="dark"] .dot-gold + .dot-icon { color: var(--heritage-gold-light, #E5C580); }
[data-theme="dark"] .dot-red + .dot-icon { color: #FF6B6B; }

/* ── Marketing Pipeline chips (migrated from prefers-color-scheme) ─ */
/* Avoid undefined --surface-2 slate fallback (same rot as MR pipeline badge). */
[data-theme="dark"] .mp-seed-chip {
  background: rgba(156, 163, 175, 0.14);
  color: var(--text-secondary);
  border-color: rgba(156, 163, 175, 0.28);
}
/* M1: restore solid dark-amber chip (was softened to translucent; brand wants punch) */
[data-theme="dark"] .mp-actnow-chip {
  background: #451a03;
  color: #fbbf24;
}

/* ── Stage 4 budget lever card (feedback #20 PR-D) ─ */
[data-theme="dark"] .mp-s4-budget { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .mp-s4-budget-tier,
[data-theme="dark"] .mp-s4-budget-row { border-color: var(--border-light); }
[data-theme="dark"] .mp-s4-budget-tier:hover,
[data-theme="dark"] .mp-s4-budget-row:hover { border-color: rgba(212, 168, 67, 0.45); }
/* Checked state keeps the heritage-red ring — parity with .mp-concept-option. */
[data-theme="dark"] .mp-s4-budget-rec,
[data-theme="dark"] .mp-s4-budget-tier-static { background: rgba(212, 168, 67, 0.2); color: #e8c87a; }
[data-theme="dark"] .mp-s4-budget-total { color: #e8c87a; border-top-color: var(--border-light); }
[data-theme="dark"] .mp-s4-budget-total-none { color: var(--text-muted); }
[data-theme="dark"] .mp-s4-budget-help,
[data-theme="dark"] .mp-s4-budget-role { color: var(--text-secondary); }

/* ── Stage 7 provenance strip + results mirror (feedback #116 Option A) ─ */
[data-theme="dark"] .mp-s7-prov { background: var(--surface); border-color: var(--border-light); }
[data-theme="dark"] .mp-s7-prov-chip {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}
[data-theme="dark"] .mp-s7-prov-chip:hover,
[data-theme="dark"] .mp-s7-prov-chip:focus-visible { border-color: rgba(212, 168, 67, 0.45); color: #e8c87a; }
[data-theme="dark"] .mp-s7-prov-chip.done { border-color: rgba(212, 168, 67, 0.45); }
[data-theme="dark"] .mp-s7-prov-label,
[data-theme="dark"] .mp-s7-prov-note,
[data-theme="dark"] .mp-s7-results-note { color: var(--text-secondary); }

/* ── Market Research posture badges (moved from 42-market-research.css, audit L2) ─ */
[data-theme="dark"] .mr-badge-posture-lead  { background: rgba(212,168,67,.2); color: #e8c87a; }
[data-theme="dark"] .mr-badge-posture-enter { background: rgba(204,0,0,.18); color: #ff9b9b; }

/* ── Feedback screenshot capture (PR polish 2026-07-14) ─ */
[data-theme="dark"] .feedback-shot-attach-btn {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}
[data-theme="dark"] .feedback-shot-attach-btn:hover:not(:disabled) {
  border-color: rgba(204, 0, 0, 0.55);
  background: rgba(204, 0, 0, 0.12);
}
[data-theme="dark"] .feedback-shot-consent,
[data-theme="dark"] .feedback-shot-preview-note,
[data-theme="dark"] .feedback-shot-purged {
  color: var(--text-secondary);
}
[data-theme="dark"] .feedback-shot-preview {
  background: var(--surface);
  border-color: var(--border-light);
}
[data-theme="dark"] .feedback-shot-thumb,
[data-theme="dark"] .feedback-shot-full {
  background: var(--surface-alt);
  border-color: var(--border-light);
}
[data-theme="dark"] .feedback-shot-remove-btn,
[data-theme="dark"] .feedback-shot-upload-link,
[data-theme="dark"] .feedback-shot-error {
  color: #FF6B6B;
}


[data-theme="dark"] .feedback-shot-progress {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,107,107,0.08);
  color: var(--ink-strong, #f5f5f4);
}
[data-theme="dark"] .feedback-shot-success {
  color: #7ddea0;
}
[data-theme="dark"] .feedback-shot-preview-meta-line {
  color: var(--text-mute, #a8a29a);
}
[data-theme="dark"] .feedback-shot-toast {
  background: rgba(12, 10, 9, 0.94);
}
[data-theme="dark"] .feedback-shot-mobile-hint {
  color: var(--text-mute, #a8a29a);
}
[data-theme="dark"] .feedback-shot-upload-link.is-primary-action {
  border-color: #ff6b6b;
  background: rgba(255,107,107,0.12);
  color: #ffb4b4;
}
[data-theme="dark"] .feedback-shot-details > summary {
  color: var(--text-primary);
}
[data-theme="dark"] .feedback-has-shot {
  opacity: 0.95;
}

/* MM freshness bar (2026-07-14) */
[data-theme="dark"] .mm-freshness {
  background: var(--bg-elevated, #1c1c1e);
  border-color: var(--border-light, #333);
}
[data-theme="dark"] .mm-freshness-title { color: var(--text-muted); }
[data-theme="dark"] .mm-fresh-chip-meta { color: var(--text-secondary); }
[data-theme="dark"] .mm-fresh-chip.mm-fresh-fresh {
  background: rgba(111, 216, 154, 0.10);
  border-color: rgba(111, 216, 154, 0.28);
}
[data-theme="dark"] .mm-fresh-chip.mm-fresh-fresh .mm-fresh-chip-badge { color: #6FD89A; }
[data-theme="dark"] .mm-fresh-chip.mm-fresh-stale {
  background: rgba(229, 197, 128, 0.10);
  border-color: rgba(229, 197, 128, 0.28);
}
[data-theme="dark"] .mm-fresh-chip.mm-fresh-stale .mm-fresh-chip-badge { color: #E5C580; }
[data-theme="dark"] .mm-fresh-chip.mm-fresh-old,
[data-theme="dark"] .mm-fresh-chip.mm-fresh-none,
[data-theme="dark"] .mm-fresh-chip.mm-fresh-error {
  background: rgba(255, 107, 107, 0.10);
  border-color: rgba(255, 107, 107, 0.28);
}
[data-theme="dark"] .mm-fresh-chip.mm-fresh-old .mm-fresh-chip-badge,
[data-theme="dark"] .mm-fresh-chip.mm-fresh-none .mm-fresh-chip-badge,
[data-theme="dark"] .mm-fresh-chip.mm-fresh-error .mm-fresh-chip-badge { color: #FF8A8A; }
[data-theme="dark"] .mm-fresh-alert-error {
  background: rgba(255, 107, 107, 0.10);
  border-color: rgba(255, 107, 107, 0.28);
  color: #FF8A8A;
}
[data-theme="dark"] .mm-fresh-alert-empty {
  background: rgba(255,255,255,0.04);
  border-color: var(--border-light);
  color: var(--text-secondary);
}
[data-theme="dark"] .mm-scrape-plat-error {
  background: rgba(255, 107, 107, 0.10);
  color: #FF8A8A;
}


/* ── Feedback attachment picker (slice A3 2026-07-24) ─────────────────────
   Component: public/js/ui/feedback-attach.js · base: 51-feedback-attach.css
   The warm tokens (--eggshell-shade / --ink-*) are only remapped globally
   inside .ws-root, so — exactly like .feedback-shot-* above and
   .agent-drawer — this component paints its own dark surfaces explicitly.
   Chips inherit .agent-attachment-chip, which is already handled. */
[data-theme="dark"] .fb-attach-label { color: var(--text-primary); }
[data-theme="dark"] .fb-attach-hint,
[data-theme="dark"] .fb-attach-count,
[data-theme="dark"] .fb-attach-busy { color: var(--text-secondary); }
[data-theme="dark"] .fb-attach-btn {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}
[data-theme="dark"] .fb-attach--compact .fb-attach-btn { background: transparent; }
[data-theme="dark"] .fb-attach-btn:hover:not(:disabled) {
  border-color: rgba(204, 0, 0, 0.55);
  background: rgba(204, 0, 0, 0.12);
  color: #FF8A8A;
}
[data-theme="dark"] .fb-attach-error {
  background: rgba(255, 107, 107, 0.10);
  border-left-color: #FF6B6B;
  color: #FF8A8A;
}
[data-theme="dark"] .fb-attach-spinner {
  border-color: var(--border-light);
  border-top-color: #FF6B6B;
}
[data-theme="dark"] .fb-attach-drop {
  background: rgba(204, 0, 0, 0.12);
  border-color: rgba(255, 107, 107, 0.55);
}
[data-theme="dark"] .fb-attach-drop-inner { color: #FF8A8A; }

/* ── A4 + A5 · feedback attachment surfaces (slices A4/A5) ───────────────── */

/* FAB modal host: only the over-cap treatment needs a dark variant — the
   picker's own dark rules live above (51-feedback-attach.css, A3). */
[data-theme="dark"] .feedback-attach-host.is-over-cap .fb-attach {
  border-color: #FF8A8A;
  background: rgba(255, 138, 138, 0.10);
}

[data-theme="dark"] .feedback-attach-host.is-over-cap .fb-attach-count { color: #FF8A8A; }

/* Proposal-card attach area + turn carryover. */
[data-theme="dark"] .agent-fb-attach-label { color: var(--text-secondary); }

[data-theme="dark"] .agent-fb-turnfiles { color: var(--text-primary); }

[data-theme="dark"] .agent-fb-attach-hint { color: var(--text-secondary); }

[data-theme="dark"] .agent-fb-attach-skipped { color: #FF8A8A; }

/* Transient picker modal (drawer-hosted). */
[data-theme="dark"] .agent-fb-attach-modal { background: rgba(0, 0, 0, 0.62); }

[data-theme="dark"] .agent-fb-attach-modal-box {
  background: var(--surface-raised, #1f1f22);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .agent-fb-attach-modal-head { color: var(--text-primary); }

/* ── A6 · feedback attachment view (read side) — 52-feedback-attachment-view.css ── */
[data-theme="dark"] .fbatt-block {
  border-color: var(--border-light);
  background: rgba(255, 255, 255, 0.03);
}
[data-theme="dark"] .fbatt-block.is-empty { background: none; }
[data-theme="dark"] .fbatt-tile {
  border-color: var(--border-light);
  background: rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .fbatt-thumb-img,
[data-theme="dark"] .fbatt-thumb-doc {
  border-color: var(--border-light);
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .fbatt-item.is-purged .fbatt-thumb-doc {
  background: rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .fbatt-dl-all,
[data-theme="dark"] .fbhub-files-toggle { color: #FF8A8A; }
[data-theme="dark"] .fbhub-att-chip {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-mute);
}

/* ---------- PLATFORM WORKSPACES (Train 1, 2026-07-24) ----------
   The picker/switcher/home use heritage tokens (--warm-white, --rule, --ink-*)
   which dark mode does NOT remap at :root — it swaps to a separate token set
   (--surface, --text-primary, --border-light). So these surfaces need explicit
   dark rules or they render as light cards on a dark shell.
   --ws-accent stays inline per workspace and reads well on both themes. */

[data-theme="dark"] .ws-picker {
  background:
    radial-gradient(circle at 15% 10%, rgba(212, 168, 67, 0.10), transparent 55%),
    radial-gradient(circle at 85% 90%, rgba(204, 0, 0, 0.10), transparent 55%),
    var(--bg-primary);
}

[data-theme="dark"] .ws-picker-title,
[data-theme="dark"] .ws-card-name,
[data-theme="dark"] .ws-home-title,
[data-theme="dark"] .ws-switch-item-name,
[data-theme="dark"] .ws-home-module-name { color: var(--text-primary); }

[data-theme="dark"] .ws-picker-sub,
[data-theme="dark"] .ws-home-tagline { color: var(--text-secondary); }

[data-theme="dark"] .ws-picker-foot,
[data-theme="dark"] .ws-card-tagline,
[data-theme="dark"] .ws-switch-item-kind,
[data-theme="dark"] .ws-switch-menu-head,
[data-theme="dark"] .ws-home-h2,
[data-theme="dark"] .ws-home-module-desc,
[data-theme="dark"] .ws-home-next-card p { color: var(--text-muted); }

[data-theme="dark"] .ws-card,
[data-theme="dark"] .ws-switch-btn,
[data-theme="dark"] .ws-switch-menu,
[data-theme="dark"] .ws-home-module {
  background: var(--surface);
  border-color: var(--border-light);
}

[data-theme="dark"] .ws-switch-btn { color: var(--text-primary); }
[data-theme="dark"] .ws-switch-item:hover { background: var(--surface-hover); }
[data-theme="dark"] .ws-switch-item.is-active { background: var(--surface-alt); }
[data-theme="dark"] .ws-home-hero { border-color: var(--border-light); }
[data-theme="dark"] .ws-home-next-card { border-color: var(--border-medium); }
[data-theme="dark"] .ws-home-next-card h3 { color: var(--text-secondary); }

/* ── AI EXCELLENCE AWARD (Train 2, 2026-07-24) ──────────────────────────── */
/* The `aix-` surfaces default to light literals so they render correctly even
   if a token is missing; dark mode re-points them at the theme tokens. */
[data-theme="dark"] .aix-card,
[data-theme="dark"] .aix-list,
[data-theme="dark"] .aix-gcard,
[data-theme="dark"] .aix-detail {
  background: var(--surface-alt);
  border-color: var(--border-medium);
}
[data-theme="dark"] .aix-title,
[data-theme="dark"] .aix-h2,
[data-theme="dark"] .aix-card h3,
[data-theme="dark"] .aix-gcard h3,
[data-theme="dark"] .aix-detail h2,
[data-theme="dark"] .aix-row-title { color: var(--text-primary); }
[data-theme="dark"] .aix-tagline,
[data-theme="dark"] .aix-muted,
[data-theme="dark"] .aix-row-sub,
[data-theme="dark"] .aix-card p,
[data-theme="dark"] .aix-gcard p { color: var(--text-secondary); }
[data-theme="dark"] .aix-tabs { border-bottom-color: var(--border-light); }
[data-theme="dark"] .aix-row { border-bottom-color: var(--border-light); }
[data-theme="dark"] .aix-actions { border-top-color: var(--border-light); }
[data-theme="dark"] .aix-notice { background: var(--surface-hover); }
[data-theme="dark"] .aix-field input,
[data-theme="dark"] .aix-field select,
[data-theme="dark"] .aix-field textarea {
  background: var(--surface-base);
  border-color: var(--border-medium);
  color: var(--text-primary);
}
[data-theme="dark"] .aix-detail section p,
[data-theme="dark"] .aix-timeline ol,
[data-theme="dark"] .aix-cycles { color: var(--text-primary); }

/* COSTA #231: campaign goal + Stage-7 sell-in lead — dark parity. */
[data-theme="dark"] .mp-goal-banner,
[data-theme="dark"] .mp-s7-sellin {
  background: var(--surface);
  border-color: var(--border-light);
  border-left-color: rgba(212, 168, 67, 0.55);
}
[data-theme="dark"] .mp-goal-banner-label,
[data-theme="dark"] .mp-s7-goal-label,
[data-theme="dark"] .mp-goal-hint,
[data-theme="dark"] .mp-run-goal,
[data-theme="dark"] .mp-s7-ask-note,
[data-theme="dark"] .mp-s7-basis { color: var(--text-secondary); }
[data-theme="dark"] .mp-s7-goal-fit { border-color: var(--border-light); color: var(--text-secondary); }
[data-theme="dark"] .mp-s7-goal-fit-direct { border-color: rgba(129, 199, 132, 0.45); color: #81c784; }
[data-theme="dark"] .mp-s7-goal-fit-partial { border-color: rgba(212, 168, 67, 0.45); color: #e8c87a; }

/* ── Feedback Hub · Reporter Board (65-feedback-leaderboard.css) ── */
[data-theme="dark"] .fblb-card {
  background: var(--surface);
  border-color: var(--border-light);
}
[data-theme="dark"] .fblb-card-value,
[data-theme="dark"] .fblb-name {
  color: var(--text-primary);
}
[data-theme="dark"] .fblb-card-label,
[data-theme="dark"] .fblb-when,
[data-theme="dark"] .fblb-span,
[data-theme="dark"] .fblb-rank,
[data-theme="dark"] .fblb-table th {
  color: var(--text-secondary);
}
[data-theme="dark"] .fblb-table th,
[data-theme="dark"] .fblb-table td {
  border-bottom-color: var(--border-light);
}
[data-theme="dark"] .fblb-sort:hover,
[data-theme="dark"] .fblb-sort.is-active {
  color: var(--text-primary);
}
[data-theme="dark"] .fblb-rate-good {
  background: rgba(45, 140, 60, 0.18);
  color: #81c784;
}
[data-theme="dark"] .fblb-rate-mid {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}
[data-theme="dark"] .fblb-rate-low {
  background: rgba(212, 168, 67, 0.16);
  color: #e8c87a;
}

/* ── Amazon visual layout (95-amazon-analytics.css, flag AMAZON_VISUALS_V2) ──
   The signal text colors (red / green / gold) are mixed toward the dark-mode
   ink so small text clears WCAG AA (4.5:1) on the dark cards and tints. Brand
   tokens only; arrows and signs still carry the meaning. Visual layout only
   (.amz-vis2): flag off keeps the earlier styling exactly. */
[data-theme="dark"] .amazon-analytics:where(.amz-vis2) {
  --amz-bad-text: color-mix(in srgb, var(--heritage-red) 45%, var(--ink));
  --amz-good-text: color-mix(in srgb, var(--success) 50%, var(--ink));
  --amz-watch-text: var(--heritage-gold-light);
  --amz-watch-tint: color-mix(in srgb, var(--heritage-gold) 14%, transparent);
}
[data-theme="dark"] .amazon-analytics .amz-pchip { background: var(--surface-alt); border-color: var(--border-medium); }
[data-theme="dark"] .amazon-analytics .amz-pchip-other { background: transparent; }
[data-theme="dark"] .amazon-analytics .amz-v2-table.cards tr.amz-hl { background: color-mix(in srgb, var(--heritage-red) 10%, var(--surface)); }
/* Amazon Brand Analytics (#/amazon-analytics). Brand tokens only, no new
   colors or motion; tables scroll inside their own region on phones. */
.amazon-analytics { min-width: 0; }
.amazon-analytics .amz-controls { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; }
.amazon-analytics .amz-control { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin-block: .5rem; }
.amazon-analytics .amz-label { font-size: .78rem; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .04em; }
.amazon-analytics .amz-tabs { margin-bottom: 0; flex-wrap: wrap; }
.amazon-analytics .amz-report-tabs { margin-block: 16px 12px; overflow-x: auto; flex-wrap: nowrap; }
.amazon-analytics .amz-report-tabs .tab { white-space: nowrap; }
.amazon-analytics .amz-select { max-width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--warm-white); color: var(--ink); font: inherit; }
.amazon-analytics .amz-fresh p { margin-block: .35rem; }
.amazon-analytics .amz-h2 { font-size: 1rem; margin: 0 0 .5rem; }
.amazon-analytics .amz-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.amazon-analytics .amz-intro { color: var(--ink-soft); max-width: 72ch; }
.amazon-analytics .amz-table-tools { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; margin-block: .5rem; }
.amazon-analytics .amz-filter input { display: block; max-width: 100%; margin-top: 4px; }
.amazon-analytics .amz-check { display: inline-flex; gap: 6px; align-items: center; }
.amazon-analytics .amz-scroll { overflow-x: auto; max-width: 100%; }
.amazon-analytics .amz-table th, .amazon-analytics .amz-table td { white-space: nowrap; }
.amazon-analytics .amz-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.amazon-analytics .amz-table td.amz-query { white-space: normal; min-width: 12rem; max-width: 28rem; overflow-wrap: anywhere; }
.amazon-analytics .amz-pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: .5rem; color: var(--ink-mute); }
.amazon-analytics .amz-asin { font-variant-numeric: tabular-nums; }
/* Dark mode, visual layout only (.amz-vis2; flag off keeps the earlier
   styling exactly; :where() adds no specificity, so the cascade inside the
   visual layout is unchanged): the brand-red link color is below AA on the dark cards and
   table rows; ASIN links use the page's dark-safe red (--amz-bad-text, 90-dark-mode.css). */
[data-theme="dark"] .amazon-analytics:where(.amz-vis2) a.amz-asin { color: var(--amz-bad-text); }
[data-theme="dark"] .amazon-analytics:where(.amz-vis2) a.amz-asin:hover, [data-theme="dark"] .amazon-analytics:where(.amz-vis2) a.amz-asin:focus-visible { color: var(--ink); }
.amazon-analytics .amz-view-tabs { margin-block: 12px 4px; overflow-x: auto; flex-wrap: nowrap; }
.amazon-analytics .amz-view-tabs .tab { white-space: nowrap; }
/* v2 "This week": insight cards, then detail sections. */
.amazon-analytics .amz-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-block: 12px; }
.amazon-analytics .amz-card { display: flex; flex-direction: column; gap: .4rem; min-width: 0; border-top: 3px solid var(--rule); }
.amazon-analytics .amz-card-alert { border-top-color: var(--heritage-red); }
.amazon-analytics .amz-card-chance { border-top-color: var(--success); }
.amazon-analytics .amz-card-title { font-size: .78rem; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.amazon-analytics .amz-card-head { font-size: 1.02rem; font-weight: 600; color: var(--ink); margin: 0; line-height: 1.35; }
.amazon-analytics .amz-card-big { font-size: 1.5rem; font-weight: 700; color: var(--ink); margin: 0; font-variant-numeric: tabular-nums; }
.amazon-analytics .amz-card-line { margin: 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.amazon-analytics .amz-card-go { align-self: flex-start; margin-top: auto; }
.amazon-analytics .amz-prod { display: inline-flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; min-width: 0; }
.amazon-analytics .amz-prod-name { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.amazon-analytics .amz-prod-asin { font-size: .82rem; color: var(--ink-mute); }
.amazon-analytics .amz-prod-other { font-size: .75rem; color: var(--ink-mute); border: 1px solid currentColor; border-radius: 999px; padding: 0 6px; cursor: help; }
.amazon-analytics .amz-ins-section { margin-block: 16px; min-width: 0; }
.amazon-analytics .amz-table td.amz-why { white-space: normal; min-width: 16rem; max-width: 30rem; color: var(--ink-soft); }
.amazon-analytics .amz-table td.amz-prod-cell { white-space: normal; min-width: 10rem; max-width: 18rem; }
.amazon-analytics .amz-why-line { display: block; margin-top: 4px; font-weight: 400; font-size: .86rem; color: var(--ink-soft); line-height: 1.4; }
.amazon-analytics .amz-ins-table td.amz-query { min-width: 16rem; max-width: 26rem; }
.amazon-analytics .amz-how { margin-block: 12px; color: var(--ink-soft); }
.amazon-analytics .amz-how summary { cursor: pointer; font-weight: 600; }
.amazon-analytics .amz-names-note { margin-top: 8px; max-width: 72ch; }
@media (max-width: 640px) {
  .amazon-analytics .amz-controls { flex-direction: column; align-items: stretch; }
  .amazon-analytics .amz-select { width: 100%; }
}
/* Phones: shared card rows (25-plan.css); numbers stay left-aligned under labels. */
@media (max-width: 768px) {
  .amazon-analytics .amz-table.cards td,
  .amazon-analytics .amz-table.cards td.num { text-align: left; white-space: normal; }
  .amazon-analytics .amz-table.cards td.amz-query { min-width: 0; max-width: none; font-weight: 600; }
  .amazon-analytics .amz-table.cards td.amz-why,
  .amazon-analytics .amz-table.cards td.amz-prod-cell { min-width: 0; max-width: none; }
  .amazon-analytics .amz-cards { grid-template-columns: 1fr; }
}

/* Visual "This week" layout (flag AMAZON_VISUALS_V2, amazon-visuals.js).
   One big number per card, secondary text in ink-soft/ink-mute, tabular
   numerals, color only for meaning (always with an arrow + sign or a label).
   Tints are color-mix() of brand tokens; no new colors. */
.amazon-analytics .amz-v2 { font-variant-numeric: tabular-nums; min-width: 0; }
/* Signal text colors (brand tokens), visual layout only (.amz-vis2). Dark
   mode remaps them for AA on the dark surfaces (90-dark-mode.css, "Amazon
   visual layout"). */
.amazon-analytics:where(.amz-vis2) { --amz-bad-text: var(--heritage-red-dark); --amz-good-text: var(--success-deep); --amz-watch-text: color-mix(in srgb, var(--heritage-gold-dark) 75%, var(--ink-strong)); --amz-watch-tint: color-mix(in srgb, var(--heritage-gold) 14%, transparent); }
.amazon-analytics .amz-v2-sec { margin-block: 26px 0; min-width: 0; }
.amazon-analytics .amz-v2-h2 { font-family: var(--font-serif); font-size: 1.35rem; font-weight: 700; color: var(--ink-strong); margin: 0 0 12px; line-height: 1.25; }
.amazon-analytics .amz-v2-h2 small { font-family: var(--font-sans); font-size: .88rem; font-weight: 400; color: var(--ink-mute); margin-left: 8px; }
.amazon-analytics .amz-v2-note { margin: 8px 0 0; }
.amazon-analytics .amz-kicker { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); margin: 0; }
/* KPI tiles */
.amazon-analytics .amz-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-block: 14px 0; }
.amazon-analytics .amz-kpi { display: flex; flex-direction: column; min-width: 0; padding: 16px 18px 14px; }
.amazon-analytics .amz-kpi-label { font-size: .85rem; font-weight: 700; color: var(--ink-soft); margin: 0; }
.amazon-analytics .amz-kpi-big { font-size: 2.4rem; font-weight: 700; line-height: 1.1; color: var(--ink-strong); margin: 4px 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
.amazon-analytics .amz-kpi-mid { font-size: 1.75rem; display: inline-block; margin-block: 6px 4px; }
.amazon-analytics .amz-kpi-row { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin: 0; font-size: .9rem; }
.amazon-analytics .amz-kpi-vs { color: var(--ink-mute); font-size: .82rem; }
.amazon-analytics .amz-kpi-spark { display: flex; align-items: center; gap: 10px; margin-top: 10px; min-height: 36px; }
.amazon-analytics .amz-spark-cap { font-size: .78rem; color: var(--ink-mute); }
.amazon-analytics .amz-spark-none { font-size: .82rem; color: var(--ink-mute); }
.amazon-analytics .amz-kpi-note { font-size: .8rem; color: var(--ink-mute); margin: auto 0 0; padding-top: 6px; border-top: 1px solid var(--rule-soft); }
.amazon-analytics .amz-kpi-spark + .amz-kpi-note { margin-top: 8px; }
.amazon-analytics .amz-kpi-caveat { font-size: .78rem; color: var(--ink-mute); margin: 4px 0 0; }
.amazon-analytics .amz-spark { flex: 0 0 auto; max-width: 100%; height: auto; overflow: visible; }
.amazon-analytics .amz-spark-line { fill: none; stroke: var(--ink-mute); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.amazon-analytics .amz-spark-pt { fill: var(--ink-mute); }
.amazon-analytics .amz-spark-last { fill: var(--ink-mute); }
.amazon-analytics .amz-spark-good { fill: var(--success); }
.amazon-analytics .amz-spark-bad { fill: var(--heritage-red); }
.amazon-analytics .amz-fresh-bars { display: inline-flex; gap: 3px; }
.amazon-analytics .amz-fresh-bars i { width: 7px; height: 20px; border-radius: 2px; background: var(--rule); }
.amazon-analytics .amz-fresh-bars i.on { background: var(--ink-mute); }
/* ▲/▼ change chips: the arrow and the sign carry the meaning, color repeats it. */
.amazon-analytics .amz-delta { font-weight: 700; padding: 1px 8px; border-radius: 999px; white-space: nowrap; font-size: .88rem; }
.amazon-analytics .amz-delta-good { color: var(--amz-good-text); background: color-mix(in srgb, var(--success) 12%, transparent); }
.amazon-analytics .amz-delta-bad { color: var(--amz-bad-text); background: color-mix(in srgb, var(--heritage-red) 10%, transparent); }
.amazon-analytics .amz-delta-flat { color: var(--ink-soft); background: var(--rule-soft); }
.amazon-analytics .amz-delta-text-good { color: var(--amz-good-text); }
.amazon-analytics .amz-delta-text-bad { color: var(--amz-bad-text); }
/* Action cards */
.amazon-analytics .amz-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.amazon-analytics .amz-act { display: flex; flex-direction: column; gap: 2px; min-width: 0; border-left: 6px solid var(--rule); padding: 16px 18px; }
.amazon-analytics .amz-act-lost { border-left-color: var(--heritage-red); }
.amazon-analytics .amz-act-opportunity { border-left-color: var(--success); }
.amazon-analytics .amz-act-watch { border-left-color: var(--heritage-gold); }
.amazon-analytics .amz-act-tag { margin: 0 0 6px; }
.amazon-analytics .amz-act-tag > span:first-child,
.amazon-analytics .amz-lg-tag { display: inline-block; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 9px; border-radius: 4px; }
.amazon-analytics .amz-act-lost .amz-act-tag > span:first-child, .amazon-analytics .amz-lg-tag.amz-act-lost { color: var(--amz-bad-text); background: color-mix(in srgb, var(--heritage-red) 10%, transparent); }
.amazon-analytics .amz-act-opportunity .amz-act-tag > span:first-child, .amazon-analytics .amz-lg-tag.amz-act-opportunity { color: var(--amz-good-text); background: color-mix(in srgb, var(--success) 12%, transparent); }
.amazon-analytics .amz-act-watch .amz-act-tag > span:first-child, .amazon-analytics .amz-lg-tag.amz-act-watch { color: var(--amz-watch-text); background: var(--amz-watch-tint); }
.amazon-analytics .amz-act-rank { font-size: .78rem; font-weight: 600; color: var(--ink-mute); }
.amazon-analytics .amz-act-head { font-size: 1.06rem; font-weight: 700; line-height: 1.3; color: var(--ink-strong); margin: 0; overflow-wrap: anywhere; }
.amazon-analytics .amz-act-head .amz-prod-asin { font-weight: 400; }
.amazon-analytics .amz-act-big { margin: 10px 0 0; line-height: 1.1; }
.amazon-analytics .amz-act-num { font-size: 2.2rem; font-weight: 700; color: var(--ink-strong); }
.amazon-analytics .amz-act-unit { font-size: 1rem; font-weight: 600; color: var(--ink-soft); }
.amazon-analytics .amz-act-sub { font-size: .82rem; color: var(--ink-mute); margin: 0 0 6px; }
.amazon-analytics .amz-act-line { font-size: .9rem; color: var(--ink-soft); margin: 4px 0 0; overflow-wrap: anywhere; }
.amazon-analytics .amz-act-line b { color: var(--ink); }
.amazon-analytics .amz-act .amz-card-go { margin-top: auto; padding-top: 8px; align-self: flex-start; }
/* Funnel */
.amazon-analytics .amz-fun { padding: 18px 22px; min-width: 0; }
.amazon-analytics .amz-fun-head { display: flex; justify-content: space-between; gap: 12px 24px; align-items: flex-start; margin-bottom: 14px; flex-wrap: wrap; }
.amazon-analytics .amz-fun-query { font-size: 1.02rem; margin: 2px 0 0; color: var(--ink-strong); overflow-wrap: anywhere; }
.amazon-analytics .amz-fun-callout { max-width: 30rem; margin: 0; font-size: .9rem; padding: 10px 14px; border-radius: var(--radius); color: var(--ink); background: color-mix(in srgb, var(--heritage-red) 7%, transparent); border: 1px solid color-mix(in srgb, var(--heritage-red) 25%, transparent); }
.amazon-analytics .amz-fun-scale, .amazon-analytics .amz-fun-row { display: grid; grid-template-columns: 11rem minmax(0, 1fr) 5rem minmax(0, 18rem); align-items: center; }
.amazon-analytics .amz-fun-scale { font-size: .75rem; color: var(--ink-mute); margin-bottom: 4px; }
.amazon-analytics .amz-fun-ticks { grid-column: 2; display: flex; justify-content: space-between; padding-right: 14px; }
.amazon-analytics .amz-fun-ticks i { font-style: normal; }
.amazon-analytics .amz-fun-row { padding: 8px 6px; border-top: 1px solid var(--rule-soft); }
.amazon-analytics .amz-fun-lose { background: color-mix(in srgb, var(--heritage-red) 5%, transparent); border-radius: var(--radius-sm); }
.amazon-analytics .amz-fun-step b { display: block; font-size: .95rem; color: var(--ink); }
.amazon-analytics .amz-fun-step small { color: var(--ink-mute); font-size: .75rem; }
.amazon-analytics .amz-fun-lose .amz-fun-step b, .amazon-analytics .amz-fun-lose .amz-fun-val { color: var(--amz-bad-text); }
.amazon-analytics .amz-fun-track { position: relative; height: 26px; background: var(--rule-soft); border-radius: var(--radius-sm); margin-right: 14px; }
.amazon-analytics .amz-fun-lose .amz-fun-track { outline: 2px solid var(--heritage-red); outline-offset: 1px; }
.amazon-analytics .amz-fun-bar { display: block; height: 100%; background: var(--ink-soft); border-radius: var(--radius-sm); }
.amazon-analytics .amz-fun-zero { position: absolute; left: 6px; top: 3px; font-size: .82rem; font-weight: 700; color: var(--amz-bad-text); }
.amazon-analytics .amz-fun-ref { position: absolute; top: -4px; bottom: -4px; border-left: 2px dashed var(--ink-mute); z-index: 1; }
.amazon-analytics .amz-fun-val { font-size: 1.2rem; font-weight: 700; text-align: right; padding-right: 18px; color: var(--ink); }
.amazon-analytics .amz-fun-note { font-size: .82rem; color: var(--ink-mute); }
.amazon-analytics .amz-fun-chg { font-weight: 700; }
.amazon-analytics .amz-fun-legend { margin: 10px 0 0; font-size: .8rem; color: var(--ink-mute); }
.amazon-analytics .amz-fun-refkey { display: inline-block; width: 0; height: 12px; border-left: 2px dashed var(--ink-mute); margin: 0 6px -2px 2px; }
/* Missed-search table */
.amazon-analytics .amz-v2-table td { vertical-align: middle; }
.amazon-analytics .amz-v2-table td.amz-prod-cell { min-width: 14rem; max-width: 22rem; }
.amazon-analytics .amz-v2 .amz-prod-asin .amz-asin { color: var(--ink-mute); text-decoration: underline dotted; text-underline-offset: 2px; }
.amazon-analytics .amz-v2 .amz-prod-asin .amz-asin:hover, .amazon-analytics .amz-v2 .amz-prod-asin .amz-asin:focus-visible { color: var(--ink); text-decoration: underline; }
.amazon-analytics .amz-act-line .amz-prod, .amazon-analytics .amz-fun-query .amz-prod { display: inline; }
.amazon-analytics .amz-v2-table tr.amz-hl td { background: color-mix(in srgb, var(--heritage-red) 6%, transparent); }
.amazon-analytics .amz-v2-table tr.amz-hl td:first-child { box-shadow: inset 4px 0 0 var(--heritage-red); }
.amazon-analytics .amz-hl-tag { display: inline-block; margin-left: 6px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--amz-bad-text); border: 1px solid color-mix(in srgb, var(--heritage-red) 35%, transparent); border-radius: var(--radius-sm); padding: 0 6px; white-space: nowrap; }
/* 14rem: at 1440 the seven columns then fit the content width (15rem left the
   table 2px wider than its box, a stray sideways scroll). */
.amazon-analytics .amz-table td.amz-bars-cell { white-space: normal; min-width: 14rem; }
.amazon-analytics .amz-pb { display: grid; grid-template-columns: 3.4rem minmax(4rem, 1fr) 3.6rem; align-items: center; gap: 6px; font-size: .78rem; margin: 1px 0; }
.amazon-analytics .amz-pb-lab { color: var(--ink-mute); }
.amazon-analytics .amz-pb-val { text-align: right; font-weight: 600; color: var(--ink); }
.amazon-analytics .amz-pb-track { height: 9px; background: var(--rule-soft); border-radius: 3px; overflow: hidden; }
.amazon-analytics .amz-pb-clk, .amazon-analytics .amz-pb-buy { display: block; height: 100%; }
.amazon-analytics .amz-pb-clk { background: var(--ink-mute); }
.amazon-analytics .amz-pb-buy { background: var(--heritage-red); }
.amazon-analytics .amz-pb-funnel { display: block; font-size: .72rem; color: var(--ink-mute); margin-top: 2px; }
.amazon-analytics .amz-lost { font-weight: 700; color: var(--amz-bad-text); white-space: nowrap; }
.amazon-analytics .amz-lost-bar { display: inline-block; height: 9px; background: color-mix(in srgb, var(--heritage-red) 22%, transparent); border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.amazon-analytics .amz-tfoot { font-size: .8rem; color: var(--ink-mute); margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
/* Weekly movers (diverging bars) */
.amazon-analytics .amz-movers { padding: 14px 18px; min-width: 0; }
.amazon-analytics .amz-mv-axis, .amazon-analytics .amz-mv-row { display: grid; grid-template-columns: minmax(12rem, 22rem) minmax(0, 1fr); align-items: center; }
.amazon-analytics .amz-mv-axis { font-size: .78rem; }
.amazon-analytics .amz-mv-axis span:first-child { grid-column: 2; grid-row: 1; justify-self: start; }
.amazon-analytics .amz-mv-axis span:last-child { grid-column: 2; grid-row: 1; justify-self: end; }
.amazon-analytics .amz-mv-row { min-height: 40px; border-top: 1px solid var(--rule-soft); }
.amazon-analytics .amz-mv-name { font-size: .85rem; line-height: 1.25; padding: 4px 10px 4px 0; min-width: 0; }
.amazon-analytics .amz-mv-from { display: block; font-size: .78rem; color: var(--ink-mute); }
.amazon-analytics .amz-mv-chart { display: grid; grid-template-columns: 1fr 1fr; align-items: center; height: 100%; min-width: 0; }
.amazon-analytics .amz-mv-half { display: flex; align-items: center; gap: 6px; min-width: 0; height: 100%; }
.amazon-analytics .amz-mv-neg { justify-content: flex-end; border-right: 1px solid var(--ink-mute); padding-right: 0; }
.amazon-analytics .amz-mv-bar { display: block; height: 16px; border-radius: 2px; flex: 0 0 auto; width: max(3px, calc((100% - 9rem) * var(--wd, 0))); }
.amazon-analytics .amz-mv-bar-up { background: var(--success); }
.amazon-analytics .amz-mv-bar-down { background: var(--heritage-red); }
.amazon-analytics .amz-mv-val { font-size: .82rem; font-weight: 700; white-space: nowrap; }
.amazon-analytics .amz-mv-val small { font-weight: 400; color: var(--ink-mute); }
.amazon-analytics .amz-mv-table { margin-top: 10px; }
.amazon-analytics .amz-mv-table summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); }
/* Bought together chips */
.amazon-analytics .amz-basket { padding: 14px 18px; }
.amazon-analytics .amz-bgroup + .amz-bgroup { margin-top: 16px; }
.amazon-analytics .amz-pchips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; padding: 0; }
.amazon-analytics .amz-pchip { background: var(--eggshell-bright); border: 1px solid var(--rule); border-radius: 999px; padding: 6px 12px; font-size: .82rem; line-height: 1.3; color: var(--ink-soft); max-width: 100%; overflow-wrap: anywhere; }
.amazon-analytics .amz-pchip b { font-weight: 600; color: var(--ink); }
.amazon-analytics .amz-pchip em { font-style: normal; color: var(--ink-mute); margin: 0 3px; }
.amazon-analytics .amz-pchip small { font-size: .72rem; color: var(--ink-mute); }
.amazon-analytics .amz-chip-n { color: var(--ink-mute); font-weight: 600; }
.amazon-analytics .amz-pchip-other { background: var(--warm-white); border-style: dashed; }
/* Glossary + legend */
.amazon-analytics .amz-gloss { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: .82rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.amazon-analytics .amz-gloss b { color: var(--ink); }
.amazon-analytics .amz-legend { display: inline-flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
@media (max-width: 1100px) {
  .amazon-analytics .amz-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .amazon-analytics .amz-v2-table td.amz-prod-cell { min-width: 10rem; }
  .amazon-analytics .amz-table.amz-v2-table td.amz-query { min-width: 9rem; }
  .amazon-analytics .amz-table td.amz-bars-cell { min-width: 12rem; }
  .amazon-analytics .amz-fun-scale, .amazon-analytics .amz-fun-row { grid-template-columns: 9rem minmax(0, 1fr) 4.5rem minmax(0, 13rem); }
}
@media (max-width: 768px) {
  .amazon-analytics .amz-kpi-big { font-size: 2rem; }
  .amazon-analytics .amz-act-num { font-size: 1.9rem; }
  .amazon-analytics .amz-fun { padding: 14px; }
  .amazon-analytics .amz-fun-scale { display: none; }
  .amazon-analytics .amz-fun-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; }
  .amazon-analytics .amz-fun-step { grid-column: 1; }
  .amazon-analytics .amz-fun-val { grid-column: 2; grid-row: 1; padding-right: 0; }
  .amazon-analytics .amz-fun-track { grid-column: 1 / -1; margin-right: 0; }
  .amazon-analytics .amz-fun-note { grid-column: 1 / -1; }
  .amazon-analytics .amz-table.cards td.amz-bars-cell { min-width: 0; }
  .amazon-analytics .amz-v2-table.cards tr.amz-hl { box-shadow: inset 4px 0 0 var(--heritage-red), var(--shadow-sm); background: color-mix(in srgb, var(--heritage-red) 6%, var(--warm-white)); }
  .amazon-analytics .amz-v2-table.cards tr.amz-hl td { background: transparent; }
  .amazon-analytics .amz-v2-table.cards tr.amz-hl td:first-child { box-shadow: none; }
  .amazon-analytics .amz-mv-axis { grid-template-columns: minmax(0, 1fr); }
  .amazon-analytics .amz-mv-axis span:first-child, .amazon-analytics .amz-mv-axis span:last-child { grid-column: 1; grid-row: 1; }
  .amazon-analytics .amz-mv-row { grid-template-columns: minmax(0, 1fr); padding: 8px 0; }
  /* Phones: stacked rows. Name, then the change in text, then one full-width
     bar scaled to the biggest change (direction = arrow, sign and color). */
  .amazon-analytics .amz-mv-chart { display: block; height: auto; }
  .amazon-analytics .amz-mv-half { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; height: auto; border-right: 0; }
  .amazon-analytics .amz-mv-half:empty { display: none; }
  .amazon-analytics .amz-mv-half .amz-mv-val { order: -1; }
  .amazon-analytics .amz-mv-bar { width: max(6px, calc(100% * var(--wd, 0))); height: 14px; }
  .amazon-analytics .amz-legend { margin-left: 0; }
}
@media (max-width: 560px) {
  .amazon-analytics .amz-kpis { grid-template-columns: minmax(0, 1fr); }
  .amazon-analytics .amz-acts { grid-template-columns: minmax(0, 1fr); }
  /* Phone card tables: the shared card row is --warm-white, which dark mode
     keeps light, so dark text-on-row would vanish. Dark rows use the dark card
     surface (the highlighted row keeps its red tint, 90-dark-mode.css).
     Visual layout only (.amz-vis2); flag off keeps the earlier styling. */
  [data-theme="dark"] .amazon-analytics:where(.amz-vis2) table.data-table.cards tr { background: var(--surface); }
}

/* Admin "Product names" view (ASIN -> LKK product, amazon-names.js). */
.amazon-analytics .amn-cover { margin: 6px 0; }
.amazon-analytics .amn-auto { margin: 6px 0 10px; }
.amazon-analytics .amn-msg { min-height: 1.2em; margin: 6px 0; }
.amazon-analytics .amn-msg-ok { color: var(--success, #1f7a3d); font-weight: 600; }
.amazon-analytics .amn-msg-error { color: var(--danger, #b42318); font-weight: 600; }
.amazon-analytics .amn-editor { margin: 10px 0 14px; padding: 14px; border: 1px solid var(--border, rgba(0,0,0,.12)); }
.amazon-analytics .amn-grid { display: grid; grid-template-columns: minmax(10rem, 14rem) minmax(12rem, 1fr); gap: 10px 16px; }
.amazon-analytics .amn-name { display: flex; flex-direction: column; margin-top: 8px; }
.amazon-analytics .amn-name .form-input { width: 100%; max-width: 36rem; }
.amazon-analytics .amn-help { margin: 4px 0; font-size: .85rem; }
.amazon-analytics .amn-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.amazon-analytics .amn-found { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; }
.amazon-analytics .amn-sapcode { font-variant-numeric: tabular-nums; color: var(--ink-mute); margin-right: 4px; }
.amazon-analytics .amn-filters { border: 0; padding: 0; margin: 10px 0 4px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.amazon-analytics .amn-filters legend { float: left; margin-right: 8px; padding: 0; }
.amazon-analytics .amn-csv { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; margin: 8px 0; }
.amazon-analytics .amn-errors { margin: 6px 0; padding-left: 1.2rem; }
@media (max-width: 640px) {
  .amazon-analytics .amn-grid { grid-template-columns: 1fr; }
}
/* "Sales report" view (E-Commerce Sales Report from an uploaded Payment
   Report). Brand tokens only; tables reuse .amz-table / phone card rows. */
.amazon-analytics .amz-sales-form { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; }
.amazon-analytics .amz-sales-form input[type="file"] { max-width: 100%; }
/* .btn sets display:inline-flex, which beats the UA [hidden] rule: keep a
   hidden button (the preview's Excel download before a preview exists) hidden. */
.amazon-analytics .amz-sales-form [hidden] { display: none; }
.amazon-analytics .amz-sales-saved { margin: 8px 0 4px; }
.amazon-analytics .amz-sales-confirm { margin-top: 12px; }
.amazon-analytics .amz-sales-history { margin-top: 16px; }
.amazon-analytics .amz-sales-history > summary { cursor: pointer; font-weight: 600; }
.amazon-analytics .amz-sales-msg { margin: .5rem 0 0; }
.amazon-analytics .amz-sales-msg-error { color: var(--danger); }
.amazon-analytics .amz-sales-errors { margin: .25rem 0 0; padding-left: 1.25rem; color: var(--ink-soft); }
.amazon-analytics .amz-sales-covers { font-weight: 600; margin-block: 16px 8px; }
.amazon-analytics .amz-sales-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-block: 8px; }
.amazon-analytics .amz-sales-metric { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius); min-width: 0; }
.amazon-analytics .amz-sales-metric-value { font-size: 1.35rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.amazon-analytics .amz-sales-metric-label { font-size: .78rem; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .04em; }
.amazon-analytics .amz-sales-ads { margin-block: 12px; border-left: 3px solid var(--rule); color: var(--ink-soft); }
.amazon-analytics .amz-sales-month { margin-top: 24px; }
.amazon-analytics .amz-sales-h3, .amazon-analytics .amz-sales-h4 { font-size: .95rem; margin: 16px 0 6px; }
.amazon-analytics .amz-sales-mtd { margin-block: .25rem .75rem; }
.amazon-analytics .amz-sales-table tr.amz-sales-out td { color: var(--ink-mute); }
.amazon-analytics .amz-sales-table tr.amz-sales-total td { font-weight: 700; border-top: 2px solid var(--rule); }
.amazon-analytics .amz-sales-table td { white-space: normal; }
.amazon-analytics .amz-sales-sku { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
/* Feedback #492: YTD / Overall views. Period tabs under the report header;
   each SKU's peak month (most units) marked like the team's highlighted cell.
   Text keeps the ink color on a light amber tint (contrast unchanged). */
.amazon-analytics .amz-sales-period-tabs { margin-top: 16px; }
.amazon-analytics .amz-sales-period { margin-top: 16px; }
.amazon-analytics .amz-sales-caveat { border-left-color: var(--warning, #C68A1F); }
.amazon-analytics .amz-sales-chosen { margin: 4px 0 8px; padding-left: 22px; overflow-wrap: anywhere; }
.amazon-analytics .amz-sales-limits { margin-top: 8px; }
.amazon-analytics .amz-sales-files { margin-top: 16px; }
.amazon-analytics .amz-sales-mom td { font-weight: 600; }
.amazon-analytics .amz-sales-peak { display: inline-block; padding: 0 6px; border-radius: 4px; background: color-mix(in srgb, var(--warning, #C68A1F) 22%, transparent); color: var(--ink); font-weight: 700; }
[data-theme="dark"] .amazon-analytics .amz-sales-peak { background: color-mix(in srgb, #E6B656 30%, transparent); }

/* LKK official list (official.js): the "Official" badge next to an ASIN link,
   the product filter note and the admin import preview. Fixed colors with
   their own text color so the badge reads the same on every surface:
   light = white on deep green (6.9:1), dark = near-black on light green (11:1). */
.amazon-analytics .amz-official { display: inline-block; font-size: .72rem; font-weight: 700; line-height: 1.4; letter-spacing: .02em; padding: 0 6px; border-radius: 999px; background: var(--success-deep, #1F6B2B); color: #FFFFFF; vertical-align: baseline; white-space: nowrap; cursor: help; }
[data-theme="dark"] .amazon-analytics .amz-official { background: #8FD49A; color: #0B1F0E; }
.amazon-analytics .amz-official-note { margin: 4px 0 10px; padding: 6px 10px; border-left: 3px solid #1F6B2B; background: color-mix(in srgb, #1F6B2B 8%, transparent); max-width: 80ch; }
[data-theme="dark"] .amazon-analytics .amz-official-note { border-left-color: #8FD49A; background: color-mix(in srgb, #8FD49A 12%, transparent); }
.amazon-analytics .amn-row-actions { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.amazon-analytics .amn-preview { margin: 10px 0; padding: 12px 14px; border: 1px solid var(--border, rgba(0,0,0,.12)); }
.amazon-analytics .amn-pv { margin: 6px 0; padding-left: 1.2rem; display: grid; gap: 4px; }
.amazon-analytics .amn-asins { font-size: .82rem; color: var(--ink-mute); overflow-wrap: anywhere; }
.amazon-analytics .amn-pv-removed { color: var(--danger, #b42318); font-weight: 600; }
[data-theme="dark"] .amazon-analytics .amn-pv-removed { color: #FF9C8F; }
/* Amazon "Daily sales" view (#/amazon-analytics?view=daily, amazon-daily.js).
   Brand tokens only, no new colors or motion; tables scroll in their own
   region on phones (shared .amz-scroll / .amz-table rules). */
.amazon-analytics .amz-h3 { font-size: .95rem; margin: 0 0 .35rem; }
.amazon-analytics .amz-daily-note { margin-block: .5rem 1rem; padding: 10px 12px; border-left: 3px solid var(--rule); background: var(--warm-white); color: var(--ink-soft); max-width: 80ch; }
.amazon-analytics .amz-daily-bar { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: flex-end; }
.amazon-analytics .amz-daily-fresh { margin-block: .5rem; }
.amazon-analytics .amz-daily-dl { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-block: .5rem; }
.amazon-analytics .amz-daily-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-block: 12px; }
.amazon-analytics .amz-daily-card { min-width: 0; }
.amazon-analytics .amz-daily-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.amazon-analytics .amz-daily-tile-value { font-size: 1.25rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.amazon-analytics .amz-daily-tile-label { font-size: .78rem; color: var(--ink-mute); }
.amazon-analytics .amz-daily-section { margin-block: 20px; }
.amazon-analytics .amz-daily-table tfoot td { font-weight: 600; border-top: 2px solid var(--rule); }
.amazon-analytics .amz-daily-range { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; }
.amazon-analytics .amz-daily-range input[type="date"] { min-width: 0; }
/* Amazon "Reviews" view (#/amazon-analytics?view=reviews, amazon-reviews.js).
   Brand tokens only, no new colors or motion. One calm card per product:
   complaints and praise side by side (stacked on phones), one number per row. */
.amazon-analytics .amz-rev-fresh { margin-block: .25rem .75rem; }
.amazon-analytics .amz-rev-small { font-size: .86rem; margin-block: .25rem .5rem; }
.amazon-analytics .amz-rev-privacy { margin-top: 20px; }
.amazon-analytics .amz-rev-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; margin-block: 8px 16px; align-items: start; }
.amazon-analytics .amz-rev-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.amazon-analytics .amz-rev-head { min-width: 0; }
.amazon-analytics .amz-rev-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.amazon-analytics .amz-rev-h4 { font-size: .78rem; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 4px; }
.amazon-analytics .amz-rev-h5 { font-size: .86rem; font-weight: 600; color: var(--ink); margin: 12px 0 4px; }
.amazon-analytics .amz-rev-col-bad { border-left: 3px solid var(--heritage-red); padding-left: 10px; }
.amazon-analytics .amz-rev-col-good { border-left: 3px solid var(--success); padding-left: 10px; }
.amazon-analytics .amz-rev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.amazon-analytics .amz-rev-none { margin: 0; font-size: .86rem; }
.amazon-analytics .amz-rev-topic { display: flex; align-items: baseline; gap: 6px; width: 100%; min-height: 36px; padding: 6px 4px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.amazon-analytics .amz-rev-topic:hover, .amazon-analytics .amz-rev-topic[aria-expanded="true"] { background: var(--warm-white); }
.amazon-analytics .amz-rev-topic:focus-visible { outline: 2px solid var(--heritage-red); outline-offset: 1px; }
.amazon-analytics .amz-rev-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.amazon-analytics .amz-rev-count { flex: none; font-size: .78rem; color: var(--ink-mute); white-space: nowrap; }
.amazon-analytics .amz-rev-range { margin: 2px 0 0; font-size: .8rem; }
.amazon-analytics .amz-rev-stale { color: var(--ink-soft); font-style: italic; }
.amazon-analytics .amz-rev-star { flex: none; font-size: .86rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amazon-analytics .amz-rev-trend { flex: none; font-weight: 700; }
.amazon-analytics .amz-rev-bad { color: var(--amz-bad-text, var(--heritage-red-dark)); }
.amazon-analytics .amz-rev-good { color: var(--amz-good-text, var(--success-deep)); }
/* Rising complaints strip: a short list of buttons that open the topic below. */
.amazon-analytics .amz-rev-rising { margin-block: 4px 16px; }
.amazon-analytics .amz-rev-rise-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 16px; }
.amazon-analytics .amz-rev-rise { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-height: 44px; padding: 6px 8px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.amazon-analytics .amz-rev-rise:hover { background: var(--warm-white); }
.amazon-analytics .amz-rev-rise:focus-visible { outline: 2px solid var(--heritage-red); outline-offset: 1px; }
.amazon-analytics .amz-rev-rise-topic { font-weight: 600; overflow-wrap: anywhere; }
.amazon-analytics .amz-rev-rise-prod { font-size: .86rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.amazon-analytics .amz-rev-rise-line { font-size: .82rem; color: var(--amz-bad-text, var(--heritage-red-dark)); }
/* Tapped topic: quotes, subtopics, 6-month bars. */
.amazon-analytics .amz-rev-detail { border-top: 1px solid var(--rule); padding-top: 10px; }
.amazon-analytics .amz-rev-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.amazon-analytics .amz-rev-detail-head .amz-rev-h4 { font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--ink); margin: 0; }
.amazon-analytics .amz-rev-detail-facts { margin: 4px 0; color: var(--ink-soft); }
.amazon-analytics .amz-rev-quotes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.amazon-analytics .amz-rev-quotes blockquote { margin: 0; padding: 6px 10px; border-left: 3px solid var(--rule); background: var(--warm-white); color: var(--ink); font-style: italic; overflow-wrap: anywhere; }
.amazon-analytics .amz-rev-subs { margin: 0; padding-left: 1.1rem; }
.amazon-analytics .amz-rev-bars { display: flex; align-items: flex-end; gap: 8px; height: 72px; max-width: 320px; }
.amazon-analytics .amz-rev-bar { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 2px; }
.amazon-analytics .amz-rev-bar-fill { display: block; width: 100%; background: var(--rule); border-radius: 2px 2px 0 0; }
.amazon-analytics .amz-rev-bar:last-child .amz-rev-bar-fill { background: var(--ink-mute); }
.amazon-analytics .amz-rev-bar-label { font-size: .72rem; color: var(--ink-mute); }
.amazon-analytics .amz-rev-quiet-list { margin: 4px 0 0; padding-left: 1.1rem; }
/* Keyword search (optional): one quiet box above the cards; results replace
   the cards until cleared. One row per product, complaints first. */
.amazon-analytics .amz-rev-search { margin-block: 4px 12px; max-width: 640px; }
.amazon-analytics .amz-rev-search-label { display: block; font-size: .86rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.amazon-analytics .amz-rev-search-row { display: flex; gap: 8px; align-items: center; }
.amazon-analytics .amz-rev-search-input { flex: 1 1 auto; min-width: 0; min-height: 40px; }
.amazon-analytics .amz-rev-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
/* [hidden] must win over the display rules above (folded quotes, Clear before a search). */
.amazon-analytics .amz-rev-search [hidden], .amazon-analytics .amz-rev-results[hidden], .amazon-analytics .amz-rev-hit-quotes[hidden] { display: none; }
.amazon-analytics .amz-rev-results { margin-block: 4px 16px; max-width: 880px; }
.amazon-analytics .amz-rev-summary { font-weight: 600; color: var(--ink); margin: 4px 0 0; }
.amazon-analytics .amz-rev-hits { list-style: none; margin: 8px 0; padding: 0; max-width: 880px; display: flex; flex-direction: column; gap: 10px; }
.amazon-analytics .amz-rev-hit { display: flex; flex-direction: column; gap: 6px; min-width: 0; border-left: 3px solid var(--success); }
.amazon-analytics .amz-rev-hit-bad { border-left-color: var(--heritage-red); }
.amazon-analytics .amz-rev-hit-topics { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.amazon-analytics .amz-rev-hit-topic { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.amazon-analytics .amz-rev-hit-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; width: 100%; }
.amazon-analytics .amz-rev-tag { flex: none; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: var(--radius); background: var(--warm-white); }
.amazon-analytics .amz-rev-tag-bad { color: var(--amz-bad-text, var(--heritage-red-dark)); }
.amazon-analytics .amz-rev-tag-good { color: var(--amz-good-text, var(--success-deep)); }
.amazon-analytics .amz-rev-hit-subs { margin: 0; font-size: .86rem; overflow-wrap: anywhere; }
.amazon-analytics .amz-rev-hit-more { min-height: 36px; padding: 4px 0; border: 0; background: transparent; color: var(--ink-soft); font: inherit; font-size: .86rem; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.amazon-analytics .amz-rev-hit-more:focus-visible { outline: 2px solid var(--heritage-red); outline-offset: 1px; }
.amazon-analytics .amz-rev-hit-quotes { width: 100%; }
.amazon-analytics .amz-rev-mark { background: rgba(212, 168, 67, .32); color: inherit; font-style: inherit; padding: 0 1px; border-radius: 2px; }
.amazon-analytics .amz-rev-noresult { padding: 12px 0; }
.amazon-analytics .amz-rev-noresult-title { margin: 0; font-weight: 600; color: var(--ink); }
@media (max-width: 640px) {
  .amazon-analytics .amz-rev-grid { grid-template-columns: minmax(0, 1fr); }
  .amazon-analytics .amz-rev-cols { grid-template-columns: minmax(0, 1fr); }
}
/* Connected SAP views: provenance chips, section heads, search bar. Reuses the
   #88 .sap-* card grammar; works down to 820px tablet width and below. */
.cv-strip { display: flex; flex-wrap: wrap; gap: .4rem; margin-block: .5rem; }
.cv-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; line-height: 1.3; padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--border, #e0d5c1); background: var(--surface, #fff); color: var(--text-mute, #555); max-width: 100%; overflow-wrap: anywhere; }
.cv-chip strong { color: var(--text, #222); font-weight: 600; }
.cv-chip-ok { border-color: #009E73; }
.cv-chip-stale { border-color: #E69F00; }
.cv-chip-unknown { border-color: #9E9E9E; border-style: dashed; }
.cv-chip-join { border-color: #0072B2; color: #0072B2; }
.cv-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; }
.cv-section-head h2 { margin: 0; }
.cv-src { font-size: .8rem; margin-left: .4rem; }
.cv-unknown { padding: .5rem .75rem; border: 1px dashed #9E9E9E; border-radius: 8px; color: var(--text-mute, #555); }
.cv-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-block: .5rem 1rem; }
.cv-nav input { min-width: 12rem; max-width: 100%; }
.cv-nav a { min-height: 32px; display: inline-flex; align-items: center; }
.cv-invalid { flex-basis: 100%; margin: 0; }
.cv-flag { margin: .1rem 0; }
.cv-flag-partial_sources { background: #eee; color: #555; }
.connected-view .sap-chart-scroll td a { font-weight: 600; }
.sap-kpi-sub .cv-chip { font-size: .68rem; padding: .05rem .4rem; }

/* UX audit 2026-10-03 #11/#12: action tables and at-risk callouts. */
.cv-action-table td, .cv-action-table th { white-space: nowrap; }
.cv-row-expired td:first-child { box-shadow: inset 3px 0 0 #D55E00; }
.cv-own { font-weight: 600; background: #f4f4f5; color: #2b2b30; }
.cv-own_ship { background: #e6f2fa; color: #0b4f7a; }
.cv-own_plan { background: #f3ecf7; color: #5c2f73; }
.cv-own_sell { background: #fdf1e3; color: #7a4300; }
.cv-detail, .cv-terms, .mbr-sap-evidence { margin-top: .75rem; }
.cv-detail > summary, .cv-terms > summary, .mbr-sap-evidence > summary { cursor: pointer; font-weight: 600; }
.sap-at-risk { border-left: 3px solid #D55E00; padding-left: .75rem; }
.sap-at-risk-title { margin: 0 0 .5rem; font-size: 1rem; }

/* "Today from SAP" connected action cards (UX audit 2026-10-03 cards A-D). */
.sap-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.sap-action-card { background: var(--surface, #fff); border: 1px solid var(--border, #e6e1d8); border-left: 4px solid #0072B2; border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sap-action-card[data-action-card="past_due_stock_elsewhere"] { border-left-color: #D55E00; }
.sap-action-card[data-action-card="incoming_after_requested"] { border-left-color: #E69F00; }
.sap-action-card[data-action-card="expiring_no_open_order"] { border-left-color: #CC79A7; }
.sap-action-card[data-action-card="production_after_requested"] { border-left-color: #0072B2; }
.sap-action-card.is-unknown { border-left-color: #8a8a93; background: #f7f7f8; }
.sap-action-title { margin: 0; font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--text-mute, #6b6b72); }
.sap-action-number { font-size: 2.2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sap-action-label { margin: 0; font-size: .92rem; }
.sap-action-do { margin: 4px 0 0; font-weight: 600; font-size: .9rem; }
.sap-action-sub { margin: 0; font-size: .8rem; color: var(--text-mute, #6b6b72); }
.sap-action-foot { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.sap-action-chips .cv-chip { font-size: .7rem; }
.sap-action-link { font-weight: 600; white-space: nowrap; }
.sap-needs-action { border-left: 3px solid #D55E00; padding-left: .75rem; }
.sap-collapsed > summary { cursor: pointer; font-weight: 600; padding: .5rem 0; }

/* Material 360: open order lines behind the "Open, not shipped" count (integration review 2026-10-03). */
.cv-open-lines { margin-top: var(--space-4, 16px); }
.cv-subhead { font-size: 1rem; margin: 0 0 var(--space-2, 8px); }
/* Bounded table scroll preserves the shell on mobile; no motion or new colors. */
.inventory-sap { min-width: 0; }
.inventory-sap-scroll { overflow-x: auto; max-width: 100%; }
.inventory-sap table { width: 100%; border-collapse: collapse; }
.inventory-sap th, .inventory-sap td { text-align: left; padding: .65rem; white-space: nowrap; }
.inventory-sap input[type="search"] { max-width: 100%; display: block; margin-block: .5rem; }
.inventory-sap .card { margin-block: .75rem; }
/* ============================================================
   95-polish-v3.css
   Comprehensive visual polish pass — mobile + desktop.
   Applies fixes from the 2026-05-26 audit (aiop-polish-v3).
   Generated by sub-agent polish pass — DO NOT EDIT main.css directly.

   Cross-cutting fixes:
   1. Content scroll containers reserve space for the floating Ask
      AIOP FAB so it never visually overlaps card content.
   2. Native `<select>.filter-select` gets a branded chevron + a
      proper touch target so it stops looking like a 1990s combo.
   3. Page-hero metrics use an even chip rhythm so wrap looks tidy
      regardless of how many badges are present.
   4. Empty-state stat badges (zero-value) get a muted treatment so
      they stop reading as "broken data" on first paint.
   5. Mobile topbar title truncates cleanly with an ellipsis so long
      module names ("Market Intel — Distributors") don't push the
      avatar off-screen.
   6. Side-by-side legacy patches:
        • Disable redundant H1 inside .page-hero when the topbar
          already shows the module title on mobile.
        • Fix kanban "Mixed/Other Mixed/Other" duplicate appearance
          by overriding line-height + max-line clamp.
        • Equalise AI Tools card heights.
   ============================================================ */

/* ──────────────────────────────────────────────────────────
   1) Floating-button safe-area: reserve room at the bottom of
      every scroll container so the Ask AIOP FAB never visually
      covers the last card on mobile.
      Desktop has lots of vertical space, but the FAB still sits
      on top of the lower-right region — we add the same padding
      everywhere; it costs ~96px of bottom whitespace and gains
      huge polish in return.
   ────────────────────────────────────────────────────────── */

.content {
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
}

/* The drawer's own scroll lives inside .agent-drawer-body, which
   has its own padding handled in 27-agent-drawer.css. */

/* ──────────────────────────────────────────────────────────
   2) Branded select chevron + larger touch target.
      Replaces the default OS combo arrow with a heritage-coloured
      caret. Affects both .filter-select and .form-select.
   ────────────────────────────────────────────────────────── */

.filter-select,
.form-select,
.af-filter {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%235B2C8A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
  padding-right: 32px !important;
  min-height: 38px;
}

/* Mobile bump: 44pt min target. */
@media (max-width: 760px) {
  .filter-select,
  .form-select,
  .af-filter {
    min-height: 44px;
    font-size: 0.92rem;
  }
}

.filter-select:hover,
.form-select:hover,
.af-filter:hover {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23CC0000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
}

/* Dark-mode chevron (pale gold) for parity. */
[data-theme="dark"] .filter-select,
[data-theme="dark"] .form-select,
[data-theme="dark"] .af-filter {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23E8C77A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
}

/* ──────────────────────────────────────────────────────────
   3) Page-hero badge rhythm.
      Multiple modules show 3-6 badges that wrap unevenly. We
      give them a min-width baseline so each badge takes roughly
      equal real estate and 2-column rows feel intentional.
   ────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .page-hero-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .page-hero-metrics .page-hero-badge {
    justify-content: flex-start;
    min-width: 0;       /* allow grid cells to size to track */
    white-space: normal;
  }

  /* If a hero has an odd number of badges, the last one spans full row. */
  .page-hero-metrics .page-hero-badge:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* ──────────────────────────────────────────────────────────
   4) Zero-state badge treatment.
      Pages like Deductions / HR-completed / MI-Signals show
      "0 …" badges that look indistinguishable from real data.
      Modules can opt in by marking a badge .is-zero or by adding
      data-value="0". We tone them down so they read as
      "ready, nothing here yet" not "broken".
   ────────────────────────────────────────────────────────── */

.page-hero-badge.is-zero,
.page-hero-badge[data-value="0"],
.page-hero-badge[data-value="$0"] {
  background: rgba(122, 110, 95, 0.06);
  border-color: rgba(122, 110, 95, 0.20);
  color: var(--ink-mute);
  border-style: dashed;
}

.page-hero-badge.is-zero .page-hero-badge-value,
.page-hero-badge[data-value="0"] .page-hero-badge-value,
.page-hero-badge[data-value="$0"] .page-hero-badge-value {
  color: var(--ink-mute);
  font-weight: 700;
}

.page-hero-badge.is-zero .page-hero-badge-label,
.page-hero-badge[data-value="0"] .page-hero-badge-label,
.page-hero-badge[data-value="$0"] .page-hero-badge-label {
  color: var(--ink-mute);
  opacity: 0.85;
}

/* ──────────────────────────────────────────────────────────
   5) Mobile topbar title truncation + safe area.
      Make sure "Market Intel — Distributors" type long titles
      don't push past the avatar.
   ────────────────────────────────────────────────────────── */

@media (max-width: 880px) {
  .topbar {
    min-width: 0;
  }
  .topbar-title {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-actions {
    flex-shrink: 0;
  }
}

/* ──────────────────────────────────────────────────────────
   6) Kanban product chip — keep to one line so the rare case
      where the field is the literal string "Mixed/Other" doesn't
      cause a doubled visual repeat with the page-hero category
      summary that lives one line above.
   ────────────────────────────────────────────────────────── */

.kanban-card-products {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--ink-mute);
}

/* ──────────────────────────────────────────────────────────
   7) AI Tools grid — uniform card heights.
   ────────────────────────────────────────────────────────── */

.tools-grid {
  align-items: stretch;
}
.tools-grid .tool-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.tools-grid .tool-card .tool-card-body {
  flex: 1;
}

/* ──────────────────────────────────────────────────────────
   8) Stat-grid breakpoint refinement.
      Below 540px the existing rule sets `1fr 1fr`. That's good,
      but several pages use a different grid class. Cover the
      stat-card containers we actually render.
   ────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  /* If there are 4 stat cards, render 2×2 instead of 4×1.
     If 3, render 1×3 stacked (already default).            */
  .stats-grid,
  .stat-row,
  .stats-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* ──────────────────────────────────────────────────────────
   9) Hide the legacy "Choose File" native button styling for
      the Formulation Bot file picker (and any others that slip
      through). The branded `.upload-zone` is the canonical
      pattern; raw <input type="file"> still ships in places.
   ────────────────────────────────────────────────────────── */

input[type="file"]:not(.raw) {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  padding: 6px 0;
}

input[type="file"]:not(.raw)::-webkit-file-upload-button {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 14px;
  margin-right: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--heritage-red);
  background: var(--heritage-red);
  color: #fff;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
input[type="file"]:not(.raw)::-webkit-file-upload-button:hover {
  background: var(--heritage-red-dark);
  transform: translateY(-1px);
}

input[type="file"]:not(.raw)::file-selector-button {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 14px;
  margin-right: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--heritage-red);
  background: var(--heritage-red);
  color: #fff;
  cursor: pointer;
}

/* ──────────────────────────────────────────────────────────
   10) Tab labels — wrap behaviour + active emphasis. Used by
       intake (RFP / HR), label-verify (Image / Vision Mode /
       Pre-loaded), file-convert, etc.
   ────────────────────────────────────────────────────────── */

.tabs,
.tab-list,
[role="tablist"] {
  flex-wrap: wrap;
  row-gap: 4px;
}

/* Disabled / "Coming X" tabs */
.tab[aria-disabled="true"],
.tab[disabled],
.tab.is-disabled,
[role="tab"][aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ──────────────────────────────────────────────────────────
   11) Activity-feed bar-chart labels — let them ellipsis cleanly
       on narrow widths.
   ────────────────────────────────────────────────────────── */

.af-module-bar-label,
.af-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ──────────────────────────────────────────────────────────
   12) Page-hero on desktop: even though the right side
       sometimes feels empty, narrowing the description column
       and right-pinning a small "status block" later is a bigger
       change. For now, keep things tidy: limit hero height growth
       when there are 6+ badges so the card doesn't double-stack
       awkwardly.
   ────────────────────────────────────────────────────────── */

@media (min-width: 1100px) {
  .page-hero-desc {
    max-width: 72ch;
  }
}

/* ──────────────────────────────────────────────────────────
   13) "EXTRACTED BY AZURE DOCUMENT INTELLIGENCE" + similar
       all-caps eyebrow inside upload zones — slight bump so it
       isn't illegible on mobile.
   ────────────────────────────────────────────────────────── */

.upload-zone-caption,
.upload-extracted-by,
.dropzone-eyebrow,
[data-extracted-by] {
  font-size: 0.74rem;
  letter-spacing: 0.10em;
  color: var(--ink-mute);
  text-transform: uppercase;
}

/* ──────────────────────────────────────────────────────────
   14) Defensive max-width fix for any rogue full-width
       textareas/paste inputs that previously stretched edge-to-
       edge on huge screens (file-convert, spec-diff, intake).
   ────────────────────────────────────────────────────────── */

@media (min-width: 1100px) {
  .paste-textarea,
  .convert-textarea,
  .spec-paste-textarea,
  .intake-paste-textarea {
    max-width: 920px;
  }
}

/* ──────────────────────────────────────────────────────────
   15) Tiny defensive null-guard styles: if a value happens to
       render the literal string "undefined" / "null" / "NaN" /
       "[object Object]" we hide it with a small CSS attribute
       check. Note: this catches only inline data-attrs; the
       runtime JS fix below covers DOM text.
   ────────────────────────────────────────────────────────── */

[data-value="undefined"]::before,
[data-value="null"]::before,
[data-value="NaN"]::before,
[data-value="[object Object]"]::before {
  content: "—";
}
[data-value="undefined"] .page-hero-badge-value,
[data-value="null"] .page-hero-badge-value,
[data-value="NaN"] .page-hero-badge-value,
[data-value="[object Object]"] .page-hero-badge-value {
  display: none;
}

/* ──────────────────────────────────────────────────────────
   16) Sidebar active state fix for sub-routes.
       When user is on `#/intake/rfp` we still want `#/intake`
       to highlight in the sidebar. Handled via JS too, but a
       CSS hook makes the rule deterministic.
   ────────────────────────────────────────────────────────── */

.nav-link.active,
.nav-link[aria-current="page"] {
  background: linear-gradient(90deg, rgba(204,0,0,0.10), transparent);
  color: var(--heritage-red-dark);
  border-left: 3px solid var(--heritage-red);
  font-weight: 600;
}

/* End 95-polish-v3.css */
/* SAP snapshot visuals: responsive chart grid (1 column under ~720px / tablet portrait). */
.sap-visuals { min-width: 0; margin-block: .75rem; }
.sap-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-block: .5rem .75rem; }
.sap-kpi { border: 1px solid var(--border, #e0d5c1); border-radius: 8px; padding: .6rem .75rem; background: var(--surface, #fff); min-width: 0; }
.sap-kpi-value { font-size: 1.35rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.sap-kpi-label { font-size: .8rem; color: var(--text-mute, #555); }
.sap-kpi-sub { font-size: .72rem; color: var(--text-mute, #555); margin-top: .2rem; }
.sap-chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: .75rem; }
.sap-chart-card { margin: 0; border: 1px solid var(--border, #e0d5c1); border-radius: 8px; padding: .75rem; background: var(--surface, #fff); min-width: 0; }
.sap-chart-title { font-weight: 600; font-size: .95rem; margin-bottom: .4rem; }
.sap-chart { width: 100%; min-width: 0; }
.sap-chart-meta { font-size: .75rem; color: var(--text-mute, #555); margin: .25rem 0 0; }
.sap-chart-table { margin-top: .4rem; font-size: .8rem; }
.sap-chart-table summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.sap-chart-scroll { overflow-x: auto; max-width: 100%; }
.sap-chart-scroll table { width: 100%; border-collapse: collapse; }
.sap-chart-scroll th, .sap-chart-scroll td { text-align: left; padding: .35rem .5rem; white-space: nowrap; }
/* LI customer drill-down (#107 fix pass): orders to chase, each expands in place to its lines. */
.li-orders-meta { font-size: .85rem; margin: .25rem 0 .4rem; }
.li-order-btn { font-weight: 600; }
.li-order-lines > td { background: var(--surface-elevated, #fffdf8); padding: .25rem .5rem .5rem 1.5rem; }
.li-order-lines-table { font-size: .85rem; width: auto; }
.li-orders-capped { font-weight: 600; }
.li-orders-table td.li-wrap { white-space: normal; min-width: 8rem; max-width: 14rem; overflow-wrap: break-word; }
.li-orders-table td.li-wrap small { white-space: nowrap; }
/* Food trends (Tastewise): #/tastewise-trends (home, detail, answer, refusal)
   + Administration → Integrations card. Brand tokens only, no new colours,
   no motion, mobile-first (phone 390px; desktop grid from 1100px). */

.tw-page { display: flex; flex-direction: column; gap: 16px; min-width: 0; } /* bottom space under the floating Ask and Feedback buttons comes from the shared .content padding, as on every module */
.tw-toprow { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tw-pill { font-size: 11.5px; font-weight: 700; color: var(--ink-mute); background: var(--eggshell-bright); border: 1px solid var(--rule-gold); border-radius: 999px; padding: 3px 10px; }

/* market toggle */
.tw-seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; background: var(--warm-white); padding: 2px; }
.tw-seg button, .tw-seg a { font: inherit; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; color: var(--ink-soft); background: none; border: 0; cursor: pointer; text-decoration: none; }
.tw-seg .on { background: var(--ink-strong); color: var(--warm-white); }

/* hero + ask */
.tw-hero-wrap { display: flex; flex-direction: column; gap: 12px; }
.tw-hero { padding: 16px 18px 14px; margin: 0; border-left: 4px solid var(--heritage-red); }
.tw-hero .page-hero-title { font-size: 1.45rem; margin: 2px 0; }
.tw-asof { font-size: 12.5px; color: var(--ink-mute); }
.tw-ask { background: var(--warm-white); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 12px; margin: 0; }
.tw-ask-input { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--rule); border-radius: 999px; padding: 6px 6px 6px 14px; background: var(--warm-white); }
.tw-ask-input input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: inherit; font-size: 15px; color: var(--ink-strong); padding: 4px 0; }
.tw-ask-input:focus-within { border-color: var(--ink-strong); }
.tw-ask-icon { color: var(--ink-mute); display: inline-flex; }
.tw-ask-go { width: 34px; height: 34px; border-radius: 50%; background: var(--heritage-red); color: var(--warm-white); display: grid; place-items: center; border: 0; cursor: pointer; flex: 0 0 auto; }
.tw-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tw-chip { font: inherit; font-size: 13px; padding: 5px 11px; border-radius: 999px; background: var(--paper); border: 1px solid var(--rule-soft); color: var(--ink-soft); cursor: pointer; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tw-chip-rewrite { background: var(--warm-white); border: 1.5px solid var(--heritage-gold); color: var(--ink-strong); font-weight: 600; }
.tw-chip-stat { cursor: default; }
.tw-chip-stat b { margin-left: 4px; }

/* section heads */
.tw-sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 2px 2px 0; }
.tw-sec-title { font-family: var(--font-sans); font-style: normal; margin: 0; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mute); }
.tw-sec-links { display: inline-flex; gap: 14px; align-items: baseline; }
.tw-seg-sm { margin: -2px 0 8px; }
.tw-seg-sm button { font-size: 12px; padding: 3px 10px; }
.tw-rise-row[hidden] { display: none; }
.tw-link { font: inherit; font-size: 13px; font-weight: 600; color: var(--heritage-red-dark); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.tw-back { align-self: flex-start; }

/* changes strip */
.tw-alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--eggshell-bright); border: 1px solid var(--rule-gold); font-size: 13.5px; color: var(--ink); line-height: 1.45; }
.tw-alert b { color: var(--ink-strong); }
.tw-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--heritage-gold); margin-top: 6px; flex: 0 0 auto; }

/* cards */
.tw-card { display: block; background: var(--warm-white); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 14px 14px 12px; min-width: 0; color: inherit; text-decoration: none; }
a.tw-card:hover { border-color: var(--ink-faint); }
.tw-ring { box-shadow: 0 0 0 2px var(--heritage-gold), var(--shadow-sm); }
.tw-grid { display: grid; gap: 10px; }
.tw-grid + .tw-grid { margin-top: 10px; }
.tw-grid-2 { grid-template-columns: 1fr 1fr; }
.tw-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tw-empty { color: var(--ink-mute); font-size: 14px; }
.tw-note { font-size: 12px; color: var(--ink-faint); margin: 8px 0 0; }

/* watchlist card */
.tw-wl { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; row-gap: 2px; }
.tw-wl-head { min-width: 0; }
.tw-wl-name { font-weight: 700; font-size: 15.5px; color: var(--ink-strong); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tw-wl-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; min-height: 20px; }
.tw-wl-kind { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; white-space: nowrap; }
.tw-wl-big { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.05; white-space: nowrap; }
.tw-wl-big small { font-size: 12px; font-weight: 600; color: var(--ink-mute); letter-spacing: 0; margin-left: 4px; }
.tw-wl-spark { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.tw-wl-so { grid-column: 1 / span 2; font-size: 13.5px; color: var(--ink-soft); line-height: 1.4; margin-top: 4px; }
.tw-wl-sub { font-size: 12px; color: var(--ink-mute); grid-column: 1 / span 2; }
.tw-newflag { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--heritage-gold-dark); white-space: nowrap; }
.tw-tile { padding: 12px; }
.tw-tile-name { font-size: 14.5px; }
.tw-tile-badge { margin: 3px 0 6px; min-height: 18px; }
.tw-tile-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tw-tile .tw-wl-big { font-size: 22px; }
.tw-spark-wrap, .tw-wl-spark { color: var(--ink-strong); }
.tw-spark-big { margin: 4px 0 8px; }
.tw-spark-big svg { width: 100%; height: auto; }
.up { color: var(--success-deep); }
.down { color: var(--danger); }
.flat { color: var(--ink-mute); }
.tw-wl-spark.down, .tw-spark-wrap.down { color: var(--danger); }
.tw-wl-spark.flat, .tw-spark-wrap.flat { color: var(--ink-mute); }
.tw-wl-spark.up, .tw-spark-wrap.up { color: var(--ink-strong); }

/* lifecycle badges */
.tw-lc { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.tw-lc-early { color: var(--heritage-purple); background: rgba(91,44,138,.08); border-color: rgba(91,44,138,.25); }
.tw-lc-emerging { color: var(--heritage-gold-dark); background: rgba(212,168,67,.14); border-color: rgba(212,168,67,.45); }
.tw-lc-trending { color: var(--success-deep); background: rgba(45,140,60,.10); border-color: rgba(45,140,60,.35); }
.tw-lc-mature { color: var(--ink-soft); background: var(--paper); border-color: var(--rule); }
.tw-lc-declining { color: var(--danger); background: rgba(192,57,43,.07); border-color: rgba(192,57,43,.25); }

/* rising */
.tw-rise { display: flex; flex-direction: column; }
.tw-rise-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--rule-soft); font-size: 14.5px; }
.tw-rise-row:last-child { border-bottom: 0; }
.tw-rise-name { color: var(--ink-strong); font-weight: 600; }
.tw-rise-name small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-faint); }
.tw-rise-delta { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }

/* quiet footer: one line (source · period · your count) + "How this works" */
.tw-foot { font-size: 12.5px; color: var(--ink-faint); line-height: 1.55; border-top: 1px solid var(--rule-soft); padding: 12px 4px 0; display: flex; flex-direction: column; gap: 8px; }
.tw-foot-line { margin: 0; }
.tw-foot .tw-how-btn { font-size: inherit; margin-left: 6px; white-space: nowrap; min-height: 0; min-width: 0; padding: 0; line-height: inherit; vertical-align: baseline; }
.tw-chart-cap { font-size: 12px; color: var(--ink-faint); margin: -4px 0 2px; }
.tw-how { display: flex; flex-direction: column; gap: 6px; background: var(--paper); border: 1px solid var(--rule-soft); border-radius: var(--radius); padding: 10px 12px; color: var(--ink-mute); }
.tw-how[hidden] { display: none; }
.tw-how p { margin: 0; }
.tw-lock { display: flex; gap: 6px; align-items: flex-start; }
.tw-lock svg { flex: 0 0 auto; margin-top: 3px; }
.tw-foot-usage { display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; row-gap: 2px; }
.tw-usage-part { white-space: nowrap; display: inline-flex; align-items: center; }
.tw-meter { height: 4px; background: var(--rule-soft); border-radius: 4px; overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; margin: 0 6px; }
.tw-meter i { display: block; height: 100%; background: var(--ink-mute); }

/* KPI tiles */
.tw-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tw-kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; }
.tw-kpi { background: var(--warm-white); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 11px; min-width: 0; }
.tw-kpi-l { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); }
.tw-kpi-v { font-size: 23px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink-strong); margin-top: 3px; }
.tw-kpi-d { font-size: 12px; font-weight: 600; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-kpi-v .tw-lc { font-size: 12px; padding: 3px 9px; vertical-align: middle; }
.tw-kpi-d span { color: var(--ink-mute); font-weight: 500; }

/* charts */
.tw-svg text { font-family: var(--font-sans); }
.tw-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-mute); margin-top: 6px; }
.tw-legend i { display: inline-block; width: 14px; height: 0; border-top: 2.5px solid; vertical-align: middle; margin-right: 5px; }
.tw-legend i.dash { border-top-style: dashed; }
.tw-bars { display: flex; flex-direction: column; gap: 9px; }
.tw-bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 58px; gap: 4px 10px; align-items: center; }
.tw-bar-label { font-size: 14px; color: var(--ink-strong); font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.tw-bar-label .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-bar-val { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.tw-bar-track { grid-column: 1 / span 2; height: 7px; background: var(--rule-soft); border-radius: 6px; overflow: hidden; }
.tw-bar-fill { height: 100%; background: var(--ink-faint); opacity: .55; border-radius: 6px; }
.tw-bar-fill.hi { background: var(--ink-strong); opacity: 1; }
.tw-bar-meta { grid-column: 1 / span 2; font-size: 11.5px; color: var(--ink-faint); }
.tw-cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.tw-cardtitle { margin: 0; font-family: var(--font-sans); font-style: normal; font-size: 15px; font-weight: 700; color: var(--ink-strong); }
.tw-cardsub { font-size: 12px; color: var(--ink-faint); text-align: right; }
.tw-addon { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--heritage-purple); border: 1px solid rgba(91,44,138,.3); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.tw-addon-card { background: var(--paper); box-shadow: none; }

/* answer */
.tw-q { align-self: flex-end; max-width: 88%; background: var(--ink-strong); color: var(--warm-white); padding: 10px 14px; border-radius: 16px 16px 4px 16px; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; margin-left: auto; }
#tw-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tw-sent { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-mute); background: var(--paper); border: 1px solid var(--rule-soft); border-radius: 8px; padding: 7px 10px; }
.tw-sent b { color: var(--ink-strong); font-weight: 600; }
.tw-sent svg { flex: 0 0 auto; }
.tw-narrowed { margin: -4px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-mute); padding: 0 10px; } /* audit re-check S3: the answer covers a narrower term */
.tw-read { border: 1px solid var(--rule); background: var(--eggshell-bright); border-radius: var(--radius-lg); padding: 12px 14px; }
.tw-read-head { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-mute); }
.tw-read ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink); line-height: 1.45; }
.tw-read-foot { margin-top: 8px; font-size: 11.5px; color: var(--ink-faint); }
.tw-says { font-size: 13.5px; color: var(--ink-soft); border-left: 3px solid var(--rule); padding: 2px 0 2px 12px; }
.tw-says-l { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); }
.tw-says p { margin: 3px 0 0; line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
details.tw-says summary { cursor: pointer; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); }
.tw-answer .tw-cardhead { align-items: flex-start; }
.tw-answer-period { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.tw-trend-svg { display: block; margin: 2px 0 4px; }
.tw-btns { display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center; }
.tw-wlstate { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-mute); }
.tw-wlstate svg { flex: 0 0 auto; color: var(--success-deep); }
.tw-wlstate.wait svg { color: var(--heritage-gold-dark); }
.tw-wlstate[hidden] { display: none; }
.tw-wlstate .tw-link { margin-left: 4px; }
.tw-claim-row { grid-template-columns: 1fr auto; }
.tw-btn { font: inherit; font-size: 13.5px; font-weight: 700; border-radius: 999px; padding: 8px 14px; border: 1.5px solid var(--rule); background: var(--warm-white); color: var(--ink-strong); text-decoration: none; cursor: pointer; }
.tw-btn.primary { background: var(--ink-strong); color: var(--warm-white); border-color: var(--ink-strong); }
.tw-source { font-size: 12px; color: var(--ink-faint); margin: 0; }

/* refusal nudge: gold / eggshell, never red */
.tw-nudge { border-radius: var(--radius-lg); background: var(--eggshell-bright); border: 1px solid var(--rule-gold); padding: 14px; }
.tw-nudge h3 { margin: 0 0 4px; font-family: var(--font-sans); font-style: normal; font-size: 16px; color: var(--ink-strong); }
.tw-nudge p { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.45; }
.tw-why { margin-top: 10px; font-size: 12.5px; color: var(--ink-mute); border-top: 1px dashed var(--rule); padding-top: 9px; line-height: 1.5; }

/* posts: text + link-out only */
.tw-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tw-post { border: 1px solid var(--rule); border-radius: 10px; background: var(--warm-white); display: flex; flex-direction: column; justify-content: space-between; }
.tw-post-cap { font-size: 12.5px; color: var(--ink-soft); padding: 9px 10px 2px; line-height: 1.4; margin: 0; overflow-wrap: anywhere; }
.tw-post-link { font-size: 12px; font-weight: 700; color: var(--heritage-red-dark); padding: 4px 10px 9px; text-decoration: none; }

/* detail */
.tw-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tw-detail-title { margin: 0; font-size: 1.7rem; }
.tw-headline { margin-top: 8px; font-size: 15px; font-weight: 600; color: var(--ink-strong); line-height: 1.4; border-left: 3px solid var(--heritage-gold); padding-left: 10px; }
.tw-detail-grid, .tw-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* optional filters on the detail (2026-11-05): the market-toggle pill look,
   one row that wraps; a choice that is not "All" turns dark like the toggle */
.tw-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: -4px; }
.tw-filters .tw-seg-sm { margin: 0; }
.tw-fsel { position: relative; display: inline-flex; }
.tw-fsel select { appearance: none; -webkit-appearance: none; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-soft); background: var(--warm-white); border: 1px solid var(--rule); border-radius: 999px; padding: 5px 26px 5px 12px; cursor: pointer; max-width: 200px; text-overflow: ellipsis; }
.tw-fsel::after { content: ''; position: absolute; right: 11px; top: 50%; width: 6px; height: 6px; margin-top: -5px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); color: var(--ink-mute); pointer-events: none; }
.tw-fsel select:focus-visible { outline: 2px solid var(--ink-strong); outline-offset: 1px; }
.tw-fsel.on select { background: var(--ink-strong); border-color: var(--ink-strong); color: var(--warm-white); }
.tw-fsel.on::after { color: var(--warm-white); }
.tw-filter-note { margin: -4px 2px 0; font-size: 12.5px; color: var(--ink-mute); line-height: 1.5; }
.tw-filter-note .tw-link { font-size: 12.5px; line-height: inherit; vertical-align: baseline; min-height: 0; margin-left: 4px; white-space: nowrap; }
.tw-filter-note[hidden] { display: none; }
.tw-filter-note b { color: var(--ink-strong); }
.tw-filter-note.on { color: var(--ink-soft); }
.tw-filter-note.bad { color: var(--heritage-red-dark); }
.tw-filter-note svg { display: inline-block; vertical-align: -2px; margin-right: 5px; }
.tw-trend-block { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tw-trend-block.tw-loading, .tw-aud-block.tw-loading { opacity: .45; }
.tw-aud-block:empty { display: none; }
.tw-aud-wide { display: none; }
/* tablet (one column, 700-1099 px): the wide charts, so axis text stays the
   size it is on desktop instead of a phone chart stretched to full width */
@media (min-width: 700px) and (max-width: 1099px) {
  .tw-detail .tw-trend-card .tw-only-phone, .tw-detail .tw-aud-narrow { display: none; }
  .tw-detail .tw-trend-card .tw-only-desk, .tw-detail .tw-aud-wide { display: block; }
}
/* phone: 16 px in the selects (no focus zoom on iPhone), the segmented
   control grown to the same height so the row reads as one set */
@media (max-width: 640px) {
  .tw-fsel select { font-size: 16px; padding: 6px 28px 6px 12px; max-width: 100%; }
  .tw-filters .tw-fseg button { font-size: 14px; padding: 6px 12px; }
}

/* an answer or a refusal takes the page; on desktop the right rail stays */
.tw-answering > .tw-toprow, .tw-answering > .tw-hero-wrap { display: none; }
@media (max-width: 1099px) { .tw-answering .tw-side { display: none; } }

/* layout: phone first, desktop grid */
.tw-desk { display: flex; flex-direction: column; gap: 14px; }
.tw-side { display: flex; flex-direction: column; gap: 14px; }
.tw-only-desk { display: none; }
.tw-grid-4 { margin-top: 10px; }
@media (min-width: 1100px) {
  .tw-only-desk { display: block; }
  .tw-only-phone { display: none; }
  .tw-hero-wrap { flex-direction: row; align-items: stretch; }
  .tw-hero-wrap > .tw-hero { flex: 1 1 50%; }
  .tw-hero-wrap > .tw-hero-ask { flex: 1 1 50%; display: flex; }
  .tw-hero-ask .tw-ask { flex: 1; }
  .tw-desk { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
  .tw-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tw-answering .tw-desk { grid-template-columns: minmax(0, 1fr) 340px; }
  .tw-q, .tw-read ul { font-size: 15px; }
  .tw-cardtitle { font-size: 16px; }
  .tw-bar-label { font-size: 14.5px; }
  .tw-foot { font-size: 13px; }
  .tw-detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .tw-wl-big { font-size: 24px; }
}

/* Products to watch (#534): one compact card per product */
.tw-products { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.tw-products .tw-sec-links { flex-wrap: wrap; justify-content: flex-end; }
.tw-pc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.tw-pc { display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 10px; }
.tw-pc-off { background: var(--paper); box-shadow: none; }
.tw-pc-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 22px; }
.tw-pc-name { font-weight: 700; font-size: 15px; color: var(--ink-strong); }
/* The row wraps: a long label ("conversación interanual") moves the sparkline
   below the figure instead of pushing it past the card edge. */
.tw-pc-trend { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 6px; min-height: 36px; }
.tw-pc-trend .tw-wl-big { font-size: 22px; min-width: 0; white-space: normal; }
.tw-pc-trend .tw-wl-big small { white-space: nowrap; }
.tw-pc-part { border-top: 1px solid var(--rule-soft); padding-top: 6px; }
.tw-pc-label { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 3px; }
.tw-pc-hint { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink-faint); }
.tw-pc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tw-pc-list li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-soft); line-height: 1.35; }
.tw-pc-list li .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-pc-list li b { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tw-pc-na { margin: 0; font-size: 12.5px; color: var(--ink-faint); font-style: italic; }
.tw-pc-edit { display: flex; flex-direction: column; gap: 8px; }
.tw-pc-edit[hidden] { display: none; }
.tw-pc-edit textarea { font: inherit; font-size: 14px; line-height: 1.45; padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--warm-white); color: var(--ink-strong); resize: vertical; max-width: 420px; }
.tw-pc-actions { display: flex; gap: 14px; align-items: center; }
.tw-pc-msg { margin: 0; font-size: 13px; color: var(--ink-strong); }
.tw-pc-msg[hidden] { display: none; }
@media (max-width: 640px) {
  .tw-pc-edit textarea { font-size: 16px; }
}

/* watchlist owner screen */
.tw-wl-sec { display: flex; flex-direction: column; gap: 10px; }
.tw-wl-list { display: grid; gap: 10px; }
.tw-wlrow { display: flex; flex-direction: column; gap: 10px; }
.tw-wlrow-main { min-width: 0; }
.tw-wlrow-act { display: flex; gap: 8px; flex-wrap: wrap; }
.tw-wlrow[data-status="proposed"] { border-color: var(--rule-gold); background: var(--eggshell-bright); }
.tw-wl-sends { margin-top: 6px; font-size: 12.5px; color: var(--ink-mute); display: flex; gap: 6px; align-items: flex-start; overflow-wrap: anywhere; }
.tw-wl-sends svg, .tw-wl-how svg { flex: 0 0 auto; margin-top: 2px; }
.tw-wl-how { display: flex; gap: 6px; align-items: flex-start; margin: -2px 2px 0; font-size: 12.5px; color: var(--ink-mute); line-height: 1.45; }
.tw-mkt { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--ink-mute); border: 1px solid var(--rule); border-radius: 5px; padding: 1px 5px; background: var(--warm-white); cursor: help; }
.tw-owner { font-weight: 700; color: var(--ink-strong); border-bottom: 1px dotted var(--ink-faint); cursor: help; }
.tw-wl-owner { margin-top: 4px; }
.tw-wl-msg { margin: 0; font-size: 13.5px; color: var(--ink-strong); background: var(--eggshell-bright); border: 1px solid var(--rule-gold); border-radius: var(--radius); padding: 8px 12px; }
.tw-wl-add .tw-btn { padding: 6px 14px; }
.tw-wl-lines { padding: 4px 14px; }
.tw-wlline { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule-soft); }
.tw-wlline:last-child { border-bottom: 0; }
.tw-wlline-name { font-size: 14.5px; color: var(--ink-strong); min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tw-wlline-tags { display: inline-flex; gap: 5px; align-items: center; justify-content: flex-end; }
.tw-wl-name .tw-wl-kind, .tw-wl-name .tw-mkt { font-weight: 600; }
.tw-wl-retire { font-size: 12.5px; color: var(--ink-mute); font-weight: 600; }
.tw-wl-retire:hover { color: var(--heritage-red-dark); }
.tw-wl-retired summary { cursor: pointer; margin: 2px 2px 10px; }
.tw-wl-ownerform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.tw-wl-ownerform .tw-wl-msg { flex-basis: 100%; }
.tw-wl-ownerform input { padding: .45rem .6rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); font: inherit; min-width: 240px; background: var(--warm-white); color: var(--ink-strong); }
.tw-wl-ed { padding: 4px 14px 14px; }
.tw-wl-ed .tw-note { margin: 10px 0 0; }
.tw-wl-ed .tw-wl-ownerform { margin-top: 12px; }
.tw-wl-ed .tw-wlline-name .tw-wl-kind { white-space: normal; overflow-wrap: anywhere; }
.tw-wl-noaccess { font-size: 11.5px; font-weight: 600; color: var(--heritage-red-dark); }
.tw-wl-full { margin: 0 2px; color: var(--ink-mute); }
@media (min-width: 1100px) {
  .tw-wl-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tw-wl-lines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
  .tw-wl-lines .tw-wlline:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .tw-wlrow { flex-direction: row; justify-content: space-between; align-items: flex-start; }
  .tw-wlrow-act { flex-direction: column; align-items: stretch; flex: 0 0 auto; }
  .tw-wlpage { max-width: 1100px; }
}

/* Administration → Integrations */
.tw-admin { margin-block: .75rem; padding: 1rem; min-width: 0; }
.tw-admin-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; justify-content: space-between; }
.tw-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
.tw-facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem .9rem; margin: .75rem 0; }
.tw-facts dt { color: var(--ink-soft); }
.tw-facts dd { margin: 0; overflow-wrap: anywhere; }
.tw-switches { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.tw-switch { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--ink-soft); }
.tw-switch select { padding: .4rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); font: inherit; color: var(--ink-strong); background: var(--warm-white); }
.tw-test { margin-top: .5rem; }
.tw-test.ok { color: var(--ink-strong); }
.tw-test.bad { color: var(--heritage-red-dark); }
.tw-tools { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.tw-tools th, .tw-tools td { text-align: left; padding: .5rem; vertical-align: top; }
@media (max-width: 480px) {
  .tw-facts { grid-template-columns: 1fr; }
  .tw-kpis-3 { grid-template-columns: 1fr 1fr 1fr; }
  .tw-kpis-3 .tw-kpi-v { font-size: 19px; }
}

/* the refused question stays in a live ask bar */
.tw-ask-again { padding: 10px; }
.tw-ask-again .tw-ask-input { border-radius: 22px; align-items: flex-end; }
.tw-ask-again .tw-ask-icon { align-self: center; }
.tw-ask-again textarea { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: inherit; font-size: 15px; line-height: 1.4; color: var(--ink-strong); padding: 4px 0; resize: none; field-sizing: content; min-height: 2.8em; max-height: 6em; }

/* Restaurants / Store shelf tabs (Tastewise trial data, 2026-11-13): the tab
   row reads like the market toggle; each card leads with its insight line,
   then the chart or list. One column on a phone, two on desktop. */
.tw-tabs { align-self: flex-start; margin: 2px 0 2px; max-width: 100%; overflow-x: auto; }
.tw-tabs a { white-space: nowrap; }
.tw-trial-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tw-tgrid { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tw-tcard { display: flex; flex-direction: column; gap: 10px; }
.tw-tcard .tw-cardhead { margin-bottom: 0; }
.tw-insight { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.45; color: var(--ink-strong); border-left: 3px solid var(--heritage-gold); padding-left: 10px; overflow-wrap: anywhere; }
.tw-tcard-na { background: var(--paper); box-shadow: none; }
.tw-tchart { display: block; }
.tw-kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tw-tlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.tw-tlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; font-size: 14px; color: var(--ink-strong); align-items: baseline; }
.tw-tlist .t { overflow-wrap: anywhere; font-weight: 600; }
.tw-tlist .m { grid-column: 1; grid-row: 2; font-size: 12px; color: var(--ink-faint); }
.tw-tlist b { grid-column: 2; grid-row: 1; font-variant-numeric: tabular-nums; font-size: 13px; }
.tw-tcols { display: grid; grid-template-columns: 1fr; gap: 14px; }
.tw-ours .tw-bar-label .t, .tw-tlist li.tw-ours .t { color: var(--heritage-red-dark); }
.tw-ours-pill { font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--heritage-red-dark); border: 1px solid var(--rule-gold); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.tw-trial-note { margin: 0; }
.tw-addon-link { text-decoration: none; }
.tw-addon-link .tw-note { color: var(--heritage-red-dark); font-weight: 600; }
.tw-trial-admin { margin: 14px 0 6px; padding-top: 10px; border-top: 1px solid var(--rule-soft); }
.tw-usage-big { font-size: 16px; font-weight: 700; color: var(--ink-strong); margin: 4px 0; }
.tw-usage-table td { font-size: 13px; }
@media (min-width: 700px) {
  .tw-kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tw-tcols { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) {
  .tw-tgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .tw-tcard-wide { grid-column: 1 / -1; }
}
.tw-tcard .tw-kpi-d { white-space: normal; }
@media (max-width: 640px) {
  .tw-tcard .tw-cardhead { flex-direction: column; align-items: flex-start; gap: 2px; }
  .tw-tcard .tw-cardsub { text-align: left; }
  .tw-tcard .tw-kpi-l { letter-spacing: .03em; }
  .tw-tcard .tw-kpi-v { font-size: 20px; }
}
/* Saved Tastewise trends inside other modules (I&Q Monday Brief section,
   Zone Pulse "Consumer demand" card, Product Catalog trend chip + popover).
   The look comes from 95-tastewise.css (tw-card, tw-wl-*, tw-lc-*, tw-rise-*,
   .up/.down); this file only lays those pieces out in their new homes.
   Brand tokens only, no new colours, no motion. Sorts after 95-tastewise.css. */

.tw-embed-slot[hidden] { display: none; }

/* shared */
.tw-embed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tw-embed-card { padding: 12px 12px 10px; grid-template-columns: minmax(0, 1fr) auto; }
/* A long "talk YoY" label (es: "conversación interanual") wraps under the
   number instead of pushing the sparkline out of a narrow card. */
.tw-embed-card .tw-wl-big { white-space: normal; }
.tw-embed-card .tw-wl-big small { display: inline-block; white-space: nowrap; margin-left: 0; }
.tw-embed-card .tw-wl-name { font-size: 15px; }
.tw-embed-card .tw-wl-big { font-size: 24px; }
.tw-embed-card .tw-wl-so { font-size: 13px; }
a.tw-embed-card { cursor: pointer; }
.tw-embed-arrow { color: var(--ink-faint); font-size: 12px; font-weight: 700; }
.tw-embed-source { margin: 10px 2px 0; font-size: 12px; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; }
.tw-embed-source .tw-link { font-size: 12.5px; }

/* I&Q Monday Brief: a section like the others, cards in the Food trends look */
.tw-embed-brief .tw-embed-sub { margin: -4px 0 12px; font-size: 13px; color: var(--ink-mute); line-height: 1.45; }
.tw-embed-group + .tw-embed-group { margin-top: 14px; }
.tw-embed-group-title { margin: 0 2px 8px; }

/* Zone Pulse: one compact card, rows like Food trends "Rising now" */
.tw-embed-zone .tw-cardhead { margin-bottom: 4px; flex-wrap: wrap; }
.tw-embed-kicker { font-size: 12px; color: var(--ink-mute); font-weight: 600; }
.tw-embed-row { grid-template-columns: minmax(0, 1fr) auto auto auto; color: inherit; text-decoration: none; }
a.tw-embed-row:hover .tw-rise-name { text-decoration: underline; text-underline-offset: 2px; }
.tw-embed-row .tw-rise-name small { font-weight: 500; }
.tw-embed-row .tw-spark-wrap { display: inline-flex; }
#hc-tw-section[hidden] { display: none; }

/* Product Catalog chip: a quiet pill under the SKU, Food trends colours */
.tw-embed-chip-row { margin-top: 6px; }
.tw-embed-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font: inherit; font-size: 12px; font-weight: 600; line-height: 1.2; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; padding: 3px 9px 3px 7px; cursor: pointer; min-height: 24px; }
.tw-embed-chip:hover, .tw-embed-chip[aria-expanded="true"] { border-color: var(--ink-faint); background: var(--warm-white); }
.tw-embed-chip:focus-visible { outline: 2px solid var(--heritage-gold); outline-offset: 2px; }
.tw-embed-chip-icon { display: inline-flex; color: var(--ink-mute); }
.tw-embed-chip.up .tw-embed-chip-icon { color: var(--success-deep); }
.tw-embed-chip.down .tw-embed-chip-icon { color: var(--danger); transform: scaleY(-1); }
.tw-embed-chip-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tw-embed-chip-num { font-variant-numeric: tabular-nums; font-weight: 700; }
.tw-embed-chip.up .tw-embed-chip-num { color: var(--success-deep); }
.tw-embed-chip.down .tw-embed-chip-num { color: var(--danger); }

/* popover: the same mini card, floating */
.tw-embed-pop { position: absolute; z-index: 1200; width: 300px; max-width: calc(100vw - 16px); background: var(--warm-white); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.14)); padding: 10px; }
.tw-embed-pop .tw-embed-card { border: 0; box-shadow: none; padding: 4px 30px 4px 4px; }
.tw-embed-pop .tw-embed-source { margin: 6px 4px 2px; }
.tw-embed-pop-x { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--ink-mute); font-size: 20px; line-height: 1; cursor: pointer; }
.tw-embed-pop-x:hover { background: var(--paper); color: var(--ink-strong); }

@media (max-width: 480px) {
  .tw-embed-grid { grid-template-columns: 1fr; }
  .tw-embed-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .tw-embed-row .tw-spark-wrap { display: none; }
}
/* ============================================================
   96-polish-v4.css
   60-minute polish pass — 2026-05-27 (Opus 4.7 subagent)

   Scope: visual consistency + new-module hardening for the
   demo-day platform. Strict frontend-only changes; no JS,
   route, or schema impact.

   Highest-impact change: variant button classes (`.btn primary`,
   `.btn ghost`, `.btn secondary`, `.btn purple`) are written
   throughout the newest modules (production, order-intelligence,
   formulation-intelligence, add-to-calendar, save-to-leespace).
   The CSS only defined hyphenated variants (.btn-primary, etc.),
   so 90+ buttons were relying on inline `style="..."` overrides
   for surface color. Hover/active/dark-mode rules never applied
   to those buttons — they read as "almost right" instead of
   pixel-perfect. We add aliases here, no markup change required.

   ============================================================ */

/* ----------------------------------------------------------
   1) Variant aliases — fix `.btn primary/ghost/secondary/purple`
      so they look identical to the hyphenated canonical form.

      Note: aliases come AFTER the inline `style="..."` resets so
      the cascade does the right thing. Inline styles still win
      where set, but every state without inline (hover, focus,
      active, disabled) now picks up the proper variant.
   ---------------------------------------------------------- */

.btn.primary {
  background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
  color: var(--warm-white);
  border-color: var(--heritage-red-dark);
  box-shadow: 0 2px 6px rgba(204, 0, 0, 0.22);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--heritage-red-deep), var(--heritage-red-dark));
  box-shadow: 0 4px 12px rgba(204, 0, 0, 0.32);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--warm-white);
}

.btn.primary:active:not(:disabled) { transform: translateY(0); }

.btn.secondary {
  background: var(--warm-white);
  color: var(--ink);
  border-color: var(--rule);
}

.btn.secondary:hover:not(:disabled) {
  border-color: var(--heritage-gold);
  background: var(--paper);
  color: var(--heritage-red);
  text-decoration: none;
}

.btn.purple {
  background: linear-gradient(135deg, var(--heritage-purple), var(--heritage-purple-dark));
  color: var(--warm-white);
  border-color: var(--heritage-purple-dark);
  box-shadow: 0 2px 6px rgba(91, 44, 138, 0.22);
}

.btn.purple:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(91, 44, 138, 0.32);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--warm-white);
}

.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}

.btn.ghost:hover:not(:disabled) {
  background: var(--paper);
  color: var(--ink-strong);
  border-color: var(--rule-gold);
  text-decoration: none;
}

.btn.ghost:active:not(:disabled) { transform: translateY(0); }

/* Ghost variant inside modal footers (used by save-to-leespace,
   add-to-calendar, and production dialogs) — borderless looks
   cleaner against the paper-tinted footer. */
.modal-footer .btn.ghost,
.modal-footer .btn-ghost {
  border-color: transparent;
}

.modal-footer .btn.ghost:hover:not(:disabled),
.modal-footer .btn-ghost:hover:not(:disabled) {
  border-color: var(--rule);
}

/* ----------------------------------------------------------
   2) Toast warn — JS calls toast(msg, 'warn') 18 times, but no
      .toast.warn rule existed → fell through to red. Match
      heritage gold so warnings read as warnings.
   ---------------------------------------------------------- */

.toast.warn,
.toast.warning {
  border-left-color: var(--heritage-gold-dark);
}

/* ----------------------------------------------------------
   3) Touch-target floor for inline-styled chips.
      `addToCalendarChip` and similar render with padding 2px 8px
      and font-size 0.7rem — that's ~22px tall, below WCAG AA
      24×24 minimum (and well below the 44×44 iOS workshop
      attendees will tap). Bump to 28px on mobile without
      breaking the chip aesthetic.
   ---------------------------------------------------------- */

@media (max-width: 760px) {
  /* Chips with inline border-radius:999px (the calendar/cal chip
     pattern used in production.js and order-intelligence.js). */
  button.btn.ghost[style*="border-radius: 999px"],
  button.btn.ghost[style*="border-radius:999px"] {
    min-height: 28px;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    font-size: 0.78rem !important;
  }

  /* Bring all small buttons up to a tappable height on mobile so
     workshop attendees on phones don't have to fight the UI. */
  .btn.btn-sm,
  .btn-sm {
    min-height: 36px;
  }
}

/* ----------------------------------------------------------
   4) Form inputs — prevent iOS Safari from zooming when focusing
      a sub-16px input. Affects upload-zone search, ask-the-data
      inputs, and any module's filter row.
   ---------------------------------------------------------- */

@media (max-width: 760px) {
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="number"],
  input[type="date"],
  input[type="tel"],
  input[type="url"],
  input[type="password"],
  textarea,
  select,
  .form-input,
  .form-textarea,
  .form-select,
  .search-bar input {
    font-size: 16px !important;
  }
}

/* ----------------------------------------------------------
   5) Empty-state consistency for new modules. Order
      Intelligence and Production use ad-hoc `empty-state` cards
      with their own typography; nudge them toward the platform
      norm — italic serif headline, soft body, generous padding.
   ---------------------------------------------------------- */

.card.empty-state {
  padding: 36px 28px;
  text-align: left;
  background: var(--warm-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card.empty-state h3 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.card.empty-state .text-mute {
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0;
}

/* ----------------------------------------------------------
   6) Loading-state polish for inline `<button>` controls that
      didn't get withLoadingState. The new modules sometimes use
      a raw `⏳ Generating…` label + `disabled` attr. Give those
      a consistent visual cue: muted color + cursor.
   ---------------------------------------------------------- */

.btn:disabled,
.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  filter: saturate(0.6);
  transform: none !important;
  box-shadow: none !important;
}

/* ----------------------------------------------------------
   7) Calendar chip + Save to LeeSpace toolbar spacing.
      Used in production.js / order-intelligence.js — the chip
      sits next to a date that's often italic. Give the chip
      slight breathing room and align the baseline.
   ---------------------------------------------------------- */

button.prod-qi-cal-chip,
button[id^="add-cal-chip-"],
button[id^="save-leespace-"] {
  vertical-align: middle;
  line-height: 1.4;
  letter-spacing: 0;
}

button.prod-qi-cal-chip:hover:not(:disabled),
button[id^="add-cal-chip-"]:hover:not(:disabled) {
  background: rgba(204, 0, 0, 0.06) !important;
  transform: translateY(-1px);
  transition: all 140ms ease;
}

/* ----------------------------------------------------------
   8) Modal close-button hit-area on iPhones.
      The X button is set to 44×44 inline; ensure it never
      collapses under font-size shrinking and that the icon
      stays centered.
   ---------------------------------------------------------- */

.modal-close {
  min-width: 44px;
  min-height: 44px;
}

/* ----------------------------------------------------------
   9) Save to LeeSpace + Add to Calendar headline polish — these
      two helpers wrap a `<p>` directly under the title with a
      raw `color: var(--text-mute, #666)`. The `--text-mute`
      var was never declared (we use `--ink-mute`). Map it.
   ---------------------------------------------------------- */

:root {
  --text-mute: var(--ink-mute, #6B6560);
  --text: var(--ink, #2C2520);
  --text-secondary: var(--ink-soft, #4A4038);
  --text-primary: var(--ink-strong, #1A1410);
}

/* ----------------------------------------------------------
   10) Sidebar active state — earlier polish-v3 introduced a left
       gradient with a left border, but the original .nav-link.active
       used a red gradient + white text. The two rules now compete.
       The v3 override (`background: linear-gradient(90deg, ..., transparent)`)
       gives a softer, ink-on-paper look — which is actually nicer for
       a sidebar — but the white text from the canonical rule is now
       red-on-eggshell. Pick the v3 look explicitly and tune the
       interplay (active link gets a deeper red, kept legible). The
       earlier rule used `color: var(--heritage-red-dark)` which
       reads great on the new background.

       Just make sure the badge color stays high contrast.
   ---------------------------------------------------------- */

.nav-link.active .nav-badge,
.nav-link[aria-current="page"] .nav-badge {
  background: var(--heritage-red);
  color: var(--warm-white);
}

/* ----------------------------------------------------------
   11) Sidebar overlay/scrim for mobile — earlier polish ships a
       hamburger, but no scrim was added for taps outside the
       sidebar to close it. The shell.js code DOES wire ESC and
       scrim clicks, but the scrim is only rendered when JS adds
       `.sidebar-scrim` to body. Make sure it looks right.
   ---------------------------------------------------------- */

.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 16, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 9;
  cursor: pointer;
  animation: scrim-fade-in 180ms ease;
}

/* Desktop side of the canonical 1280px NAV DRAWER breakpoint (25-plan.css). */
@media (min-width: 1281px) {
  .sidebar-scrim { display: none; }
}

/* ----------------------------------------------------------
   12) "is-zero" badge auto-detection for currency strings the
       v3 rule missed: $0.00, 0%, 0 cases, $0 / 0 / 0.0.
   ---------------------------------------------------------- */

.page-hero-badge[data-value="$0.00"],
.page-hero-badge[data-value="0%"],
.page-hero-badge[data-value="0.0"],
.page-hero-badge[data-value="0 cases"] {
  background: rgba(122, 110, 95, 0.06);
  border-color: rgba(122, 110, 95, 0.20);
  color: var(--ink-mute);
  border-style: dashed;
}

/* ----------------------------------------------------------
   13) Table horizontal scroll: when content overflows on small
       screens, give the wrapper a subtle right-edge fade so the
       user sees there's more content. Only on touch devices.
   ---------------------------------------------------------- */

@media (max-width: 880px) {
  .table-wrap {
    position: relative;
  }

  .table-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 24px;
    background: linear-gradient(to left, var(--warm-white), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 200ms ease;
  }

  .table-wrap[data-overflow="true"]::after {
    opacity: 0.95;
  }
}

/* ----------------------------------------------------------
   14) Inline-styled "Manage uploads" / "Upload new data" / etc.
       buttons that sit on top of the page-hero — when several
       sit in a row, the row wraps on small screens. Improve
       wrap behaviour.
   ---------------------------------------------------------- */

@media (max-width: 760px) {
  .page-hero-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-hero-actions > .btn {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 0.86rem;
  }
}

/* ----------------------------------------------------------
   15) Focus-visible polish — ensure keyboard navigation looks
       intentional everywhere. Default Chromium focus rings get
       eaten by some component CSS. Bring back a heritage ring.
   ---------------------------------------------------------- */

.btn:focus-visible,
.nav-link:focus-visible,
.tab:focus-visible,
.kanban-card:focus-visible,
.alert:focus-visible,
.kpi-tile:focus-visible {
  outline: 2px solid var(--heritage-gold);
  outline-offset: 2px;
  border-radius: var(--radius);
}

/* ----------------------------------------------------------
   16) Disclosure/banner inside new modules — production.js and
       order-intelligence.js wrap error fallbacks in a `card
       empty-state` with raw error text. The fallback message is
       fine; tighten the layout so it doesn't look like a crash.
   ---------------------------------------------------------- */

.card.empty-state > h3 + .text-mute {
  margin-top: 4px;
  font-size: 0.92rem;
}

/* ----------------------------------------------------------
   17) Inline calendar chip dark-mode parity. The chip's inline
       style hard-codes `background: transparent; color: red`,
       which reads fine on dark canvas but the border darkens.
   ---------------------------------------------------------- */

[data-theme="dark"] button[id^="add-cal-chip-"],
[data-theme="dark"] button.prod-qi-cal-chip {
  color: var(--heritage-gold-light, #E8C572) !important;
  border-color: var(--heritage-gold-light, #E8C572) !important;
}

[data-theme="dark"] button[id^="add-cal-chip-"]:hover:not(:disabled),
[data-theme="dark"] button.prod-qi-cal-chip:hover:not(:disabled) {
  background: rgba(212, 168, 67, 0.12) !important;
}

/* ----------------------------------------------------------
   18) Spinner color when used inside a `.btn.primary` (red bg).
       The .btn-spinner is `border-color: currentColor` already,
       which on .btn.primary is white — that works. But on
       gradient-disabled (opacity 0.55), it disappears. Make
       the spinner a touch heavier for clarity.
   ---------------------------------------------------------- */

.btn.is-loading .btn-spinner {
  border-width: 2px;
  opacity: 1;
}

/* ----------------------------------------------------------
   19) Long-title page-hero on phones. The italic serif headline
       can wrap awkwardly; nudge line-height so a 3-line title
       still reads cleanly.
   ---------------------------------------------------------- */

@media (max-width: 540px) {
  .page-hero-title { line-height: 1.22; }
  .dash-title      { line-height: 1.22; }
}

/* End 96-polish-v4.css */
/* ============================================================
   97-mobile-optimize.css — Mobile + touch refinements
   Generated 2026-05-27 in response to Kevin's mobile PWA audit
   (Past Briefs modal bug, Dynamic Island awareness, SEO Intel
   layout funk, Order Intelligence two-column collapse, touch
   target compliance).

   File loads AFTER 96-polish-v4 so its selectors win the cascade
   for true mobile sizes. Kept conservative on !important — used
   only where modules ship inline styles or where dark-mode hover
   states would otherwise override us.

   Breakpoints (matches what the rest of the codebase already uses):
     - 880px : tablet / sidebar collapse boundary
     - 768px : large-phone landscape
     - 640px : phone breakpoint (most rules)
     - 480px : narrow phone (iPhone 13/14 portrait = 390px)
     - 380px : iPhone SE class
   ============================================================ */


/* ─────────────────────────────────────────────────────────────
   GLOBAL — touch targets, safe areas, input zoom prevention
   ───────────────────────────────────────────────────────────── */

@media (max-width: 880px) {
  /* iOS auto-zooms any input <16px on focus. Lock to 16px on
     mobile widths regardless of inline `font-size` styles. */
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  select,
  textarea,
  .form-input,
  .form-textarea,
  .form-select {
    font-size: 16px;
  }

  /* Buttons + clickable controls: WCAG 2.2 says 24px min, Apple
     HIG says 44px. We target 40px as a reasonable middle ground
     so the visual rhythm stays tight on dense modals but the
     tap area is forgiving. The modal close already inline-styles
     to 44px; do not enlarge it further. */
  .btn,
  .btn-sm,
  .pill,
  .chip,
  .tab,
  .lv-spec-tab,
  .pillar-chip,
  .ai-tools-filter-input {
    min-height: 40px;
  }

  .btn-sm {
    /* btn-sm is intentionally tight in dense tables. Keep visual
       size, just guarantee the hit-target via padding. */
    min-height: 36px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  /* Heritage rule — keep inline icon-only buttons (📅 📈 etc.)
     square-ish, not stretched tall. Order Intel sidebar uses
     these. */
  .btn[title]:not(.btn-primary):not(.primary) {
    min-width: 40px;
  }
}


/* ─────────────────────────────────────────────────────────────
   MODALS — Dynamic Island aware, scrollable body, sticky close
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .modal-backdrop {
    /* Edge-to-edge on phones. Small top/side insets only — the sheet
       is bottom-anchored, so the notch is above the sheet (in the
       scrim), not on the modal header. Double safe-area on header
       + modal padding was creating a large empty top gap (smoke 7/11). */
    padding: max(env(safe-area-inset-top, 0px), 6px)
             0
             0
             0;
    align-items: flex-end;     /* slide up from bottom on phones */
  }

  .modal,
  .modal-wide {
    /* Take the available height; let the body do the scrolling.
       Max-height was already set inline; we widen it here. */
    max-width: 100%;
    width: 100%;
    /* Leave a thin top scrim for dismiss; don't subtract safe-area
       again (backdrop already padded). */
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 8px);
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    /* Cancel legacy inline safe-area padding on .modal from utils.js */
    padding-top: 0 !important;
  }

  .modal-header {
    /* Sticky header keeps the × reachable while body scrolls.
       Critical for the Past Briefs bug — the body table was so
       tall on mobile that the × scrolled off-screen. */
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--warm-white);
    /* Bottom sheet tops sit mid-viewport — NOT under Dynamic Island.
       Use normal padding only (safe-area already on backdrop). */
    padding: 14px 18px 12px;
  }

  .modal-title {
    font-size: 1.25rem;
  }

  .modal-body {
    padding: 16px 18px;
    /* Ensure -webkit-overflow-scrolling momentum on iOS */
    -webkit-overflow-scrolling: touch;
  }

  .modal-footer {
    padding: 12px 18px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    /* Stack stacked-action footers neatly on narrow phones */
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* Modal close: ensure the inline 44px sizing also has visible
     padding for fat-finger taps. */
  .modal-close {
    flex-shrink: 0;
    margin-left: 8px;
  }
}


/* ─────────────────────────────────────────────────────────────
   GENERIC TABLES INSIDE MODALS — fallback responsive treatment
   ─────────────────────────────────────────────────────────────
   When a modal contains a .data-table without a module-specific
   stacked layout, give it the horizontal-scroll affordance
   instead of clipping. Outer .table-wrap already handles this,
   but some callers use a bare <table>. */

@media (max-width: 640px) {
  .modal-body table:not(.seo-past-briefs-table) {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
}


/* ─────────────────────────────────────────────────────────────
   PAST BRIEFS modal (SEO Intelligence)
   ─────────────────────────────────────────────────────────────
   Kevin called this out by name: the table is unusable on
   mobile. Convert to a card stack with When/Title/Source labels
   inline next to values, and the View button full-width. */

@media (max-width: 640px) {
  .seo-past-briefs {
    /* Drop the outer scroll-wrap chrome — we don't need it once
       we're rendering as cards. */
    border: none;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Nuclear containment — nothing in the briefs modal escapes viewport */
  .modal-body .seo-past-briefs,
  .modal-body .seo-past-briefs * {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Force modal-wide to respect viewport on mobile */
  .modal-wide {
    max-width: calc(100vw - 24px) !important;
    width: 100% !important;
    margin: 0 auto !important;
  }

  .modal-wide .modal-body {
    overflow-x: hidden !important;
    max-width: 100% !important;
    padding: 12px !important;
  }

  .seo-past-briefs-table {
    width: 100%;
    border-collapse: collapse;
  }

  .seo-past-briefs-table thead {
    /* Hide the table header on mobile — each cell shows its own
       label via data-label. */
    display: none;
  }

  .seo-past-briefs-table tbody,
  .seo-past-briefs-table tr,
  .seo-past-briefs-table td {
    display: block;
    width: 100%;
  }

  .seo-past-briefs-table tr {
    background: var(--warm-white, #fff);
    border: 1px solid var(--rule, #e5e5e5);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(26, 20, 16, 0.04);
  }

  /* Kill the default hover bg from .data-table since each row is
     now a card. */
  .seo-past-briefs-table tr:hover {
    background: var(--warm-white, #fff);
  }

  .seo-past-briefs-table td {
    padding: 4px 0;
    border-bottom: none;
  }

  /* Render the When/Title/Source label inline */
  .seo-past-briefs-table td[data-label]:not([data-label=""])::before {
    content: attr(data-label) " · ";
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-mute, #888);
    font-weight: 600;
    margin-right: 4px;
  }

  /* Title row gets prominence */
  .seo-past-briefs-table td[data-label="Title"] {
    padding: 8px 0 6px;
    font-size: 1rem;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
  }

  .seo-past-briefs-table td[data-label="Title"] strong {
    display: block;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .seo-past-briefs-table td[data-label="Title"] .text-mute {
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
  }

  .seo-past-briefs-table td[data-label="Title"]::before {
    display: none;   /* title doesn't need its label echo */
  }

  /* SEMRush keyword widget — constrain on mobile */
  #seo-semrush-widget .card {
    padding: 12px !important;
  }

  #seo-semrush-widget .card > div {
    flex-direction: column !important;
    gap: 10px !important;
  }

  #seo-semrush-widget .card > div > div:nth-child(2) {
    min-width: 0 !important;
  }

  #seo-semrush-widget .card > div > div:last-child {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100%;
  }

  #seo-semrush-widget .card > div > div:last-child > div {
    text-align: center;
    padding: 8px 4px;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
  }

  #seo-semrush-widget .card > div > div:last-child > div > div:first-child {
    font-size: 1.1rem !important;
  }

  /* View button: full-width, primary feel */
  .seo-past-briefs-action {
    margin-top: 10px;
    padding-top: 10px !important;
    border-top: 1px solid var(--rule, #eee) !important;
  }

  .seo-past-briefs-action .btn {
    width: 100%;
    min-height: 40px;
  }
}


/* ─────────────────────────────────────────────────────────────
   SEO INTELLIGENCE — full mobile pass
   ─────────────────────────────────────────────────────────────
   The view has zero mobile breakpoints prior to this file. Card
   titles wrap, action button rows stack, engine grid collapses
   gracefully, the brief renderer pulls in padding, tier-button
   row scrolls horizontally. */

@media (max-width: 640px) {
  /* Top brief generator card — title row gets squeezed by the
     "Generate this week's brief" + "Past briefs" pair. Stack
     them vertically. */
  #seo-brief-output > .seo-brief-shell {
    padding: 0;
  }

  /* Engine grid: at 280px min and 12px gap, two cards never fit
     below ~600px anyway — let auto-fit do its job but tighten
     the gap. */
  .seo-engine-grid {
    gap: 10px;
    margin-bottom: 12px;
  }

  /* Engine card densification */
  .seo-engine-card {
    padding: 10px 12px;
    border-radius: 8px;
  }

  .seo-engine-head {
    gap: 8px;
    margin-bottom: 8px;
  }

  .seo-engine-name {
    font-size: 0.9rem;
  }

  .seo-engine-deploy {
    /* Deployment string can be long; let it wrap on small
       screens instead of overflowing. */
    font-size: 0.68rem;
    word-break: break-word;
  }

  /* Brief renderer — the inline headline card was eating 14px
     18px padding which is fine, but the wrapper itself sat on
     top of full-width body padding. Tighten everything. */
  .seo-brief-shell h4 {
    font-size: 1.05rem;
    margin-top: 14px !important;
  }

  /* Tier-buttons row scrolls horizontally rather than wrapping
     into a 3-row stack (tier buttons can be long labels). */
  #seo-tier-buttons {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin-left: -2px;
    margin-right: -2px;
  }

  #seo-tier-buttons > .btn,
  #seo-tier-buttons > button {
    flex-shrink: 0;
  }

  /* Summary chips wrap below the title at narrow widths */
  .seo-summary-chips {
    margin-top: 4px;
  }

  /* Probe history toolbar — filter selects stack */
  #seo-mentioned-filter,
  .filter-select {
    width: 100%;
    margin-bottom: 6px;
  }
}

@media (max-width: 480px) {
  /* Even tighter on small phones: probe card titles + card
     subtitles take less vertical real estate. */
  .seo-brief-shell > div:first-child {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px !important;
  }
}


/* ─────────────────────────────────────────────────────────────
   ORDER INTELLIGENCE — sidebar/main collapse + line-item cards
   ─────────────────────────────────────────────────────────────
   Inline styles set a 320-380px sidebar + 1fr main grid. Below
   880px that's untenable. Override with the .oi-main-layout
   hook added to the JS. */

@media (max-width: 880px) {
  .oi-main-layout {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .oi-side {
    position: static !important;
    max-height: none !important;
    /* Cap the sidebar so it doesn't push the detail offscreen.
       400px shows ~5 uploads, then scrolls. */
    max-height: 60vh !important;
    overflow: auto !important;
  }
}

@media (max-width: 640px) {
  /* Pipeline + delivery date buttons should stay as icon-only
     even when the row is narrow. */
  #oi-bulk-all-dates,
  #oi-show-pipeline {
    flex: 0 0 auto;
  }

  /* Detail header: the action buttons (Add to Calendar / Save
     to LeeSpace / Re-extract) wrap nicely already because the
     module sets flex-wrap. Just ensure they stretch instead of
     becoming awkward 80px-wide pills. */
  #oi-main .card > div[style*="justify-content: space-between"]
           > div[style*="flex-wrap: wrap"] .btn {
    flex: 1 1 auto;
    min-width: 120px;
  }
}


/* ─────────────────────────────────────────────────────────────
   LOGIN — small-screen polish
   ─────────────────────────────────────────────────────────────
   No prior breakpoints existed. At 375px the 44px horizontal
   padding eats too much width; the demo-grid scrollable area
   needs a sensible max-height that doesn't trap users in the
   list. */

@media (max-width: 640px) {
  .login-page {
    padding: 20px 12px;
    /* Use dvh so iOS Safari URL bar doesn't crop the lockup. */
    min-height: 100dvh;
  }

  .login-card {
    padding: 32px 22px 24px;
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(91, 44, 138, 0.10), 0 2px 10px rgba(26, 20, 16, 0.05);
  }

  .login-mark {
    height: 72px;
    margin-bottom: 14px;
  }

  .login-mark + .login-title {
    font-size: 1rem;
  }

  .login-subtitle {
    font-size: 0.95rem;
  }

  .login-tagline {
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .login-demo-grid {
    /* Slightly shorter on phones so the OAuth button + footer
       remain visible without scrolling the whole page. */
    max-height: 280px;
  }

  .persona-card {
    padding: 14px 14px;
    min-height: 56px;
  }

  .persona-card:hover {
    /* Disable translateX nudge on touch — looks janky when the
       hover state sticks after a tap. */
    transform: none;
  }
}

@media (max-width: 380px) {
  .login-card {
    padding: 24px 16px 20px;
  }

  .login-mark {
    height: 60px;
  }
}


/* ─────────────────────────────────────────────────────────────
   ACTIVITY FEED — header wrap, meta tightening
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .af-header {
    align-items: flex-start;
  }

  .af-header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .af-filter {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;   /* iOS zoom guard */
  }

  .af-event {
    padding: 12px;
    gap: 10px;
  }

  .af-event-meta {
    /* Lots of metadata chips (time / dept / model / elapsed) —
       let them wrap to a second row instead of overflowing. */
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .af-event-headline {
    flex-wrap: wrap;
    row-gap: 2px;
  }

  /* The af-server-time was inline next to the live-dot; on
     narrow screens it pushes everything off. Move to next
     line. */
  .af-server-time {
    display: block;
    margin: 4px 0 0 0;
  }
}


/* ─────────────────────────────────────────────────────────────
   GENERIC HERO HEADERS / PAGE TITLES
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .page-hero,
  .ai-tools-hero {
    /* Tighten the visual gutters so hero metrics don't push
       below the fold. */
    padding-left: 14px;
    padding-right: 14px;
  }

  .dash-title,
  h1 {
    word-break: break-word;
  }

  /* Long greeting ("Today, Wednesday, May 27, 2026") gets clipped at
     1.6rem italic serif on iPhone 13/14. Drop a touch and allow it
     to break naturally. */
  .dash-title {
    font-size: 1.35rem;
    line-height: 1.2;
  }
}

@media (max-width: 380px) {
  .dash-title {
    font-size: 1.2rem;
  }
}


/* ─────────────────────────────────────────────────────────────
   CARDS + SECTIONS — global breathing room reduction
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .section {
    padding-left: 0;
    padding-right: 0;
  }

  /* .card has 18-24px padding in most modules. On phones the
     module headers + chips get cramped. Pull it in slightly. */
  .card {
    padding: 14px 14px;
  }

  .card-title {
    font-size: 1rem;
    line-height: 1.35;
  }

  .card-subtitle {
    font-size: 0.85rem;
    line-height: 1.45;
  }

  /* Form fields stacked card layout */
  .form-field + .form-field {
    margin-top: 12px;
  }
}


/* ─────────────────────────────────────────────────────────────
   TOOLBARS — wrap and stretch on mobile
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .toolbar {
    flex-wrap: wrap;
    gap: 8px !important;
  }

  .toolbar > .btn,
  .toolbar > button {
    flex: 1 1 auto;
  }
}


/* ─────────────────────────────────────────────────────────────
   PWA / NOTCHED DEVICES — safe-area defenses
   ─────────────────────────────────────────────────────────────
   Dynamic Island + iPhone X-class notch. The topbar already
   accounts for env(safe-area-inset-top), but modals + login
   needed reinforcement above. Floating action buttons (FABs)
   anywhere in the app get a bottom-inset cushion. */

@media (display-mode: standalone) {
  /* Anything pinned to the bottom of the viewport (sticky/fixed
     bottom: 0) should respect home-bar inset. */
  [style*="position: fixed"][style*="bottom: 0"],
  .fab,
  .floating-action,
  .sticky-bottom-bar {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  }
}


/* ─────────────────────────────────────────────────────────────
   ORIENTATION — landscape on phones (narrow + short)
   ─────────────────────────────────────────────────────────────
   Modals especially suffer here: at 740×400 the body has
   ~150px of vertical room. Pull header padding tight. */

@media (max-height: 500px) and (orientation: landscape) {
  .modal-header {
    padding-top: 10px;
    padding-bottom: 8px;
  }

  .modal-title {
    font-size: 1.1rem;
  }

  .modal-body {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  /* Login page in landscape on a phone — keep the card scrollable
     instead of cropping the OAuth button. */
  .login-page {
    align-items: flex-start;
    overflow-y: auto;
  }
}


/* ─────────────────────────────────────────────────────────────
   REDUCED-MOTION — hover transforms off on touch devices
   ─────────────────────────────────────────────────────────────
   Sticky hover states (translateX, translateY) feel laggy on
   iOS Safari. Disable when there's no real hover pointer. */

@media (hover: none) and (pointer: coarse) {
  .persona-card:hover,
  .module-card:hover,
  .seo-engine-card-done:hover,
  .af-event:hover {
    transform: none;
  }

  /* Hover bg states stick around after taps. Make them subtler
     so they don't visually disorient. */
  .seo-engine-card-done:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }
}


/* ============================================================
   VISUAL QA FIX PASS — 2026-05-27 (Kevin iPhone testing)
   ============================================================
   Issues caught during office mobile testing:
   • Agent FAB (red lock) overlaps content on every view
   • Page-hero badges wrap value/label internally (2-col grid forces shrink)
   • Topbar title truncates with hard ellipsis on long module names
   • Pills in spec-diff / label-verify wrap unevenly in 2-col layout
   • Desktop-only ⌘V keyboard hints render on touch
   • Order Intelligence detail/list inner padding gets tight at 390px
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   AGENT FAB — mobile sizing, idle dim, scroll-hide affordance
   ─────────────────────────────────────────────────────────────
   The .agent-fab is 56px square at right:24px + bottom:24px. On
   phones it overlaps whatever content is at the bottom of the
   viewport. Two-part fix:
     1. Add bottom padding to the page bottom so user can scroll to
        a clean last-screen state (helps the page-end case).
     2. Shrink the FAB to 48px and lower idle opacity so mid-scroll
        overlap is less visually destructive. JS handles the optional
        scroll-hide animation. */

@media (max-width: 880px) {
  .main {
    padding-bottom: 0 !important;
  }

  /* FAB clearance goes on .content, not .main — otherwise it adds
     space BELOW the footer which is .main's last child. */
  .content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  /* Belt-and-suspenders: views that render their own bottom-anchored
     containers (textareas + action rows) inherit the gap. */
  .view,
  .module-content,
  [data-module] {
    scroll-padding-bottom: 120px;
  }

  /* Smaller, dimmer idle FAB so mid-scroll overlap is less harsh */
  .agent-fab {
    width: 48px;
    height: 48px;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    opacity: 0.92;
    box-shadow: 0 4px 14px rgba(204, 0, 0, 0.28);
  }

  .agent-fab svg {
    width: 22px;
    height: 22px;
  }

  /* Scroll-hide: JS toggles this class when user scrolls down.
     Reappears on scroll-up or when the page is near the bottom. */
  .agent-fab.fab-hidden {
    transform: translateY(96px);
    opacity: 0;
    pointer-events: none;
    transition: transform 240ms ease, opacity 240ms ease;
  }

  .agent-fab:not(.fab-hidden) {
    transition: transform 240ms ease, opacity 240ms ease;
  }
}


/* ─────────────────────────────────────────────────────────────
   PAGE-HERO BADGES — vertical stack at <480px to stop inner wrap
   ─────────────────────────────────────────────────────────────
   The badge has `white-space: nowrap` but flex-shrink:1 lets each
   badge collapse to fit when 4 badges are forced into 2 columns by
   flex-wrap, which then makes value/label inside break unpredictably.
   Force single-column stack on narrow phones and lift the nowrap so
   long descriptors wrap cleanly between value and label, not mid-word. */

@media (max-width: 480px) {
  .page-hero-metrics {
    /* Stack badges full-width — no more 2-col grid that fights the
       longer descriptors. Polish-v3 set display:grid 2-col at <=760px
       so we have to explicitly switch back to single-column grid here. */
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 6px;
  }

  .page-hero-metrics .page-hero-badge {
    /* Lift the nowrap so the descriptor can wrap below the value
       on the rare super-long string. With one badge per row this
       almost never triggers. */
    white-space: normal;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
    min-height: 32px;
    /* Keep the value chip from getting squished by long labels */
    flex-wrap: wrap;
    row-gap: 2px;
  }

  /* Cancel the polish-v3 odd-child full-width rule — every cell
     is already full-width in single-column. */
  .page-hero-metrics .page-hero-badge:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .page-hero-badge-value,
  .page-hero-badge-label {
    word-break: keep-all;
    overflow-wrap: normal;
  }
}

@media (max-width: 380px) {
  /* iPhone SE class — even tighter typography */
  .page-hero-badge {
    font-size: 0.78rem;
  }
  .page-hero-badge-value {
    font-size: 0.86rem;
  }
}


/* ─────────────────────────────────────────────────────────────
   TOPBAR — title sizing + subtitle hide on phones
   ─────────────────────────────────────────────────────────────
   At 390px the topbar shows menu button + title + search icon +
   help + avatar. The title "Formulation Intelligence" gets hard
   ellipsis. Drop the font slightly, hide the subtitle (it's only
   used on a couple views and never critical), and tighten the
   gap so the title earns more horizontal room. */

@media (max-width: 640px) {
  .topbar {
    /* Trim outer padding so the title strip can breathe. The
       shell's existing rule already pads 32px which is overkill. */
    padding-left: 14px;
    padding-right: 14px;
    gap: 10px;
  }

  .topbar-titles {
    min-width: 0;
    flex: 1 1 auto;
  }

  .topbar-title {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .topbar-subtitle {
    /* Subtitle is decorative metadata — hide on phones so the
       primary title gets room. */
    display: none;
  }

  .topbar-actions {
    gap: 8px;
  }

  /* The desktop search input is hidden behind the search icon
     on mobile already, but defensively zero its width if it leaks. */
  .topbar .search-bar {
    display: none;
  }
}

@media (max-width: 380px) {
  .topbar-title {
    font-size: 1rem;
  }
  .topbar {
    padding-left: 10px;
    padding-right: 10px;
    gap: 6px;
  }
}

/* When the title attribute carries the full module name (long), let
   it shrink further so common long names ("Formulation Intelligence",
   "Deductions Intelligence", "Vendor Compliance") fit. The shell
   only needs the title visible — the page-hero already restates it. */
@media (max-width: 440px) {
  .topbar-title {
    font-size: 1.02rem;
    letter-spacing: -0.025em;
  }
}


/* ─────────────────────────────────────────────────────────────
   TOPBAR — phone: the page title must be readable (2026-10-25)
   ─────────────────────────────────────────────────────────────
   Layout sweep: at 390px the menu button, the workspace pill
   ("AIOP Americas"), search, help and avatar took 275px of the
   362px row, so the page title got ~23px and showed one letter
   plus an ellipsis ("A…", "F…") on every page in every locale.
   Fix, phones only (desktop/tablet untouched):
   1. The workspace pill keeps its colour dot and caret but its
      name is visually hidden. It stays the button's accessible
      name, and the open menu still lists every workspace by name
      with a check on the active one.
   2. Tighter gaps between the action buttons.
   3. The title may wrap to two lines instead of one-line ellipsis,
      so long names ("Formulation Intelligence", "Clasificación de
      correos") read in full. Every control stays visible. */

@media (max-width: 640px) {
  .topbar .topbar-actions {
    gap: 4px;
  }

  .topbar .ws-switch-btn {
    gap: 6px;
    padding: 5px 9px;
  }

  .topbar .ws-switch-name {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .topbar .topbar-titles {
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar .topbar-titles .topbar-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    white-space: normal;
    overflow: hidden;
    overflow-wrap: break-word;
    font-size: 1rem;
    line-height: 1.15;
  }
}


/* ─────────────────────────────────────────────────────────────
   GENERIC TEXT CONTAINMENT — cards, headlines, hero descriptions
   ─────────────────────────────────────────────────────────────
   Long product names ("COSTCO-CA_PO001791215416.pdf") and SKU
   strings push cards beyond the viewport. Word-break everything
   inside cards at phone widths so nothing escapes horizontally. */

@media (max-width: 640px) {
  .card,
  .card * {
    /* Targeted defensive wrap — won't break inline-flex layouts
       because we don't change display. */
    max-width: 100%;
  }

  .card .card-title,
  .card .card-subtitle,
  .card p,
  .card li,
  .card span:not(.page-hero-badge):not(.pill):not(.chip):not(.tag):not(.tab) {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  /* Page-hero description column gets a hard wrap too */
  .page-hero-desc,
  .page-hero .page-hero-subtitle {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
}


/* ─────────────────────────────────────────────────────────────
   DESKTOP-ONLY HINTS — hide ⌘V / kbd cues on touch
   ─────────────────────────────────────────────────────────────
   Label-verify drop zones print "or paste from clipboard (⌘V)".
   No clipboard paste exists on iOS Safari for image bytes, and
   touch users can't ⌘V anyway. Hide the parenthetical inline.
   Also hide bare <kbd> shortcuts when the help panel surfaces them. */

@media (hover: none) and (pointer: coarse) {
  /* Match the literal text fragment by leveraging the inline span
     pattern used in label-verify. We can't pseudo-strip text, so
     this rule trims the visible kbd cluster inside dropzones. */
  .lv-dropzone-text {
    /* Force the second clause ("or paste from clipboard (⌘V)")
     onto its own line and dim it, since we can't trivially remove
     the substring without touching JS. */
  }

  /* Visual hint blocks across modules */
  .kbd-hint,
  .help-shortcut,
  .shortcut-cue,
  .desktop-only {
    display: none !important;
  }

  kbd {
    /* When a <kbd> appears inline in body copy, render it as plain
       text rather than a keycap box. */
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    font-family: inherit;
  }
}


/* ─────────────────────────────────────────────────────────────
   LABEL VERIFY — dropzone copy + spec tabs stacking
   ─────────────────────────────────────────────────────────────
   Tabs are intentionally stacked at small widths (lv-spec-tabs flex
   wraps), but the underline that follows .active was clipping the
   second tab. Reinforce wrap + reset underline width. */

@media (max-width: 640px) {
  .lv-spec-tabs {
    flex-wrap: wrap;
    gap: 6px;
  }

  .lv-spec-tab {
    flex: 1 1 auto;
    text-align: center;
  }

  .lv-dropzone-text {
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .lv-dropzone-text br + * {
    /* When we still have the ⌘V parenthetical, soften it visually. */
    display: block;
  }
}


/* ─────────────────────────────────────────────────────────────
   ORDER INTELLIGENCE — list row alignment + filename overflow
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  /* Long PO filenames break out of the side rail on narrow phones.
     Force overflow-wrap on the OI side panel rows. */
  .oi-side,
  .oi-side .card,
  .oi-side [class*="oi-row"],
  .oi-side a,
  .oi-side span,
  .oi-side div {
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
  }

  /* Tighten the side panel padding so filename + PO# both fit */
  .oi-side .card {
    padding: 10px 12px;
  }

  /* Extracted-fields table inside detail panel — allow horizontal
     scroll instead of clipping labels/values. */
  #oi-main table,
  #oi-detail table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
  }

  #oi-main table th,
  #oi-main table td,
  #oi-detail table th,
  #oi-detail table td {
    white-space: nowrap;
    /* But let cells that contain natural language (notes, addresses)
       wrap when given the .wrap modifier. */
  }

  #oi-main table td.wrap,
  #oi-detail table td.wrap {
    white-space: normal;
    word-break: break-word;
  }
}


/* ─────────────────────────────────────────────────────────────
   VENDOR COMPLIANCE — paste-cert textarea overflow + FAB collision
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  /* Textareas inside the vendor compliance view get a right-side
     padding cushion so the FAB never crosses input text. The FAB
     sits at right:24px so 60px of inline-end space keeps content
     visible. */
  textarea {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* All form textareas: force 100% width to prevent the default
     <textarea cols="20"> behavior from leaking past container. */
  textarea.form-textarea,
  textarea.form-input,
  textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Vendor compliance specifically */
  .vc-cert-text,
  textarea[data-vc-cert],
  textarea#vc-text {
    width: 100%;
    max-width: 100%;
  }
}


/* ─────────────────────────────────────────────────────────────
   GLOBAL HORIZONTAL OVERFLOW GUARD
   ─────────────────────────────────────────────────────────────
   Last line of defense: prevent any inline element with an inline
   width from poking past the viewport at phone widths. */

@media (max-width: 480px) {
  body,
  html {
    overflow-x: hidden;
  }

  /* Stat / KPI tiles, generic tile patterns */
  .kpi-grid,
  .stat-grid,
  .tile-grid,
  .module-grid,
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* When even 2 columns crowd content, KPI tile wraps neatly */
  .kpi-tile,
  .stat-tile {
    padding: 12px;
    min-width: 0;
    overflow: hidden;
  }

  .kpi-tile .kpi-value,
  .kpi-tile .kpi-label,
  .stat-tile .stat-value,
  .stat-tile .stat-label {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  /* Tables anywhere in module bodies get horizontal-scroll affordance */
  .section table,
  .card table,
  table.data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}


/* ─────────────────────────────────────────────────────────────
   SECTION SPACING — tighter rhythm on phones
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .section + .section,
  section + section {
    margin-top: 14px;
  }

  .section {
    margin-top: 12px;
    margin-bottom: 12px;
  }
}


/* ─────────────────────────────────────────────────────────────
   PRINT/PREVIEW BANNERS + INLINE LINKS LIST
   ─────────────────────────────────────────────────────────────
   Complaint-video shows emoji-prefixed links (📹 Upload Video,
   📝 Custom Complaint) as plain anchors. On touch they get a
   visible affordance so users know they're tappable. */

@media (max-width: 640px) {
  .cv-preview-banner a,
  .cv-cases-list a,
  a[href*="upload"],
  a[href*="custom-complaint"] {
    display: inline-block;
    min-height: 40px;
    line-height: 1.5;
    padding: 8px 4px;
  }
}


/* ─────────────────────────────────────────────────────────────
   SEMRush keyword table — card stack on mobile
   ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .seo-kw-table-wrap {
    overflow-x: hidden !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    grid-template-columns: none !important;
  }

  .seo-kw-table thead { display: none; }

  .seo-kw-table tbody,
  .seo-kw-table tr,
  .seo-kw-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .seo-kw-table tr {
    background: var(--warm-white, #fff);
    border: 1px solid var(--rule, #e5e5e5);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(26, 20, 16, 0.04);
  }

  .seo-kw-table tr:hover { background: var(--warm-white, #fff); }

  .seo-kw-table td {
    padding: 3px 0;
    border-bottom: none;
  }

  /* Keyword name gets prominence */
  .seo-kw-table td[data-label="Keyword"] {
    font-size: 1rem;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--rule, #eee) !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .seo-kw-table td[data-label="Keyword"]::before {
    content: "Keyword";
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-mute, #888);
    font-weight: 600;
    margin-bottom: 4px;
  }

  /* Compact inline stats below keyword — hide empty fields */
  .seo-kw-table td:not([data-label="Keyword"]):not([data-label="Landing"]) {
    display: inline-block;
    padding: 4px 10px 4px 0;
    font-size: 0.85rem;
  }

  .seo-kw-table td:not([data-label="Keyword"]):not([data-label="Landing"])::before {
    content: attr(data-label) ": ";
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-mute, #888);
    font-weight: 600;
  }

  /* Hide fields that only contain an em-dash (empty) */
  .seo-kw-table td .text-mute:only-child {
    font-size: 0.75rem;
  }

  /* Landing URL — compact, own row */
  .seo-kw-table td[data-label="Landing"] {
    display: block;
    padding-top: 6px;
    margin-top: 6px;
    border-top: 1px solid var(--rule, #eee) !important;
    font-size: 0.78rem;
    word-break: break-all;
  }

  .seo-kw-table td[data-label="Landing"]::before {
    content: "Landing: ";
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-mute, #888);
    font-weight: 600;
  }

  /* Title header for the keyword section */
  .seo-kw-table-wrap > div:first-child {
    font-size: 0.95rem !important;
    word-break: break-word;
  }
}

/* ─────────────────────────────────────────────────────────────
   Footer anchoring on mobile (≤880px)

   Root cause: on desktop, .sidebar is position:sticky height:100vh,
   which stretches the .app-shell grid row to 100vh and in turn
   stretches .main (a flex column) to fill it. That gives
   `.app-footer { margin-top: auto }` real space to consume, so the
   footer sits at the bottom on short-content pages.

   On mobile (≤880px) the sidebar becomes position:fixed and leaves
   the flow entirely. The single 1fr grid column collapses its row
   to .main's content height, so .main is only as tall as topbar +
   content + footer. `margin-top: auto` then has zero free space to
   push against, and the footer floats up under the content.

   Fix: force .main to be at least 100vh tall on mobile so the flex
   column has room for `margin-top: auto` on .app-footer to anchor
   it to the bottom of the viewport.
   ───────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .main {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  .content {
    flex: 1 1 auto;
  }

  .app-footer {
    flex-shrink: 0;
    margin-top: auto !important;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }
}

/* ─────────────────────────────────────────────────────────────
   Sidebar / nav drawer — add top safe-area space above logo
   ───────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .sidebar {
    padding-top: calc(20px + env(safe-area-inset-top, 20px)) !important;
  }
}


/* ============================================================
   ADMIN PANEL — mobile polish pass (2026-05-27, Kevin office test)
   ============================================================
   The Admin panel has 6 tabs (Overview, Users & Roles, Module
   Access, Active Sessions, Activity Feed, Nav Config). On desktop
   the layout is a 200px sticky sidebar + content. At ≤900px the
   sidebar already collapses inline above content (handled in
   21-admin.css), but the resulting stack is awkward on phones:
   the vertical button list eats vertical real estate, and every
   tab's table overflows horizontally.

   Strategy:
     • ≤880px — sidebar becomes horizontal scrolling tab strip,
       sticky to the top of .admin-content so it stays reachable
       while user scrolls a long tab body. ≥44px touch targets,
       active tab keeps the red gradient.
     • ≤640px — every admin table converts to a card stack using
       the data-label attributes we added to the cells. Stats grid
       drops to 2-col (and 1-col at <480px). Nav-config 1.4fr 1fr
       grid stacks. All inline buttons/handles meet 44px.
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   ADMIN LAYOUT — horizontal scrolling tab strip on mobile
   ───────────────────────────────────────────────────────────── */

@media (max-width: 880px) {
  .admin-layout {
    /* Already single-column at 900px from 21-admin.css. Tighten
       the gap and let the sidebar behave like a sticky tab strip. */
    gap: 12px !important;
  }

  .admin-sidebar {
    /* Horizontal tab rail. Sticky to the top of the content area
       so it remains reachable while a long body scrolls. */
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    z-index: 5;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 6px 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    /* Hide ugly default scrollbar — fade-edge gives the affordance */
    scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
    /* Soft fade on the right edge to hint at horizontal scroll */
    background:
      linear-gradient(to right, var(--warm-white) 80%, rgba(255, 255, 255, 0)) right top / 24px 100% no-repeat,
      var(--warm-white);
    border-radius: 12px;
  }

  .admin-sidebar::-webkit-scrollbar { height: 4px; }
  .admin-sidebar::-webkit-scrollbar-track { background: transparent; }
  .admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 2px;
  }

  .admin-sidebar-title {
    /* The "Administration" label is redundant on phones — the
       page hero/topbar already states the section. Hide it so
       the tab rail stays compact. */
    display: none;
  }

  .admin-tab {
    /* Each tab becomes a horizontal pill. Padding-driven height
       hits the 44px touch target. White-space:nowrap keeps the
       label on one line so the row scrolls instead of wrapping. */
    flex: 0 0 auto;
    width: auto;
    min-height: 44px;
    padding: 10px 14px;
    margin: 0;
    border-radius: 999px;
    font-size: 0.9rem;
    white-space: nowrap;
    text-align: center;
    border: 1px solid transparent;
  }

  .admin-tab:not(.active) {
    /* Subtle outline so non-active tabs read as tappable, not flat */
    background: rgba(0, 0, 0, 0.025);
    border-color: rgba(0, 0, 0, 0.06);
  }

  .admin-tab.active {
    /* Existing red gradient already wins on desktop; we keep the
       same look on mobile but lift it slightly so it stands out
       inside the scrolling rail. */
    box-shadow: 0 2px 8px rgba(204, 0, 0, 0.25);
  }

  .admin-content {
    /* Don't let the content card glue to viewport edges; the
       sidebar above already has 12px gap, but inner padding
       was reduced via .card mobile rule — fine. */
  }

  .admin-h2 {
    font-size: 1.25rem;
    margin-bottom: 12px;
  }
}


/* ─────────────────────────────────────────────────────────────
   ADMIN STATS GRID — Overview tab KPI tiles
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .admin-stats-grid {
    /* Force a clean 2-up grid on phones — auto-fit minmax(160px)
       can give weird 3-col fits at boundary widths. */
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
    margin-bottom: 14px;
  }

  .admin-stat-card {
    padding: 16px 10px;
  }

  .admin-stat-value {
    font-size: 1.7rem;
  }

  .admin-stat-label {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
  }

  .admin-stat-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 6px;
  }
}

@media (max-width: 380px) {
  /* iPhone SE class — single-col so the values don't crunch. */
  .admin-stats-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 760px) {
  /* 21-admin.css already drops .admin-cards-row to 1fr at 760px.
     Just tighten the gap. */
  .admin-cards-row {
    gap: 12px !important;
  }
}

@media (max-width: 640px) {
  /* Roles + auth info rows: keep label/value rows but tighten
     dashed dividers visually. */
  .admin-role-row,
  .admin-info-row {
    padding: 8px 0;
  }

  .admin-info-label {
    font-size: 0.82rem;
  }

  .admin-info-value {
    font-size: 0.88rem;
    text-align: right;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 55%;
  }
}


/* ─────────────────────────────────────────────────────────────
   ADMIN TABLES — universal card-stack treatment at ≤640px
   ─────────────────────────────────────────────────────────────
   The Users / Sessions / Module Access / Activity tabs all use
   .data-table inside .card.gateway.card-table. The 04-components
   .data-table on its own wraps with horizontal-scroll, but on a
   phone that's a poor UX — the user has to scroll horizontally
   per-row to read each record. Convert them to card stacks using
   the data-label attributes added in admin.js. */

@media (max-width: 640px) {
  /* Cancel the inherited card-table table styling so each row
     renders as a self-contained card. */
  .admin-content .card.gateway.card-table {
    padding: 8px;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }

  /* Section headers inside card-table cards (used by Module
     Access for "Visibility summary") — keep them readable. */
  .admin-content .card.gateway.card-table > .card-h3 {
    padding: 4px 6px 8px !important;
    font-size: 1rem;
  }

  /* Reset the table flow */
  .admin-content .data-table,
  .admin-content .data-table thead,
  .admin-content .data-table tbody,
  .admin-content .data-table tr,
  .admin-content .data-table td,
  .admin-content .data-table th {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .admin-content .data-table {
    /* Drop the block-overflow-x set by the global guard so the
       cards inside aren't stuck inside a scroller. */
    overflow-x: visible;
  }

  .admin-content .data-table thead {
    /* Hide column headers; each cell shows its own label */
    display: none;
  }

  .admin-content .data-table tr {
    background: var(--warm-white, #fff);
    border: 1px solid var(--rule, #e5e5e5);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(26, 20, 16, 0.04);
  }

  .admin-content .data-table tr:hover {
    background: var(--warm-white, #fff);
  }

  .admin-content .data-table tbody tr:last-child td {
    /* Cancel the desktop "last row no border" rule for stacked
       cards — each cell row should keep its small divider. */
    border-bottom: 1px solid transparent;
  }

  .admin-content .data-table td {
    padding: 6px 0;
    border-bottom: none;
    /* Layout: label on top, value below. Word-wrap aggressively. */
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .admin-content .data-table td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-mute, #888);
    font-weight: 600;
    margin-bottom: 3px;
  }

  /* Empty data-label cells (like the action column) shouldn't
     emit a label gap. */
  .admin-content .data-table td[data-label=""] {
    padding-top: 8px;
  }

  /* Cancel inline width caps that desktop sets via inline styles
     (e.g. .admin-ua-cell has inline max-width:280px). */
  .admin-content .admin-ua-cell {
    max-width: 100% !important;
    white-space: normal !important;
    text-overflow: clip !important;
    overflow: visible !important;
    font-size: 0.78rem;
  }

  /* Reason cell in per-user modules — let it wrap fully */
  .admin-content .admin-reason-cell {
    font-size: 0.85rem;
  }
}


/* ─────────────────────────────────────────────────────────────
   USERS TAB — name cell + role pills + role select
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  /* The first cell in user rows has its own user-cell layout —
     keep that intact but ensure the label still shows above. */
  .admin-content .data-table td[data-label="Name"] {
    /* Give the name card prominence at the top of the card */
    padding-top: 4px;
  }

  .admin-content .user-cell {
    gap: 12px;
  }

  .admin-content .user-cell-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.82rem;
  }

  .admin-content .user-cell-name {
    font-size: 1rem;
  }

  /* The role select in the Users tab should be full-width and
     tap-friendly. The base .role-select is small (4px 8px). */
  .admin-content .role-select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px;   /* iOS zoom guard */
    border-radius: 10px;
  }

  /* Users toolbar (search / filter / sort) — stack controls
     full-width with 44px touch targets. The selects inherit the
     .role-select 44px rule above; the search input needs its own. */
  .admin-content .users-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .admin-content .users-toolbar label {
    width: 100%;
  }

  .admin-content .users-search-input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px;   /* iOS zoom guard */
    border-radius: 10px;
    box-sizing: border-box;
  }

  .admin-content .users-count {
    margin-left: 0;
    align-self: flex-start;
  }

  /* Role pills — give them generous spacing so multi-pill cells
     wrap rather than overflow. */
  .admin-content .role-pill {
    display: inline-block;
    margin: 2px 4px 2px 0;
    white-space: nowrap;
  }

  .admin-content .entity-pill {
    display: inline-block;
    margin: 2px 4px 2px 0;
    white-space: normal;
  }
}


/* ─────────────────────────────────────────────────────────────
   SESSIONS TAB — Revoke button full-width
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .admin-content .data-table tr[data-session-id] {
    /* A bit more breathing room for sessions because the user
       agent string can be long. */
    padding: 14px;
  }

  .admin-content .data-table td.admin-row-actions {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--rule, #eee);
  }

  .admin-content .revoke-session-btn {
    display: block;
    width: 100%;
    min-height: 44px;
    text-align: center;
    background: rgba(204, 0, 0, 0.06);
    border: 1px solid rgba(204, 0, 0, 0.18);
    color: var(--heritage-red);
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 600;
  }
}


/* ─────────────────────────────────────────────────────────────
   MODULE ACCESS TAB — Visibility summary + per-user overrides
   ─────────────────────────────────────────────────────────────
   The visibility summary table already converts via the universal
   card-stack treatment above. The per-user grant/revoke/clear
   button row needs to be a 2-up (or 3-up when clear is present)
   grid that gives 44px touch targets. */

@media (max-width: 640px) {
  /* User selector for per-user overrides — full width */
  #module-user-select.role-select {
    max-width: 100% !important;
    width: 100% !important;
  }

  .admin-content .admin-override-cell {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--rule, #eee);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .admin-content .admin-override-cell .btn {
    flex: 1 1 calc(50% - 4px);
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.88rem;
    text-align: center;
  }

  /* Grant: green-ish hint, Revoke: red-ish hint, Clear: neutral. */
  .admin-content .admin-override-cell .grant-btn:not(:disabled) {
    background: rgba(0, 128, 0, 0.06);
    border-color: rgba(0, 128, 0, 0.18);
    color: #0a6f0a;
  }
  .admin-content .admin-override-cell .revoke-btn:not(:disabled) {
    background: rgba(204, 0, 0, 0.06);
    border-color: rgba(204, 0, 0, 0.18);
    color: var(--heritage-red);
  }
}


/* ─────────────────────────────────────────────────────────────
   ACTIVITY FEED TAB — timestamp wrap, entity pill wrap
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  /* Activity table already cards via the universal treatment.
     Just ensure long entity IDs wrap. */
  .admin-content .data-table td[data-label="Entity"] {
    word-break: break-all;
    overflow-wrap: anywhere;
  }

  .admin-content .data-table td[data-label="Action"] code {
    word-break: break-all;
    overflow-wrap: anywhere;
    display: inline-block;
    max-width: 100%;
    white-space: normal;
  }
}


/* ─────────────────────────────────────────────────────────────
   NAV CONFIG TAB — 1.4fr 1fr → stack on mobile
   ─────────────────────────────────────────────────────────────
   The renderNavConfig template sets inline `grid-template-columns:
   1.4fr 1fr`. That ratio is unworkable below ~860px. Override the
   inline styles by selector specificity + !important. */

@media (max-width: 880px) {
  .admin-content .nav-config-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .admin-content .nav-config-modules-card,
  .admin-content .nav-config-presets-card {
    padding: 14px !important;
  }
}

@media (max-width: 640px) {
  /* Module list rows — each row sets inline styles for the row
     container. We override targeted properties via specificity
     without !important where possible. */
  .admin-content .nav-module-row {
    /* The inline style includes display:flex, gap:10px, padding:
       10px 12px. We need bigger padding for touch + room for the
       drag handle + toggle button. */
    padding: 12px 14px !important;
    gap: 12px !important;
    flex-wrap: wrap;
  }

  /* Drag handle: 44x44 touch target so phone users can actually
     grab it. Visual stays small via the inline glyph. */
  .admin-content .nav-module-row .drag-handle {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px !important;
    /* Subtle bg so users see a hit area */
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    /* Slight nudge negative-margin so layout doesn't grow much */
    margin-left: -4px;
  }

  /* The icon col next to the handle — keep visible */
  .admin-content .nav-module-row > span:nth-child(2) {
    font-size: 22px !important;
  }

  /* Name + meta column flex:1 — make sure it wraps long names */
  .admin-content .nav-module-row > div {
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
  }

  /* Hide the "pos N" label on narrow phones — drag handle implies order */
  .admin-content .nav-module-row > span[class="text-mute"] {
    display: none;
  }

  /* Toggle button (show/hide) — full-width row below the meta */
  .admin-content .nav-module-row .nav-toggle-btn {
    flex: 1 1 100%;
    min-height: 44px;
    min-width: 0 !important;
    margin-top: 4px;
    padding: 10px 12px;
    font-size: 0.88rem;
    border-radius: 10px;
    order: 99;   /* pin to end of flex */
  }

  /* Preset rows — apply button gets full prominence, delete
     stays a compact destructive corner button. */
  .admin-content #nav-preset-list .preset-row {
    flex-wrap: wrap;
    padding: 12px !important;
    gap: 10px !important;
  }

  .admin-content #nav-preset-list .preset-row > div:first-child {
    flex: 1 1 100%;
  }

  .admin-content #nav-preset-list .preset-apply-btn {
    flex: 1 1 auto;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.9rem;
    border-radius: 10px;
  }

  .admin-content #nav-preset-list .preset-delete-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 1.2rem;
    line-height: 1;
  }

  /* "Save current as preset" form — full-width inputs already
     via inline style, just bump heights for touch. */
  .admin-content #nav-preset-name,
  .admin-content #nav-preset-desc {
    min-height: 44px;
    padding: 10px 12px !important;
    font-size: 16px !important;   /* iOS zoom guard */
    border-radius: 10px;
  }

  .admin-content #nav-preset-save {
    min-height: 44px;
    padding: 12px 14px !important;
    font-size: 0.95rem;
    border-radius: 10px;
  }
}


/* ─────────────────────────────────────────────────────────────
   ADMIN — disable drag-to-reorder hint on touch
   ─────────────────────────────────────────────────────────────
   Native HTML5 drag-and-drop doesn't work on iOS Safari without
   a polyfill. The drag handle still works as a visual marker but
   shouldn't promise a behavior the touch user can't trigger.
   For now we soften the hover state and tell the user via title
   attribute (handled in JS) — no behavior change here, just a
   visual cue. */

@media (hover: none) and (pointer: coarse) {
  .admin-content .nav-module-row {
    cursor: default !important;
  }
  .admin-content .nav-module-row .drag-handle {
    cursor: default !important;
    /* Slightly dimmer to suggest "not interactive on touch" */
    opacity: 0.75;
  }
  .admin-content .admin-tab:hover {
    background: rgba(0, 0, 0, 0.025);
    color: var(--ink-soft);
  }
  .admin-content .admin-tab.active:hover {
    background: linear-gradient(135deg, var(--heritage-red), var(--heritage-red-dark));
    color: white;
  }
}


/* ════════════════════════════════════════════════════════════════
   MARKETING PIPELINE (.mp-*) — mobile responsive
   (Grok 4.5 audit fix 2026-07-08)
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 600px) {
  .mp-toolbar {
    flex-direction: column;
    gap: 8px;
  }
  .mp-toolbar .btn {
    width: 100%;
    min-height: 44px;
  }
  .mp-form-grid {
    grid-template-columns: 1fr;
  }
  .mp-run-head-card {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .mp-run-head {
    flex-direction: column;
    align-items: stretch;
  }
  .mp-stage-card {
    padding: 12px;
  }
  .mp-stage-panel {
    padding: 12px;
  }
  .mp-detail {
    padding: 12px;
  }
  .mp-run-row {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  .mp-run-meta {
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
  }
  .mp-run-title {
    font-size: 1rem;
  }
  .mp-funnel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mp-concept-picker {
    flex-direction: column;
  }
  .mp-concept-option {
    width: 100%;
    min-height: 44px;
  }
  .mp-s5-grid {
    grid-template-columns: 1fr;
  }
  .mp-s5-card {
    min-height: auto;
  }
  .mp-gate-actions {
    flex-direction: column;
  }
  .mp-gate-actions .btn {
    width: 100%;
    min-height: 44px;
  }
  .mp-s3-heatmap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mp-s3-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mp-s3-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mp-s6-bench-grid { grid-template-columns: 1fr; }
  .mp-s7-scores { flex-direction: column; }
  .mp-launch-actions {
    flex-direction: column;
    gap: 8px;
  }
  .mp-launch-actions .btn {
    width: 100%;
    min-height: 44px;
  }
  .mp-panel-actions {
    flex-direction: column;
    gap: 8px;
  }
  .mp-panel-actions .btn {
    width: 100%;
    min-height: 44px;
  }
}

/* ════════════════════════════════════════════════════════════════
   MI COMPETITORS (.mi-cmp-*) — mobile responsive
   (Grok 4.5 audit fix 2026-07-08)
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 600px) {
  .mi-cmp-toolbar {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  .mi-cmp-toolbar .form-select,
  .mi-cmp-toolbar .form-input,
  .mi-cmp-toolbar .btn {
    width: 100%;
    min-height: 44px;
  }
  .mi-cmp-search {
    width: 100%;
  }
  .mi-cmp-card {
    padding: 12px;
  }
  .mi-cmp-card-head {
    flex-direction: column;
    gap: 8px;
  }
  .mi-cmp-badge-row {
    flex-wrap: wrap;
    gap: 4px;
  }
  .mi-cmp-dossier {
    padding: 16px;
  }
  .mi-cmp-dossier-head {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  .mi-cmp-block {
    padding: 12px;
  }
  .mi-cmp-compare-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mi-cmp-compare-bar {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    text-align: center;
  }
  .mi-cmp-compare-bar .btn {
    width: 100%;
    min-height: 44px;
  }
  .mi-cmp-stat-card {
    min-width: 0;
    flex: 1 1 100%;
  }
}

/* ════════════════════════════════════════════════════════════════
   MARKET RESEARCH (.mr-*) — mobile responsive
   (Grok 4.5 audit fix 2026-07-08; density polish 2026-07-11)
   Single source of truth for MR mobile — keep out of 42-*.css.
   Breakpoint 640 to match Market Monitor density pass.
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  /* Tabs: horizontal scroll, no wrap, no scrollbar chrome */
  .mr-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
    margin-bottom: 8px;
  }
  .mr-tabs::-webkit-scrollbar { display: none; }
  .mr-tab {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Content spacing under tabs */
  #mr-content { margin-top: 10px !important; }
  .mr-intro { margin: 0 0 10px; font-size: 0.88rem; }

  /* Launch bar: label above select, tight stack */
  .mr-launch-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-bottom: 10px;
  }
  .mr-launch-bar .mr-region-label { margin: 0; }
  .mr-region-select,
  .filter-select.mr-region-select {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    height: 40px;
  }

  /* Watchlist chips: horizontal scroll row, not wrap tower */
  .mr-watchlist {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    gap: 6px;
    margin: 4px 0 10px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .mr-watchlist::-webkit-scrollbar { display: none; }
  .mr-watch-chip {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 4px 10px;
    white-space: nowrap;
  }

  /* Template / competitor grids */
  .mr-card-grid,
  .mr-ci-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .mr-tpl-card,
  .mr-comp-card,
  .mr-job-card {
    padding: 12px;
  }
  .mr-comp-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .mr-comp-actions {
    width: 100%;
    justify-content: stretch;
  }
  .mr-comp-actions .btn {
    width: 100%;
    min-height: 40px;
  }

  /* Launch form */
  .mr-launch-form {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  .mr-launch-form .form-select,
  .mr-launch-form .form-input,
  .mr-launch-form .mr-topic {
    width: 100%;
    min-height: 40px;
  }
  .mr-posture-option {
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 8px 0;
  }
  .mr-launch-actions {
    flex-direction: column;
    gap: 8px;
  }
  .mr-launch-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  /* Library filter toolbar — dense stacked fields, no excess air */
  .mr-lib-toolbar.toolbar,
  .mr-lib-toolbar {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 8px !important;
    margin: 0 0 8px;
  }
  .mr-lib-filter {
    flex: 0 0 auto;
    width: 100%;
    gap: 3px;
  }
  .mr-lib-filter .filter-select,
  .mr-lib-filter .mr-region-select {
    width: 100%;
    min-height: 40px;
    height: 40px;
  }
  .mr-lib-list { margin-top: 2px; }

  /* Library rows: stack content → actions full-width */
  .mr-lib-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }
  .mr-lib-topic {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .mr-lib-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  .mr-lib-actions .btn {
    flex: 1 1 auto;
    min-height: 40px;
  }
  .mr-lib-actions .mr-view-run {
    margin-left: 0;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }
  .mr-lib-badges .mr-badge,
  .mr-lib-main .mr-badge {
    align-self: flex-start;
  }

  /* Report modal */
  .mr-report-actions {
    justify-content: stretch;
  }
  .mr-report-actions .btn,
  .mr-report-actions a.btn {
    width: 100%;
    min-height: 40px;
    text-align: center;
  }
  .mr-report-md table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.82rem;
  }
  .mr-report-md th,
  .mr-report-md td {
    padding: 5px 8px;
  }
}
/* ============================================================
   98-mcn-toolbar-layout.css
   Redemption > Manual credit notes: toolbar wrap (layout only).
   ============================================================

   Bug (visual sweep 2026-10-25, es desktop 1440 + tablet 1280):
   `.rdm-toolbar` is a right-aligned flex row (justify-content: flex-end) with
   no wrap. The manual credit notes toolbar holds up to six items (New note,
   Import Excel, template link, customer import, customer template link, status
   filter). In Spanish they are wider than the pane, and a flex-end row that
   cannot wrap overflows to the LEFT. The primary "Nueva nota de crédito"
   button was pushed under the sidebar on desktop and cut at the screen edge
   on tablet, so it could not be seen or clicked.

   Fix: let this one toolbar wrap. Items that do not fit move to a second
   line, still right-aligned, so nothing leaves the pane in any locale.
   Scoped by id to the manual credit notes toolbar only; the Cases toolbar
   (#rdm-toolbar, two buttons) is not changed. Phones at <=390px keep the
   existing stacked column from 44-redemption.css.

   Layout only. No markup, no script, no money logic. Kept out of
   44-redemption.css because that file is on the money-path exclusion list. */

#rdm-mcn-toolbar {
  flex-wrap: wrap;
}
/* Explicit intake: bounded dialog, independently scrolling review, persistent actions. */
.intake-review { box-sizing: border-box; width: min(980px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; border: 1px solid var(--rule); border-radius: 18px; background: var(--warm-white); color: var(--ink); box-shadow: 0 24px 80px #0004; }
.intake-review::backdrop { background: #211b2480; }
.intake-form { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); min-width: 0; margin: 0; }
.intake-form h2, .intake-form h3, .intake-form p { margin: 0; overflow-wrap: anywhere; }
.intake-header { flex: none; padding: 22px 28px 18px; border-bottom: 1px solid var(--rule); }
.intake-header h2 { font-size: 1.5rem; line-height: 1.25; }
.intake-header h2:focus { outline: none; }
.intake-person { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px !important; font-size: .9rem; }
.intake-person span { color: var(--ink-mute); }
.intake-body { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.4fr); gap: 28px; padding: 24px 28px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; scrollbar-gutter: stable; }
.intake-evidence { display: grid; align-content: start; gap: 14px; font-size: .875rem; line-height: 1.5; }
.intake-evidence h3 { font-size: 1rem; color: var(--heritage-purple); }
.intake-facts { display: grid; gap: 12px; margin: 0; }
.intake-facts dt { font-size: .75rem; color: var(--ink-mute); margin-bottom: 3px; }
.intake-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.intake-notice { padding: 12px 14px; border-left: 3px solid var(--heritage-gold); border-radius: 0 8px 8px 0; background: var(--paper); }
.intake-use-suggestion { justify-self: start; }
.intake-choices { display: grid; gap: 12px; min-width: 0; }
.intake-form label { display: flex; align-items: center; gap: 10px; }
.intake-form select { box-sizing: border-box; max-width: 100%; min-width: 0; min-height: 44px; font: inherit; background: var(--warm-white); color: var(--ink); }
.intake-field { display: grid !important; gap: 6px !important; font-weight: 600; font-size: .875rem; }
.intake-field select { width: 100%; font-weight: 400; }
.intake-help { color: var(--ink-mute); font-size: .825rem; line-height: 1.5; }
.intake-form fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.intake-form legend { font-weight: 600; font-size: .875rem; padding: 0 0 8px; }
.intake-floor { display: grid; grid-template-columns: minmax(0,1fr) minmax(130px,.85fr); gap: 12px; align-items: center; margin-bottom: 6px; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 10px; }
.intake-floor:has(.intake-floor-toggle:checked) { border-color: var(--heritage-purple); background: var(--paper); box-shadow: inset 3px 0 var(--heritage-purple); }
.intake-floor-name { min-height: 44px; font-weight: 600; font-size: .875rem; cursor: pointer; overflow-wrap: anywhere; }
.intake-form input[type=checkbox] { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: var(--heritage-purple); }
.intake-floor-role { display: grid !important; gap: 3px !important; font-size: .72rem; color: var(--ink-mute); }
.intake-floor-role select { width: 100%; font-size: .825rem; }
.intake-floor-role select:disabled { opacity: .6; }
.intake-verify { padding: 14px; background: var(--paper); border-radius: 10px; align-items: flex-start !important; font-size: .875rem; line-height: 1.5; cursor: pointer; }
.intake-verify input { margin-top: 2px !important; }
.intake-footer { flex: none; padding: 14px 28px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); background: var(--warm-white); }
.intake-actions { display: flex; justify-content: flex-end; gap: 10px; }
.intake-form .btn { min-height: 44px; white-space: normal; }
.intake-error { color: var(--heritage-red); font-size: .875rem; }
.intake-error:not(:empty) { padding-bottom: 12px; }
.intake-form :is(input, select, button):focus-visible { outline: 3px solid var(--heritage-purple); outline-offset: 3px; }
/* The pending queue must not pin a large table over the controls below it. */
#admission-queue { padding: 20px; margin-bottom: 16px; overflow-x: auto; }
#admission-queue h3 { margin: 0 0 14px; }
#admission-queue td { overflow-wrap: break-word; }
#admission-queue .admission-actions { min-width: 180px; }
#admission-queue [data-admission] { min-height: 44px; margin: 3px 4px 3px 0; }
#admission-queue [data-admission=approve] { background: var(--heritage-red); color: white; border: 1px solid var(--heritage-red); }
#admission-queue [data-admission=deny] { background: transparent; border: 1px solid var(--rule); color: var(--ink-mute); }
@media (max-width: 700px) {
  .intake-review { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 14px; }
  .intake-form { max-height: calc(100dvh - 18px); }
  .intake-header { padding: 16px; }
  .intake-header h2 { font-size: 1.2rem; }
  .intake-person { display: grid; gap: 2px; }
  .intake-body { grid-template-columns: minmax(0,1fr); gap: 24px; padding: 18px 16px; }
  .intake-evidence { gap: 10px; }
  .intake-facts { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .intake-floor { grid-template-columns: minmax(0,1fr) minmax(120px,.85fr); gap: 8px; padding: 8px 10px; }
  .intake-form select { font-size: 16px; }
  .intake-footer { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
  .intake-actions .intake-submit { flex: 1; }
  #admin-content .users-toolbar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  #admin-content .users-toolbar label { min-width: 0; }
  #admin-content .users-toolbar .users-search-label, #admin-content .users-neverlogin-toggle, #admin-content .users-count { grid-column: 1 / -1; }
  #admin-content .users-toolbar :is(select,input[type=search]) { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }
}

@media (min-width: 701px) { .intake-floor-role { display: flex !important; flex-direction: column; align-items: stretch; } }

/* Map legacy brand tokens locally; global dark mode leaves warm-white unchanged. */
[data-theme="dark"] .intake-review, [data-theme="dark"] #admission-queue {
  --warm-white: #1e2130; --paper: #292c3e; --ink: #f1f2f6; --ink-mute: #bec3d1;
  --rule: #565c73; --heritage-purple: #c7a4ee;
}
[data-theme="dark"] .intake-review .btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--rule); }
[data-theme="dark"] .intake-review .intake-error { color: #ffaaaa; }
[data-theme="dark"] .intake-floor-role select:disabled { opacity: 1; color: var(--ink-mute); background: #242736; }

/* Tablets use the same readable cards as phones; keep the dialog breakpoint independent. */
@media (max-width: 900px) {
  #admission-queue { padding: 14px; }
  #admission-queue table, #admission-queue tbody { display: block; width: 100%; min-width: 0; }
  #admission-queue thead { display: none; }
  #admission-queue tr { display: block; border: 1px solid var(--rule); border-radius: 10px; padding: 12px; margin-bottom: 12px; background: var(--warm-white); }
  #admission-queue td { display: block; border: 0; padding: 5px 0; width: auto; min-width: 0; white-space: normal; text-align: left; }
  #admission-queue td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--ink-mute); font-weight: 600; }
  #admission-queue .admission-actions { display: flex; gap: 8px; padding-top: 10px; }
  #admission-queue .admission-actions button { margin: 0; flex: 1; }
}
/* ============================================================
   99-overrides.css
   Safe-area insets, mobile overrides, print styles, !important rules
   Generated by scripts/split-css.py — DO NOT EDIT main.css directly.
   ============================================================ */

/* ═══════════════════════════════════════════════════════════════
   Print: hide PWA chrome
   ═══════════════════════════════════════════════════════════════ */

@media print {
  .sidebar,
  .topbar,
  .sidebar-scrim,
  .pwa-update-bar,
  .pwa-update-block,
  .app-footer { display: none !important; }
  .main { display: block; }
  .content { padding: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   Dark-mode text contrast fix (2026-06-17)
   Root cause: 96-polish-v4.css :root unconditionally maps the
   semantic text vars (--text, --text-mute, --text-secondary,
   --text-primary) to the LIGHT --ink tokens. Since it loads after
   90-dark-mode.css, dark mode rendered dark-on-dark text.
   Fix: re-point those semantic vars (and the base --ink* tokens
   that many components read directly) to light values whenever
   [data-theme="dark"] is active. This file loads LAST so it wins.
   ═══════════════════════════════════════════════════════════════ */

[data-theme="dark"] {
  /* Semantic text vars — light on dark, WCAG AA on the dark surfaces */
  --text:            #E8EAED;
  --text-primary:    #F3F4F6;
  --text-secondary:  #C2C7D0;
  --text-mute:       #9AA0AC;

  /* Base ink tokens — many components reference these directly */
  --ink-strong:      #F3F4F6;
  --ink:             #E8EAED;
  --ink-soft:        #C2C7D0;
  --ink-mute:        #9AA0AC;
  --ink-faint:       #6B7180;

  /* Rules/dividers need to be visible on dark, not warm-light */
  --rule:            #2D3044;
  --rule-soft:       #262838;
}

/* Body text + base color follow the token in dark mode */
[data-theme="dark"] body,
[data-theme="dark"] {
  color: var(--ink);
}

/* ── Market Monitor: Data Management status panel (2026-06-17) ── */
.mm-data-status { margin-top: 12px; }
.mm-data-status-head { display:flex; align-items:baseline; justify-content:space-between; gap:8px; margin-bottom:6px; }
.mm-data-status-title { font-weight:600; font-size:13px; }
.mm-data-status-last { font-size:12px; }
.mm-data-markets { display:flex; flex-direction:column; gap:2px; margin:4px 0 8px; }
.mm-data-market-row { display:grid; grid-template-columns: 1fr auto auto; gap:10px; font-size:12px; padding:2px 0; border-bottom:1px solid var(--rule-soft, #efe5d2); }
.mm-data-snap { margin-top:6px; }
.mm-data-snap-title { font-size:11px; text-transform:uppercase; letter-spacing:0.04em; margin-bottom:4px; }
.mm-data-snap-row { display:grid; grid-template-columns: 1fr auto auto; gap:10px; font-size:12px; padding:2px 0; }
.mm-data-snap-prod { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:280px; }
.mm-data-snap-price { font-variant-numeric: tabular-nums; }
[data-theme="dark"] .mm-data-market-row { border-bottom-color: var(--rule-soft, #262838); }

/* ── Admin user-profile dropdown z-index fix (2026-06-17) ──
   Bug: tapping the avatar on the Admin page opened the profile dropdown
   BEHIND the mobile tab rail. Root cause: .topbar and .admin-sidebar (mobile
   horizontal tab rail) were BOTH position:sticky z-index:5. On a z-index tie,
   later-in-DOM wins → the admin rail painted over the topbar's dropdown.
   Fix: lift the topbar (and thus its .user-dropdown) above the admin rail. */
.topbar { z-index: 60; }
.user-dropdown { z-index: 1000; }

/* ── Mobile nav drawer above topbar (fix for the 6/17 z-index side-effect) ──
   The 2026-06-17 profile-dropdown fix above set `.topbar { z-index: 60 }` to
   beat the admin tab rail. But that ALSO lifted the sticky topbar above the
   mobile nav DRAWER (.sidebar @ z-index 20 ≤980px) — so when the hamburger
   drawer opened, the translucent topbar header painted OVER the drawer's
   brand/logo area (Kevin screenshot 6/17 "header overlaps the brand area").
   The drawer is a full-height overlay; when OPEN it must sit above the topbar
   AND its scrim must cover the header too. Scoped to mobile only — desktop
   sticky-topbar + dropdown behavior (the original fix) is untouched. */
/* Match the canonical NAV DRAWER breakpoint in 25-plan.css. */
@media (max-width: 1280px) {
  .sidebar.open      { z-index: 70; }  /* above topbar (60) */
  .sidebar-scrim     { z-index: 65; }  /* over the header, under the drawer */
}

/* ── AI Workspace takeover above the topbar (fix for the same 6/17 z-index side-effect) ──
   .ws-root is a position:fixed;inset:0 full-screen takeover meant to cover the
   ENTIRE shell (it hides the sidebar; Back is the only way out). It was z-index:50,
   which beat the OLD topbar (z5). But the 2026-06-17 profile-dropdown fix raised
   .topbar to z-index:60 — so the shell topbar now paints OVER the workspace,
   overlapping the Back button at the top-left of .ws-topbar (Kevin 6/18, desktop).
   Lift the takeover above the topbar (60) and mobile drawer (70), still below the
   Ask AIOP drawer (9000/9001) + toasts (9100). */
.ws-root { z-index: 80; }


/* ═══════════════════════════════════════════════════════════════
   PWA portrait chrome composite (2026-07-25)
   Kevin: on mobile PWA portrait, topbar/nav vanish after SPA nav to
   AI Hub / AI Excellence / Team but STILL RECEIVE TOUCH; landscape OK;
   scroll or rotate restores paint.

   HARD RULE (learned the hard way):
   NEVER put transform / will-change:transform / translateZ on
   .topbar OR any ancestor (.app-shell, .main). On iOS WebKit a
   transform creates a containing block and BREAKS position:sticky
   — chrome stays in the hit-test tree (touch works) but stops
   painting at the viewport edge until scroll forces a recomposite.
   Symptom match: "visible for a split second, then gone until scroll."

   Safe paint-only mitigations only:
   - kill body background-attachment:fixed
   - kill topbar/scrim backdrop-filter (expensive ghost layer)
   - opaque topbar fill
   No layout/position gambles (0f7de65 fixed-topbar was reverted).
   This file loads LAST so rules win without fighting 03-shell/25-plan.
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 980px) and (orientation: portrait) {
  /* background-attachment:fixed on body is a known iOS sticky killer */
  body {
    background-attachment: scroll !important;
  }
  .topbar {
    /* Drop expensive blur layer that often ghosts sticky chrome on iOS PWA */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    /* Opaque fill so content never shows "through" a missing blur layer */
    background: var(--eggshell-bright, #fffdf8) !important;
    /* Explicitly clear any leftover layer hacks from earlier experiments */
    -webkit-transform: none !important;
    transform: none !important;
    will-change: auto !important;
    -webkit-backface-visibility: visible !important;
    backface-visibility: visible !important;
  }
  /* Scrim blur is also a composite cost on open drawer; solid is fine */
  .sidebar-scrim {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

