/* ── Fonts ───────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Open Sans';
  src: url('fonts/OpenSans-VariableFont_wdth_wght.woff2') format('woff2'),
       url('fonts/OpenSans-VariableFont_wdth_wght.ttf') format('truetype');
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('fonts/OpenSans-Italic-VariableFont_wdth_wght.woff2') format('woff2'),
       url('fonts/OpenSans-Italic-VariableFont_wdth_wght.ttf') format('truetype');
  font-weight: 300 800;
  font-style: italic;
  font-display: swap;
}

/* ── Brand Tokens ──────────────────────────────────────────────────────────────
   The :root custom-property block has been moved into AppThemeProvider.tsx
   (src/react/AppThemeProvider.tsx) as a MUI GlobalStyles injection derived
   directly from src/react/theme.ts (BRAND_COLORS, STAGE_COLORS, RADIUS).
   GlobalStyles targets the document <head> (not scoped), so the same CSS
   custom properties remain available to every non-React page that uses
   var(--orchid), var(--paper), var(--stage-sales-bg), etc.

   To change a token: edit src/react/theme.ts and/or the rootTokens map in
   AppThemeProvider.tsx — no manual sync needed here any more.
─────────────────────────────────────────────────────────────────────────── */

/* ── Mono font custom property (fallback; canonical value comes from tokens.css) */
/* ── Animation timing tokens ─────────────────────────────────────────────────
   Centralised duration tokens — change here to update every transition and
   animation in this file.  The JS counterparts live in src/react/timings.ts.
   The prefers-reduced-motion block below overrides these via the blanket *
   selector so no per-rule duplicate is needed. */
:root {
  --font-mono: 'Source Code Pro', ui-monospace, Consolas, monospace;

  --mo-transition-snap:           0.1s;   /* near-instant: quick bg flashes   */
  --mo-transition-fast:           0.15s;  /* standard hover / interactive      */
  --mo-transition-medium:         0.2s;   /* slightly longer state changes     */
  --mo-transition-slow:           0.25s;  /* panel slide / large-area motion   */
  --mo-skeleton-shimmer-duration: 1.4s;   /* skeleton-shimmer loop             */
}

/* ── Global monospace elements ───────────────────────────────────────────────── */
code, pre, kbd { font-family: var(--font-mono); }

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* The AppBar inside #app-header-mount is position:fixed (out of flow), leaving
   the mount div at 0 height. overflow:hidden prevents margin-collapse between
   it and adjacent content blocks. */
#app-header-mount { height: 0; overflow: hidden; }

/* ── Global utility ──────────────────────────────────────────────────────────── */
/* Mirrors Tailwind's .hidden so non-Tailwind pages (e.g. admin.html) honour it. */
.hidden { display: none; }

body {
  margin: 0;
  font-family: 'Open Sans', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink-1);
  overscroll-behavior: none;
  padding-top: var(--header-h);
  padding-bottom: var(--nav-h);
}
body.has-viewer-banner { padding-top: calc(var(--header-h) + var(--banner-h)); }

/* ── Viewer read-only banner ─────────────────────────────────────────────────── */
.viewer-banner {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  z-index: var(--z-nav);
  background: var(--status-warning-soft-bg);
  border-bottom: 1px solid var(--status-warning-active-bg);
  color: var(--status-warning-text);
  padding: 7px 12px 7px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
}
.viewer-banner span { flex: 1; }
.viewer-banner-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--status-warning-text);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--mo-transition-fast), background var(--mo-transition-fast);
}
.viewer-banner-close:hover { opacity: 1; background: rgba(0,0,0,0.06); }

/* ── Tab layout (all tabs now account for bottom nav) ────────────────────────── */
.app-body {
  display: flex;
  position: fixed;
  top: var(--header-h);
  bottom: var(--nav-h);
  left: 0; right: 0;
}
body.has-viewer-banner .app-body { top: calc(var(--header-h) + var(--banner-h)); }
.app-body.hidden { display: none; }

/* ── List Panel ──────────────────────────────────────────────────────────────── */
.list-panel {
  width: 100%;
  background: var(--paper);
  border-right: 1px solid var(--stone);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform var(--mo-transition-slow) ease, opacity var(--mo-transition-medium) ease;
  -webkit-overflow-scrolling: touch;
}

/* Standalone workflow panel — used on the customer detail page */
.workflow-panel-detail {
  display: flex !important;
  flex: 1;
}

/* ── Workflow Panel ──────────────────────────────────────────────────────────── */
.workflow-panel {
  flex: 1;
  background: var(--paper);
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}


@media (min-width: 768px) {

  .list-panel    { display: flex !important; width: 17rem; }
  .workflow-panel { display: flex !important; }

}


/* ── Back button (mobile) ────────────────────────────────────────────────────── */
.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--orchid);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 14px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--stone);
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  text-align: left;
  flex-shrink: 0;
}
.back-btn:active { background: var(--paper-deep); }

@media (min-width: 768px) {

  .back-btn { display: none !important; }

}


/* ── Scrollbars ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--stone); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--stone-deep); }

/* ── Admin Lead Statuses table — Stage select coloured left border ───────────
   data-stage is set by JS on render and oninput so CSS always reflects current
   value without a full re-render.
─────────────────────────────────────────────────────────────────────────────── */
.ls-stage-select { border-left: 3px solid transparent; transition: border-color var(--mo-transition-fast); }
.ls-stage-select[data-stage="SALES"]            { border-left-color: var(--stage-sales-bg); }
.ls-stage-select[data-stage="DESIGN_VISIT"]     { border-left-color: var(--stage-designvisit-bg); }
.ls-stage-select[data-stage="SURVEY"]           { border-left-color: var(--stage-survey-bg); }
.ls-stage-select[data-stage="ORDER"]            { border-left-color: var(--stage-order-bg); }
.ls-stage-select[data-stage="WORKSHOP"]         { border-left-color: var(--stage-workshop-bg); }
.ls-stage-select[data-stage="PACKING"]          { border-left-color: var(--stage-packing-bg); }
.ls-stage-select[data-stage="DELIVERY"]         { border-left-color: var(--stage-delivery-bg); }
.ls-stage-select[data-stage="INSTALLATION"]     { border-left-color: var(--stage-installation-bg); }
.ls-stage-select[data-stage="AFTERCARE"]        { border-left-color: var(--stage-aftercare-bg); }
.ls-stage-select[data-stage="CUSTOMER_SERVICE"] { border-left-color: var(--stage-customerservice-bg); }


/* ── Offline sync pill spinner ───────────────────────────────────────────────── */
@keyframes dv-sync-spin {
  to { transform: rotate(360deg); }
}

/* ── Customer List Skeleton ──────────────────────────────────────────────────── */
@keyframes skeleton-shimmer {

  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }

}

.skeleton-line {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--stone-light) 25%, var(--paper) 50%, var(--stone-light) 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer var(--mo-skeleton-shimmer-duration) ease-in-out infinite;
}
.skeleton-pill {
  height: 11px;
  width: 64px;
  border-radius: var(--radius-pill);
}
/* ── Stage Cards ─────────────────────────────────────────────────────────────── */

/* ── Notes / Comments ───────────────────────────────────────────────────────── */
.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.notes-header-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}


.comment-input-area { margin-bottom: 10px; }


.btn-save-note {
  background: var(--orchid);
  color: #fff; /* hex-color-ok: plain white text on orchid button */
  font-size: .88rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 16px;
  cursor: pointer;
}
.btn-save-note:hover { opacity: 0.88; }
.btn-cancel-note {
  background: none;
  color: var(--ink-3);
  font-size: .88rem;
  border: none;
  cursor: pointer;
  padding: 8px 16px;
}
.btn-cancel-note:hover { color: var(--ink-1); }
.comment-item {
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: var(--radius-lg);
  padding: 11px 14px;
  box-shadow: var(--shadow-sm);
}
.comment-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}

.comment-meta-sep {
  font-size: 0.65rem;
  color: var(--ink-4);
}
.comment-date {
  font-size: 0.68rem;
  color: var(--ink-4);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.comment-text {
  font-size: 0.875rem;
  color: var(--ink-2);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 20px;
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  font-weight: 600;
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-lg);
  animation: slideUp var(--mo-transition-medium) ease;
  white-space: nowrap;
}
.toast-error   { background: var(--status-error-bg); color: var(--status-error-text); border: 1px solid #fca5a5; } /* hex-color-ok: red-300 border; no exact token */
.toast-success { background: var(--status-success-deep-bg); color: var(--status-success-deep-text); border: 1px solid #6ee7b7; } /* hex-color-ok: emerald-300 border; no exact token */
@keyframes slideUp {

  from { transform: translateX(-50%) translateY(8px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);   opacity: 1; }

}


/* ── Utility ─────────────────────────────────────────────────────────────────── */


.workflow-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
}

@media (min-width: 640px) {

  .workflow-inner { padding: 20px 24px 40px; }

}


/* ── Home Tab ────────────────────────────────────────────────────────────────── */
/* The home page is fully migrated to React MUI — see
   src/react/pages/HomePage.tsx (mount id "home-view", home.js is a no-op).
   The .home-tab wrapper div in index.html still provides fixed positioning
   for the React mount; all .home-inner / .home-date-* / .home-section-* /
   .home-card-* / .home-badge-* / .home-empty / .home-more rules were
   removed once the React island took ownership of all home UI. */
.home-tab {
  position: fixed;
  top: var(--header-h);
  bottom: var(--nav-h);
  left: 0; right: 0;
  overflow-y: auto;
  background: var(--paper);
  -webkit-overflow-scrolling: touch;
}
.home-tab.hidden { display: none; }

.customer-num-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--orchid-deep);
  background: var(--orchid-tint);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Sub-status affordance shown next to the lead-status pill */

.lead-substatus-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--paper-deep);
  color: var(--ink-2);
  border: 1px solid var(--stone);
  line-height: 1.4;
}
.lead-substatus-chip.lsb-clickable        { cursor: pointer; }
.lead-substatus-chip.lsb-clickable:hover  { filter: brightness(0.95); }
.lead-substatus-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 999px;
  border: 1px dashed var(--stone);
  background: none;
  color: var(--ink-4);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}
.lead-substatus-add:hover { background: var(--paper-deep); color: var(--ink-2); }

/* ── Customer-detail invoice row hover ─────────────────────────────────────── */
.inv-row:hover { background: var(--paper-deep); }

/* ── Customer-detail invoice skeleton rows ─────────────────────────────────── */
.inv-skeleton-pulse {
  background: linear-gradient(90deg, var(--stone-light) 25%, var(--paper) 50%, var(--stone-light) 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer var(--mo-skeleton-shimmer-duration) ease-in-out infinite;
}

/* ── Task section button hover/active states ───────────────────────────────── */
#add-task-btn:hover { background: var(--orchid-tint); }
.task-save-btn:hover:not(:disabled) { filter: brightness(0.92); }
.task-save-btn:active:not(:disabled) { filter: brightness(0.85); }

/* Inputs ─────────────────────────────────────────────────────────────────── */
input[type="text"],
input[type="date"],
select,
textarea {
  font-family: 'Open Sans', system-ui, sans-serif;
  color: var(--ink-1);
  background: var(--paper);
  border-color: var(--stone);
  border-radius: var(--radius-md);
}
input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--orchid-soft);
  background: #fff; /* hex-color-ok: plain white for focused input */
  box-shadow: 0 0 0 3px rgba(139,43,255,0.10);
}

/* Transparent overlay used by TokenHighlightField.
   Hard-pinned with !important so any future bare-element rule that sets
   background, color, border, or outline cannot silently break the overlay.
   Specificity (element + class) already beats bare-element rules, but
   !important makes the guarantee unconditional. */
textarea.token-overlay,
input.token-overlay {
  background: transparent !important;
  color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* ── Shared button base ──────────────────────────────────────────────────────── */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--mo-transition-fast), opacity var(--mo-transition-fast);
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Primary action buttons (rendered via JS innerHTML) */
.btn-primary {
  background: var(--orchid);
  color: #fff; /* hex-color-ok: plain white text on orchid button */
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-size: .88rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--mo-transition-fast);
}
.btn-primary:hover { background: var(--orchid-deep); }

/* The header avatar (.header-avatar-btn / .header-avatar-dot / .header-avatar-img)
   moved to the React MUI GlobalHeader island — see
   src/react/components/GlobalHeader.tsx. */

/* ── Skip link ───────────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -999px; left: 0;
  background: var(--plum); color: #fff; /* hex-color-ok: plain white text on plum */
  padding: 8px 14px; font-size: 0.875rem; font-weight: 600;
  border-radius: 0 0 var(--radius-md) 0;
  z-index: calc(var(--z-tooltip) + 1);
  text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ── Server-rendered page-heading placeholder ────────────────────────────────
   Static copy of PageHeadingPanel's layout (src/react/components/
   PageHeadingPanel.tsx) emitted inside #page-heading-mount by the EJS page
   shells so the page title paints as soon as CSS loads, long before the React
   bundle executes — it is the page's LCP element. React's createRoot render
   replaces the placeholder with the real panel on mount; keep the two visually
   identical to avoid a layout shift at that swap. */
.page-heading-ssr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px 8px;
  box-sizing: border-box;
}
.page-heading-ssr h1 {
  margin: 0;
  font-family: 'Anton', system-ui, sans-serif;
  font-weight: 400;
  font-size: 1.6rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--ink-1);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Reduced motion ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

}


/* ── Utility helpers ─────────────────────────────────────────────────────────── */


.flex-shrink-0    { flex-shrink: 0; }


.fw-600           { font-weight: 600; }
.mt-1             { margin-top: 2px; }


.card-desc        { font-size: .82rem; color: var(--ink-3); margin: 0 0 14px; }

.count-muted      { color: var(--ink-4); font-weight: 400; }


/* ── Contact edit button (workflow header) ───────────────────────────────────── */
.contact-edit-btn {
  background: none; border: none; cursor: pointer;
  color: #94a3b8; /* hex-color-ok: slate-400; no exact design-system token */ padding: 2px 4px; border-radius: 4px;
  display: inline-flex; align-items: center; flex-shrink: 0;
  transition: color var(--mo-transition-fast);
}
.contact-edit-btn:hover { color: var(--orchid); }

/* ── Sales tab: projects-style layout with overlay workflow panel ─────────────── */

.sales-list-panel {
  width: 100% !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex !important;
  flex-direction: column;
  background: var(--paper);
}
@media (min-width: 768px) {

  .sales-list-panel { overflow: hidden; }

}

.sales-list-panel > #sales-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
#sales-board-mount {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* React island: ScopedCssBaseline renders an intermediate div that must
   also participate in the flex chain so SalesBoardPage fills the height. */
#sales-board-mount > div {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sales-list-panel > #survey-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
#survey-board-mount {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* React island: ScopedCssBaseline renders an intermediate div that must
   also participate in the flex chain so SurveyBoardPage fills the height. */
#survey-board-mount > div {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


/* ── Sales board: 3-column layout ────────────────────────────────────────── */


/* Warning banner shown dynamically by workflow-core.js when room-assignments
   data is stale. Created/removed via _renderRoomAssignmentsStaleBanner() —
   no per-page HTML markup required. */
.room-stale-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: var(--status-warning-light-bg);
  border-top: 2px solid var(--status-warning-deep-bg);
  font-size: 0.8rem;
  color: var(--status-warning-deep-text);
}
.room-stale-banner span {
  flex: 1;
}
.room-stale-banner-dismiss {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--status-warning-deep-text);
  cursor: pointer;
  opacity: 0.7;
  font-size: 1rem;
  line-height: 1;
  transition: opacity var(--mo-transition-fast), background var(--mo-transition-fast);
}
.room-stale-banner-dismiss:hover { opacity: 1; background: rgba(0,0,0,0.06); }

/* Fixed banner shown on workflow-core pages when open-leads data is stale */
.ls-stale-hint {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: var(--status-warning-light-bg);
  border-top: 2px solid var(--status-warning-deep-bg);
  font-size: 0.8rem;
  color: var(--status-warning-deep-text);
}
.ls-stale-hint span {
  flex: 1;
}


/* Inline notice shown when counts fail to load (hard error / 5xx / network) */
.ls-counts-error-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--status-warning-light-bg);
  border-left: 3px solid var(--status-warning-deep-bg);
  font-size: 0.78rem;
  color: var(--status-warning-deep-text);
  flex-shrink: 0;
}
.ls-counts-error-notice span {
  flex: 1;
}
.ls-counts-error-dismiss {
  background: none;
  border: none;
  padding: 0 2px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--status-warning-text);
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.7;
}
.ls-counts-error-dismiss:hover {
  opacity: 1;
}


/* ── Command Palette ─────────────────────────────────────────────────────────── */
.cp-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgba(20, 10, 40, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(56px, calc(env(safe-area-inset-top) + 16px)) 16px 16px;
  backdrop-filter: blur(2px);
}
.cp-modal {
  width: 100%;
  max-width: 560px;
  background: #fff; /* hex-color-ok: plain white modal background */
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
}
.cp-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stone);
  flex-shrink: 0;
}
.cp-search-icon { color: var(--ink-3); flex-shrink: 0; }
.cp-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink-1);
  background: none;
  min-width: 0;
}
.cp-input::placeholder { color: var(--ink-4); }
.cp-esc-btn { background: none; border: none; cursor: pointer; padding: 0; flex-shrink: 0; }
.cp-esc-badge {
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--stone-light);
  border: 1px solid var(--stone);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
}
.cp-results {
  overflow-y: auto;
  padding: 6px 0 10px;
  flex: 1;
}
.cp-section-label {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  padding: 10px 16px 4px;
}
.cp-result-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background var(--mo-transition-snap);
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.cp-result-item:hover,
.cp-result-item:focus-visible { background: #f5f3ff; /* hex-color-ok: violet-50; no exact token */ outline: none; }
.cp-result-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--stone-light);
  border-radius: var(--radius-sm);
  color: var(--plum);
  flex-shrink: 0;
}
.cp-result-avatar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--orchid);
  color: #fff; /* hex-color-ok: plain white text on orchid */
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.cp-result-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.cp-result-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cp-result-sub {
  font-size: 0.74rem;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cp-result-category {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-4);
  flex-shrink: 0;
}
.cp-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 0.875rem;
}

/* ── Shared modal scrim (z-index ladder) ────────────────────────────────────
   Helper class for JS-built modal overlays so we don't reach for inline
   cssText with hardcoded z-index numbers. Use:
     <div class="js-modal-scrim">…</div>
─────────────────────────────────────────────────────────────────────────────── */
.js-modal-scrim {
  position: fixed; inset: 0;
  background: var(--overlay-scrim);
  display: flex; align-items: center; justify-content: center;
  z-index: var(--z-tooltip);
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)) 16px;
}
.js-modal-scrim--below { z-index: calc(var(--z-tooltip) - 1); }

/* ── Design System admin tab ────────────────────────────────────────────────
   Read-only documentation panel rendered by the React island at
   src/react/pages/DesignSystemPage.tsx (built to /react/main.js).
─────────────────────────────────────────────────────────────────────────────── */


.ds-swatch {
  border: 1px solid var(--stone); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--paper);
  font-family: var(--font-mono);
}
.ds-swatch-chip { height: 56px; }
.ds-swatch-meta { padding: 8px 10px; font-size: .72rem; line-height: 1.4; }
.ds-swatch-name { font-weight: 700; color: var(--ink-1); }
.ds-swatch-value { color: var(--ink-3); }


/* Shared empty-state block (used by renderEmptyState helper) */
.ui-empty {
  border: 1px dashed var(--stone-deep);
  border-radius: var(--radius-lg);
  padding: 28px 16px; text-align: center;
  color: var(--ink-3); font-size: .9rem;
}
.ui-empty--compact { padding: 14px 12px; font-size: .82rem; }

/* Shared tab bar built by renderTabBar helper */
.ui-tabbar {
  display: flex; gap: 4px; border-bottom: 2px solid var(--stone);
  overflow-x: auto; overflow-y: clip; overflow-clip-margin: 2px;
}
.ui-tabbar-btn {
  background: none; border: none;
  padding: 8px 14px; font: inherit;
  font-weight: 600; font-size: .82rem; color: var(--ink-3);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  white-space: nowrap;
}
.ui-tabbar-btn:hover { color: var(--ink-1); background: var(--paper); }
.ui-tabbar-btn.is-active { color: var(--plum); border-bottom-color: var(--plum); }

/* WhatsApp action modal positioning (markup in customer-detail.html). */
.wa-modal {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)) 16px;
}
.wa-modal.hidden { display: none; }

/* ── Shared admin-derived design tokens ─────────────────────────────────────
   Rules below were originally written for /admin but use generic class names
   (.card, .tabs, .modal, .badge, .lvl, .field, secondary .btn variants).
   Audit (May 2026): no other page uses these bare class names in markup —
   other pages namespace their variants (.eq-card, .trades-modal, .db-tabs,
   .auth-card, etc.) — so promoting them to global has zero impact today and
   gives future pages a ready-made design-system vocabulary.
   The remaining .admin-page-scoped block below keeps things that genuinely
   need to override or live only inside the admin shell (.btn-primary plum
   override, .toast slide-from-bottom variant, table element selectors,
   admin-specific layout chrome, the permissions matrix, audit feed, etc.).
─────────────────────────────────────────────────────────────────────────── */

/* Tabs (also used by future settings-style pages) */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 2px solid var(--stone);
  margin-bottom: 24px;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.tab-btn {
  padding: 9px 16px;
  font-size: .82rem; font-weight: 600;
  color: var(--ink-3);
  background: none; border: none;
  cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color var(--mo-transition-fast), background var(--mo-transition-fast);
  white-space: nowrap; flex-shrink: 0;
}
.tab-btn:hover  { color: var(--ink-1); background: var(--paper); }
.tab-btn.active { color: var(--plum); border-bottom-color: var(--plum); }
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--orchid); color: #fff; /* hex-color-ok: plain white text on orchid */
  border-radius: var(--radius-pill);
  font-size: .65rem; font-weight: 700; margin-left: 5px;
}
.tab-badge--warn { background: #ed6c02; } /* hex-color-ok: MUI warning orange; no design-system equivalent */
.tab-panel         { display: none; }
.tab-panel.active  { display: block; }

/* Card panel */
.card {
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); margin: 0 0 16px;
}


/* Privilege level / status pill */
.lvl {
  display: inline-block; padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: .7rem; font-weight: 700;
  text-transform: capitalize; letter-spacing: .02em;
}


/* Status badges */
.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: .7rem; font-weight: 600; text-transform: capitalize;
}


/* Secondary button variants. Pairs with the global .btn base defined above.
   .btn-primary stays scoped under .admin-page (admin uses plum, the global
   .btn-primary used elsewhere is orchid). */


.btn-ghost   { background: var(--paper); color: var(--ink-2); border-color: var(--stone); }
.btn-ghost:hover:not(:disabled)   { background: var(--paper); }
.btn-approve { background: var(--stage-packing-bg); color: #fff; /* hex-color-ok: plain white text on green */ border: none; }
.btn-approve:hover:not(:disabled) { background: var(--stage-packing-text); }


/* Field inputs (compact text input used in admin forms and inline edit rows). */
.field {
  border: 1px solid var(--stone);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: .82rem; font-family: inherit;
  color: var(--ink-1); background: #fff; /* hex-color-ok: plain white form field */
  outline: none;
  transition: border-color var(--mo-transition-fast);
}
.field:focus { border-color: var(--orchid); }


/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20,20,19,.52);
  display: flex; align-items: center; justify-content: center;
  z-index: var(--z-modal);
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)) 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  width: 100%; max-width: 640px;
  padding: 24px;
  max-height: 90vh; overflow-y: auto;
}


/* ── Admin page ─────────────────────────────────────────────────────────────
   Rules that genuinely live only inside the admin shell. The .admin-page
   body class survives because of:
     - the .btn-primary (plum) and .toast overrides below (they would collide
       with the global versions if unscoped),
     - bare element selectors (table/th/td) we don't want leaking globally,
     - layout chrome and Search-Settings rows still rendered by vanilla JS.
   Z-index values use the ladder tokens defined on :root.

   All admin tabs are now React MUI islands. Dead rules for the old vanilla-JS
   rendering (permissions matrix, audit-feed chip badges, job-roles manager,
   add-member form, perm-toggle, checklist, avatar/user-cell, etc.) were
   removed. The surviving rules below are annotated with their consumers.
─────────────────────────────────────────────────────────────────────────── */

/* Hide the search-shortcut hint inside the MUI GlobalHeader on /admin so the
   admin-tab bar doesn't compete with the search affordance. */
.admin-page #app-header-mount [aria-label^="Search ("] > span:last-child { display: none; }

.admin-page { min-height: 100vh; }

.admin-page .page { padding: 28px 20px 60px; }
.admin-page .page-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 2px; }
.admin-page .page-sub   { color: var(--ink-3); font-size: .88rem; margin: 0 0 16px; }

/* Two-level grouped tab navigation (AdminGroupedTabsBar) */
.admin-grouped-tabs { margin-bottom: 20px; }
.admin-grouped-tabs .admin-grouped-tabs__groups .ui-tabbar-btn {
  font-size: .875rem;
  padding: 9px 16px;
}
.admin-grouped-tabs .admin-grouped-tabs__subtabs {
  margin-top: 0;
  border-top: none;
}
.admin-grouped-tabs .admin-grouped-tabs__subtabs .ui-tabbar-btn {
  font-size: .78rem;
  padding: 7px 12px;
  color: var(--ink-4);
}
.admin-grouped-tabs .admin-grouped-tabs__subtabs .ui-tabbar-btn.is-active {
  color: var(--plum);
  border-bottom-color: var(--plum);
}

/* Table (bare element selectors — kept scoped to avoid bleeding globally) */
.admin-page table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.admin-page th {
  text-align: left; padding: 8px 12px;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-4); border-bottom: 1px solid var(--stone);
}
.admin-page td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--paper);
  vertical-align: middle;
}
.admin-page tr:last-child td { border-bottom: none; }


/* Admin's plum .btn-primary overrides the global orchid one. The shared .btn
   base lives in the "Shared button base" block earlier in this file; admin's
   copy of it has been removed because the two declarations were identical. */
.admin-page .btn-primary { background: var(--plum); color: #fff; } /* hex-color-ok: plain white text on plum */
.admin-page .btn-primary:hover:not(:disabled) { background: #2e0f5a; } /* hex-color-ok: darker plum hover; no exact token */


/* Toast */
.admin-page .toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--plum); color: #fff; /* hex-color-ok: plain white text on plum */
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: .875rem; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity var(--mo-transition-medium);
  z-index: var(--z-toast);
  white-space: nowrap;
}
.admin-page .toast.show { opacity: 1; }
.admin-page .toast.err  { background: var(--error); }


/* Loading / forbidden */
.admin-page .loading-state {
  display: flex; align-items: center; justify-content: center;
  height: 200px;
  color: var(--ink-4); font-size: .9rem;
}

/* Search Settings tab — standalone (no .admin-page scope so SearchActionList works anywhere) */
.ss-action-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  background: #fff; /* hex-color-ok: plain white action row */
  border: 1px solid var(--stone);
  border-radius: var(--radius-sm);
  user-select: none;
  transition: opacity var(--mo-transition-fast), background var(--mo-transition-snap);
}
.ss-action-row + .ss-action-row { margin-top: 4px; }
.ss-action-row.ss-action-disabled { opacity: 0.45; }
.ss-action-row.ss-drag-over { background: var(--orchid-tint); border-color: var(--plum); }
.ss-action-row.ss-dragging  { opacity: 0.35; }
.ss-drag-handle {
  cursor: grab; color: var(--ink-4); font-size: 1rem;
  flex-shrink: 0; padding: 0 2px; line-height: 1;
}
.ss-toggle { position: relative; display: inline-flex; cursor: pointer; flex-shrink: 0; }
.ss-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.ss-toggle-track {
  width: 32px; height: 18px;
  background: #9ca3af; /* hex-color-ok: gray-400 unchecked toggle; no exact token */ border-radius: 9px;
  transition: background var(--mo-transition-medium); position: relative;
}
.ss-toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; background: #fff; /* hex-color-ok: plain white toggle thumb */ border-radius: 50%;
  transition: transform var(--mo-transition-medium);
}
.ss-toggle input:checked + .ss-toggle-track { background: var(--plum); }
.ss-toggle input:checked + .ss-toggle-track::after { transform: translateX(14px); }
.ss-action-label {
  flex: 1; font-size: .875rem; font-weight: 600; color: var(--ink-1); min-width: 0;
}
.ss-action-category {
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3);
  background: var(--paper);
  border-radius: 4px; padding: 2px 6px; flex-shrink: 0;
}
.ss-action-hint {
  font-size: .78rem; color: var(--ink-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
@media (max-width: 640px) {

  .ss-action-hint { display: none; }

}


/* Small reusable text helpers used inside admin template literals (replacing
   recurring `style="font-size:.82rem;color:…"` attributes). */
.admin-page .admin-msg {
  font-size: .82rem;
  margin: 0;
}
.admin-page .admin-msg--muted { color: var(--ink-4); }
.admin-page .admin-msg--error { color: var(--error); }

/* ── Admin helper classes (`adm-` prefix) ────────────────────────────────────
   Used by React admin islands (CardActionsPage, ActionHandlersPage,
   DesignVisitPage) and their modal template-literals. Vanilla-JS rendering
   has been fully removed; any class not referenced by a .tsx or admin modal
   template is dead and should be deleted here.
─────────────────────────────────────────────────────────────────────────── */

/* Compact data table chrome */
.admin-page .adm-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.admin-page .adm-th {
  text-align: left; padding: 6px 8px;
  font-weight: 600; color: var(--ink-3);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
}
.admin-page .adm-tr  { border-bottom: 1px solid var(--stone-light); }
.admin-page .adm-tr--alt { background: var(--paper); }
.admin-page .adm-td  { padding: 7px 8px; }
.admin-page .adm-td--right   { text-align: right; }
.admin-page .adm-td--nowrap  { white-space: nowrap; }
.admin-page .adm-td--actions { padding: 4px 4px; white-space: nowrap; }

/* Reorder / icon mini-buttons */
.admin-page .adm-iconbtn--xs  { padding: 2px 5px; font-size: .75rem; line-height: 1; }
.admin-page .adm-btn-xs       { padding: 3px 8px; font-size: .75rem; }
.admin-page .adm-btn-xs--danger { color: var(--status-error-text); }


/* Modal labels (Action handler dialog, DV item editor, etc.) */
.admin-page .adm-modal-label {
  display: block; font-size: .78rem; color: #4b5563; /* hex-color-ok: gray-600; no exact token */
  margin: 10px 0 4px; font-weight: 600;
}
.admin-page .adm-modal-label--first { margin: 0 0 4px; }
.admin-page .adm-req      { color: var(--status-error-text); }
.admin-page .adm-optional { font-weight: 400; color: var(--ink-4); }

/* Error / status lines under form fields */
.admin-page .adm-err-line {
  color: #b91c1c; /* hex-color-ok: red-700; nearest token is --status-error-text (#991b1b) but intentionally darker */ font-size: .82rem; margin-top: 8px; min-height: 18px;
}
.admin-page .adm-err-line--sm {
  color: #b91c1c; /* hex-color-ok: red-700; nearest token is --status-error-text (#991b1b) but intentionally darker */ font-size: .78rem; margin-top: 3px;
}

/* Typography helpers used in admin template literals and React islands */
.admin-page .adm-text-muted-xs { font-size: .72rem; color: var(--ink-4); }
.admin-page .adm-text-faint-mono {
  font-family: var(--font-mono); font-size: .7rem; color: var(--ink-4);
}

/* Modal scrim children (the inner white card) */
.admin-page .adm-modal-card {
  background: #fff; /* hex-color-ok: plain white modal card */ border-radius: var(--radius-md); padding: 20px;
  width: 100%; max-width: 500px;
  box-shadow: var(--shadow-modal);
  max-height: 90vh; overflow: auto;
}
.admin-page .adm-modal-card--narrow { max-width: 440px; padding: 22px 24px; }
.admin-page .adm-modal-title {
  margin: 0 0 6px; font-size: 1.05rem; font-weight: 700;
}
.admin-page .adm-modal-title--big   { margin: 0 0 16px; font-size: 1rem; }
.admin-page .adm-modal-sub {
  margin: 0 0 14px; font-size: .78rem; color: var(--ink-4);
}
.admin-page .adm-modal-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px;
}
.admin-page .adm-modal-list {
  display: flex; flex-direction: column; gap: 8px;
}

.admin-page .adm-inline-code {
  font-family: var(--font-mono);
  background: var(--paper);
  padding: 1px 4px; border-radius: 3px;
}


/* Card-action stages renderer (admin Card-actions tab) */
.admin-page .adm-ca-empty {
  padding: 14px; font-size: .78rem; color: var(--ink-4);
}
.admin-page .adm-ca-block {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 14px; border-bottom: 1px solid var(--stone-light);
}
.admin-page .adm-ca-block-title { font-size: .85rem; color: var(--ink-1); flex-shrink: 0; white-space: nowrap; }
.admin-page .adm-ca-block-title.is-null { font-style: italic; }
.admin-page .adm-ca-default-input {
  flex: 1; min-width: 120px; max-width: 260px;
  padding: 5px 8px; font-size: .82rem;
}
.admin-page .adm-ca-sub-list { margin-top: 8px; }
.admin-page .adm-ca-add-sub  { margin-top: 8px; }
.admin-page .adm-ca-add-sub .btn {
  padding: 4px 10px; font-size: .74rem;
}
.admin-page .adm-ca-sub-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-top: 1px dashed var(--stone);
}
.admin-page .adm-ca-sub-row--new { background: var(--status-warning-light-bg); }
.admin-page .adm-ca-sub-arrows {
  flex: 0 0 auto; display: flex; flex-direction: column; line-height: 1;
}
.admin-page .adm-ca-sub-arrow {
  padding: 0 5px; font-size: .7rem; line-height: 1;
}
.admin-page .adm-ca-sub-arrow--dim { opacity: .3; }
.admin-page .adm-ca-sub-key-wrap {
  display: flex; align-items: stretch; flex: 0 0 auto;
}
.admin-page .adm-ca-sub-key-prefix {
  flex: 0 0 auto;
  padding: 4px 0 4px 7px;
  font-size: .78rem; font-family: var(--font-mono); color: var(--ink-3);
  background: #f3f4f6; /* hex-color-ok: gray-100 prefix chip; no exact token */
  border: 1px solid var(--stone); border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  line-height: 1.4; user-select: none;
}
.admin-page .adm-ca-sub-key {
  flex: 0 0 140px;
  padding: 4px 7px; font-size: .78rem; font-family: var(--font-mono);
  text-transform: uppercase;
}
.admin-page .adm-ca-sub-key--has-prefix {
  flex: 0 0 90px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.admin-page .adm-ca-sub-input {
  flex: 1; padding: 4px 7px; font-size: .78rem;
}

/* Card-action handler badges + conflict-fix button (lives next to default labels) */
.admin-page .adm-handler-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; margin-left: 6px;
  background: #ede0ff; /* hex-color-ok: light orchid tint; --orchid-tint-deep is #EDE8FF, different shade */ color: var(--plum-light);
  border-radius: 999px;
  font-size: .7rem; font-weight: 600;
  line-height: 1.5; white-space: nowrap; vertical-align: middle;
}

/* Conflict-resolution modal rows (admin Action handlers tab) */
.admin-page .adm-conflict-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--stone);
  border-radius: var(--radius-sm); background: #fafaf9; /* hex-color-ok: near-white; no exact token */
}
.admin-page .adm-conflict-row-body { flex: 1; min-width: 0; }
.admin-page .adm-conflict-row-title {
  font-weight: 600; font-size: .85rem; color: var(--ink-1);
}
.admin-page .adm-conflict-row-icon { margin-right: 4px; }
.admin-page .adm-conflict-row-desc {
  font-size: .75rem; color: var(--ink-4);
  margin-top: 2px; line-height: 1.4;
}
.admin-page .adm-conflict-remove {
  flex: 0 0 auto; font-size: .78rem;
  padding: 4px 12px; color: var(--status-error-text); white-space: nowrap;
}

/* Action-handler editor modal (admin Action handlers tab) */
.admin-page .adm-modal-card--wide {
  max-width: 560px;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
}
.admin-page .adm-modal-label--sm { margin: 8px 0 4px; }
.admin-page .adm-block-mt12 { margin-top: 12px; }
.admin-page .adm-hint {
  font-size: .7rem; color: var(--ink-4); margin-top: 3px;
}
.admin-page .adm-type-desc {
  margin-top: 8px; padding: 8px 10px;
  border: 1px solid var(--stone); border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: .78rem; color: var(--ink-2);
  line-height: 1.5; white-space: pre-line;
}
.admin-page .adm-info-amber {
  margin-top: 4px; padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--status-warning-bg); border: 1px solid #fcd34d; /* hex-color-ok: amber-300 border; no exact token */
  font-size: .75rem; color: var(--status-warning-text); line-height: 1.5;
}
.admin-page .adm-info-blue {
  margin-top: 8px; padding: 7px 10px; border-radius: var(--radius-sm);
  background: var(--status-info-light-bg); border: 1px solid #bfdbfe; /* hex-color-ok: blue-200 border; no exact token */
  font-size: .75rem; color: var(--status-info-light-text); line-height: 1.5;
}
.admin-page .adm-checkbox-row {
  display: flex; align-items: center; gap: 6px;
  font-size: .82rem; color: #4b5563; /* hex-color-ok: gray-600; no exact token */ cursor: pointer;
}
.admin-page .adm-conflict-box {
  margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--status-warning-border); border-radius: var(--radius-sm);
  background: var(--status-warning-light-bg);
}
.admin-page .adm-conflict-box-head {
  font-size: .8rem; font-weight: 600; color: var(--status-warning-text); margin-bottom: 6px;
}
.admin-page .adm-conflict-box-list {
  font-size: .78rem; color: var(--status-warning-deep-text); margin-bottom: 10px; line-height: 1.6;
}
.admin-page .adm-conflict-box-actions { display: flex; gap: 8px; }
.admin-page .adm-btn-conflict { font-size: .78rem; padding: 4px 12px; }
.admin-page .adm-btn-conflict--primary {
  background: var(--stage-survey-bg); color: #fff; /* hex-color-ok: plain white text on amber button */
  border: none; border-radius: var(--radius-sm); cursor: pointer;
}

/* Audit log + misc admin helpers */
.admin-page .adm-mb-12 { margin-bottom: 12px; }
.admin-page .adm-mt-8  { margin-top: 8px; }

/* DV Terms publish editor */
.admin-page .adm-terms-textarea { font-size: .84rem; width: 100%; }

/* Handler summary card (action-handlers tab) */
.admin-page .adm-handler-actionname {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  background: var(--status-violet-bg); color: var(--status-violet-text);
  border-radius: 999px; font-size: .72rem; font-weight: 600;
  letter-spacing: .01em;
}
.admin-page .adm-muted-inline { color: var(--ink-4); }
.admin-page .adm-handler-extra {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px dashed #d8c7f5; /* hex-color-ok: light violet border; no exact token */
  font-size: .76rem; color: var(--ink-2); line-height: 1.5;
}
.admin-page .adm-handler-summary {
  border: 1px solid #d8c7f5; /* hex-color-ok: light violet border; no exact token */ border-radius: var(--radius-sm);
  padding: 8px 10px; background: #f7f2ff; /* hex-color-ok: very light violet; no exact token */
}
.admin-page .adm-handler-summary-head {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: .82rem; color: var(--plum-light);
  user-select: none;
}
.admin-page .adm-handler-summary-desc {
  margin-top: 5px; font-size: .78rem; color: var(--ink-2);
  line-height: 1.5; white-space: pre-line;
}

/* Handlers table */
.admin-page .adm-handlers-none { color: var(--ink-4); font-size: .82rem; }
.admin-page .adm-btn-remove { color: var(--status-error-text); }
.admin-page .adm-btn-add-action { padding: 4px 12px; font-size: .78rem; }
.admin-page .adm-handlers-row { border-top: 1px solid var(--stone-light); }
.admin-page .adm-handlers-cell {
  padding: 10px 12px; vertical-align: top;
}
.admin-page .adm-handlers-cell--slot { width: 34%; }
.admin-page .adm-handlers-cell--actions { text-align: right; white-space: nowrap; }
.admin-page .adm-handlers-slot-label {
  font-weight: 600; font-size: .85rem; color: var(--ink-1);
}
.admin-page .adm-handlers-slot-sub {
  font-size: .72rem; color: var(--ink-4); margin-top: 2px;
}
.admin-page .adm-handlers-group { border-top: 1px solid var(--stone-light); }
.admin-page .adm-handlers-group-head {
  padding: 7px 12px; font-size: .74rem; font-weight: 600;
  color: var(--ink-3); background: var(--surface-muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.admin-page .adm-handlers-table {
  width: 100%; border-collapse: collapse; font-size: .85rem;
}
.admin-page .adm-handlers-stage {
  margin-bottom: 18px;
  border: 1px solid var(--stone); border-radius: var(--radius-sm);
  overflow: hidden;
}
.admin-page .adm-handlers-stage-head {
  padding: 10px 14px; background: var(--paper);
  font-weight: 600; font-size: .85rem; color: var(--ink-2);
}

/* DV terms (TermsDisplay React component) */
.admin-page .adm-terms-history { margin-top: 10px; }
.admin-page .adm-terms-history-list {
  margin-top: 10px; display: flex; flex-direction: column; gap: 10px;
}
.admin-page .adm-terms-history-item {
  border: 1px solid var(--stone);
  border-radius: var(--radius-sm); padding: 8px 12px;
}

/* ── Final inline-style sweep helpers ──────────────────────────────────────
   Generic admin spacing / text utilities and section-specific helpers used
   only after the bulk extraction. Add new admin-only inline-style
   replacements here so they stay grouped. */
.admin-page .adm-mt-10 { margin-top: 10px; }
.admin-page .adm-tab-link    { text-decoration: none; }

/* Card-action-handler modal inputs (small, mono variants) */
.admin-page .adm-field-sm      { font-size: .85rem; }
.admin-page .adm-field-xs      { font-size: .82rem; }
.admin-page .adm-field-mono-xs { font-family: var(--font-mono); font-size: .82rem; }

/* Card-action handlers — conflicts banner */
.admin-page .adm-cab-wrap {
  border: 1px solid var(--status-warning-border); border-radius: 10px;
  background: var(--status-warning-light-bg); padding: 12px 14px;
}
.admin-page .adm-cab-head { display: flex; align-items: flex-start; gap: 10px; }
.admin-page .adm-cab-icon { font-size: 1.1rem; line-height: 1.2; }
.admin-page .adm-cab-body { flex: 1; min-width: 0; }
.admin-page .adm-cab-title {
  font-weight: 700; font-size: .88rem; color: var(--status-warning-text);
}
.admin-page .adm-cab-desc {
  font-size: .78rem; color: var(--status-warning-text); margin-top: 2px; line-height: 1.5;
}
.admin-page .adm-cab-dismiss {
  flex: 0 0 auto; background: transparent; border: none;
  color: var(--status-warning-text); font-size: 1rem; line-height: 1;
  cursor: pointer; padding: 2px 6px;
}
.admin-page .adm-cab-list { list-style: none; margin: 8px 0 0; padding: 0; }
.admin-page .adm-cab-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-top: 1px solid var(--status-warning-active-bg);
}
.admin-page .adm-cab-item:first-child { border-top: 0; }
.admin-page .adm-cab-item-body {
  flex: 1; min-width: 0; font-size: .8rem; color: var(--status-warning-deep-text); line-height: 1.45;
}
.admin-page .adm-cab-fix-btn {
  flex: 0 0 auto; font-size: .78rem; padding: 4px 12px;
  background: var(--stage-survey-bg); color: #fff; /* hex-color-ok: plain white text on amber button */
  border: none; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
}

/* Dev-environment banner inline code (DevEnvironmentPage.tsx) */
.admin-page .adm-devenv-banner-code {
  font-family: var(--font-mono);
  background: #fef08a; /* hex-color-ok: yellow-200 code highlight; no exact token */ padding: 1px 4px; border-radius: var(--radius-sm);
}

/* DV catalogue — drag handles, thumbnails, previews */
.admin-page .adm-dv-drag-cell {
  padding: 4px 4px; cursor: grab; color: var(--ink-4);
  text-align: center; user-select: none;
}
.admin-page .adm-dv-drag-th    { width: 24px; }
.admin-page .adm-dv-actions-th { width: 52px; }
.admin-page .adm-dv-thumb {
  width: 32px; height: 32px; object-fit: contain;
  border-radius: var(--radius-sm); border: 1px solid var(--stone);
}
.admin-page .adm-dv-thumb-empty { color: var(--ink-4); }
.admin-page .adm-dv-preview-wrap { margin-bottom: 6px; }
.admin-page .adm-dv-preview {
  max-height: 80px; max-width: 160px;
  border-radius: var(--radius-sm); border: 1px solid var(--stone); object-fit: contain;
}
.admin-page .adm-field-file   { font-size: .85rem; padding: 4px; }
.admin-page .adm-field-resize { font-size: .85rem; resize: vertical; }
.admin-page .adm-field-name   { font-size: .88rem; }

/* Error-banner action links/buttons (replaces Tailwind text-blue-600). */
.mo-error-action { color: var(--orchid); }
.mo-error-msg { color: var(--error); }
