/* ==========================================================================
   BillRight — Design System & Stylesheet
   Designed with Linear / Stripe / Vercel Calm Fintech Aesthetics
   Zero external trackers • WCAG 2.2 AA • Dual Theme (Light / Dark)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* --------------------------------------------------------------------------
   1. Design Tokens (CSS Custom Properties)
   -------------------------------------------------------------------------- */

:root {
  /* Color Palette — Light Mode (Pure High-End Monochrome Noir) */
  --bg-app: #fafafa;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f4f4f5;
  --bg-surface-raised: #ffffff;
  --bg-surface-overlay: rgba(0, 0, 0, 0.7);

  --border-subtle: #e4e4e7;
  --border-strong: #71717a;
  --border-focus: #09090b;

  --text-primary: #09090b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --text-inverse: #ffffff;

  /* Brand & Controls — Pure Crisp Black & White */
  --primary: #09090b;
  --primary-hover: #27272a;
  --primary-foreground: #ffffff;
  --primary-ring: rgba(9, 9, 11, 0.2);

  --accent-blue: #09090b;
  --accent-blue-subtle: #f4f4f5;
  --accent-blue-border: #d4d4d8;

  /* Semantic Status Tokens (Disciplined Monochrome) */
  --success-bg: #f4f4f5;
  --success-text: #09090b;
  --success-border: #d4d4d8;
  --success-solid: #18181b;

  --danger-bg: #f4f4f5;
  --danger-text: #09090b;
  --danger-border: #18181b;
  --danger-solid: #09090b;

  --warning-bg: #f4f4f5;
  --warning-text: #09090b;
  --warning-border: #d4d4d8;
  --warning-solid: #27272a;

  --info-bg: #f4f4f5;
  --info-text: #09090b;
  --info-border: #d4d4d8;

  /* Spacing Scale (4px Grid) */
  --space-0-5: 2px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Refined Monochrome Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.12), 0 4px 6px -4px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.15);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Color Palette — Dark Mode (Pure Charcoal Obsidian Monochrome) */
[data-theme="dark"] {
  --bg-app: #09090b;
  --bg-surface: #0f0f11;
  --bg-surface-subtle: #18181b;
  --bg-surface-raised: #1c1c1f;
  --bg-surface-overlay: rgba(0, 0, 0, 0.88);

  --border-subtle: #27272a;
  --border-strong: #52525b;
  --border-focus: #ffffff;

  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-inverse: #09090b;

  /* Brand & Controls */
  --primary: #ffffff;
  --primary-hover: #e4e4e7;
  --primary-foreground: #09090b;
  --primary-ring: rgba(255, 255, 255, 0.2);

  --accent-blue: #ffffff;
  --accent-blue-subtle: #18181b;
  --accent-blue-border: #3f3f46;

  /* Semantic Status Tokens */
  --success-bg: #18181b;
  --success-text: #ffffff;
  --success-border: #3f3f46;
  --success-solid: #ffffff;

  --danger-bg: #18181b;
  --danger-text: #ffffff;
  --danger-border: #ffffff;
  --danger-solid: #ffffff;

  --warning-bg: #18181b;
  --warning-text: #ffffff;
  --warning-border: #3f3f46;
  --warning-solid: #ffffff;

  --info-bg: #18181b;
  --info-text: #ffffff;
  --info-border: #3f3f46;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px -1px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -4px rgba(0, 0, 0, 0.6);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.85);
}

/* --------------------------------------------------------------------------
   2. Reset & Base Typography
   -------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* --------------------------------------------------------------------------
   3. Top Notice Bar (Dismissible)
   -------------------------------------------------------------------------- */

.disclaimer-banner {
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.5rem 1.5rem;
  font-size: 0.8125rem;
  transition: all var(--transition-fast);
}

.disclaimer-banner.dismissed {
  display: none !important;
}

.disclaimer-content {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.disclaimer-text-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.disclaimer-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}

.disclaimer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  font-size: 1.15rem;
  line-height: 1;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.disclaimer-close-btn:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
}

/* --------------------------------------------------------------------------
   4. Site Header & Hero
   -------------------------------------------------------------------------- */

.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 2.25rem 1.5rem 2rem;
  transition: background-color var(--transition-normal);
}

.header-container {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.header-brand-block {
  display: flex;
  flex-direction: column;
  max-width: 680px;
}

.header-meta-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-blue);
  background: var(--accent-blue-subtle);
  border: 1px solid var(--accent-blue-border);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.system-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--success-text);
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success-solid);
  animation: pulse-dot 2.5s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.jurisdiction-pill-tag {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
}

.brand-logo-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  background-color: #000000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.brand-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  line-height: 1.15;
}

.brand-title span {
  color: var(--accent-blue);
}

.brand-tagline {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 0.5rem;
  font-weight: 400;
  line-height: 1.5;
}

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

/* Theme Toggle Button */
.btn-theme-toggle {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-theme-toggle:hover {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* (Trust pillars moved to dedicated Statutory Rules Directory section) */

/* --------------------------------------------------------------------------
   5. Layout Containers & Card System
   -------------------------------------------------------------------------- */

.main-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

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

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

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.84375rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* --------------------------------------------------------------------------
   6. Sample Presets (Radio-Group Interactive Cards)
   -------------------------------------------------------------------------- */

.presets-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-xs);
}

.presets-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.presets-header-text {
  flex: 1 1 280px;
}

.presets-subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  margin-bottom: 0;
  line-height: 1.45;
}

.presets-title {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
}

.demo-data-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0.2rem 0.55rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  line-height: 1.4;
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
}

.preset-btn {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  color: inherit;
  font-family: inherit;
  outline: none;
  position: relative;
}

.preset-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.preset-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.preset-btn.active,
.preset-btn[aria-checked="true"] {
  background: var(--bg-surface);
  border-color: var(--text-primary);
  box-shadow: 0 0 0 1px var(--text-primary), var(--shadow-sm);
}

.preset-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.preset-btn .preset-badge {
  display: inline-flex;
  flex-direction: column;
  align-self: flex-start;
  gap: 0.15rem;
  padding: 0.3rem 0.55rem;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
}

.preset-badge-country {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: inherit;
  line-height: 1.25;
}

.preset-badge-sub {
  font-size: 0.6875rem;
  font-weight: 500;
  color: inherit;
  opacity: 0.88;
  line-height: 1.25;
}

.preset-badge.protected,
.preset-badge.valid,
.preset-badge.incomplete {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.preset-btn.active .preset-badge {
  background: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

.preset-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.preset-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   7. Statement & Meter Photo Dropzones
   -------------------------------------------------------------------------- */

.upload-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
  gap: 0.5rem;
}

.upload-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.65rem 1rem;
  font-size: 0.84375rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
  margin-bottom: -1px;
}

.upload-tab-btn:hover {
  color: var(--text-primary);
}

.upload-tab-btn.active,
.upload-tab-btn[aria-selected="true"] {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 2.25rem 1.5rem;
  text-align: center;
  background: var(--bg-surface-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent-blue);
  background: var(--accent-blue-subtle);
}

.dropzone:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.file-input-hidden {
  display: none;
}

.dropzone-icon {
  color: var(--accent-blue);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: center;
}

.dropzone-text {
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.dropzone-browse {
  color: var(--accent-blue);
  text-decoration: underline;
  font-weight: 600;
}

.dropzone-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.dropzone-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.processing-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.processing-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.dropzone-success {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  text-align: left;
}

.sample-bill-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.25rem;
  flex-wrap: wrap;
}

.btn-sample-bill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-sample-bill:hover {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: var(--shadow-xs);
}

.sample-bill-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.meter-evidence-card {
  margin-top: 1rem;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.meter-evidence-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--bg-surface);
  color: var(--success-text);
  border: 1px solid var(--success-border);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

/* --------------------------------------------------------------------------
   8. Form Controls, Toggles & Tables
   -------------------------------------------------------------------------- */

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

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

.form-grid > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-input,
.form-select {
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

input[type="date"].form-input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-blue-subtle);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  line-height: 1.4;
}

/* OCR Field Auto-fill Highlight & Review Hint */
.ocr-highlight {
  border-color: #2563eb !important;
  background-color: rgba(37, 99, 235, 0.04) !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15) !important;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ocr-review-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: var(--radius-xs);
  padding: 0.15rem 0.45rem;
  margin-left: 0.5rem;
  font-weight: 500;
  vertical-align: middle;
}

[data-theme="dark"] .ocr-review-hint {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.3);
}

.ocr-review-hint .review-tag {
  font-weight: 700;
  text-transform: uppercase;
  background: #2563eb;
  color: #ffffff;
  padding: 0 0.3rem;
  border-radius: 2px;
}

[data-theme="dark"] .ocr-review-hint .review-tag {
  background: #3b82f6;
  color: #09090b;
}

/* Segmented Toggles (No/Yes) */
.toggle-group {
  display: flex;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.toggle-btn {
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
  background: transparent;
  border: none;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  white-space: normal;
  word-break: break-word;
  line-height: 1.25;
}

.toggle-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* Result-dependent cards hidden until audit runs */
.result-dependent-card {
  display: none;
}

.result-dependent-card.visible {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

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

.mobile-field-label,
.mobile-btn-label {
  display: none !important;
}

/* Data Table System */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84375rem;
}

.data-table th {
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.data-table tr:hover td {
  background: var(--bg-surface-subtle);
}

.table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.table-totals {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.table-totals strong {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-left: 0.35rem;
}

.error-banner {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  font-size: 0.8125rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}

.error-banner.visible {
  display: flex;
}

/* --------------------------------------------------------------------------
   9. Buttons & Interactive Controls
   -------------------------------------------------------------------------- */

.btn-primary,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  outline: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border: 1px solid var(--primary);
  box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}

.btn-primary:active {
  transform: scale(0.98);
}

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

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--text-secondary);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  color: var(--danger-solid);
  background: var(--danger-bg);
}

.action-bar {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   10. Results Section, Plain-Language Result & Trust Badges
   -------------------------------------------------------------------------- */

/* Trust Badges */
.trust-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  vertical-align: middle;
  line-height: 1.3;
  margin-left: 0.4rem;
  letter-spacing: 0.02em;
}

.trust-code {
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.trust-ai {
  background: var(--bg-surface-subtle);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

[data-theme="dark"] .trust-ai {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
}

.trust-live {
  background: var(--bg-surface-subtle);
  color: #059669;
  border: 1px solid #10b981;
}

[data-theme="dark"] .trust-live {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

.trust-builtin {
  background: var(--bg-surface-subtle);
  color: #d97706;
  border: 1px solid #f59e0b;
}

[data-theme="dark"] .trust-builtin {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

/* Collapsible How This Works Accordion */
.how-it-works-details {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0 !important;
  overflow: hidden;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-xs);
}

.how-it-works-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
  background: var(--bg-surface);
  transition: background var(--transition-fast);
}

.how-it-works-summary:hover {
  background: var(--bg-surface-subtle);
}

.how-it-works-summary::-webkit-details-marker {
  display: none;
}

.how-it-works-header-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: var(--text-primary);
  flex-wrap: wrap;
}

.how-it-works-chevron {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.how-it-works-details[open] .how-it-works-chevron {
  transform: rotate(180deg);
}

.how-it-works-body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.how-it-works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .how-it-works-grid {
    grid-template-columns: 1fr;
  }
}

.how-it-works-step {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.how-step-badge {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.how-it-works-step p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

/* Plain-Language Result Card */
.plain-result-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-xs);
}

.plain-result-card.warning {
  border-left-color: #dc2626;
  background: #fef2f2;
}

[data-theme="dark"] .plain-result-card.warning {
  border-left-color: #ef4444;
  background: rgba(220, 38, 38, 0.12);
}

.plain-result-header {
  margin-bottom: 1.15rem;
}

.plain-result-badge-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.plain-result-badge-tag.warning {
  color: #b91c1c;
}

[data-theme="dark"] .plain-result-badge-tag.warning {
  color: #fca5a5;
}

.plain-result-headline {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0 0 0.45rem;
}

.plain-result-why {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.plain-next-steps {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

.plain-next-steps-header {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.plain-next-steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.plain-next-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.plain-next-step-item .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-surface);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.plain-next-step-item .step-content {
  flex: 1;
}

.step-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.plain-dispute-btn {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-xs);
}

.plain-next-step-item .step-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.2rem 0 0;
  line-height: 1.4;
}

.results-container {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  margin-top: 0.5rem;
}

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.85rem;
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.verdict-badge.protected {
  background: var(--text-primary);
  color: var(--bg-surface);
  border: 1px solid var(--text-primary);
}

.verdict-badge.valid {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.verdict-badge.incomplete {
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
}

.verdict-amount-banner {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-top: 1rem;
}

@media (max-width: 600px) {
  .verdict-amount-banner {
    grid-template-columns: 1fr;
  }
}

.verdict-amount-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.verdict-amount-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--danger-solid);
  letter-spacing: -0.02em;
  margin-top: 0.2rem;
}

/* --------------------------------------------------------------------------
   11. Interactive SVG Timeline Visualizer
   -------------------------------------------------------------------------- */

.timeline-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.85rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-disputable { background-color: #dc2626; }
.dot-permissible { background-color: #059669; }
.dot-barrier { background-color: #2563eb; }

.timeline-scroll-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
}

.timeline-scroll-hint {
  display: none;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-style: italic;
}

.timeline-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

.timeline-svg {
  min-width: 520px;
  width: 100%;
  height: auto;
  display: block;
}

.zone-disputable {
  fill: var(--danger-bg);
  opacity: 0.65;
}

.zone-permissible {
  fill: var(--success-bg);
  opacity: 0.65;
}

.zone-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.disputable-label { fill: var(--danger-text); }
.permissible-label { fill: var(--success-text); }

.timeline-tooltip {
  position: absolute;
  display: none;
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 20;
}

/* Period Bars and SVG Timeline Elements */
.period-bar {
  cursor: pointer;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.period-bar:hover {
  filter: brightness(1.1);
}

.bar-disputable {
  fill: #dc2626 !important;
}

.bar-permissible {
  fill: #059669 !important;
}

.bar-text {
  fill: #ffffff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.cutoff-barrier-line {
  stroke: #2563eb;
  stroke-width: 2px;
  stroke-dasharray: 4 3;
}

.cutoff-pill-rect {
  fill: #1e293b;
  stroke: #334155;
  stroke-width: 1px;
}

[data-theme="dark"] .cutoff-pill-rect {
  fill: #0f172a;
  stroke: #475569;
}

.cutoff-pill-text {
  fill: #f8fafc;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}

.timeline-axis-line {
  stroke: var(--border-strong);
  stroke-width: 1.5px;
}

.axis-tick {
  stroke: var(--border-strong);
  stroke-width: 1.5px;
}

.axis-label-text {
  fill: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

.not-legal-advice-banner {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.warning-banner-callout {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

[data-theme="dark"] .warning-banner-callout {
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.35);
}

/* --------------------------------------------------------------------------
   12. Statutory Regulatory Sources & Dispute Letter Box
   -------------------------------------------------------------------------- */

.source-item {
  background: var(--bg-surface-subtle);
  border-left: 3px solid var(--accent-blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.25rem;
}

.source-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
}

.source-url {
  font-size: 0.78125rem;
  color: var(--accent-blue);
  text-decoration: underline;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.letter-box {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 480px;
  overflow-y: auto;
}

.copy-feedback {
  display: none;
  font-size: 0.75rem;
  color: var(--success-text);
  font-weight: 600;
}

.copy-feedback.visible {
  display: inline-block;
}

/* --------------------------------------------------------------------------
   13. Statutory Escalation & Ombudsman Deadlines
   -------------------------------------------------------------------------- */

.escalation-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 820px) {
  .escalation-steps-grid {
    grid-template-columns: 1fr;
  }
}

.escalation-step-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.escalation-step-card.active-step {
  border-color: var(--warning-solid);
  background: var(--warning-bg);
}

.step-number-pill {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
}

.step-number-pill.today {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.step-number-pill.deadline {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.step-number-pill.ombudsman {
  background: var(--accent-blue-subtle);
  color: var(--accent-blue);
  border: 1px solid var(--accent-blue-border);
}

.step-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.step-date {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.step-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* --------------------------------------------------------------------------
   14. Enterprise Direct Supplier Email Dispatcher Modal
   -------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-surface-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 1000;
  animation: fadeIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-dialog {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-modal);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-subtle);
}

.modal-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-blue-subtle);
  color: var(--accent-blue);
  border: 1px solid var(--accent-blue-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.supplier-dossier-pill {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.modal-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.modal-label {
  font-size: 0.78125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-label-badge {
  font-size: 0.6875rem;
  color: var(--accent-blue);
  background: var(--accent-blue-subtle);
  border: 1px solid var(--accent-blue-border);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  text-transform: none;
  font-weight: 500;
}

.modal-input-with-action {
  display: flex;
  gap: 0.5rem;
}

.modal-input {
  flex: 1;
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
}

.btn-copy-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.78125rem;
  font-weight: 600;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-copy-inline:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--text-secondary);
}

.modal-channels-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.modal-channels-heading {
  font-size: 0.78125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.modal-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

@media (max-width: 580px) {
  .modal-actions-grid {
    grid-template-columns: 1fr;
  }
}

.dispatch-channel-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.dispatch-channel-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.channel-text {
  display: flex;
  flex-direction: column;
}

.channel-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.channel-desc {
  font-size: 0.71875rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.modal-preview-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

.modal-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-textarea {
  font-family: var(--font-mono);
  font-size: 0.78125rem;
  line-height: 1.5;
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
  resize: vertical;
  min-height: 110px;
}

/* --------------------------------------------------------------------------
   15. Toast Notification System
   -------------------------------------------------------------------------- */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.84375rem;
  font-weight: 500;
  max-width: 380px;
  animation: toastSlideIn 250ms cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 200ms ease, transform 200ms ease;
  border-left: 4px solid var(--accent-blue);
  border-top: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.toast-item.toast-success { border-left-color: var(--success-solid); }
.toast-item.toast-warning { border-left-color: var(--warning-solid); }
.toast-item.toast-error { border-left-color: var(--danger-solid); }

.toast-item.fading {
  opacity: 0;
  transform: translateY(10px) scale(0.95);
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.toast-text {
  flex: 1;
}

.toast-close {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: var(--radius-xs);
}

.toast-close:hover {
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   16. Dedicated Statutory Rules Modal Dialog
   -------------------------------------------------------------------------- */

.modal-dialog-lg {
  max-width: 780px;
  width: 95%;
}

.rules-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 0.5rem;
}

@media (max-width: 680px) {
  .rules-modal-grid {
    grid-template-columns: 1fr;
  }
}

.rules-modal-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.rules-modal-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rules-modal-country {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
}

.rules-modal-limit {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  background: var(--text-primary);
  color: var(--bg-surface);
}

.rules-modal-code {
  font-family: var(--font-mono);
  font-size: 0.71875rem;
  color: var(--text-muted);
}

.rules-modal-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.rules-modal-subnote {
  font-size: 0.71875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.5rem;
  line-height: 1.4;
}

.rules-modal-footer-note {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   17. Enterprise Footer
   -------------------------------------------------------------------------- */

.site-footer {
  background: var(--bg-surface);
  color: var(--text-secondary);
  padding: 3rem 1.5rem 2.5rem;
  border-top: 1px solid var(--border-subtle);
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.footer-logo-img {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  background-color: #000000;
}

.badge-version {
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--accent-blue-subtle);
  color: var(--accent-blue);
  border: 1px solid var(--accent-blue-border);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
}

.footer-badge-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer-pill {
  font-size: 0.75rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-full);
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
}

.footer-disclaimer {
  max-width: 1120px;
  margin: 1.5rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   17. Print Stylesheet (Dispute Packet (draft) A4)
   -------------------------------------------------------------------------- */

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
  }

  .disclaimer-banner,
  .site-header,
  .presets-card,
  .upload-card,
  .header-actions,
  .action-bar,
  .table-actions,
  .toast-container,
  .modal-backdrop,
  #btn-copy-letter,
  #btn-email-supplier,
  #btn-download-pdf,
  #btn-print-dossier,
  #btn-add-calendar {
    display: none !important;
  }

  .main-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .card {
    border: 1px solid #333333 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 1.5rem !important;
    padding: 1rem !important;
  }

  .results-container {
    display: block !important;
  }

  .letter-box {
    background: transparent !important;
    border: 1px solid #000000 !important;
    color: #000000 !important;
    max-height: none !important;
    font-size: 10pt !important;
    page-break-inside: avoid;
  }

  .data-table th,
  .data-table td {
    border-color: #333333 !important;
    color: #000000 !important;
  }
}

/* --------------------------------------------------------------------------
   18. Reduced Motion Preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   19. Visible Keyboard Focus States & A11y
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--accent-blue) !important;
  outline-offset: 2px !important;
}

/* --------------------------------------------------------------------------
   20. Mobile Viewport (640px, 375px & Small Screens) Optimizations
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  /* Billing Periods Table as Stacked Cards */
  #table-periods,
  #table-periods tbody,
  #table-periods tr,
  #table-periods td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  #table-periods thead {
    display: none;
  }

  #table-periods tbody tr {
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.875rem;
  }

  #table-periods td {
    padding: 0.35rem 0;
    border: none;
  }

  #table-periods td .mobile-field-label {
    display: block !important;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  #table-periods td.cell-action {
    padding-top: 0.65rem;
    margin-top: 0.4rem;
    border-top: 1px solid var(--border-subtle);
    text-align: left !important;
  }

  #table-periods td.cell-action .btn-delete-row {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    justify-content: center;
    padding: 0.45rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
  }

  #table-periods td.cell-action .btn-delete-row:hover {
    color: var(--text-primary);
    border-color: var(--border-focus);
    background: var(--bg-surface);
  }

  #table-periods td.cell-action .mobile-btn-label {
    display: inline !important;
  }

  /* Apportionment Schedule Table as Stacked Rows */
  #table-breakdown,
  #table-breakdown tbody,
  #table-breakdown tr,
  #table-breakdown td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  #table-breakdown thead {
    display: none;
  }

  #table-breakdown tbody tr {
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    margin-bottom: 0.875rem;
  }

  #table-breakdown td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.875rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  #table-breakdown td:last-child {
    border-bottom: none;
    padding-top: 0.5rem;
  }

  #table-breakdown td .mobile-field-label {
    display: inline-block !important;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8125rem;
  }

  #table-breakdown td .breakdown-val {
    display: inline-block;
    text-align: right;
  }

  /* Full width buttons in cards and action bar */
  .action-bar button,
  .plain-dispute-btn,
  #dispute-letter-card .card-header > div:last-child,
  #dispute-letter-card .card-header > div:last-child button,
  #btn-add-calendar,
  .table-actions button {
    width: 100%;
    justify-content: center;
  }

  .plain-result-headline {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
  }

  .timeline-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .timeline-scroll-hint {
    display: inline-flex;
  }

  .timeline-svg {
    min-width: 520px;
    width: 100%;
    height: auto;
  }
}

@media (max-width: 480px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  .main-container {
    padding: 1rem 0.5rem 3.5rem;
    gap: 1.25rem;
    max-width: 100%;
    box-sizing: border-box;
  }

  .toast-container {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 1rem;
    max-width: calc(100vw - 1.5rem);
    box-sizing: border-box;
  }

  .toast-item {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  .footer-badge-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .footer-pill {
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    border-radius: var(--radius-sm);
  }

  .site-header {
    padding: 1.25rem 0.875rem 1rem;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .card,
  .presets-card {
    padding: 0.875rem;
    border-radius: var(--radius-md);
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
  }

  .presets-grid {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .brand-title {
    font-size: 1.65rem;
  }

  .brand-logo-img {
    width: 36px;
    height: 36px;
  }

  .verdict-amount-banner {
    display: flex;
    flex-direction: column;
    padding: 0.875rem;
    gap: 0.75rem;
  }

  .verdict-amount-banner > div:last-child {
    text-align: left !important;
  }

  .verdict-amount-value {
    font-size: 1.5rem;
  }

  .table-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .table-totals {
    text-align: left;
  }

  .action-bar {
    width: 100%;
  }

  .action-bar .btn-primary {
    width: 100%;
  }

  .modal-dialog {
    width: 95%;
    max-height: 90vh;
  }

  .modal-actions-grid {
    grid-template-columns: 1fr;
  }

  .plain-result-card {
    padding: 0.875rem;
  }

  .plain-result-headline {
    font-size: 1.1rem;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .step-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .step-title-row .btn-primary {
    width: 100%;
    margin-top: 0.25rem;
  }

  .table-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .letter-box {
    padding: 0.75rem;
    font-size: 0.75rem;
  }
}
