/* ==========================================================================
   COMINV 3.0 — SOVEREIGN TRADE WORKSTATION DESIGN SYSTEM
   Layered Architecture: reset -> tokens -> base -> layout -> components -> views -> utilities
   ========================================================================== */

@layer reset, tokens, base, layout, components, views, utilities;

/* --------------------------------------------------------------------------
   1. RESET LAYER (Targeted element reset — avoids universal * reset)
   -------------------------------------------------------------------------- */
@layer reset {
  html,
  body,
  header,
  nav,
  main,
  section,
  article,
  aside,
  footer,
  div,
  span,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  ul,
  ol,
  li,
  dl,
  dt,
  dd,
  figure,
  figcaption,
  blockquote,
  form,
  fieldset,
  legend,
  label,
  input,
  select,
  textarea,
  button,
  table,
  thead,
  tbody,
  tfoot,
  tr,
  th,
  td,
  details,
  summary,
  dialog {
    box-sizing: border-box;
  }

  body,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  figure,
  blockquote,
  dl,
  dd {
    margin: 0;
  }

  ul,
  ol {
    margin: 0;
    padding: 0;
  }

  img,
  picture,
  svg,
  video,
  canvas {
    display: block;
    max-width: 100%;
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
    letter-spacing: inherit;
    color: inherit;
  }
}

/* --------------------------------------------------------------------------
   2. TOKENS LAYER (Color Scheme, Light/Dark Variables, Typography & Elevation)
   -------------------------------------------------------------------------- */
@layer tokens {
  :root {
    color-scheme: light dark;

    /* Progressive enhancement tokens for wide-gamut gradient interpolation */
    --in-oklab: ;
    --in-oklch: ;

    /* Brand Maritime & Cobalt Palette */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-strong: #1e40af;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    --accent: #0284c7;
    --accent-soft: #e0f2fe;
    --focus-ring: rgba(37, 99, 235, 0.22);

    /* Semantic Status Colors (Contrast-calibrated for light theme) */
    --success: #047857;
    --success-bright: #10b981;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --warning: #b45309;
    --warning-bright: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;
    --danger: #dc2626;
    --danger-bright: #ef4444;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --info: #0369a1;
    --info-bg: #f0f9ff;
    --info-border: #bae6fd;

    /* Surfaces & Borders — Light ("Manifest Daylight") */
    --bg-app: #f3f6fb;
    --bg-canvas: #eef2f8;
    --bg-surface: #ffffff;
    --bg-surface-secondary: #f8fafc;
    --bg-surface-elevated: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.86);
    --bg-studio: #e7edf6;
    --bg-card: var(--bg-surface);
    --bg-body: var(--bg-app);
    --bg-hover: var(--bg-surface-secondary);
    --input-bg: #ffffff;
    --border-color: #dbe3ef;
    --border-subtle: #e9eff7;
    --border-strong: #bcc9dc;

    /* Typography Foreground Ramp */
    --text-main: #0b1526;
    --text-secondary: #334155;
    --text-muted: #475569;
    --text-label: #1e293b;
    --text-inverse: #ffffff;

    /* Neutral Scale Compatibility */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Typography Stacks */
    --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Geometric Scale */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-md: var(--radius);
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-pill: 9999px;

    /* Multi-Layered Realistic Shadows */
    --shadow-xs: 0 1px 2px rgba(11, 21, 38, 0.04);
    --shadow-sm: 0 1px 3px rgba(11, 21, 38, 0.06), 0 1px 2px rgba(11, 21, 38, 0.04);
    --shadow: 0 4px 12px rgba(11, 21, 38, 0.06), 0 1px 3px rgba(11, 21, 38, 0.05);
    --shadow-md: 0 10px 24px -4px rgba(11, 21, 38, 0.08), 0 4px 8px -2px rgba(11, 21, 38, 0.04);
    --shadow-lg: 0 20px 40px -10px rgba(11, 21, 38, 0.12), 0 6px 14px -4px rgba(11, 21, 38, 0.05);
    --shadow-xl: 0 30px 64px -14px rgba(11, 21, 38, 0.18), 0 10px 24px -6px rgba(11, 21, 38, 0.08);
    --shadow-glow: 0 0 0 1px var(--primary-border), 0 12px 32px -6px rgba(37, 99, 235, 0.22);

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 140ms;
    --duration-base: 220ms;
  }

  @supports (background: linear-gradient(in oklab, white, black)) {
    :root {
      --in-oklab: in oklab;
      --in-oklch: in oklch;
    }
  }

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

  /* Dark Theme — Activated via [data-theme="dark"] OR early FOUC <meta> selector */
  [data-theme="dark"],
  :root:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;

    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-strong: #60a5fa;
    --primary-light: rgba(59, 130, 246, 0.15);
    --primary-border: rgba(59, 130, 246, 0.4);
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.14);
    --focus-ring: rgba(96, 165, 250, 0.32);

    --success: #34d399;
    --success-bright: #10b981;
    --success-bg: rgba(16, 185, 129, 0.14);
    --success-border: rgba(16, 185, 129, 0.36);
    --warning: #fbbf24;
    --warning-bright: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --warning-border: rgba(245, 158, 11, 0.4);
    --danger: #f87171;
    --danger-bright: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --danger-border: rgba(239, 68, 68, 0.38);
    --info: #38bdf8;
    --info-bg: rgba(56, 189, 248, 0.14);
    --info-border: rgba(56, 189, 248, 0.36);

    /* Surfaces & Borders — Dark ("Nocturne Operations Desk") */
    --bg-app: #060b16;
    --bg-canvas: #0b1324;
    --bg-surface: #0f182a;
    --bg-surface-secondary: #152137;
    --bg-surface-elevated: #1a2842;
    --bg-glass: rgba(10, 17, 32, 0.84);
    --bg-studio: #09101f;
    --bg-card: var(--bg-surface);
    --bg-body: var(--bg-app);
    --bg-hover: var(--bg-surface-secondary);
    --input-bg: #0c1526;
    --border-color: #1f2f49;
    --border-subtle: #172338;
    --border-strong: #2e4469;

    /* Foreground */
    --text-main: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-label: #e2e8f0;
    --text-inverse: #0b1526;

    --gray-50: #152137;
    --gray-100: #1b2842;
    --gray-200: #263656;
    --gray-300: #374b70;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03);
    --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
    --shadow-lg: 0 22px 46px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-xl: 0 32px 72px rgba(0, 0, 0, 0.78), 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-glow: 0 0 0 1px rgba(59, 130, 246, 0.45), 0 14px 36px -6px rgba(37, 99, 235, 0.35);
  }
}

/* --------------------------------------------------------------------------
   3. BASE LAYER
   -------------------------------------------------------------------------- */
@layer base {
  html {
    font-size: 16px;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    -webkit-text-size-adjust: 100%;
  }

  body {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--bg-app);
    background-image:
      radial-gradient(ellipse 80% 50% at 50% -10%, rgba(37, 99, 235, 0.08), transparent 65%),
      radial-gradient(ellipse 50% 40% at 95% 15%, rgba(2, 132, 199, 0.05), transparent 60%);
    background-attachment: fixed;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scrollbar-color: var(--gray-400) transparent;
  }

  [data-theme="dark"] body {
    background-image:
      radial-gradient(ellipse 85% 50% at 50% -10%, rgba(59, 130, 246, 0.16), transparent 65%),
      radial-gradient(ellipse 55% 40% at 92% 18%, rgba(56, 189, 248, 0.08), transparent 60%);
  }

  h1, h2, h3, h4, th {
    font-family: var(--font-display);
    text-wrap: balance;
    letter-spacing: -0.02em;
  }

  p, li, figcaption {
    text-wrap: pretty;
  }

  a {
    color: var(--primary);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
  }

  code, pre, .font-mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
  }

  :where(a:any-link, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2.5px solid var(--primary);
    outline-offset: 2px;
  }

  /* Visually hidden utility + focusable skip-link */
  .visually-hidden:where(:not(:focus-within, :active)),
  .sr-only {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
  }

  .skip-link:focus-visible {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 9999;
    padding: 0.65rem 1.1rem;
    border-radius: var(--radius);
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.875rem;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
  }

  /* Dark-Mode Safe Browser Autofill & Focus-Visible Styling */
  input:-webkit-autofill,
  input:-webkit-autofill:hover,
  input:-webkit-autofill:focus,
  textarea:-webkit-autofill,
  textarea:-webkit-autofill:hover,
  textarea:-webkit-autofill:focus,
  select:-webkit-autofill,
  select:-webkit-autofill:hover,
  select:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 100vmax var(--input-bg, #1e293b) inset !important;
    box-shadow: 0 0 0 100vmax var(--input-bg, #1e293b) inset !important;
    -webkit-text-fill-color: var(--text-main, #f8fafc) !important;
    border-color: var(--primary, #3b82f6) !important;
    transition: background-color 5000s ease-in-out 0s;
  }

  input:autofill,
  textarea:autofill,
  select:autofill {
    box-shadow: 0 0 0 100vmax var(--input-bg, #1e293b) inset !important;
    color: var(--text-main, #f8fafc) !important;
    border-color: var(--primary, #3b82f6) !important;
  }

  input:-webkit-autofill:focus-visible,
  input:autofill:focus-visible,
  textarea:-webkit-autofill:focus-visible,
  textarea:autofill:focus-visible {
    outline: 2.5px solid var(--primary, #3b82f6) !important;
    outline-offset: 1px !important;
    box-shadow: 0 0 0 100vmax var(--input-bg, #1e293b) inset, 0 0 0 4px var(--focus-ring) !important;
  }
}

/* --------------------------------------------------------------------------
   4. LAYOUT LAYER (Header, Nav, Banners, Workspace Grid, Responsive Tables, Footer)
   -------------------------------------------------------------------------- */
@layer layout {
  .app-header {
    background: var(--bg-glass);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 120;
    box-shadow: var(--shadow-xs);
    transition: background var(--duration-base) var(--ease-out), border-color var(--duration-base) var(--ease-out);
  }

  .header-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    min-block-size: 58px;
    padding: 0.45rem clamp(0.85rem, 1.8vw, 1.5rem);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
  }

  .logo-area {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
    justify-self: start;
    min-width: 0;
    cursor: pointer;
    text-decoration: none;
    border-radius: var(--radius-sm);
    padding: 0.12rem 0.2rem;
    transition: opacity var(--duration-fast) ease;
  }

  .logo-area:hover {
    opacity: 0.88;
  }

  .logo-icon {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-main);
  }

  .logo-icon svg,
  .logo-icon img,
  .logo-icon .cominv-logo-img {
    height: 52px;
    width: auto;
    display: block;
    object-fit: contain;
    pointer-events: none;
  }

  [data-theme="light"] .cominv-logo-img {
    filter: brightness(0);
  }

  .logo-text {
    display: flex;
    align-items: center;
  }

  .logo-text h1 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.15;
  }

  .logo-text span {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 600;
    border-left: 1px solid var(--border-color);
    padding-left: 0.65rem;
    line-height: 1.25;
    max-width: 142px;
  }

  @media (max-width: 1580px) {
    .logo-text span {
      display: none;
    }
  }

  /* Segmented Command Pill Navigation */
  .nav-tabs {
    display: flex;
    align-items: center;
    gap: 0.16rem;
    justify-self: center;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 0.22rem;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-divider {
    width: 1px;
    height: 1.1rem;
    background: var(--border-strong);
    margin: 0 0.18rem;
    flex-shrink: 0;
  }

  .nav-tabs .tab-btn,
  .tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.36rem;
    min-block-size: 32px;
    padding: 0.34rem 0.7rem;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background var(--duration-fast) ease, color var(--duration-fast) ease, border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  }

  .nav-tabs .tab-btn svg,
  .tab-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.78;
    transition: opacity var(--duration-fast) ease;
  }

  .nav-tabs .tab-btn:hover,
  .tab-btn:hover {
    color: var(--text-main);
    background: var(--bg-surface);
  }

  .nav-tabs .tab-btn.active,
  .tab-btn.active {
    background: var(--bg-surface);
    color: var(--primary);
    border-color: var(--primary-border);
    box-shadow: var(--shadow-xs);
    font-weight: 700;
  }

  .nav-tabs .tab-btn.active svg,
  .tab-btn.active svg {
    opacity: 1;
    color: var(--primary);
  }

  [data-theme="dark"] .nav-tabs .tab-btn.active,
  [data-theme="dark"] .tab-btn.active {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.42);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
  }

  .nav-tabs .tab-btn .badge {
    font-size: 0.68rem;
    padding: 0.1rem 0.42rem;
    min-block-size: auto;
  }

  /* Header Right Actions */
  .user-menu-area {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-self: end;
    flex-shrink: 0;
    min-width: 0;
  }

  .user-menu-area #btnLogout,
  .user-menu-area #btnHeaderSignIn {
    min-block-size: 34px;
    block-size: 34px;
    padding: 0 0.72rem;
    border-radius: var(--radius-pill);
    font-size: 0.77rem;
  }

  /* Mobile Drawer Toggle (hidden on desktop) */
  .mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    min-inline-size: 36px;
    min-block-size: 36px;
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    cursor: pointer;
    transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease;
  }

  .mobile-nav-toggle:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
  }

  /* Adaptive Extended Navigation Density (Broker / Admin / Team Active) */
  .app-header.has-extended-nav .logo-text span {
    display: none;
  }

  .app-header.has-extended-nav .nav-tabs {
    gap: 0.12rem;
  }

  .app-header.has-extended-nav .nav-tabs .tab-btn {
    padding: 0.32rem 0.56rem;
    font-size: 0.765rem;
    gap: 0.3rem;
  }

  .app-header.has-extended-nav #headerTeamBadge {
    max-width: 170px;
  }

  .app-header.has-extended-nav .user-menu-area {
    gap: 0.35rem;
  }

  .app-header.has-extended-nav .btn-pricing-label {
    display: none;
  }

  /* Seamless single-pill plan badge when pricing label is hidden (no nested double box) */
  .app-header.has-extended-nav .btn-outline-pricing {
    padding: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .app-header.has-extended-nav .btn-outline-pricing:hover {
    border-color: transparent;
    box-shadow: none;
  }

  .app-header.has-extended-nav .btn-outline-pricing .pricing-plan-badge {
    min-block-size: 34px;
    block-size: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.72rem;
    font-size: 0.72rem;
  }

  /* Header User & Workspace Badges */
  .user-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-block-size: 34px;
    block-size: 34px;
    padding: 0 0.65rem 0 0.25rem;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease;
  }

  .user-badge:hover {
    border-color: var(--primary);
    background: var(--bg-surface);
  }

  .user-avatar {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg var(--in-oklab), var(--primary), var(--accent));
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.12;
    min-width: 0;
  }

  .user-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    max-width: 155px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .user-title {
    font-size: 0.62rem;
    color: var(--text-muted);
    white-space: nowrap;
    max-width: 155px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cloud-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    min-block-size: 34px;
    block-size: 34px;
    padding: 0 0.7rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-pill);
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    white-space: nowrap;
  }

  .cloud-status-badge.cloud-online {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
  }

  .cloud-status-badge.is-broker-badge {
    cursor: pointer;
    background: var(--primary-light);
    border-color: var(--primary-border);
    color: var(--primary);
  }

  .cloud-status-badge.is-broker-badge:hover {
    border-color: var(--primary);
  }

  #headerTeamName {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 145px;
  }

  .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success-bright);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px var(--success-bg);
  }

  .btn-outline-pricing {
    display: inline-flex;
    align-items: center;
    gap: 0.36rem;
    min-block-size: 34px;
    block-size: 34px;
    padding: 0 0.65rem 0 0.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  }

  .btn-outline-pricing:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-xs);
  }

  .pricing-plan-badge {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.16rem 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  /* Theme Toggle Icon Swap */
  .btn-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 34px;
    block-size: 34px;
    min-inline-size: 34px;
    min-block-size: 34px;
    padding: 0;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease, transform var(--duration-fast) ease;
  }

  .btn-theme-toggle:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
  }

  .btn-theme-toggle .theme-icon {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* Light mode: show moon icon, hide sun */
  .btn-theme-toggle .sun-icon { display: none; }
  .btn-theme-toggle .moon-icon { display: block; }

  /* Dark mode: show sun icon, hide moon */
  [data-theme="dark"] .btn-theme-toggle .sun-icon,
  :root:has(> head > meta[name="color-scheme"][content="dark"]) .btn-theme-toggle .sun-icon {
    display: block;
    color: #fbbf24;
  }

  [data-theme="dark"] .btn-theme-toggle .moon-icon,
  :root:has(> head > meta[name="color-scheme"][content="dark"]) .btn-theme-toggle .moon-icon {
    display: none;
  }

  /* Broker Representation & Guest Banners */
  .broker-active-client-banner {
    background: linear-gradient(90deg var(--in-oklab), rgba(37, 99, 235, 0.1), rgba(2, 132, 199, 0.08));
    border-bottom: 1px solid var(--primary-border);
    padding: 0.65rem clamp(1rem, 2.5vw, 1.75rem);
  }

  .broker-banner-container {
    max-width: 1520px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .broker-banner-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-main);
  }

  .broker-banner-icon {
    font-size: 1.1rem;
  }

  .broker-badge-pill {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.18rem 0.55rem;
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    border: 1px solid var(--primary-border);
    color: var(--primary);
  }

  .broker-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .guest-promo-banner {
    background: linear-gradient(90deg var(--in-oklab), rgba(37, 99, 235, 0.08), rgba(16, 185, 129, 0.06));
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem clamp(1rem, 2.5vw, 1.75rem);
  }

  .guest-banner-content {
    max-width: 1520px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .guest-banner-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.85rem;
    color: var(--text-main);
  }

  .guest-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  /* Main Container & Tab Panes */
  .main-content {
    width: 100%;
    max-width: 1520px;
    margin: 0 auto;
    padding: clamp(1rem, 2.2vw, 1.75rem) clamp(0.85rem, 2.2vw, 1.75rem) 3rem;
    flex: 1 0 auto;
  }

  .tab-pane {
    display: none;
  }

  .tab-pane.active {
    display: block;
    animation: paneFadeIn 220ms var(--ease-out);
  }

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

  /* Split Grid for Single Invoice Workspace */
  .workspace-grid {
    display: grid;
    grid-template-columns: minmax(430px, 1.02fr) minmax(460px, 0.98fr);
    gap: 1.35rem;
    align-items: start;
  }

  .directory-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.35rem;
  }

  /* Accessible Responsive Table Wrapper & Performance Containment */
  .table-responsive,
  .batch-data-table-container {
    width: 100%;
    container-type: inline-size;
    overflow: auto;
    max-block-size: min(70dvh, 780px);
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    content-visibility: auto;
    contain-intrinsic-size: auto 300px auto 800px;
  }

  .table-responsive thead,
  .batch-data-table-container thead {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
  }

  @supports not (content-visibility: auto) {
    .table-responsive,
    .batch-data-table-container,
    .landing-bento-grid,
    .landing-faq-section {
      contain: layout style paint;
    }
  }

  @container (width < 600px) {
    .data-table thead,
    .list-table thead,
    .batch-master-table thead {
      display: none;
    }

    .data-table tbody tr:not(.batch-detail-row),
    .list-table tbody tr,
    .batch-master-table tbody tr:not(.batch-detail-row) {
      display: block;
      border-bottom: 2px solid var(--border-color);
      padding: 0.35rem 0;
    }

    .data-table tbody td[data-label],
    .list-table tbody td[data-label],
    .batch-master-table tbody td[data-label] {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.75rem;
      padding: 0.45rem 0.75rem;
      text-align: right;
      border-bottom: 1px solid var(--border-subtle);
      width: 100%;
    }

    .data-table tbody td[data-label]::before,
    .list-table tbody td[data-label]::before,
    .batch-master-table tbody td[data-label]::before {
      content: attr(data-label);
      font-weight: 700;
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.03em;
      color: var(--text-muted);
      text-align: left;
      flex: 0 0 auto;
    }
  }

  .table-responsive:focus-visible,
  .batch-data-table-container:focus-visible {
    outline: 2.5px solid var(--primary);
    outline-offset: 2px;
  }

  /* Persistent Legal Footer */
  .app-legal-footer {
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    padding: 1.5rem clamp(1rem, 2.5vw, 1.75rem);
    margin-top: auto;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
  }

  .legal-footer-container {
    max-width: 1520px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
  }

  .legal-footer-left {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .legal-brand {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-main);
  }

  .legal-footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    flex-wrap: balance;
    gap: 0.35rem 0.65rem;
  }

  .legal-link-btn {
    background: none;
    border: none;
    padding: 0.25rem 0.35rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
  }

  .legal-link-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
  }

  .legal-footer-seo-bar {
    max-width: 1520px;
    margin: 0.9rem auto 0;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    flex-wrap: balance;
    gap: 0.45rem 0.75rem;
    font-size: 0.78rem;
  }

  .seo-footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-xs);
    transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
  }

  .seo-footer-link:hover {
    color: var(--primary);
    background: var(--primary-light);
    text-decoration: underline;
  }
}

/* --------------------------------------------------------------------------
   5. COMPONENTS LAYER (Cards, Buttons, Forms, Combobox, Tables, Modals, Toasts)
   -------------------------------------------------------------------------- */
@layer components {
  /* Card Containers — overflow: visible preserved for searchable comboboxes */
  .card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    overflow: visible;
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-base) var(--ease-out);
  }

  .card:hover {
    border-color: var(--border-strong);
  }

  .card-header {
    padding: 0.9rem 1.25rem;
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .card-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .card-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .card-title svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
    flex-shrink: 0;
  }

  .card-body {
    padding: 1.25rem;
  }

  /* Enterprise Step Badges & Form Section Polishing */
  .step-heading-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
  }

  .form-section > .step-heading-group {
    margin-bottom: 0.85rem;
  }

  .form-section-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
  }

  .line-item-actions {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    flex-wrap: wrap;
  }

  .declaration-toggles-row {
    margin-top: -0.15rem;
    margin-bottom: 0.5rem;
  }

  .declaration-toggles-box {
    display: flex;
    flex-direction: column;
    gap: 0.48rem;
    padding: 0.65rem 0.8rem;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
  }

  .declaration-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .declaration-toggle-item.has-divider {
    border-top: 1px dashed var(--border-color);
    padding-top: 0.48rem;
  }

  .declaration-toggle-item .toggle-label {
    font-size: 0.8125rem;
    margin: 0;
  }

  .info-tooltip-wrapper {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
  }

  .info-tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: help;
    transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
  }

  .info-tooltip-icon:hover {
    background: var(--primary-light);
    color: var(--primary);
  }

  .step-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-pill);
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    white-space: nowrap;
  }

  /* Live Pre-Flight Compliance Strip */
  .single-compliance-strip {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.15rem;
    margin-bottom: 1.15rem;
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
  }

  .compliance-strip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .compliance-strip-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-main);
  }

  .compliance-strip-title svg {
    width: 15px;
    height: 15px;
    color: var(--primary);
  }

  .compliance-strip-summary {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
  }

  .compliance-strip-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .compliance-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.24rem 0.65rem;
    border-radius: var(--radius-pill);
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease, color var(--duration-fast) ease;
  }

  .compliance-pill .pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gray-400);
    flex-shrink: 0;
  }

  .compliance-pill .pill-label {
    font-weight: 500;
  }

  .compliance-pill .pill-val {
    font-weight: 700;
  }

  .compliance-pill[data-status="pass"] {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
  }

  .compliance-pill[data-status="pass"] .pill-dot {
    background: var(--success-bright);
  }

  .compliance-pill[data-status="warn"] {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning);
  }

  .compliance-pill[data-status="warn"] .pill-dot {
    background: var(--warning-bright);
  }

  .compliance-pill[data-status="fail"] {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
  }

  .compliance-pill[data-status="fail"] .pill-dot {
    background: var(--danger-bright);
  }

  .compliance-pill[data-status="info"] {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info);
  }

  .compliance-pill[data-status="info"] .pill-dot {
    background: var(--primary);
  }

  /* Draft Status & Step 3 Running Totals Pill */
  .draft-status-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.18rem 0.55rem;
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
  }

  .step3-summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.22rem 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-pill);
    user-select: none;
    white-space: nowrap;
  }

  /* Buttons Hierarchy */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.42rem;
    min-block-size: 38px;
    padding: 0.48rem 0.95rem;
    font-family: var(--font-sans);
    font-size: 0.84375rem;
    font-weight: 600;
    line-height: 1.25;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease, color var(--duration-fast) ease, transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  }

  .btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }

  .btn:hover:not(:disabled) {
    transform: translateY(-1px);
  }

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

  .btn:disabled {
    opacity: 0.56;
    cursor: not-allowed;
    transform: none;
  }

  .btn-primary {
    background: linear-gradient(180deg var(--in-oklab), var(--primary), var(--primary-hover));
    color: #ffffff;
    border-color: var(--primary-hover);
    box-shadow: 0 1px 2px rgba(11, 21, 38, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  }

  .btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg var(--in-oklab), var(--primary-hover), var(--primary-strong));
    box-shadow: var(--shadow-glow);
  }

  .btn-secondary {
    background: var(--bg-surface);
    color: var(--text-main);
    border-color: var(--border-color);
    box-shadow: var(--shadow-xs);
  }

  .btn-secondary:hover:not(:disabled) {
    background: var(--bg-surface-secondary);
    border-color: var(--border-strong);
  }

  .btn-success {
    background: linear-gradient(180deg var(--in-oklab), #10b981, #059669);
    color: #ffffff;
    border-color: #047857;
    box-shadow: 0 1px 2px rgba(4, 120, 87, 0.25);
  }

  .btn-success:hover:not(:disabled) {
    background: linear-gradient(180deg var(--in-oklab), #059669, #047857);
  }

  .btn-warning {
    background: linear-gradient(180deg var(--in-oklab), #f59e0b, #d97706);
    color: #111827;
    border-color: #b45309;
    font-weight: 700;
  }

  .btn-danger {
    background: linear-gradient(180deg var(--in-oklab), #ef4444, #dc2626);
    color: #ffffff;
    border-color: #b91c1c;
  }

  .btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary-border);
  }

  .btn-outline-primary:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary);
  }

  .btn-outline-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
  }

  .btn-outline-secondary:hover:not(:disabled) {
    background: var(--bg-surface-secondary);
    color: var(--text-main);
    border-color: var(--border-strong);
  }

  .btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger-border);
  }

  .btn-outline-danger:hover:not(:disabled) {
    background: var(--danger-bg);
    border-color: var(--danger);
  }

  .btn-outline-warning {
    background: transparent;
    color: var(--warning);
    border-color: var(--warning-border);
  }

  .btn-outline-warning:hover:not(:disabled) {
    background: var(--warning-bg);
    border-color: var(--warning);
  }

  .btn-outline-info {
    background: transparent;
    color: var(--info);
    border-color: var(--info-border);
  }

  .btn-outline-info:hover:not(:disabled) {
    background: var(--info-bg);
    border-color: var(--info);
  }

  .btn-link {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: 0.25rem 0.45rem;
    min-block-size: auto;
  }

  .btn-link:hover:not(:disabled) {
    text-decoration: underline;
    transform: none;
  }

  .btn-sm {
    min-block-size: 32px;
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
  }

  .btn-xs {
    min-block-size: 26px;
    padding: 0.18rem 0.5rem;
    font-size: 0.72rem;
    border-radius: var(--radius-xs);
  }

  .btn-lg {
    min-block-size: 46px;
    padding: 0.72rem 1.35rem;
    font-size: 0.96rem;
    border-radius: var(--radius);
  }

  .btn-block {
    width: 100%;
    display: flex;
  }

  .loading-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: val-spin 0.65s linear infinite;
  }

  /* Semantic Badges & Mini Pills */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.18rem 0.52rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: var(--bg-surface-secondary);
    color: var(--text-main);
    white-space: nowrap;
  }

  .badge-primary {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-border);
  }

  .badge-secondary {
    background: var(--bg-surface-secondary);
    color: var(--text-muted);
    border-color: var(--border-color);
  }

  .badge-success,
  .badge-positive {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success-border);
  }

  .badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: var(--warning-border);
  }

  .badge-danger,
  .badge-negative {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger-border);
  }

  .badge-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: var(--info-border);
  }

  .badge-mini {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.1rem 0.42rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
    white-space: nowrap;
  }

  .badge-mini-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success-border);
  }

  .badge-mini-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger-border);
  }

  .badge-mini-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: var(--info-border);
  }

  .beta-pill,
  .beta-tag {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.12rem 0.42rem;
    border-radius: var(--radius-xs);
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--info-border);
  }

  /* Forms, Field Grids & Controls */
  .form-section {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .form-section:first-child {
    padding-top: 0;
  }

  .form-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .form-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
  }

  .form-section-header h3,
  .section-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.45rem;
  }

  .form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 0.85rem;
  }

  .form-row:last-child {
    margin-bottom: 0;
  }

  .form-row-3col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-row-4col {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .col-span-2 {
    grid-column: span 2;
  }

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

  .form-group label {
    font-size: 0.78125rem;
    font-weight: 600;
    color: var(--text-label);
    margin-bottom: 0.32rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
  }

  .required {
    color: var(--danger);
    font-weight: 700;
  }

  .form-control {
    width: 100%;
    min-block-size: 40px;
    padding: 0.48rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--text-main);
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 1px 2px rgba(11, 21, 38, 0.03);
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease, background var(--duration-fast) ease;
  }

  .form-control::placeholder {
    color: var(--gray-400);
  }

  .form-control:hover:not(:disabled) {
    border-color: var(--border-strong);
  }

  .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px var(--focus-ring);
  }

  .form-control-sm {
    min-block-size: 32px;
    padding: 0.3rem 0.6rem;
    font-size: 0.8125rem;
  }

  textarea.form-control {
    min-block-size: 76px;
    resize: vertical;
  }

  select.form-control {
    cursor: pointer;
  }

  .checkbox-label,
  .toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.84375rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
  }

  .checkbox-label input[type="checkbox"],
  .toggle-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
  }

  /* Progressive Disclosure Details Drawers */
  .form-optional-drawer {
    margin-top: 0.85rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-surface-secondary);
  }

  .form-optional-summary {
    padding: 0.65rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
  }

  .form-optional-summary::-webkit-details-marker {
    display: none;
  }

  .summary-title {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
  }

  .summary-hint {
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--text-muted);
  }

  .optional-pill {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
  }

  .drawer-body {
    padding: 0.9rem;
    border-top: 1px solid var(--border-color);
  }

  /* Dynamic Incoterm Helper */
  .incoterm-helper-text {
    margin-top: 0.4rem;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-secondary);
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-xs);
    padding: 0.42rem 0.65rem;
  }

  .incoterm-helper-text strong {
    color: var(--primary);
    font-weight: 700;
  }

  /* Customs Validation Badges & Input States */
  .val-badge {
    display: none;
    align-items: center;
    gap: 0.32rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.18rem 0.5rem;
    border-radius: var(--radius-xs);
    margin-top: 0.3rem;
    line-height: 1.25;
  }

  .val-valid {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
  }

  .val-invalid {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
  }

  .val-loading {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
  }

  .val-info {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
  }

  .val-spinner {
    width: 10px;
    height: 10px;
    border: 1.5px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: val-spin 0.6s linear infinite;
  }

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

  .val-description {
    display: none;
    font-size: 0.74rem;
    color: var(--text-muted);
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    padding: 0.38rem 0.6rem;
    border-radius: var(--radius-xs);
    margin-top: 0.3rem;
    line-height: 1.38;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .is-valid-customs {
    border-color: var(--success-bright) !important;
  }

  .is-invalid-customs {
    border-color: var(--danger-bright) !important;
  }

  /* Line Items Cards */
  .items-container {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
  }

  .line-item-card {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.95rem 1rem;
    position: relative;
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  }

  .line-item-card:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow-xs);
  }

  .line-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--border-subtle);
  }

  .line-item-number {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    padding: 0.16rem 0.55rem;
    border-radius: var(--radius-pill);
  }

  .duplicate-item-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
  }

  /* Searchable Combobox */
  .searchable-combobox {
    position: relative;
    width: 100%;
  }

  .combobox-control {
    position: relative;
    display: flex;
    align-items: center;
  }

  .combobox-control .search-icon {
    position: absolute;
    left: 0.75rem;
    width: 15px;
    height: 15px;
    color: var(--text-muted);
    pointer-events: none;
    stroke: currentColor;
    fill: none;
  }

  .combobox-input {
    width: 100%;
    padding-left: 2.2rem !important;
    padding-right: 3.8rem !important;
    cursor: text;
  }

  .combobox-actions {
    position: absolute;
    right: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.2rem;
  }

  .combobox-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    min-inline-size: 28px;
    min-block-size: 28px;
    padding: 0.2rem 0.38rem;
    font-size: 0.8rem;
    border-radius: var(--radius-xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
  }

  .combobox-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
  }

  .combobox-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 290px;
    overflow-y: auto;
    z-index: 600;
    animation: fadeInDown 140ms var(--ease-out);
  }

  .combobox-option {
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--duration-fast) ease;
  }

  .combobox-option:last-child {
    border-bottom: none;
  }

  .combobox-option:hover,
  .combobox-option.active-option {
    background: var(--primary-light);
    color: var(--text-main);
  }

  .combobox-group-header {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.45rem 0.85rem;
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-subtle);
  }

  .combobox-option-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-main);
  }

  .combobox-option-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 0.18rem;
  }

  .combobox-empty {
    padding: 0.9rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
  }

  /* Recent Invoices & Utility Dropdowns */
  .dropdown-wrapper {
    position: relative;
  }

  .dropdown-menu,
  .recent-invoices-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 280px;
    max-width: min(360px, 92vw);
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
    z-index: 450;
    display: none;
  }

  .dropdown-menu.show,
  .recent-invoices-menu.show {
    display: block;
    animation: fadeInDown 140ms var(--ease-out);
  }

  .recent-invoices-menu-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: var(--radius-xs);
    padding: 0.55rem 0.7rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    color: var(--text-main);
    transition: background var(--duration-fast) ease;
  }

  .recent-invoices-menu-item:hover {
    background: var(--primary-light);
  }

  .menu-item-primary {
    font-weight: 700;
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .menu-item-secondary {
    font-size: 0.74rem;
    color: var(--text-muted);
  }

  .recent-invoices-menu-empty {
    padding: 1rem 0.75rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
  }

  /* Data Tables */
  .data-table,
  .list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84375rem;
  }

  .data-table th,
  .list-table th {
    background: var(--bg-surface-secondary);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.72rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
  }

  .data-table td,
  .list-table td {
    padding: 0.78rem 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
    vertical-align: middle;
  }

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

  .data-table tbody tr:hover td,
  .list-table tbody tr:hover td {
    background: var(--bg-surface-secondary);
  }

  .search-filter-input {
    max-width: 300px;
  }

  /* KPI Grid */
  .batch-kpi-grid,
  .broker-kpi-grid,
  .admin-funnel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
  }

  .batch-kpi-card,
  .funnel-kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    overflow: hidden;
  }

  .batch-kpi-card::before,
  .funnel-kpi-card::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    height: 3px;
    background: var(--primary);
  }

  .batch-kpi-card.kpi-ready::before { background: var(--success-bright); }
  .batch-kpi-card.kpi-risks::before { background: var(--warning-bright); }
  .batch-kpi-card.kpi-savings::before { background: var(--primary); }
  .batch-kpi-card.kpi-registry::before { background: var(--info); }

  .kpi-label,
  .funnel-kpi-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
  }

  .kpi-value,
  .funnel-kpi-val {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
  }

  .kpi-sub,
  .funnel-kpi-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
  }

  /* Modals (Native <dialog> top-layer geometry) */
  dialog.modal-overlay {
    margin: auto;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    width: fit-content;
    max-width: calc(100vw - 1.5rem);
    max-height: 92dvh;
    overflow: visible;
  }

  dialog.modal-overlay[open] {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalPanelIn 200ms var(--ease-out);
  }

  dialog:modal {
    overscroll-behavior: contain;
  }

  dialog::backdrop {
    background: rgba(6, 11, 22, 0.65);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    overflow: hidden;
    overscroll-behavior: contain;
    animation: modalBackdropIn 180ms ease-out;
  }

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

  .modal-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: calc(100vw - 1.5rem);
    max-width: 640px;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .pricing-modal-container {
    max-width: 1060px;
  }

  @keyframes modalPanelIn {
    from {
      opacity: 0;
      transform: translateY(10px) scale(0.985);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  .modal-header {
    padding: 1rem 1.35rem;
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
  }

  .modal-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.45rem;
  }

  .modal-close {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    min-inline-size: 34px;
    min-block-size: 34px;
    border-radius: var(--radius-sm);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast) ease, color var(--duration-fast) ease, border-color var(--duration-fast) ease;
  }

  .modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger-border);
  }

  .modal-body {
    padding: 1.25rem 1.35rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1 1 auto;
  }

  .modal-footer {
    padding: 0.9rem 1.35rem;
    background: var(--bg-surface-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.65rem;
    flex-shrink: 0;
  }

  /* Alert Boxes & Empty States */
  .alert-box {
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-surface-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
    margin-bottom: 1rem;
  }

  .empty-state {
    text-align: center;
    padding: 2.5rem 1.25rem;
    color: var(--text-muted);
    font-size: 0.875rem;
  }

  /* Toast Notifications */
  .toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: min(410px, calc(100vw - 2rem));
    pointer-events: none;
  }

  .toast {
    pointer-events: auto;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-strong);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 0.78rem 1rem;
    box-shadow: var(--shadow-lg);
    color: var(--text-main);
    font-size: 0.84rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    animation: fadeInDown 180ms var(--ease-out);
  }

  .toast.toast-success { border-left-color: var(--success-bright); }
  .toast.toast-warning { border-left-color: var(--warning-bright); }
  .toast.toast-danger,
  .toast.toast-error { border-left-color: var(--danger-bright); }
  .toast.toast-primary { border-left-color: var(--primary); }

  /* Brand Theme Color Swatches */
  .settings-brand-swatches {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.5rem;
  }

  .brand-swatch-btn {
    min-block-size: 32px;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  }

  .brand-swatch-btn:hover,
  .brand-swatch-btn.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--focus-ring);
  }

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

/* --------------------------------------------------------------------------
   6A. VIEWS LAYER — SINGLE INVOICE STUDIO, PREVIEW PAPER, BATCH, TRACKER, BROKER, AUTH
   -------------------------------------------------------------------------- */
@layer views {
  /* Sticky Studio Preview Panel — overflow: hidden preserved */
  .preview-panel {
    position: sticky;
    top: 4.45rem;
    overflow: hidden;
  }

  /* Bar 1: Primary Preview Header */
  .preview-panel .card-header,
  .preview-header {
    padding: 0.65rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .preview-title-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
  }

  .preview-card-title {
    margin: 0;
    white-space: nowrap;
  }

  .preview-primary-actions {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    flex-wrap: wrap;
  }

  .preview-primary-actions .btn-sm {
    min-block-size: 30px;
    padding: 0.25rem 0.62rem;
    font-size: 0.76rem;
  }

  .preview-primary-actions .btn-sm svg {
    width: 14px;
    height: 14px;
  }

  /* Bar 2: Structured Utility Toolbar & Theme Rail */
  .preview-subtoolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.45rem 0.75rem;
    padding: 0.45rem 1rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
  }

  .preview-toolbar {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    flex-wrap: wrap;
  }

  .btn-ghost-tool {
    min-block-size: 28px;
    padding: 0.18rem 0.55rem;
    font-size: 0.735rem;
    font-weight: 600;
    border-radius: var(--radius-xs);
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
  }

  .btn-ghost-tool svg {
    width: 13px;
    height: 13px;
    opacity: 0.8;
  }

  .btn-ghost-tool:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary-border);
    color: var(--primary);
  }

  .btn-ghost-tool:hover:not(:disabled) svg {
    opacity: 1;
  }

  .preview-mode-toggle {
    display: inline-flex;
    align-items: center;
    padding: 2px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    gap: 2px;
  }

  .preview-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.24rem 0.58rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
  }

  .preview-mode-btn svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
  }

  .preview-mode-btn:hover {
    color: var(--text-main);
  }

  .preview-mode-btn.active {
    background: var(--primary);
    color: #ffffff;
  }

  .preview-zoom-btn.active {
    background: var(--primary-light);
    border-color: var(--primary-border);
    color: var(--primary);
  }

  /* Inline Brand Theme Rail inside Bar 2 */
  .preview-color-bar,
  .preview-theme-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding: 0;
    background: transparent;
    border: none;
  }

  .color-picker-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .color-picker-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
  }

  .color-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.32rem;
  }

  .color-input-wrapper input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
  }

  .color-preview-swatch {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-xs);
    border: 2px solid var(--bg-surface);
    box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-xs);
    background-color: var(--primary);
    display: inline-block;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform var(--duration-fast) ease;
  }

  .color-preview-swatch:hover {
    transform: scale(1.08);
  }

  .color-hex-text {
    width: 74px !important;
    min-block-size: 26px !important;
    padding: 0.14rem 0.38rem !important;
    font-family: var(--font-mono) !important;
    font-size: 0.71rem !important;
    text-transform: uppercase;
  }

  .preset-colors {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.28rem;
  }

  .preset-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
    box-shadow: 0 0 0 1px var(--border-strong);
    cursor: pointer;
    padding: 0;
    transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  }

  .preset-btn:hover {
    transform: scale(1.15);
  }

  .preset-btn.active {
    box-shadow: 0 0 0 2px var(--primary);
  }

  .preset-btn-reset {
    width: auto;
    height: auto;
    border-radius: var(--radius-xs);
    padding: 0.12rem 0.42rem;
    font-size: 0.68rem;
    font-weight: 600;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease;
  }

  .preset-btn-reset:hover {
    color: var(--text-main);
    border-color: var(--border-strong);
  }

  /* Bar 3: Docked Flush Pre-Flight Compliance Strip inside Preview Panel */
  .preview-panel .single-compliance-strip {
    margin: 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: none;
    background: var(--bg-surface-secondary);
    padding: 0.5rem 1rem;
    gap: 0.38rem;
  }

  .preview-panel .compliance-strip-title {
    font-size: 0.71rem;
  }

  .preview-panel .compliance-strip-summary {
    font-size: 0.72rem;
  }

  .preview-panel .compliance-strip-pills {
    gap: 0.35rem;
  }

  .preview-panel .compliance-pill {
    font-size: 0.71rem;
    padding: 0.16rem 0.52rem;
  }

  /* Tier 1 Zero-Hold Regulatory Toggles, Description Chips & Advisor Banner */
  .declaration-toggles-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.9rem;
    padding-top: 0.55rem;
    margin-top: 0.35rem;
    border-top: 1px dashed var(--border-subtle);
  }

  .declaration-toggles-extra .toggle-chip {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    gap: 0.38rem;
  }

  .item-desc-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
  }

  .desc-suggestion-chip {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-xs);
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease;
  }

  .desc-suggestion-chip:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
  }

  .compliance-advisor-banner {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
    margin-top: 0.35rem;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.28);
    font-size: 0.73rem;
    color: var(--text-main);
  }

  .compliance-advisor-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .advisor-chip-btn {
    background: var(--bg-surface);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: var(--radius-xs);
    padding: 0.14rem 0.48rem;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
  }

  .advisor-chip-btn:hover {
    background: var(--primary);
    color: #ffffff;
  }

  /* Studio Paper Viewport */
  .invoice-preview-wrapper {
    background: var(--bg-studio);
    background-image: radial-gradient(rgba(100, 116, 139, 0.16) 1px, transparent 1px);
    background-size: 16px 16px;
    padding: 1.15rem;
    max-height: calc(100dvh - 210px);
    overflow-y: auto;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  .invoice-preview-wrapper.zoom-fit {
    padding: 0.85rem 0.5rem;
    overflow-x: hidden;
  }

  .invoice-preview-wrapper.zoom-fit .invoice-sheet {
    transform: scale(0.84);
    transform-origin: top center;
    margin-bottom: -155px;
  }

  @media (max-width: 1200px) {
    .invoice-preview-wrapper.zoom-fit .invoice-sheet {
      transform: scale(0.72);
      margin-bottom: -280px;
    }
  }

  @media (max-width: 768px) {
    .invoice-preview-wrapper.zoom-fit .invoice-sheet {
      transform: scale(0.54);
      margin-bottom: -460px;
    }
  }

  /* Commercial Invoice Document Sheet (A4 Proportion Paper) */
  .invoice-sheet {
    --inv-theme: var(--primary);
    background: #ffffff;
    width: 100%;
    max-width: 800px;
    min-height: 1020px;
    padding: 2.2rem;
    box-shadow: var(--shadow-lg);
    color: #111827;
    font-family: var(--font-sans);
    font-size: 9.5pt;
    line-height: 1.35;
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 3px;
  }

  [data-theme="dark"] .invoice-sheet {
    background: #0f172a;
    color: #f1f5f9;
    border: 1px solid #263652;
    box-shadow: var(--shadow-xl);
  }

  [data-theme="dark"] .inv-title-area p,
  [data-theme="dark"] .inv-meta-label,
  [data-theme="dark"] .party-address,
  [data-theme="dark"] .party-tax-row,
  [data-theme="dark"] .item-desc-cell span,
  [data-theme="dark"] .inv-declaration-box,
  [data-theme="dark"] .sign-line {
    color: var(--text-muted);
  }

  [data-theme="dark"] .inv-meta-val,
  [data-theme="dark"] .party-name,
  [data-theme="dark"] .item-desc-cell strong,
  [data-theme="dark"] .inv-table td {
    color: var(--text-main);
  }

  [data-theme="dark"] .inv-company-logo { border-right-color: var(--border-color); }
  [data-theme="dark"] .party-box,
  [data-theme="dark"] .logistics-totals-box { background: var(--bg-surface-secondary); border-color: var(--border-color); }
  [data-theme="dark"] .party-title { border-bottom-color: var(--border-color); }
  [data-theme="dark"] .party-tax-row { border-top-color: var(--border-color); }
  [data-theme="dark"] .shipment-bar {
    background: color-mix(in srgb, var(--inv-theme, var(--primary)) 15%, var(--bg-surface-secondary));
    border-color: color-mix(in srgb, var(--inv-theme, var(--primary)) 32%, transparent);
  }
  [data-theme="dark"] .shipment-bar-item:not(:last-child) {
    border-right-color: color-mix(in srgb, var(--inv-theme, var(--primary)) 32%, transparent);
  }
  [data-theme="dark"] .inv-table td { border-color: var(--border-color); }
  [data-theme="dark"] .inv-table tbody tr:nth-child(even) {
    background-color: color-mix(in srgb, var(--inv-theme, var(--primary)) 10%, var(--bg-surface));
  }
  [data-theme="dark"] .totals-row.strong { border-top-color: var(--border-color); }
  [data-theme="dark"] .financial-totals-table tr.grand-total {
    background: color-mix(in srgb, var(--inv-theme, var(--primary)) 15%, var(--bg-surface-secondary));
  }
  [data-theme="dark"] .inv-declaration-box,
  [data-theme="dark"] .sign-line { border-top-color: var(--border-color); }
  [data-theme="dark"] .party-contact { color: #94a3b8; }
  [data-theme="dark"] .party-contact strong { color: #e2e8f0; }

  .inv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--inv-theme, var(--primary));
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
  }

  .inv-title-area {
    display: flex;
    align-items: center;
    gap: 0.85rem;
  }

  .inv-title-area h2 {
    font-size: 18pt;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--inv-theme, var(--primary));
    text-transform: uppercase;
  }

  .inv-title-area p {
    font-size: 8.5pt;
    color: #4b5563;
    margin-top: 2px;
  }

  .inv-company-logo {
    max-height: 54px;
    max-width: 160px;
    object-fit: contain;
    flex-shrink: 0;
    border-right: 1.5px solid #e5e7eb;
    padding-right: 0.85rem;
  }

  .inv-meta-grid {
    display: grid;
    grid-template-columns: auto auto;
    gap: 0.25rem 1.25rem;
    font-size: 8.5pt;
  }

  .inv-meta-label { font-weight: 700; color: #374151; }
  .inv-meta-val { font-weight: 600; color: #111827; }

  .inv-parties-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1rem;
  }

  .party-box {
    border: 1px solid #9ca3af;
    padding: 0.65rem 0.8rem;
    border-radius: 2px;
    background: #fafafa;
    overflow: hidden;
    overflow-wrap: break-word;
  }

  .party-title {
    font-size: 8.5pt;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--inv-theme, var(--primary));
    border-bottom: 1px solid #d1d5db;
    padding-bottom: 0.25rem;
    margin-bottom: 0.4rem;
  }

  .party-name { font-size: 10pt; font-weight: 700; color: #111827; margin-bottom: 0.2rem; }
  .party-address { white-space: pre-line; font-size: 8.5pt; color: #374151; margin-bottom: 0.4rem; min-height: 2.8em; overflow-wrap: break-word; }
  .party-contact { font-size: 8pt; color: #4b5563; margin-bottom: 0.4rem; overflow-wrap: anywhere; line-height: 1.35; }
  .party-contact strong { color: #374151; }
  .party-tax-row { display: flex; justify-content: space-between; font-size: 8pt; color: #374151; padding-top: 0.25rem; border-top: 1px dashed #e5e7eb; }

  .shipment-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    background: color-mix(in srgb, var(--inv-theme, var(--primary)) 6%, #ffffff);
    border: 1px solid color-mix(in srgb, var(--inv-theme, var(--primary)) 25%, #ffffff);
    padding: 0.5rem 0.75rem;
    font-size: 8pt;
    margin-bottom: 1rem;
  }

  .shipment-bar-item { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
  .shipment-bar-item:not(:last-child) { border-right: 1px solid color-mix(in srgb, var(--inv-theme, var(--primary)) 20%, transparent); }
  .shipment-bar-item strong { display: block; font-size: 7pt; color: var(--inv-theme, var(--primary)); text-transform: uppercase; margin-bottom: 2px; }

  .inv-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: 8.5pt; }
  .inv-table th {
    background: var(--inv-theme, var(--primary));
    color: #ffffff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 7.5pt;
    letter-spacing: 0.03em;
    padding: 0.45rem 0.5rem;
    border: 1px solid var(--inv-theme, var(--primary));
    text-align: left;
  }
  .inv-table th.text-right, .inv-table td.text-right { text-align: right; }
  .inv-table th.text-center, .inv-table td.text-center { text-align: center; }
  .inv-table td { padding: 0.45rem 0.5rem; border: 1px solid #d1d5db; color: #1f2937; vertical-align: top; }
  .inv-table tbody tr:nth-child(even) { background-color: color-mix(in srgb, var(--inv-theme, var(--primary)) 3%, #ffffff); }
  .item-desc-cell strong { display: block; font-weight: 700; color: #111827; }
  .item-desc-cell span { font-size: 7.5pt; color: #6b7280; }

  .inv-summary-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 1.5rem; margin-bottom: 1rem; }
  .logistics-totals-box { border: 1px solid #d1d5db; padding: 0.5rem 0.75rem; font-size: 8.5pt; background: #f9fafb; }
  .totals-row { display: flex; justify-content: space-between; padding: 0.2rem 0; }
  .totals-row.strong { font-weight: 700; border-top: 1px solid #d1d5db; margin-top: 0.25rem; padding-top: 0.25rem; }
  .financial-totals-table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  .financial-totals-table td { padding: 0.25rem 0.4rem; }
  .financial-totals-table tr.grand-total {
    font-size: 10pt;
    font-weight: 800;
    border-top: 2px solid var(--inv-theme, var(--primary));
    border-bottom: 2px solid var(--inv-theme, var(--primary));
    background: color-mix(in srgb, var(--inv-theme, var(--primary)) 8%, #ffffff);
  }

  .inv-declaration-box { margin-top: auto; border-top: 1px solid #9ca3af; padding-top: 0.65rem; font-size: 7.5pt; color: #4b5563; }
  .declaration-statement { margin-bottom: 0.75rem; font-style: italic; line-height: 1.3; }
  .origin-statement-box, .statutory-clause-box {
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.25);
    padding: 0.45rem 0.65rem;
    border-radius: 3px;
    margin-bottom: 0.6rem;
    font-size: 7.5pt;
    line-height: 1.35;
  }
  .inv-seal-row {
    margin-top: 0.6rem;
    padding-top: 0.4rem;
    border-top: 1px dashed #cbd5e1;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 6.8pt;
    color: var(--text-muted);
  }
  .inv-watermark-footer {
    margin-top: 0.65rem;
    padding: 0.38rem 0.5rem;
    text-align: center;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    border-radius: 3px;
    font-size: 7pt;
    font-weight: 700;
  }
  .signoff-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 0.5rem; }
  .sign-line { border-top: 1px solid #4b5563; padding-top: 0.25rem; font-size: 7.5pt; color: #374151; text-transform: uppercase; }

  /* Signature Pad & Canvas */
  .signature-box {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    background: #ffffff;
    padding: 0.85rem;
    text-align: center;
  }
  .signature-canvas {
    width: 100%;
    max-width: 360px;
    height: 120px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: #ffffff;
    touch-action: none;
    cursor: crosshair;
    display: block;
    margin: 0 auto 0.55rem auto;
  }
  .signature-preview-img {
    max-height: 60px;
    max-width: 200px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid var(--gray-300);
    padding: 4px;
    border-radius: var(--radius-xs);
  }

  .beta-autofill-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.55rem;
    padding: 0.52rem 0.78rem;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    margin-top: 0.15rem;
    margin-bottom: 0.75rem;
  }

  /* Batch Rollout Workbench */
  .batch-toolbar-top,
  .batch-bulk-apply-bar,
  .batch-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.85rem 1.05rem;
    border-radius: var(--radius);
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
  }

  .beta-bar-label,
  .bulk-bar-label,
  .beta-bar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 700;
  }

  .bulk-select {
    max-width: 185px;
  }

  .batch-upload-zone {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.08), transparent 65%), var(--bg-surface-secondary);
    padding: 2rem 1.5rem 1.65rem;
    text-align: center;
    cursor: pointer;
    margin-bottom: 1.25rem;
    transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  }

  .batch-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
  }

  .batch-upload-zone:hover,
  .batch-upload-zone.dragover {
    border-color: var(--primary);
    background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.14), transparent 65%), var(--primary-light);
    box-shadow: inset 0 0 0 1px var(--primary-border);
  }

  .upload-icon-badge {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
  }

  .upload-icon {
    width: 26px;
    height: 26px;
    margin: 0;
    color: var(--primary);
  }

  .upload-copy {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 520px;
  }

  .upload-title {
    margin: 0;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-main);
  }

  .upload-subtitle {
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.45;
  }

  .upload-actions-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.15rem;
  }

  .btn-browse-csv {
    pointer-events: none;
  }

  .batch-upload-zone:hover .btn-browse-csv {
    background: linear-gradient(180deg var(--in-oklab), var(--primary-hover), var(--primary-strong));
    box-shadow: var(--shadow-glow);
  }

  .btn-sample-demo {
    position: relative;
    z-index: 5;
  }

  .upload-format-chips {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.2rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
    width: 100%;
    max-width: 680px;
  }

  .upload-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
  }

  .batch-filter-group,
  .batch-filter-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .batch-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-block-size: 34px;
    padding: 0.35rem 0.78rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
  }

  .batch-filter-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
  }

  .batch-filter-btn.batch-filter-risk.active {
    background: var(--warning-bright);
    color: #111827;
    border-color: #d97706;
  }

  .batch-filter-btn.batch-filter-ready.active {
    background: var(--success-bright);
    color: #ffffff;
    border-color: #059669;
  }

  .batch-filter-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 0.08rem 0.42rem;
    border-radius: var(--radius-pill);
    background: rgba(15, 23, 42, 0.08);
  }

  .batch-filter-btn.active .batch-filter-count {
    background: rgba(255, 255, 255, 0.24);
  }

  .batch-table,
  .batch-master-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
  }

  .batch-table th,
  .batch-master-table th {
    background: var(--bg-surface-secondary);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.72rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
  }

  .batch-table td,
  .batch-master-table td {
    padding: 0.72rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
  }

  .batch-master-row.has-risks {
    background: rgba(245, 158, 11, 0.04);
  }

  .batch-master-row.is-expanded {
    background: var(--primary-light);
  }

  .batch-expand-btn {
    min-inline-size: 28px;
    min-block-size: 28px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 0.35rem;
    transition: transform var(--duration-fast) ease, background var(--duration-fast) ease;
  }

  .batch-expand-btn svg {
    width: 14px;
    height: 14px;
    transition: transform var(--duration-fast) ease;
  }

  .batch-master-row.is-expanded .batch-expand-btn svg {
    transform: rotate(90deg);
  }

  .batch-issue-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .batch-issue-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.14rem 0.48rem;
    border-radius: var(--radius-pill);
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
    cursor: pointer;
  }

  .batch-status-ready {
    display: inline-flex;
    align-items: center;
  }

  .batch-status-risk-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .batch-risk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    flex-wrap: wrap;
  }

  .batch-fix-hint {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-pill);
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
  }

  .batch-fix-hint:hover {
    background: var(--primary);
    color: #ffffff;
  }

  .btn-row-chevron {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 26px;
    height: 26px;
    border-radius: var(--radius-xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--duration-fast) ease, border-color var(--duration-fast) ease, color var(--duration-fast) ease;
  }

  .btn-row-chevron.is-expanded {
    transform: rotate(90deg);
    color: var(--primary);
    border-color: var(--primary-border);
  }

  .batch-sku-count-pill {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.14rem 0.5rem;
    border-radius: var(--radius-xs);
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
  }

  .batch-sku-preview {
    font-size: 0.74rem;
    color: var(--text-muted);
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Expandable Remediation Drawer */
  .batch-detail-drawer > td {
    padding: 0 !important;
    background: var(--bg-surface-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: normal !important;
  }

  .batch-diagnostic-pass {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    margin-bottom: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success);
    font-size: 0.825rem;
    font-weight: 600;
  }

  .batch-drawer-inner {
    padding: 1.35rem 1.5rem;
    background: var(--bg-surface-secondary);
    border-top: 2px solid var(--primary-border);
  }

  .batch-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--border-color);
  }

  .batch-drawer-diagnostic {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 1.15rem;
  }

  .batch-diagnostic-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.45rem;
    font-size: 0.8rem;
    padding: 0.4rem 0.65rem;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--warning-border);
  }

  .batch-diagnostic-item-text {
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .batch-drawer-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .batch-drawer-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
  }

  .batch-drawer-field label {
    display: block;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
  }

  .batch-drawer-input,
  .batch-cell-input {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.38rem 0.58rem;
    min-block-size: 34px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    background: var(--input-bg);
    color: var(--text-main);
  }

  textarea.batch-drawer-input {
    min-block-size: 56px;
    line-height: 1.35;
  }

  .batch-input-error {
    border-color: var(--danger-bright) !important;
    background-color: var(--danger-bg) !important;
  }

  .batch-input-valid {
    border-color: var(--success-bright) !important;
  }

  .batch-subtable-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    margin-bottom: 0.75rem;
  }

  .batch-subtable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
  }

  .batch-subtable th {
    background: var(--bg-surface-secondary);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.58rem 0.55rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
  }

  .batch-subtable th:first-child,
  .batch-subtable td.batch-subtable-idx {
    width: 44px;
    padding-left: 0.85rem;
    text-align: center;
    color: var(--text-muted);
  }

  .batch-subtable td {
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    white-space: nowrap;
  }

  .batch-subtable tbody tr:last-child td {
    border-bottom: none;
  }

  .batch-hs-input-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  .btn-batch-find-hs {
    inline-size: 34px;
    block-size: 34px;
    min-inline-size: 34px;
    min-block-size: 34px;
    padding: 0;
    flex-shrink: 0;
    border-radius: var(--radius-xs);
  }

  .btn-batch-find-hs svg {
    width: 14px;
    height: 14px;
  }

  .batch-item-total {
    padding-right: 0.85rem !important;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-main);
  }

  .batch-subtable-col-act,
  .batch-subtable-act {
    width: 54px;
    padding-right: 0.75rem !important;
  }

  .btn-batch-remove-row {
    inline-size: 32px;
    block-size: 32px;
    min-inline-size: 32px;
    min-block-size: 32px;
    padding: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .btn-batch-remove-row svg {
    width: 15px;
    height: 15px;
  }

  .btn-batch-remove-row:hover:not(:disabled) {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
  }

  .batch-audit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .batch-audit-title-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .batch-audit-heading {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
  }

  .batch-audit-subheading {
    font-size: 0.8rem;
    color: var(--text-muted);
  }

  .batch-audit-action-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .progress-bar-track {
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-top: 0.45rem;
  }

  .progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg var(--in-oklab), var(--primary), var(--success-bright));
    transition: width 260ms var(--ease-out);
  }

  /* Tracker, Notes Timeline & Broker Switcher */
  .category-btn {
    min-block-size: 36px;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--duration-fast) ease;
  }

  .category-btn.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-border);
    font-weight: 700;
  }

  .invoice-pill-btn {
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid var(--primary-border);
    color: var(--primary);
    border-radius: var(--radius-pill);
    padding: 0.16rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
  }

  .tracker-note-snippet {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    padding: 0.16rem 0.48rem;
    border-radius: var(--radius-xs);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 280px;
    cursor: pointer;
  }

  .tracker-note-snippet .note-snippet-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .notes-quick-chip {
    background: var(--bg-surface-secondary);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.28rem 0.65rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all var(--duration-fast) ease;
  }

  .notes-quick-chip:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
  }

  .notes-input-card {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.9rem;
  }

  .notes-timeline-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.78rem 0.9rem;
    margin-bottom: 0.65rem;
  }

  .notes-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
  }

  .notes-author-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    font-size: 0.8rem;
  }

  .notes-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Broker Portfolio & Client Switcher */
  .client-switcher-wrapper {
    position: relative;
  }

  .broker-switcher-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(330px, 92vw);
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInDown 150ms var(--ease-out);
  }

  .switcher-menu-header {
    padding: 0.78rem 0.9rem;
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-color);
  }

  .switcher-menu-title {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
  }

  .switcher-active-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.18rem;
  }

  .switcher-search-box {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
  }

  .switcher-search-box input {
    width: 100%;
    padding: 0.42rem 0.65rem;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    background: var(--input-bg);
    color: var(--text-main);
  }

  .switcher-clients-list {
    max-height: 240px;
    overflow-y: auto;
  }

  .switcher-client-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.62rem 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--duration-fast) ease;
  }

  .switcher-client-item:hover {
    background: var(--primary-light);
  }

  .switcher-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
  }

  .switcher-item-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
  }

  .switcher-item-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
  }

  .switcher-check {
    color: var(--primary);
    font-weight: 800;
    font-size: 0.85rem;
  }

  .switcher-arrow,
  .switcher-demo-caret {
    font-size: 0.72rem;
    opacity: 0.75;
    flex-shrink: 0;
  }

  .notes-empty-state {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
  }

  .notes-item-text {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
  }

  .note-snippet-date {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
  }

  .link-open-shipment,
  .link-preview-invoice {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
  }

  .link-open-shipment:hover,
  .link-preview-invoice:hover {
    text-decoration: underline;
  }

  .switcher-menu-footer {
    padding: 0.6rem 0.75rem;
    background: var(--bg-surface-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
  }

  .broker-portfolio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
  }

  .broker-feed-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .user-table-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Auth Modal & Studio Card (#authScreen Native <dialog>) */
  dialog.auth-page-wrapper.auth-modal-overlay {
    margin: auto;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    width: min(calc(100vw - 1.5rem), 480px);
    max-width: 480px;
    max-height: 92dvh;
    overflow: visible;
  }

  dialog.auth-page-wrapper.auth-modal-overlay[open] {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalPanelIn 220ms var(--ease-out);
  }

  dialog.auth-page-wrapper.auth-modal-overlay::backdrop {
    background: rgba(6, 11, 22, 0.72);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    overflow: hidden;
    overscroll-behavior: contain;
  }

  .auth-theme-corner {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1320;
  }

  .auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    margin: auto;
    position: relative;
    overflow: hidden;
    animation: modalPanelIn 220ms var(--ease-out);
  }

  .auth-header {
    padding: 1.75rem 1.75rem 1.2rem;
    background: linear-gradient(180deg var(--in-oklab), var(--primary-light), transparent);
    border-bottom: 1px solid var(--border-subtle);
    text-align: center;
  }

  .auth-logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.65rem;
  }

  .auth-logo-badge .cominv-logo-img {
    height: 54px;
    width: auto;
  }

  .auth-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
  }

  .auth-subtitle {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
  }

  .auth-body {
    padding: 1.35rem 1.75rem 1.75rem;
  }

  .auth-modal-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    min-inline-size: 34px;
    min-block-size: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .auth-modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger-border);
  }

  .auth-context-notice {
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    color: var(--text-main);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    margin-bottom: 1rem;
    align-items: center;
    gap: 0.55rem;
  }

  .auth-context-notice svg {
    width: 18px;
    height: 18px;
    color: var(--info);
    flex-shrink: 0;
  }

  .auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.3rem;
    padding: 0.25rem;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 1.15rem;
  }

  .auth-tabs .tab-btn {
    width: 100%;
  }

  .auth-form-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
  }

  .auth-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
  }

  .auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.1rem 0;
    font-size: 0.75rem;
    color: var(--text-muted);
  }

  .auth-divider::before,
  .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color);
  }

  .auth-guest-option {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .btn-toggle-password {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
  }

  .hs-result-card {
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-surface-secondary);
    margin-bottom: 0.65rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
  }

  .btn-hs-filter {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
  }

  .btn-hs-filter.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
  }
}

/* --------------------------------------------------------------------------
   6B. VIEWS LAYER — LANDING SHOWCASE, INTERACTIVE STUDIO MOCKUP, ROI, BENTO, PRICING, FAQ
   -------------------------------------------------------------------------- */
@layer views {
  .landing-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 clamp(0.25rem, 1vw, 0.75rem);
  }

  .landing-section,
  .landing-section-deferred {
    padding: clamp(2.75rem, 5vw, 4.25rem) 0;
  }

  .landing-section-header {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 2.5rem;
  }

  .landing-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    padding: 0.28rem 0.78rem;
    border-radius: var(--radius-pill);
    margin-bottom: 0.9rem;
  }

  .landing-section-title {
    font-size: clamp(1.65rem, 1.15rem + 1.8vw, 2.5rem);
    font-weight: 800;
    line-height: 1.16;
    color: var(--text-main);
    margin-bottom: 0.85rem;
  }

  .landing-section-subtitle {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 65ch;
    margin: 0 auto;
  }

  /* 1. Asymmetric Sovereign Trade Hero */
  .landing-hero {
    position: relative;
    padding: clamp(1.75rem, 3.5vw, 3.25rem) 0 clamp(2.5rem, 4.5vw, 4rem);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: clamp(1.75rem, 3.5vw, 3rem);
    align-items: center;
  }

  .landing-hero .landing-container {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: clamp(1.75rem, 3.5vw, 3rem);
    align-items: center;
  }

  .landing-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.34rem 0.85rem;
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    border: 1px solid var(--primary-border);
    box-shadow: var(--shadow-xs);
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.15rem;
  }

  .badge-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-bright);
    box-shadow: 0 0 0 4px var(--success-bg);
  }

  .landing-hero-title {
    font-size: clamp(2.15rem, 1.35rem + 2.6vw, 3.45rem);
    font-weight: 800;
    line-height: 1.08;
    color: var(--text-main);
    margin-bottom: 1.15rem;
    letter-spacing: -0.03em;
  }

  .gradient-text {
    background: linear-gradient(125deg var(--in-oklch), var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .landing-hero-subtitle {
    font-size: 1.0625rem;
    line-height: 1.62;
    color: var(--text-secondary);
    max-width: 60ch;
    margin-bottom: 1.6rem;
  }

  .landing-hero-ctas {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.65rem;
  }

  .landing-hero-proof-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
  }

  .proof-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.75rem;
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: var(--shadow-xs);
  }

  .proof-chip svg {
    width: 15px;
    height: 15px;
    color: var(--success-bright);
  }

  /* Interactive Hero Audit Studio Card */
  .landing-hero-visual {
    min-width: 0;
  }

  .landing-preview-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
  }

  .preview-card-header {
    padding: 0.85rem 1.15rem;
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .preview-card-title-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .preview-pulse-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success-bright);
    box-shadow: 0 0 0 3px var(--success-bg);
  }

  .preview-card-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-main);
  }

  .preview-badge-status {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.16rem 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
  }

  .preview-card-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
  }

  .mockup-directory-strip {
    padding: 0.65rem 0.85rem;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .mockup-directory-strip-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
  }

  .dir-strip-icon {
    width: 14px;
    height: 14px;
    color: var(--primary);
  }

  .mockup-directory-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .mockup-dir-chip {
    padding: 0.24rem 0.62rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
  }

  .mockup-dir-chip.active,
  .mockup-dir-chip:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
  }

  .preview-card-audit-strip {
    padding: 0.85rem 1.15rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
  }

  .audit-strip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.55rem;
  }

  .audit-pass-rate {
    color: var(--success);
    font-family: var(--font-mono);
    font-size: 0.74rem;
  }

  .audit-chips-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .hero-audit-chip {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    padding: 0.48rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface-secondary);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all var(--duration-fast) ease;
  }

  .hero-audit-chip .chip-status {
    flex-shrink: 0;
  }

  .hero-audit-chip .chip-label {
    min-width: 0;
    text-align: left;
  }

  .hero-audit-chip.active {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
  }

  .hero-audit-chip:not(.active),
  .hero-audit-chip.flagged {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
  }

  .hero-audit-feedback {
    margin-top: 0.6rem;
    font-size: 0.75rem;
    line-height: 1.4;
    padding: 0.52rem 0.72rem;
    border-radius: var(--radius-sm);
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
    transition: all var(--duration-fast) ease;
  }

  .hero-audit-feedback.has-warning {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
  }

  .preview-document-mockup {
    padding: 1rem 1.15rem;
    background: var(--bg-studio);
  }

  .mockup-doc-mini {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 0.95rem 1rem;
    box-shadow: var(--shadow-sm);
    font-size: 0.76rem;
  }

  .doc-mini-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.55rem;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 0.75rem;
  }

  .mockup-doc-type {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--primary);
    font-size: 0.88rem;
    letter-spacing: 0.04em;
  }

  .mockup-doc-num {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
  }

  .doc-mini-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .doc-tag {
    font-size: 0.66rem;
    font-weight: 700;
    padding: 0.14rem 0.45rem;
    border-radius: var(--radius-pill);
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
  }

  .mockup-parties-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 0.85rem;
  }

  .mockup-party-box {
    min-width: 0;
    padding: 0.72rem 0.82rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
    background: var(--bg-surface-secondary);
  }

  .mockup-party-role-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
    flex-wrap: nowrap;
  }

  .mockup-party-role {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--primary);
    white-space: nowrap;
  }

  .mockup-dir-pill {
    font-size: 0.61rem;
    font-weight: 700;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    border-radius: var(--radius-pill);
    padding: 0.1rem 0.45rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .mockup-dir-pill-highlight {
    color: var(--primary);
    border-color: var(--primary-border);
    background: var(--primary-light);
    cursor: pointer;
  }

  .mockup-party-name { font-weight: 700; color: var(--text-main); }
  .mockup-party-sub { font-size: 0.7rem; color: var(--text-muted); }

  .mockup-items-table {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    overflow: hidden;
    margin-bottom: 0.65rem;
  }

  .mockup-table-header,
  .mockup-table-row {
    display: grid;
    grid-template-columns: 2fr 0.95fr 0.55fr 0.55fr 0.85fr;
    gap: 0.4rem;
    padding: 0.42rem 0.58rem;
    align-items: center;
  }

  .mockup-table-header {
    background: var(--bg-surface-secondary);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
  }

  .mockup-table-row {
    border-bottom: 1px solid var(--border-subtle);
  }

  .mockup-table-row:last-child { border-bottom: none; }
  .mockup-origin { font-size: 0.68rem; color: var(--text-muted); }
  .mockup-col-price, .mockup-price-val { text-align: right; font-family: var(--font-mono); font-weight: 700; }

  .mockup-footer-notice {
    padding: 0.42rem 0.6rem;
    border-radius: var(--radius-xs);
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    color: var(--info);
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
  }

  .preview-card-cta-bar {
    padding: 0.85rem 1.15rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .preview-cta-hint {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 500;
  }

  /* SEO Route Deep Dive & Solutions Hub */
  .seo-route-deep-dive {
    background: var(--bg-surface);
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-xl);
    padding: clamp(1.5rem, 3vw, 2.25rem);
    margin: 1.25rem auto;
    max-width: 1280px;
    box-shadow: var(--shadow-md);
  }

  .landing-solutions-hub {
    padding: 1.5rem 0;
  }

  .solutions-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
  }

  .solution-hub-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-shadow: var(--shadow-xs);
    transition: border-color var(--duration-fast) ease, transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  }

  .solution-hub-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }

  .solution-hub-card strong {
    font-family: var(--font-display);
    font-size: 0.94rem;
    color: var(--text-main);
  }

  .solution-hub-card span {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
  }

  /* 2. Customer Impact & Buyer Experience Spotlight */
  .landing-customer-impact-section {
    padding: clamp(2.25rem, 4vw, 3.75rem) 0;
  }

.customer-impact-container {
  max-width: 100%;
  margin: 0 auto;
}

  .customer-impact-comparison-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.35rem;
    align-items: stretch;
  }

  .impact-card {
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .impact-card-negative {
    background: linear-gradient(180deg var(--in-oklab), rgba(239, 68, 68, 0.05), var(--bg-surface) 40%);
    border-color: var(--danger-border);
  }

  .impact-card-positive {
    background: linear-gradient(180deg var(--in-oklab), rgba(16, 185, 129, 0.06), var(--bg-surface) 40%);
    border-color: var(--success-border);
    box-shadow: var(--shadow-md);
  }

  [data-theme="dark"] .impact-card-negative {
    background: linear-gradient(180deg var(--in-oklab), rgba(239, 68, 68, 0.1), var(--bg-surface) 45%);
    border-color: rgba(239, 68, 68, 0.35);
  }

  [data-theme="dark"] .impact-card-positive {
    background: linear-gradient(180deg var(--in-oklab), rgba(16, 185, 129, 0.12), var(--bg-surface) 45%);
    border-color: rgba(16, 185, 129, 0.38);
  }

  .impact-card-header {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
  }

  .impact-card-badge {
    align-self: flex-start;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.22rem 0.65rem;
    border-radius: var(--radius-pill);
  }

  .impact-card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
  }

  .impact-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
  }

  .impact-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.875rem;
  }

  .impact-item-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
  }

  .impact-item-content strong {
    display: block;
    color: var(--text-main);
    margin-bottom: 0.15rem;
  }

  .impact-item-content p {
    color: var(--text-muted);
    font-size: 0.825rem;
    line-height: 1.5;
  }

  /* 3. ROI Calculator Card */
.landing-roi-container {
  max-width: 100%;
  margin: 0 auto;
}

  .roi-calculator-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: clamp(1.25rem, 3vw, 2.1rem);
    box-shadow: var(--shadow-lg);
  }

  .roi-slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
  }

  .roi-slider-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
  }

  .roi-slider-value-badge {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 0.92rem;
    padding: 0.3rem 0.85rem;
    border-radius: var(--radius-pill);
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
  }

  .roi-range-slider {
    width: 100%;
    accent-color: var(--primary);
    cursor: pointer;
    height: 8px;
  }

  .roi-slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    margin-bottom: 1.5rem;
  }

  .roi-results-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
  }

  .roi-metric-card {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
  }

  .metric-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
  }

  .metric-label { font-size: 0.76rem; font-weight: 700; color: var(--text-muted); }
  .metric-value { font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; color: var(--text-main); margin: 0.15rem 0; }
  .metric-subtext { font-size: 0.74rem; color: var(--text-muted); }

  .roi-calculator-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
  }

  .roi-footer-cta-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
  }

  .roi-estimate-details {
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-surface-secondary);
  }

  .roi-estimate-summary {
    padding: 0.65rem 0.9rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
  }

  .roi-estimate-explainer {
    padding: 0 0.9rem 0.85rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
  }

  /* 4. 6-Pillar Bento Grid */
  .landing-bento-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
  }

  .landing-bento-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform var(--duration-base) var(--ease-out), border-color var(--duration-fast) ease, box-shadow var(--duration-base) var(--ease-out);
  }

  .landing-bento-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-border);
    box-shadow: var(--shadow-md);
  }

  .bento-span-2 {
    grid-column: span 2;
  }

  .bento-badge {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.22rem 0.6rem;
    border-radius: var(--radius-pill);
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
  }

  .bento-title {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-main);
  }

  .bento-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.55;
  }

  .bento-points {
    padding-left: 1.15rem;
    font-size: 0.825rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .bento-card-link {
    margin-top: auto;
    align-self: flex-start;
  }

  /* 5. Broker Spotlight */
  .broker-spotlight-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: clamp(1.5rem, 3.5vw, 2.5rem);
    box-shadow: var(--shadow-lg);
  }

  .broker-spotlight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
    align-items: center;
  }

  .broker-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.15rem;
  }

  .broker-feature-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 800;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .broker-mockup-card {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    box-shadow: var(--shadow);
  }

  /* 6. Pricing Grid & Interactive Matrix */
  .billing-interval-selector {
    display: flex;
    justify-content: center;
    margin-bottom: 1.75rem;
  }

  .billing-interval-pill {
    display: inline-flex;
    padding: 4px;
    border-radius: var(--radius-pill);
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    gap: 4px;
  }

  .btn-interval-toggle {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 700;
    padding: 0.48rem 1rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--duration-fast) ease;
  }

  .btn-interval-toggle.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-xs);
  }

  .badge-save-discount {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.14rem 0.45rem;
    border-radius: var(--radius-pill);
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
  }

  .landing-pricing-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.15rem;
    align-items: stretch;
  }

  .pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.15rem;
    align-items: stretch;
  }

  .pricing-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.45rem 1.25rem;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    transition: transform var(--duration-base) var(--ease-out), border-color var(--duration-fast) ease, box-shadow var(--duration-base) var(--ease-out);
  }

  .pricing-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-border);
    box-shadow: var(--shadow-md);
  }

  .pricing-card.popular {
    border-color: var(--primary-border);
    background: linear-gradient(180deg var(--in-oklab), var(--primary-light), var(--bg-surface) 32%);
  }

  .pricing-card.is-selected-package {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
  }

  .pricing-card.current-plan {
    border-color: var(--success);
    box-shadow: 0 0 0 1px var(--success-border), var(--shadow-md);
  }

  .plan-badge-pro {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border-color: var(--primary-border) !important;
  }

  .pricing-popular-badge {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.22rem 0.7rem;
    border-radius: var(--radius-pill);
    white-space: nowrap;
  }

  .pricing-tier-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
  }

  .pricing-price {
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    margin: 0.65rem 0 0.25rem;
  }

  .price-currency { font-size: 1.1rem; font-weight: 700; color: var(--text-muted); }
  .price-val { font-family: var(--font-display); font-size: 2.1rem; font-weight: 800; color: var(--text-main); }
  .price-period { font-size: 0.82rem; color: var(--text-muted); }
  .pricing-billing-subtext { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.5rem; }
  .pricing-desc { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem; min-height: 2.6em; }

  .pricing-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    flex: 1 0 auto;
  }

  .pricing-card-footer {
    margin-top: auto;
  }

  /* Matrix Comparison Table */
  .comparison-matrix-details {
    margin-top: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--bg-surface);
    overflow: hidden;
  }

  .comparison-matrix-summary {
    padding: 1rem 1.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 700;
    list-style: none;
  }

  .comparison-matrix-summary::-webkit-details-marker { display: none; }

  .comparison-matrix-wrapper {
    overflow-x: auto;
    border-top: 1px solid var(--border-color);
  }

  .landing-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
  }

  .landing-comparison-table th,
  .landing-comparison-table td {
    padding: 0.72rem 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
  }

  .landing-comparison-table th.col-highlight,
  .landing-comparison-table td.col-highlight {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
  }

  .landing-comparison-table tr.feature-row-included td:first-child {
    color: var(--text-main);
    font-weight: 600;
  }

  .landing-comparison-table tr.feature-row-excluded {
    opacity: 0.72;
  }

  .val-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    line-height: 1;
  }

  /* 7. Lead Magnet & FAQ & CTA Banner */
.lead-magnet-card {
  max-width: 100%;
  background: linear-gradient(135deg var(--in-oklab), var(--primary-light), var(--bg-surface));
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  box-shadow: var(--shadow-md);
}

  .lead-magnet-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
    align-items: end;
    margin-top: 1.15rem;
  }

  .landing-faq-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }

  .faq-accordion-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.95rem 1.15rem;
    margin-bottom: 0.85rem;
  }

  .faq-question {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-main);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
  }

  .faq-question::-webkit-details-marker { display: none; }

  .faq-answer {
    margin-top: 0.65rem;
    font-size: 0.84375rem;
    line-height: 1.6;
    color: var(--text-muted);
  }

  .landing-cta-footer {
    margin-top: 2rem;
    background: linear-gradient(135deg var(--in-oklch), #1e3a8a, #1d4ed8, #0284c7);
    color: #ffffff;
    border-radius: var(--radius-xl);
    padding: clamp(1.75rem, 4vw, 3rem);
    text-align: center;
    box-shadow: var(--shadow-lg);
  }

  .cta-footer-title { font-size: clamp(1.4rem, 1rem + 1.5vw, 2.1rem); color: #ffffff; margin-bottom: 0.55rem; }
  .cta-footer-subtitle { color: rgba(255, 255, 255, 0.88); max-width: 60ch; margin: 0 auto 1.35rem; }
  .cta-footer-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.75rem; }
  .cta-footer-content { max-width: 780px; margin: 0 auto; }

  /* Broker Spotlight Mockup & Client Rows */
  .broker-spotlight-header { margin-bottom: 1.5rem; }
  .broker-spotlight-info { display: flex; flex-direction: column; gap: 0.45rem; }
  .broker-feature-text strong { display: block; color: var(--text-main); font-size: 0.94rem; margin-bottom: 0.15rem; }
  .broker-feature-text p { font-size: 0.84rem; color: var(--text-muted); line-height: 1.5; }
  .broker-spotlight-cta { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.65rem; }
  .broker-mockup-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; font-size: 0.78rem; font-weight: 700; }
  .broker-mockup-switcher-demo { padding: 0.65rem 0.75rem; border-radius: var(--radius); background: var(--bg-surface); border: 1px solid var(--border-color); margin-bottom: 0.75rem; }
  .switcher-demo-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.35rem; }
  .switcher-demo-select { display: flex; align-items: center; justify-content: space-between; padding: 0.45rem 0.65rem; border-radius: var(--radius-xs); background: var(--bg-surface-secondary); border: 1px solid var(--border-color); font-size: 0.8rem; font-weight: 700; }
  .broker-mockup-clients-list { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.75rem; }
  .client-mini-row { display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem 0.65rem; border-radius: var(--radius-sm); background: var(--bg-surface); border: 1px solid var(--border-color); }
  .client-mini-icon { width: 28px; height: 28px; border-radius: var(--radius-xs); background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 0.85rem; flex-shrink: 0; }
  .client-mini-info { flex: 1; min-width: 0; font-size: 0.78rem; }
  .client-mini-info strong { display: block; color: var(--text-main); }
  .client-mini-info span { font-size: 0.7rem; color: var(--text-muted); }
  .broker-dual-sig-preview { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.55rem 0.75rem; border-radius: var(--radius-sm); background: var(--info-bg); border: 1px solid var(--info-border); font-size: 0.74rem; }
  .sig-preview-label { font-weight: 700; color: var(--info); }
  .sig-preview-val { font-family: var(--font-mono); color: var(--text-main); font-size: 0.72rem; }
  .broker-mockup-footer { margin-top: 0.65rem; font-size: 0.72rem; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; }

  /* Bento Visuals & Tracker Mini */
  .bento-visual { margin-top: 0.25rem; }
  .tracker-mini { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.75rem; border-radius: var(--radius); background: var(--bg-surface-secondary); border: 1px solid var(--border-color); font-size: 0.76rem; }
  .tracker-mini-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }

  /* Pricing Modal, Active Comparison Pill & ROI Highlight */
  .comparison-active-pill-wrapper { display: flex; justify-content: center; margin-top: 1rem; margin-bottom: 0.75rem; }
  .comparison-active-pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.85rem; border-radius: var(--radius-pill); background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-border); font-size: 0.78rem; }
  .comparison-summary-chevron { transition: transform var(--duration-fast) ease; }
  details[open] .comparison-summary-chevron { transform: rotate(180deg); }
  .pricing-modal-header { padding: 1.25rem 1.5rem 1rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; background: var(--bg-surface-secondary); }
  .pricing-modal-eyebrow { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--primary); margin-bottom: 0.25rem; }
  .pricing-roi-banner { display: flex; align-items: center; justify-content: center; gap: 0.55rem; padding: 0.75rem 1.35rem; background: var(--primary-light); border: 1px solid var(--primary-border); border-radius: var(--radius-sm); margin-bottom: 1.25rem; font-size: 0.82rem; color: var(--text-main); text-align: center; }
  .pricing-roi-banner svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }
  .pricing-card-header { display: flex; flex-direction: column; }
  .pricing-modal-footer { padding: 1rem 1.5rem; background: var(--bg-surface-secondary); border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
  .pricing-modal-footer-left { display: flex; align-items: center; flex-wrap: wrap; gap: 0.65rem; font-size: 0.8rem; color: var(--text-muted); }

  /* Legal Modal Tabs & Content Panes */
  .legal-nav-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.3rem; background: var(--bg-surface-secondary); border: 1px solid var(--border-color); border-radius: var(--radius); margin-bottom: 1.15rem; }
  .legal-tab-btn { flex: 1 1 auto; min-block-size: 34px; padding: 0.38rem 0.75rem; border: 1px solid transparent; border-radius: var(--radius-xs); background: transparent; color: var(--text-muted); font-size: 0.8rem; font-weight: 600; cursor: pointer; }
  .legal-tab-btn.active { background: var(--bg-surface); color: var(--primary); border-color: var(--primary-border); box-shadow: var(--shadow-xs); font-weight: 700; }
  .legal-tab-pane { display: none; font-size: 0.875rem; line-height: 1.6; color: var(--text-secondary); }
  .legal-tab-pane.active { display: block; }
  .legal-divider { opacity: 0.45; }
  .legal-tagline { font-size: 0.78rem; color: var(--text-muted); }

  /* Lead Magnet Feedback & FAQ Icon */
  .lead-magnet-badge { display: inline-flex; padding: 0.22rem 0.65rem; border-radius: var(--radius-pill); background: var(--bg-surface); border: 1px solid var(--primary-border); color: var(--primary); font-size: 0.72rem; font-weight: 700; margin-bottom: 0.6rem; }
  .lead-magnet-title { font-size: 1.35rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.4rem; }
  .lead-magnet-subtitle { font-size: 0.9rem; color: var(--text-secondary); max-width: 65ch; }
  .lead-magnet-submit-col { display: flex; align-items: flex-end; }
  .lead-magnet-feedback { margin-top: 1rem; padding: 1rem; border-radius: var(--radius); background: var(--bg-surface); border: 1px solid var(--success-border); }
  .feedback-success-badge { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--success); font-weight: 700; font-size: 0.85rem; }
  .feedback-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 0.75rem; }
  .faq-icon { font-family: var(--font-mono); font-size: 1.1rem; color: var(--primary); flex-shrink: 0; transition: transform var(--duration-fast) ease; }
  details[open] .faq-icon { transform: rotate(45deg); }

  /* Miscellaneous Functional Hooks */
  .batch-audit-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--primary); font-size: 1.4rem; line-height: 1; }
  .batch-audit-icon svg { width: 22px; height: 22px; }
  .batch-audit-progress { min-width: 220px; flex: 1 1 220px; max-width: 340px; }
  .progress-label { display: flex; justify-content: space-between; font-size: 0.74rem; font-weight: 700; color: var(--text-muted); }
  .btn-banner-link, .btn-guest-banner-action, .btn-guest-banner-secondary, .btn-beta-action, .btn-switcher-action, .btn-trigger-support, .btn-guest-mode, .btn-header-signin { white-space: nowrap; }
  .btn-guest-banner-dismiss { background: transparent; border: none; color: var(--text-muted); font-size: 1.2rem; line-height: 1; padding: 0.25rem 0.45rem; cursor: pointer; border-radius: var(--radius-xs); }
  .btn-guest-banner-dismiss:hover { background: var(--bg-surface); color: var(--text-main); }
  .info-tooltip-wrapper { position: relative; display: inline-flex; align-items: center; }
  .info-tooltip-icon { cursor: help; opacity: 0.75; }
  .quick-save-btn { border-style: dashed; }
  .landing-cta-pricing-link { font-size: 0.88rem; font-weight: 600; color: var(--text-muted); background: transparent; border: none; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
  .landing-cta-pricing-link:hover { color: var(--primary); }
  .mockup-meta-row { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
  .mockup-dir-pill-inline { margin-left: 0.35rem; }
}

/* --------------------------------------------------------------------------
   7. UTILITIES & ADAPTIVE RESPONSIVE MEDIA QUERIES
   -------------------------------------------------------------------------- */
@layer utilities {
  .text-right { text-align: right; }
  .text-center { text-align: center; }
  .text-muted { color: var(--text-muted); }
  .text-danger { color: var(--danger); }
  .text-success { color: var(--success); }
  .font-semibold { font-weight: 600; }

  /* Compact Single-Row Density <= 1440px (keeps desktop single-row without wrapping onto row 2) */
  @media (max-width: 1440px) {
    .app-header .nav-tabs .tab-btn {
      padding: 0.32rem 0.52rem;
      font-size: 0.76rem;
      gap: 0.28rem;
    }

    .app-header.has-extended-nav .nav-tabs .tab-btn {
      padding: 0.3rem 0.46rem;
      font-size: 0.74rem;
    }

    .user-info {
      display: none;
    }

    .user-badge {
      padding: 0.15rem;
    }
  }

  /* Workspace Split Stack <= 1200px */
  @media (max-width: 1200px) {
    .workspace-grid {
      grid-template-columns: 1fr;
    }

    .preview-panel {
      position: static;
    }

    .landing-pricing-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .landing-bento-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  /* Tablet & Mobile Navigation Drawer <= 1024px */
  @media (max-width: 1024px) {
    .app-header .header-container {
      grid-template-columns: 1fr auto;
      row-gap: 0.55rem;
    }

    .mobile-nav-toggle {
      display: inline-flex;
    }

    .app-header .nav-tabs {
      display: none;
      grid-column: 1 / -1;
      grid-row: 2;
      width: 100%;
      flex-direction: column;
      align-items: stretch;
      border-radius: var(--radius-lg);
      padding: 0.55rem;
      gap: 0.25rem;
    }

    .app-header .nav-tabs.mobile-nav-open {
      display: flex;
    }

    .app-header .nav-tabs .tab-btn {
      justify-content: flex-start;
      padding: 0.65rem 0.85rem;
      font-size: 0.875rem;
      min-block-size: 44px;
    }

    .app-header .nav-divider {
      width: 100%;
      height: 1px;
      margin: 0.2rem 0;
    }

    .landing-hero,
    .landing-hero .landing-container,
    .customer-impact-comparison-grid,
    .broker-spotlight-grid,
    .directory-grid,
    .landing-faq-grid {
      grid-template-columns: 1fr;
    }

    .bento-span-2 {
      grid-column: span 1;
    }

    .batch-drawer-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

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

  /* Mobile Phone Viewport <= 768px */
  @media (max-width: 768px) {
    .logo-text span,
    .user-info,
    .btn-pricing-label {
      display: none;
    }

    .user-badge {
      padding: 0.15rem;
    }

    .btn-outline-pricing {
      padding: 0;
      border-color: transparent;
      background: transparent;
      box-shadow: none;
    }

    .btn-outline-pricing .pricing-plan-badge {
      min-block-size: 34px;
      block-size: 34px;
      display: inline-flex;
      align-items: center;
      padding: 0 0.65rem;
    }

    .form-row,
    .form-row-3col,
    .form-row-4col,
    .roi-results-grid,
    .landing-bento-grid,
    .landing-pricing-grid,
    .pricing-grid,
    .audit-chips-grid,
    .mockup-parties-grid {
      grid-template-columns: 1fr;
    }

    .col-span-2 {
      grid-column: span 1;
    }

    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
      font-size: 1rem;
    }

    .batch-drawer-grid {
      grid-template-columns: 1fr;
    }
  }

  /* Compact Small Mobile <= 480px */
  @media (max-width: 480px) {
    .header-container {
      padding: 0.5rem 0.75rem;
    }

    .card-body {
      padding: 0.95rem;
    }

    .modal-body,
    .modal-header,
    .modal-footer {
      padding: 0.85rem 1rem;
    }

    #headerTeamBadge {
      max-width: 115px;
    }
  }

  /* Coarse Touch Devices (44px+ accessible tap ergonomics) */
  @media (pointer: coarse) {
    .btn,
    .tab-btn,
    .category-btn,
    .batch-filter-btn,
    .modal-close,
    .btn-theme-toggle {
      min-block-size: 44px;
    }
  }

  /* Motion Preferences */
  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }

    .tab-pane.active,
    .modal-overlay,
    dialog.modal-overlay[open],
    dialog.auth-page-wrapper.auth-modal-overlay[open],
    dialog::backdrop,
    .modal-container,
    .toast,
    .val-spinner,
    .loading-spinner,
    .combobox-dropdown,
    .broker-switcher-menu,
    .btn,
    .pricing-card,
    .landing-bento-card,
    .solution-hub-card,
    .batch-expand-btn svg,
    .comparison-summary-chevron,
    .faq-icon {
      animation: none !important;
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* Windows Forced-Colors High-Contrast Mode */
  @media (forced-colors: active) {
    .card,
    .modal-container,
    .pricing-card,
    .line-item-card,
    .batch-kpi-card,
    .btn {
      border: 1px solid ButtonBorder;
    }

    .tab-btn.active,
    .btn-primary {
      background: Highlight;
      color: HighlightText;
      border-color: Highlight;
    }
  }
}


/* ==========================================================================
   VIEWS & COLLABORATION WORKBENCH EXTENSIONS (OPS DESK, DRAWERS, COMPACT GRID)
   ========================================================================== */
@layer views {
  .input-with-action-row {
    display: flex;
    gap: 0.4rem;
    align-items: stretch;
  }

  .input-with-action-row .form-control {
    flex: 1;
    min-width: 0;
  }

  .btn-xs {
    padding: 0.25rem 0.55rem;
    font-size: 0.74rem;
    line-height: 1.25;
  }

  /* Header Activity Bell & Popover */
  .btn-activity-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    cursor: pointer;
  }

  .btn-activity-bell:hover {
    border-color: var(--primary);
    color: var(--primary);
  }

  .activity-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Native Popover Menus (Activity Feed, Export & Pack, Row Overflow) */
  [popover].export-pack-popover,
  [popover].activity-feed-popover,
  [popover].row-overflow-popover {
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
    padding: 0.4rem;
    min-width: 240px;
    max-width: min(360px, 92vw);
    max-height: min(440px, 80dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  [popover].activity-feed-popover {
    width: 340px;
    padding: 0;
  }

  .activity-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-body);
  }

  .activity-popover-list {
    display: flex;
    flex-direction: column;
  }

  .activity-popover-item {
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
  }

  .activity-popover-item:last-child {
    border-bottom: none;
  }

  .popover-menu-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-align: left;
    cursor: pointer;
  }

  .popover-menu-item:hover {
    background: var(--bg-body);
    color: var(--primary);
  }

  .popover-menu-item-danger {
    color: var(--danger);
  }

  .popover-menu-item-danger:hover {
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger);
  }

  .popover-menu-sep {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.3rem 0;
  }

  @supports (position-area: block-end) {
    #headerActivityBellBtn {
      anchor-name: --activity-bell-anchor;
    }
    #headerActivityPopover[popover] {
      position-anchor: --activity-bell-anchor;
      position-area: block-end span-inline-start;
      position-try-fallbacks: flip-block, flip-inline;
      margin-top: 6px;
    }

    #btnExportPackMenu {
      anchor-name: --export-pack-anchor;
    }
    #singleExportPopover[popover] {
      position-anchor: --export-pack-anchor;
      position-area: block-end span-inline-start;
      position-try-fallbacks: flip-block, flip-inline;
      margin-top: 6px;
    }
  }

  @supports not (position-area: block-end) {
    #headerActivityPopover[popover],
    #singleExportPopover[popover] {
      inset: 64px 16px auto auto;
    }
  }

  /* Operations Command Desk */
  .ops-desk-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.15rem;
  }

  .ops-desk-title {
    margin: 0 0 0.25rem 0;
    font-size: 1.4rem;
    font-weight: 700;
  }

  .ops-desk-subtitle {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  .ops-desk-quick-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
  }

  .handover-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(14, 165, 233, 0.08));
    border: 1px solid rgba(37, 99, 235, 0.28);
    border-radius: var(--radius-md);
    padding: 0.9rem 1.15rem;
    margin-bottom: 1.25rem;
  }

  .handover-banner-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
  }

  .handover-banner-icon {
    font-size: 1.6rem;
    line-height: 1;
  }

  .handover-banner-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
  }

  .handover-banner-summary {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
  }

  .ops-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.25rem;
  }

  .ops-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
  }

  .ops-kpi-card.ops-kpi-alerts {
    border-left-color: var(--danger);
  }

  .ops-kpi-card.ops-kpi-notice {
    border-left-color: var(--warning);
  }

  .ops-kpi-card.ops-kpi-transit {
    border-left-color: var(--success);
  }

  .ops-kpi-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
  }

  .ops-kpi-value {
    font-size: 1.65rem;
    font-weight: 800;
    margin: 0.2rem 0;
    color: var(--text-main);
  }

  .ops-kpi-sub {
    font-size: 0.74rem;
    color: var(--text-muted);
  }

  .ops-desk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.25rem;
  }

  .ops-desk-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }

  .handover-pin-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
  }

  .handover-pin-form .form-control {
    flex: 1;
  }

  .pinned-notes-board,
  .ops-queue-list,
  .activity-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
  }

  .pinned-note-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
  }

  .ops-queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
  }

  .activity-timeline-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
  }

  .activity-timeline-item:last-child {
    border-bottom: none;
  }

  .empty-inline-hint {
    padding: 0.9rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-body);
    border-radius: var(--radius-sm);
  }

  /* Step 1 Conditional Regime & Step 3 Packaging / Compact Grid */
  .conditional-regime-box {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.9rem;
  }

  .regime-box-title {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    margin-bottom: 0.55rem;
  }

  .packaging-summary-card {
    margin-top: 0.85rem;
    padding: 0.85rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
  }

  .packaging-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    font-size: 0.85rem;
  }

  .hs-suggestions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
  }

  .hs-suggestion-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(37, 99, 235, 0.35);
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
  }

  /* Compact Line-Item Grid Mode */
  #lineItemsContainer.compact-grid-mode {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  #lineItemsContainer.compact-grid-mode .line-item-card {
    padding: 0.45rem 0.6rem;
    margin-bottom: 0;
  }

  #lineItemsContainer.compact-grid-mode .line-item-header {
    margin-bottom: 0.35rem;
  }

  #lineItemsContainer.compact-grid-mode .line-item-body {
    display: grid;
    grid-template-columns: 1.5fr 2fr 1.1fr 0.8fr 0.7fr 0.8fr 0.8fr 0.8fr;
    gap: 0.4rem;
    align-items: end;
  }

  #lineItemsContainer.compact-grid-mode .form-row,
  #lineItemsContainer.compact-grid-mode .form-row-4col {
    display: contents;
  }

  #lineItemsContainer.compact-grid-mode .form-group label {
    font-size: 0.68rem;
    margin-bottom: 0.15rem;
  }

  #lineItemsContainer.compact-grid-mode .form-control {
    padding: 0.3rem 0.45rem;
    font-size: 0.78rem;
  }

  @media (max-width: 900px) {
    #lineItemsContainer.compact-grid-mode .line-item-body {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  /* Batch Waves Bar */
  .batch-waves-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
  }

  .batch-waves-group {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
  }

  .workspace-subnav {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
  }

  /* Workflow Status Pills */
  .status-workflow-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .status-workflow-pill.status-draft {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
  }

  .status-workflow-pill.status-awaiting_weights {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
  }

  .status-workflow-pill.status-needs_customs_review {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
  }

  .status-workflow-pill.status-issued {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
  }

  /* Slide-Over Consignment Drawer (<dialog>) */
  dialog.slide-over-drawer {
    position: fixed;
    inset: 0 0 0 auto;
    margin: 0 0 0 auto;
    width: min(560px, 100vw);
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: none;
    border-left: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    padding: 0;
    display: flex;
    flex-direction: column;
    box-shadow: -12px 0 36px rgba(15, 23, 42, 0.25);
    overscroll-behavior: contain;
  }

  dialog.slide-over-drawer:not([open]) {
    display: none;
  }

  dialog.slide-over-drawer::backdrop {
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    overflow: hidden;
    overscroll-behavior: contain;
  }

  .slide-over-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-body);
  }

  .slide-over-eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.05em;
  }

  .slide-over-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .drawer-section-card {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
  }
}
