/* =============================================================================
   STYLES.CSS - Legacy Styles (ITCSS Migration Complete)
   
   STATUS: ✅ MIGRATION COMPLETE - No duplicates remain
   DATE: 2026-01-21
   
   ┌─────────────────────────────────────────────────────────────────────────────┐
   │  ARCHITECTURE: ITCSS + Domain Isolation                                     │
   │  PRIMARY CSS: static/css/main.css (loads modular files via @import)         │
   │  THIS FILE: Unique legacy styles not yet modularized                        │
   └─────────────────────────────────────────────────────────────────────────────┘
   
   MODULAR FILES (in main.css - DO NOT DUPLICATE HERE):
   ─────────────────────────────────────────────────────
   00-settings/tokens.css        → Design tokens, CSS variables
   02-generic/reset.css          → Box-sizing, body reset
   03-elements/typography.css    → Text utilities, headings
   04-objects/layout.css         → Flexbox, grid patterns
   05-components/button-row.css  → Button row family (CANONICAL EXEMPLAR)
   05-components/dropdowns.css   → Scene selector, menus
   05-components/forms.css       → Inputs, selects, textareas
   05-components/modals.css      → Modal dialogs, panels
   05-components/cards.css       → Info cards, callouts
   06-domains/tesseract/*.css    → Profile folders, factory
   06-domains/spiral/*.css       → Canvas, preview
   06-domains/hud/*.css          → Tracker panels
   
   UNIQUE STYLES IN THIS FILE (not duplicated):
   ─────────────────────────────────────────────────────
   - Bento grid layout (app-specific 3-column structure)
   - Scene themes (night, field, storm, train)
   - Animation keyframes
   - Print styles
   - Domain-specific overrides and context rules
   
   FOR NEW AGENTS:
   ─────────────────────────────────────────────────────
   • New component CSS → create in appropriate ITCSS folder
   • Context-specific overrides → add here with clear section comment
   • Reference: docs/CSS_REFACTOR_SWARM_PLAN.md
   ============================================================================= */

/* :root tokens REMOVED - now in 00-settings/tokens.css */

/* =============================================================================
   LIVE ADJUST TOOLBAR
   Extracted from :root block - was incorrectly nested inside variables
   ============================================================================= */
.toolbar.live-adjust {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 8px;
}

#applyBallisticsButton {
  min-width: 60px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.toolbar.live-adjust .live-adjust-label {
  color: var(--text-muted);
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.toolbar.live-adjust .mv-control {
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.toolbar.live-adjust .mv-label {
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 0.85em;
}

.toolbar.live-adjust .mv-decrease {
  padding: 2px 6px;
  min-width: auto;
}

.toolbar.live-adjust .mv-input {
  width: 70px;
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-inverse);
  padding: 4px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

/* =============================================================================
   BASE STYLES
   ============================================================================= */
body {
  margin: 0;
  height: 100vh; /* Fallback for older browsers */
  height: 100dvh; /* Dynamic viewport height - adjusts for iOS Safari chrome */
  width: 100vw;
  overflow: hidden; /* Prevent body from scrolling */
  position: relative;
  background: var(--surface-bg);
  color: var(--text-primary);
  font-family: var(--font-primary);
  transition:
    background 0.25s ease,
    color 0.25s ease;
  color-scheme: light;
}

/* Desktop layout - excluded when mobile app shell is active */
body:not(:has(.mobile-app)) {
  display: flex;
  flex-direction: column;
}

* {
  box-sizing: border-box;
}

/* Global styling for small text elements */
small {
  color: var(--text-muted) !important;
}

/* Ensure label subtext is readable */
label small {
  color: var(--text-soft) !important;
}

html {
  height: 100%;
  overflow: hidden; /* Prevent html from scrolling */
}

body[data-theme='dark'] {
  color-scheme: dark;
  --surface-bg: #05070d;
  --surface-panel: #0f121b;
  --surface-muted: #161b26;
  --surface-muted-strong: #1b2130;
  --surface-subtle: #151b28;
  --surface-positive: rgba(76, 217, 100, 0.12);
  --surface-warning: rgba(255, 179, 71, 0.16);
  --surface-danger: rgba(255, 107, 107, 0.16);
  --surface-info: rgba(0, 200, 255, 0.12);

  --border-default: rgba(86, 110, 255, 0.22);
  --border-muted: rgba(86, 110, 255, 0.18);
  --border-subtle: rgba(86, 110, 255, 0.12);
  --border-soft: rgba(86, 110, 255, 0.08);

  --text-primary: #f5f7fb;
  --text-secondary: #d9dce8;
  --text-soft: #9aa0b3;
  --text-muted: #8f94a7;
  --text-inverse: #05070d;
  --text-inverse-rgb: 5, 7, 13;

  --accent-primary: #00c8ff;
  --accent-primary-rgb: 0, 200, 255;
  --accent-primary-strong: #3f8cff;
  --accent-primary-hover: #3f8cff;
  --accent-primary-active: #5aa4ff;

  --shadow-subtle: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-medium: 0 10px 28px rgba(0, 0, 0, 0.45);
  --shadow-strong: 0 12px 36px rgba(0, 0, 0, 0.55);

  --gradient-accent-soft: linear-gradient(
    120deg,
    rgba(var(--accent-primary-rgb), 0.2),
    rgba(var(--accent-primary-rgb), 0.32)
  );
  --gradient-accent-strong: linear-gradient(
    145deg,
    rgba(var(--accent-primary-rgb), 0.32),
    rgba(var(--accent-primary-rgb), 0.48)
  );
}

body[data-theme='gamer'] {
  color-scheme: dark;
  --surface-bg: #020308;
  --surface-panel: #070b1a;
  --surface-muted: #0b1124;
  --surface-muted-strong: #101735;
  --surface-subtle: #131d42;
  --surface-positive: rgba(0, 255, 144, 0.2);
  --surface-warning: rgba(255, 196, 56, 0.22);
  --surface-danger: rgba(255, 85, 129, 0.22);
  --surface-info: rgba(0, 178, 255, 0.22);

  --border-default: rgba(86, 110, 255, 0.35);
  --border-muted: rgba(86, 110, 255, 0.25);
  --border-subtle: rgba(86, 110, 255, 0.12);
  --border-soft: rgba(86, 110, 255, 0.08);

  --text-primary: #f0f3ff;
  --text-secondary: #cbd4ff;
  --text-soft: #8b96c7;
  --text-muted: #7e88bb;
  --text-inverse: #05070d;
  --text-inverse-rgb: 5, 7, 13;

  --accent-primary: #00ff90;
  --accent-primary-rgb: 0, 255, 144;
  --accent-primary-strong: #8a2eff;
  --accent-primary-hover: #8a2eff;
  --accent-primary-active: #b558ff;

  --status-success: #00ff90;
  --status-success-rgb: 0, 255, 144;
  --status-warning: #ffc438;
  --status-warning-rgb: 255, 196, 56;
  --status-error: #ff5581;
  --status-error-rgb: 255, 85, 129;
  --status-info: #00b2ff;
  --status-info-rgb: 0, 178, 255;

  --shadow-subtle: 0 10px 32px rgba(0, 255, 144, 0.18);
  --shadow-medium: 0 12px 38px rgba(138, 46, 255, 0.22);
  --shadow-strong: 0 16px 48px rgba(0, 255, 144, 0.28);

  --gradient-accent-soft: linear-gradient(
    135deg,
    rgba(var(--accent-primary-rgb), 0.24),
    rgba(138, 46, 255, 0.28)
  );
  --gradient-accent-strong: linear-gradient(
    135deg,
    rgba(var(--accent-primary-rgb), 0.32),
    rgba(138, 46, 255, 0.36)
  );
}

body[data-theme='business'] {
  color-scheme: light;
  --surface-bg: #eef2f7;
  --surface-panel: #ffffff;
  --surface-muted: #f7f9fb;
  --surface-muted-strong: #f2f5f9;
  --surface-subtle: #e9edf4;
  --surface-positive: rgba(14, 160, 77, 0.1);
  --surface-warning: rgba(230, 162, 60, 0.12);
  --surface-danger: rgba(235, 87, 87, 0.12);
  --surface-info: rgba(38, 132, 255, 0.12);

  --border-default: #c9d4e3;
  --border-muted: #d7e2f0;
  --border-subtle: #e3eaf3;
  --border-soft: #eef2f7;

  --text-primary: #0f1d33;
  --text-secondary: #30415d;
  --text-soft: #4a5d7a;
  --text-muted: #6b7a92;
  --text-inverse: #ffffff;
  --text-inverse-rgb: 255, 255, 255;

  --accent-primary: #367bf5;
  --accent-primary-rgb: 54, 123, 245;
  --accent-primary-strong: #274b97;
  --accent-primary-hover: #274b97;
  --accent-primary-active: #1c5ed6;

  --status-success: #0ea04d;
  --status-success-rgb: 14, 160, 77;
  --status-warning: #e6a23c;
  --status-warning-rgb: 230, 162, 60;
  --status-error: #eb5757;
  --status-error-rgb: 235, 87, 87;
  --status-error-strong: #c92a2a;
  --status-error-accent: #e03131;
}

.app-header {
  padding: 0.4rem 0.85rem 0.35rem 1.25rem;
  background: var(--surface-panel);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  gap: 25px;
}

/* Utility helpers */
.flex-row {
  display: flex;
  align-items: center;
}
.flex-column {
  display: flex;
  flex-direction: column;
}
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.inline-flex {
  display: inline-flex;
}
.gap-xs {
  gap: var(--space-1);
}
.gap-sm {
  gap: var(--space-2);
}
.gap-md {
  gap: var(--space-3);
}
.gap-lg {
  gap: var(--space-4);
}
.gap-1 {
  gap: var(--space-1);
}
.gap-2 {
  gap: var(--space-2);
}
.gap-tight {
  gap: 0.4rem;
}
.items-center {
  align-items: center;
}
.text-muted {
  color: var(--text-muted) !important;
}
.text-soft {
  color: var(--text-soft) !important;
}
.text-xs {
  font-size: 0.75rem;
}
.text-sm {
  font-size: 0.875rem;
}
.text-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.text-cyan {
  color: var(--accent-primary) !important;
}
.surface-panel {
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.surface-muted {
  background: var(--surface-muted);
  border-radius: var(--radius-md);
}
.surface-subtle {
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
}
.badge-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--gradient-accent-soft);
  color: var(--text-inverse);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.panel {
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
}
/* =============================================================================
   LEGACY BUTTON PATTERNS - DEPRECATED
   Use BEM pattern instead: .btn--primary, .btn--ghost, .btn--danger
   See: docs/BUTTON_NORMALIZATION_CONTRACT.md
   ============================================================================= */
.btn-solid {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.1s ease;
}
.btn-solid:hover:not(:disabled) {
  background: var(--accent-primary-hover);
}
.btn-solid:active:not(:disabled) {
  background: var(--accent-primary-active);
  transform: translateY(1px);
}
.btn-ghost {
  background: transparent;
  color: var(--accent-primary);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.45);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition:
    border 0.2s ease,
    background 0.2s ease;
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(var(--accent-primary-rgb), 0.12);
  border-color: rgba(var(--accent-primary-rgb), 0.65);
}
.btn-danger {
  background: var(--status-error);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.2s ease;
}
.btn-danger:hover:not(:disabled) {
  background: var(--status-error-accent);
}
.btn-muted {
  background: var(--border-muted);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
}
/* END LEGACY BUTTON PATTERNS */
.spacing-stack > * + * {
  margin-top: var(--space-2);
}
.w-full {
  width: 100%;
}
.mt-0 {
  margin-top: 0 !important;
}
.mt-1 {
  margin-top: var(--space-1) !important;
}
.mt-1-5 {
  margin-top: 0.375rem !important;
}
.mt-2 {
  margin-top: var(--space-2) !important;
}
.mb-1 {
  margin-bottom: var(--space-1) !important;
}

/* TODO(theme-inline): Promote build info badge helpers into theme tokens */
.build-info {
  position: absolute;
  bottom: var(--space-1);
  right: var(--space-3);
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, 0.3);
  font-family: var(--font-mono);
  z-index: 5;
  pointer-events: none;
}
.header-badge {
  font-family: var(--font-mono);
  color: rgba(var(--text-inverse-rgb), 0.9);
}
.header-badge .label {
  font-size: var(--font-size-sm);
  letter-spacing: var(--letter-spacing-tight);
}
.header-badge {
  font-family: var(--font-mono);
  color: rgba(var(--text-inverse-rgb), 0.9);
}
.header-badge .label {
  font-size: var(--font-size-sm);
  letter-spacing: var(--letter-spacing-tight);
}

/* Header status banner - OLD STYLES REMOVED
   See line ~6702 for current status-banner styles
   This block was causing conflicts with the newer centered/resizable design
*/

.status-banner .status-toggle {
  pointer-events: auto;
  background: rgba(var(--accent-primary-rgb), 0.15);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.5);
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font-primary);
  font-size: 12px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}

.status-banner .status-toggle[aria-expanded='true'] {
  background: rgba(var(--accent-primary-rgb), 0.25);
  border-color: rgba(0, 200, 255, 0.8);
}

.status-history {
  display: none;
  position: absolute;
  left: 50%;
  top: calc(50% + 24px);
  transform: translateX(-50%);
  width: 420px;
  max-width: 60vw;
  max-height: 40vh;
  overflow-y: auto;
  background: var(--gradient-accent-strong);
  border: 2px solid rgba(var(--accent-primary-rgb), 0.6);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(var(--accent-primary-rgb), 0.25);
  z-index: 10001;
  /* Mobile-first: hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.status-history::-webkit-scrollbar {
  display: none;
}

.status-history.open {
  display: block;
}

.status-history .history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font-primary);
  font-size: 13px;
}

.status-history .history-item:last-child {
  border-bottom: none;
}

.status-history .history-item .time {
  min-width: 64px;
  color: rgba(var(--text-inverse-rgb), 0.65);
  font-size: 11px;
}

.status-history .history-item.info {
  border-left: 3px solid rgba(0, 200, 255, 0.8);
}
.status-history .history-item.success {
  border-left: 3px solid rgba(var(--status-success-rgb), 0.8);
}
.status-history .history-item.warning {
  border-left: 3px solid rgba(255, 149, 0, 0.9);
}
.status-history .history-item.error {
  border-left: 3px solid rgba(255, 59, 48, 0.9);
}

.status-history .history-empty {
  padding: 10px 12px;
  color: rgba(var(--text-inverse-rgb), 0.7);
  text-align: center;
}

/* Severity variants for banner and toast */
.status-banner.info,
#toast.toast.info {
  border-color: rgba(var(--accent-primary-rgb), 0.6);
  background: rgba(var(--accent-primary-rgb), 0.15);
  color: var(--text-inverse);
}
.status-banner.success,
#toast.toast.success {
  border-color: rgba(var(--status-success-rgb), 0.6);
  background: rgba(var(--status-success-rgb), 0.15);
  color: #1a1a1a;
}
.status-banner.warning,
#toast.toast.warning {
  border-color: rgba(var(--status-warning-rgb), 0.6);
  background: rgba(255, 149, 0, 0.15);
  color: #1a1a1a;
}
.status-banner.error,
#toast.toast.error {
  border-color: rgba(var(--status-error-rgb), 0.7);
  background: rgba(255, 59, 48, 0.15);
  color: #1a1a1a;
}

/* Compact header for full-screen viewing */
@media (max-width: 1400px) {
  .app-header {
    padding: 0.75rem 1rem 0.5rem;
  }
  .app-header h1 {
    font-size: 1.5rem;
  }
  .tagline {
    font-size: 0.85rem;
  }
}

/* =============================================================================
   CONTROL DROPDOWN - Production Accordion Pattern
   Golden ratio: border 0.5 opacity, bg 0.15/0.25, text 0.95
   ============================================================================= */
.control-dropdown {
  margin-bottom: var(--space-3); /* 12px */
  border: var(--border-base) solid rgba(var(--accent-primary-rgb), 0.5);
  border-radius: var(--radius-md); /* 8px */
  background: var(--gradient-dark-solid);
  overflow: visible;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-primary);
}

/* Dropdown Header - uses typo-section pattern */
.control-dropdown .dropdown-header {
  display: flex;
  align-items: center;
  gap: var(--space-2); /* 8px */
  padding: var(--space-2) var(--space-3); /* 8px 12px */

  /* Typography */
  font-family: var(--font-primary);
  font-size: var(--font-size-base); /* 13px */
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  color: var(--text-primary);

  /* Appearance */
  background: var(--gradient-cyan);
  border-bottom: var(--border-thin) solid rgba(var(--accent-primary-rgb), 0.3);
  border-radius: var(--radius-base);
  cursor: pointer;
  transition: background 0.15s ease;
}

.control-dropdown .dropdown-header:hover {
  background: var(--gradient-cyan-hover);
}

.control-dropdown .dropdown-header::before {
  content: '▶';
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 0.75em;
  color: var(--accent-primary, var(--cyan));
}

.control-dropdown[open] .dropdown-header::before {
  transform: rotate(90deg);
}

/* Dropdown Content */
.control-dropdown .dropdown-content {
  padding: var(--space-3); /* 12px */
  border-top: none;
  background: rgba(var(--accent-primary-rgb), 0.03);
  color: var(--text-primary);
  position: relative;
  z-index: 2;
}

/* Field Section Labels */
.field-section-label {
  font-family: var(--font-primary);
  font-size: var(--font-size-xs); /* 10px */
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-caps);
  color: var(--text-muted);
  margin: var(--space-3) 0 var(--space-1) 0;
  padding-bottom: var(--space-1);
  border-bottom: var(--border-thin) solid rgba(255, 255, 255, 0.1);
}

.field-section-label:first-child {
  margin-top: 0;
}

/* Labels in dropdowns */
.control-dropdown label {
  font-family: var(--font-primary);
  font-size: var(--font-size-sm); /* 11px */
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

/* Hints and small text */
.control-dropdown .field-hint,
.control-dropdown small,
.control-dropdown label small {
  font-size: var(--font-size-xs); /* 10px */
  color: var(--text-muted);
}

/* Ensure small text in controls panels is readable */
.controls-panel small,
.field-group small,
details small {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* Input styling in dropdowns */
.control-dropdown input,
.control-dropdown select,
.control-dropdown textarea {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  background: var(--black-30);
  border: var(--border-thin) solid rgba(var(--accent-primary-rgb), 0.3);
  color: var(--text-primary);
  border-radius: var(--radius-base);
  padding: var(--space-2);
}

.control-dropdown input:focus,
.control-dropdown select:focus,
.control-dropdown textarea:focus {
  border-color: rgba(var(--accent-primary-rgb), 0.6);
  outline: none;
  box-shadow: var(--glow-sm);
}

/* Developer Panel Divider */
.dropdown-divider {
  border: none;
  border-top: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  margin: var(--space-2) 0;
}

/* Field Group with Top Divider */
.field-group-divider {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid rgba(var(--text-inverse-rgb), 0.1);
}

/* ============================================
   CALIBRATION TOOL - Compact Styles
   ============================================ */

/* Inline range input (e.g., Blend: [50] – [100] yd) */
.cal-inline-range {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.8rem;
}

.cal-inline-range label {
  font-size: 0.75rem;
  color: rgba(var(--text-inverse-rgb), 0.7);
  white-space: nowrap;
}

.cal-inline-range input[type='number'] {
  width: 50px;
  padding: 2px 4px;
  text-align: center;
  font-size: 0.8rem;
}

.cal-inline-range .cal-unit {
  font-size: 0.7rem;
  color: rgba(var(--text-inverse-rgb), 0.5);
}

/* Compact checkbox toggle row */
.cal-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
}

.cal-toggle-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  color: rgba(var(--text-inverse-rgb), 0.7);
}

.cal-toggle-btn:hover {
  background: rgba(var(--accent-primary-rgb), 0.2);
  border-color: rgba(var(--accent-primary-rgb), 0.5);
}

.cal-toggle-btn.active {
  background: rgba(var(--accent-primary-rgb), 0.3);
  border-color: rgba(var(--accent-primary-rgb), 0.6);
  color: var(--text-inverse);
}

.cal-toggle-btn input[type='checkbox'] {
  width: 12px;
  height: 12px;
  accent-color: var(--accent-primary);
}

/* Compact action button row */
.cal-action-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-2);
}

.cal-action-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.cal-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Icon-only action buttons */
.cal-icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.cal-icon-btn:hover {
  background: rgba(var(--accent-primary-rgb), 0.3);
  border-color: rgba(var(--accent-primary-rgb), 0.6);
  transform: scale(1.05);
}

/* Collapsible hint */
.cal-hint {
  font-size: 0.7rem;
  color: rgba(var(--text-inverse-rgb), 0.5);
  padding: 2px 0;
}

/* Status badge inline */
.cal-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  border-radius: 10px;
  background: rgba(var(--accent-primary-rgb), 0.15);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
}

.cal-status-badge.success {
  background: rgba(var(--accent-success-rgb), 0.15);
  border-color: rgba(var(--accent-success-rgb), 0.3);
  color: var(--accent-success);
}

/* Compact results grid */
.cal-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-1);
  font-size: 0.75rem;
  text-align: center;
}

.cal-results-grid .label {
  color: rgba(var(--text-inverse-rgb), 0.5);
  font-size: 0.65rem;
}

.cal-results-grid .value {
  font-weight: 600;
  color: var(--text-inverse);
}

/* Profile row */
.cal-profile-row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.cal-profile-row select {
  flex: 1;
  padding: 4px 8px;
  font-size: 0.8rem;
}

/* Developer Tools Row */
.dev-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.dev-tools-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-success);
  opacity: 0.7;
}

.dev-tools-buttons {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Vertical separator between button families */
.dev-separator {
  width: 1px;
  height: 16px;
  background: rgba(var(--accent-primary-rgb), 0.3);
  margin: 0 4px;
}

.dev-icon-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: all 0.15s;
}

.dev-icon-btn:hover {
  background: rgba(var(--accent-primary-rgb), 0.3);
  border-color: rgba(var(--accent-primary-rgb), 0.6);
  transform: scale(1.1);
}

.dev-icon-btn:active {
  transform: scale(0.95);
}

/* Developer Inspector Output */
.dev-inspector-output {
  display: none;
  margin-top: var(--space-2);
  max-height: 300px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: pre-wrap;
  color: var(--accent-success);
}

.dev-inspector-output:not(:empty) {
  display: block;
}

/* Developer CLI Input */
.dev-cli-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.4);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-success);
}

.dev-cli-input::placeholder {
  color: rgba(var(--accent-primary-rgb), 0.5);
}

.dev-cli-input:focus {
  outline: none;
  border-color: var(--accent-success);
  box-shadow: 0 0 6px rgba(var(--accent-success-rgb), 0.3);
}

/* Reticle Builder Modal - Size to Canvas */
#reticleBuilderModal {
  width: calc(100vw - 600px) !important;
  height: 90vh !important;
  max-width: none !important;
  padding: 0 !important;
  border: 2px solid rgba(var(--accent-primary-rgb), 0.6) !important;
  border-radius: 12px !important;
  background: linear-gradient(145deg, rgba(15, 25, 35, 0.98), rgba(25, 35, 45, 0.98)) !important;
  box-shadow: 0 8px 32px rgba(var(--accent-primary-rgb), 0.3) !important;
}

#reticleBuilderModal::backdrop {
  background: rgba(0, 0, 0, 0.85);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* Bezel Builder Modal - Size to Canvas */
#bezelBuilderModal {
  width: calc(100vw - 600px) !important;
  height: 90vh !important;
  max-width: none !important;
  padding: 0 !important;
  border: 2px solid rgba(var(--accent-primary-rgb), 0.6) !important;
  border-radius: 12px !important;
  background: linear-gradient(145deg, rgba(15, 25, 35, 0.98), rgba(25, 35, 45, 0.98)) !important;
  box-shadow: 0 8px 32px rgba(var(--accent-primary-rgb), 0.3) !important;
}

#bezelBuilderModal::backdrop {
  background: rgba(0, 0, 0, 0.85);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* Universal button font override - applies to ALL buttons */
button,
.btn,
[class*='button'],
[class*='btn-'],
[type='button'],
[role='button'] {
  font-family: var(--font-primary) !important;
}

/* Button Styling Improvements */
button {
  transition: var(--btn-transition);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  background: var(--btn-bg);
  border: var(--btn-border);
  color: var(--btn-text);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  text-transform: none;
  cursor: pointer;
  letter-spacing: var(--btn-letter-spacing);
}

button:hover:not(:disabled) {
  background: var(--btn-hover-bg);
  border-color: var(--btn-hover-border);
  box-shadow: var(--btn-hover-shadow);
}

button:active:not(:disabled) {
  background: var(--btn-active-bg);
  border-color: var(--btn-active-border);
  transform: translateY(1px);
}

button:disabled {
  opacity: var(--btn-disabled-opacity);
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: none;
}

/* Global focus-visible for keyboard navigation (WCAG AAA) */
button:focus-visible {
  outline: 2px solid var(--accent-primary, rgb(0, 200, 100));
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.35);
  background: var(--accent-primary);
  color: var(--text-inverse);
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease,
    color 0.2s ease;
}

.btn:hover:not(:disabled) {
  background: var(--accent-primary-hover);
  border-color: rgba(var(--accent-primary-rgb), 0.55);
  box-shadow: 0 4px 10px rgba(var(--accent-primary-rgb), 0.22);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
  background: var(--accent-primary-active);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: none;
}

/* Button variant focus-visible states (WCAG AAA) */
.btn:focus-visible {
  outline: 2px solid var(--accent-primary, rgb(0, 200, 100));
  outline-offset: 2px;
}

.btn--warning:focus-visible {
  outline-color: var(--status-warning, #ff9500);
}

.btn--danger:focus-visible,
.btn-danger:focus-visible,
button.danger:focus-visible {
  outline-color: var(--status-error, #ff4444);
}

.btn--ghost:focus-visible,
button.ghost:focus-visible {
  outline-color: var(--cyan, rgb(0, 200, 255));
}

.btn--compact {
  padding: var(--space-2);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.btn--warning {
  background: var(--status-warning);
  border-color: rgba(var(--status-warning-rgb), 0.7);
  color: var(--text-inverse);
  box-shadow: 0 3px 8px rgba(var(--status-warning-rgb), 0.25);
}

.btn--warning:hover:not(:disabled) {
  background: var(--status-warning-accent);
  border-color: rgba(var(--status-warning-rgb), 0.8);
  box-shadow: 0 4px 10px rgba(var(--status-warning-rgb), 0.32);
}

.btn--warning:active:not(:disabled) {
  background: var(--status-warning-strong);
  border-color: rgba(var(--status-warning-rgb), 0.9);
}

.btn--ghost,
button.ghost {
  background: rgba(var(--accent-primary-rgb), 0.05);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  color: rgba(var(--accent-primary-rgb), 0.9);
}

.btn--ghost:hover:not(:disabled),
button.ghost:hover:not(:disabled) {
  background: rgba(var(--accent-primary-rgb), 0.15);
  border-color: rgba(var(--accent-primary-rgb), 0.5);
  box-shadow: 0 0 6px rgba(var(--accent-primary-rgb), 0.3);
}

.btn--ghost:active:not(:disabled),
button.ghost:active:not(:disabled) {
  background: rgba(var(--accent-primary-rgb), 0.2);
}

.btn--danger,
button.danger,
.btn-danger {
  background: var(--status-error);
  border: 1px solid rgba(var(--status-error-rgb), 0.5);
  color: var(--text-inverse);
  box-shadow: 0 3px 8px rgba(var(--status-error-rgb), 0.25);
}

.btn--danger:hover:not(:disabled),
button.danger:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
  background: var(--status-error-accent);
  border-color: rgba(var(--status-error-rgb), 0.65);
  box-shadow: 0 4px 10px rgba(var(--status-error-rgb), 0.35);
}

.btn--danger:active:not(:disabled),
button.danger:active:not(:disabled),
.btn-danger:active:not(:disabled) {
  background: var(--status-error-strong);
  border-color: rgba(var(--status-error-rgb), 0.8);
}

.btn--block {
  display: inline-flex;
  width: 100%;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.toggle-button-group {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.modal {
  display: none;
  font-family: var(--font-primary);
}

.modal.show {
  display: block;
}

/* Ensure all modal content uses the app's font */
.modal *,
.modal-content *,
.modal-body *,
.modal-header *,
.modal-footer * {
  font-family: inherit;
}
.control-group-inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.control-group-inline .inline-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.field-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.field-row.inline {
  flex-direction: row;
}
.field-row.inline > * {
  flex: 1;
}
.field-row .stacked-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.field-row .columns-2 {
  display: flex;
  gap: var(--space-2);
}
.field-row .columns-2 > * {
  flex: 1;
}
.field-row .columns-2 .narrow {
  width: 3.75rem;
}
.field-row .accent-heading {
  color: var(--accent-primary);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0;
}
.field-row .full-width {
  width: 100%;
}
.field-row .note {
  font-size: 0.8rem;
  color: var(--text-soft);
}
.input--compact {
  width: 3.75rem;
}

/* Legacy grid-overlay removed - now handled by CAD rulers */
.preview-canvas {
  position: relative;
  z-index: 2;
  border-radius: 0.75rem; /* Match .preview container corners */
}

/* Floating canvas color controls (bottom-left corner of preview)
   Matches .rotation-toolbar styling for visual consistency */
.canvas-color-float {
  position: absolute;
  bottom: 30px; /* Match Bezel/Axle label offset from scale bars */
  left: 30px; /* Match Bezel/Axle label offset from scale bars */
  z-index: 1200;
  display: flex;
  align-items: center;
  flex-wrap: nowrap; /* Prevent wrapping to new line */
  gap: 6px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(8px); /* Safari support */
  backdrop-filter: blur(8px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  min-height: 44px; /* Use min-height instead of fixed height */
  max-width: none; /* Remove any max-width constraint */
  width: auto; /* Let it expand as needed */
  pointer-events: auto;
}
.canvas-color-float input[type='color'] {
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0 1px; /* Ensure symmetrical horizontal spacing */
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}
.canvas-color-float input[type='color']::-webkit-color-swatch-wrapper {
  padding: 2px;
}
.canvas-color-float input[type='color']::-webkit-color-swatch {
  border-radius: 4px;
  border: none;
}

/* VCC Select dropdown */
.vcc-select-group {
  margin-bottom: 12px;
}
.vcc-select-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.vcc-select {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
}
.vcc-select:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* VCC Slider hints (Angular/Smooth labels) */
.vcc-slider-hints {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
  opacity: 0.7;
}

/* VCC Stepper row (inline: label + stepper) */
.vcc-stepper-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.vcc-stepper-label {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 50px;
}
.vcc-stepper {
  display: flex;
  align-items: center;
  gap: 2px;
}
.vcc-stepper-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vcc-stepper-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-color);
}
.vcc-stepper-input {
  width: 48px;
  height: 24px;
  padding: 0 4px;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 12px;
  text-align: center;
  font-family: var(--font-mono, monospace);
}
.vcc-stepper-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* VCC Toggle button */
.vcc-toggle {
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.vcc-toggle:hover {
  border-color: var(--accent-color);
}
.vcc-toggle--active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--text-inverse, #fff);
}

.canvas-color-float button {
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0 1px; /* Ensure symmetrical horizontal spacing - same as color inputs */
  font-size: 14px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.canvas-color-float button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}
.canvas-color-float button.active {
  background: rgba(0, 255, 136, 0.2);
  border-color: rgba(0, 255, 136, 0.5);
  color: #00ff88;
}
.canvas-float-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 4px; /* Slightly wider margin for dividers to create visual grouping */
}

/* CAD RULERS - Precision rulers and measurement tool
   Owned by cad_rulers.js (plug-and-play module)
   ============================================ */

/* Hide rulers in production mode */
body[data-feature-mode='production'] .cad-ruler-container {
  display: none !important;
}

/* Container for all ruler elements - matches .preview border-radius (0.75rem = 12px) */
.cad-ruler-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  border-radius: 0.75rem; /* Match .preview */
  overflow: hidden; /* Clip rulers to rounded corners */
}

/* Corner square where rulers meet - now also day/night toggle in Field View */
.ruler-corner {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 0.75rem 0 0.75rem 0; /* Top-left corner radius */
  z-index: 10;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  user-select: none;
  pointer-events: auto; /* Override parent's pointer-events: none */
}

.ruler-corner:hover {
  background: rgba(0, 0, 0, 0.95);
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.2);
}

/* In Field View, show day/night indicator */
.preview.field-view .ruler-corner {
  color: #fff;
  font-size: 10px;
}

.preview.field-view .ruler-corner::before {
  content: '☀️';
}

.preview.field-view.field-night .ruler-corner::before {
  content: '🌙';
}

.preview.field-view.field-night .ruler-corner {
  background: rgba(0, 100, 150, 0.6);
}

/* Horizontal ruler (top) - top-right corner gets radius */
.ruler-horizontal {
  position: absolute;
  top: 0;
  left: 20px;
  right: 0;
  height: 20px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 0 0.75rem 0 0; /* Top-right corner radius */
  overflow: hidden;
}

/* Vertical ruler (left) - bottom-left corner gets radius */
.ruler-vertical {
  position: absolute;
  top: 20px;
  left: 0;
  bottom: 0;
  width: 20px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 0 0 0 0.75rem; /* Bottom-left corner radius */
}

/* Tick marks - base styles */
.ruler-tick {
  position: absolute;
  background: rgba(255, 255, 255, 0.6);
}

/* Horizontal ticks (top ruler) */
.ruler-tick-top {
  bottom: 0;
  width: 1px;
}

/* Vertical ticks (left ruler) */
.ruler-tick-left {
  right: 0;
  height: 1px;
}

/* Tick sizes by importance */
.ruler-tick.tick-major {
  background: rgba(255, 255, 255, 0.9);
}
.ruler-tick.tick-minor {
  background: rgba(255, 255, 255, 0.5);
}
.ruler-tick.tick-micro {
  background: rgba(255, 255, 255, 0.3);
}

/* Ruler labels */
.ruler-label {
  position: absolute;
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
}

/* Labels on horizontal ruler */
.ruler-tick-top .ruler-label {
  top: 2px;
  left: 3px;
}

/* Labels on vertical ruler */
.ruler-tick-left .ruler-label {
  left: 2px;
  top: 3px;
  writing-mode: vertical-lr;
  text-orientation: mixed;
  transform: rotate(180deg);
}

/* Measurement tooltip */
.measure-tooltip {
  position: fixed;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.85);
  color: #00ff88;
  font-family: var(--font-mono, 'SF Mono', 'Consolas', monospace);
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid rgba(0, 255, 136, 0.3);
  pointer-events: none;
  z-index: 10000;
  white-space: nowrap;
}

/* Measurement line */
.measure-line {
  position: absolute;
  height: 2px;
  background: #00ff88;
  transform-origin: left center;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 0 4px rgba(0, 255, 136, 0.5);
}

/* Adjust grid overlay to account for rulers and avoid label collision */
#previewContainer.has-rulers #inchGridOverlay {
  top: 20px;
  left: 20px;
  right: 0;
  bottom: 0;
}

/* Adjust canvas elements to avoid ruler collision with labels */
#previewContainer.has-rulers #templateDimensionInfo {
  top: 30px; /* Move below horizontal ruler */
  left: 30px; /* Move right of vertical ruler */
}

#previewContainer.has-rulers #ballisticsMetaLabel {
  top: 30px; /* Move below horizontal ruler */
}

.library-divider {
  border-bottom: 1px solid rgba(var(--text-primary), 0.2);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
}
.builder-tools-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.developer-section {
  margin-top: var(--space-3);
}
.developer-grid {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.developer-grid .flex-1 {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.verification-dialog {
  background: var(--modal-bg);
  border: 2px solid rgba(var(--status-success-rgb), 0.4);
  border-radius: var(--radius-lg);
  padding: 0;
  min-width: 500px;
  box-shadow: var(--shadow-md);
}
.verification-dialog__header {
  background: linear-gradient(
    90deg,
    rgba(var(--status-success-rgb), 0.18),
    rgba(var(--status-success-rgb), 0.28)
  );
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid rgba(var(--status-success-rgb), 0.3);
}
.verification-dialog__title {
  margin: 0;
  color: rgba(var(--status-success-rgb), 0.85);
  font-family: var(--font-primary);
  font-size: var(--font-size-md);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}
.verification-dialog__body {
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-4);
  color: rgba(var(--text-inverse-rgb), 0.85);
  font-family: var(--font-primary);
  /* Mobile-first: hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.verification-dialog__body::-webkit-scrollbar {
  display: none;
}
.verification-dialog__actions {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid rgba(var(--status-success-rgb), 0.2);
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  background: rgba(10, 20, 30, 0.5);
}

/* Improve field group styling */
.field-group {
  margin-bottom: 1rem;
}

.field-group.inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Enforce single-column layout inside control dropdowns */
.controls-panel .control-dropdown .dropdown-content .field-group.inline {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0.4rem !important;
}
.controls-panel .control-dropdown .dropdown-content .field-group.inline > * {
  flex: 0 0 auto !important;
  width: 100% !important;
}

/* Also stack ad-hoc inline flex rows inside the left controls form */
#controls-form .dropdown-content div[style*='display: flex'] {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0.4rem !important;
}
#controls-form .dropdown-content div[style*='display: flex'] > * {
  width: 100% !important;
}

.field-group.inline > * {
  flex: 1;
}

.field-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85em;
  color: var(--text-soft);
  line-height: 1.3;
}

.field-note {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-soft);
  font-size: 0.8em;
}

#ballisticsCalculatorBtn {
  color: var(--text-primary) !important;
}

#ballisticsCalculatorBtn:hover {
  color: var(--white) !important;
}

/* PROJECT button - muted when no project loaded, normal when active */
#quickLaunchSpade {
  color: var(--text-muted, rgba(255, 255, 255, 0.4)) !important;
  opacity: 0.7;
  transition:
    color 0.2s ease,
    opacity 0.2s ease;
}

#quickLaunchSpade:hover {
  color: var(--text-secondary, rgba(255, 255, 255, 0.7)) !important;
  opacity: 0.85;
}

/* PROJECT button with saved projects - matches other buttons */
#projectBtn.has-projects,
#quickLaunchSpade.on-deck {
  color: var(--text-primary) !important;
  opacity: 1;
}

#projectBtn.has-projects:hover,
#quickLaunchSpade.on-deck:hover {
  color: var(--white) !important;
}

/* PROJECT button when no projects - dim state */
#projectBtn:not(.has-projects) {
  opacity: 0.5;
}

/* PROJECT button with ACTIVE project (just saved, in-view) */
#projectBtn.has-active-project {
  color: var(--gt-silver, #c0c0c0) !important;
  opacity: 1;
  text-shadow: 0 0 8px rgba(192, 192, 192, 0.5);
  animation: projectActiveGlow 2s ease-out;
}

@keyframes projectActiveGlow {
  0% {
    text-shadow: 0 0 12px rgba(192, 192, 192, 0.8);
  }
  100% {
    text-shadow: 0 0 8px rgba(192, 192, 192, 0.5);
  }
}

/* Oracle styles moved to static/css/domains/oracle.css */

/* Hardpoint table buttons */
.btn-edit,
.btn-remove {
  padding: 2px 8px;
  margin: 0 2px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn-edit {
  background: var(--cyan-500, #00bcd4);
  color: #000;
}

.btn-edit:hover {
  background: var(--cyan-400, #26c6da);
  transform: scale(1.1);
}

.btn-remove {
  background: #dc3545;
  color: #fff;
}

.btn-remove:hover {
  background: #c82333;
  transform: scale(1.1);
}

/* BUTTON ROW FAMILY REMOVED - now in 05-components/button-row.css */

/* Legacy class selectors - no longer used, kept for backwards compatibility */

.app-header h1 {
  margin: 0;
  font-size: 1.4rem;
  display: flex;
  align-items: baseline;
  gap: 50px;
  flex-shrink: 0;
  position: relative;
  z-index: 10; /* Above status-banner which is centered in header */
}

.knomad-title {
  font-family: 'Arial Black', 'Arial Bold', Impact, sans-serif;
  letter-spacing: 0.175em;
  transform: scaleX(2) scaleY(0.75);
  transform-origin: left center;
  display: inline-block;
  font-weight: 900;
  margin-right: 80px; /* Increased to account for 2x scale visual width */
  transition: opacity 0.2s ease;
  /* Button reset for clickable title */
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
}

.knomad-title:hover {
  opacity: 0.7;
}

.knomad-title:focus {
  outline: none;
}

.about-knomad-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 0.5rem;
  margin-left: 0.5rem;
  opacity: 0.6;
  transition:
    opacity 0.2s,
    color 0.2s;
  vertical-align: middle;
}
.about-knomad-btn:hover {
  opacity: 1;
  color: var(--accent-primary);
}

.tesseract-title {
  font-style: italic;
  font-weight: 400;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(0, 160, 180, 0.9);
  text-shadow:
    0 0 8px rgba(var(--accent-primary-rgb), 0.6),
    0 0 16px rgba(var(--accent-primary-rgb), 0.4);
  font-size: 0.95em;
  white-space: nowrap;
  margin-left: 80px;
  letter-spacing: 0.12em;
}

/* Dev Mode Toggle - disguised as Black Team LLC branding */
.black-team-toggle {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-left: auto;
  margin-right: 150px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.black-team-toggle:hover {
  color: var(--text-secondary);
}

/* Active state - glowing cyan effect */
.black-team-toggle.active {
  color: var(--cyan);
  text-shadow:
    0 0 4px var(--cyan-50),
    0 0 8px var(--cyan-40),
    0 0 12px var(--cyan-30);
  animation: dev-mode-pulse 2s ease-in-out infinite;
}

@keyframes dev-mode-pulse {
  0%,
  100% {
    text-shadow:
      0 0 4px var(--cyan-50),
      0 0 8px var(--cyan-40),
      0 0 12px var(--cyan-30);
  }
  50% {
    text-shadow:
      0 0 6px var(--cyan-60),
      0 0 12px var(--cyan-50),
      0 0 18px var(--cyan-40);
  }
}

.tagline {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
}

/* ============================================
   BENTO SPACING SYSTEM
   Single variable controls ALL gaps uniformly:
   - Between bentos
   - Between bentos and browser edges (top, bottom, sides)
   - Between bentos and header
   ============================================ */
:root {
  --bento-gap: 10px; /* Master spacing variable - change this one value to adjust all gaps */
}

/* App Shell - True full-width, no maximum, full viewport height */
.app-shell {
  width: 100%;
  max-width: none; /* No upper limit - always full width */
  padding: var(--bento-gap) var(--bento-gap) var(--bento-gap); /* Uniform spacing: top, sides, bottom */
  box-sizing: border-box;
  flex: 1 1 auto; /* Take remaining vertical space */
  display: flex;
  flex-direction: column;
  min-height: 0; /* Allow shrinking */
  gap: var(--bento-gap); /* Gap between app-layout and any footer elements */
}

.app-layout {
  display: grid;
  /* Flexible columns: min-width for usability, fr for proportional growth */
  grid-template-columns: minmax(320px, 18%) minmax(600px, 1fr) minmax(280px, 18%);
  grid-template-rows: 1fr auto; /* Row 1: panels at full height, Row 2: tracker section */
  gap: var(--bento-gap); /* Uniform bento spacing */
  padding: 0;
  width: 100%;
  flex: 1 1 auto; /* Take remaining vertical space */
  min-height: 0; /* Critical: allows grid to shrink to fit */
  overflow: hidden; /* Prevent layout from growing */
  position: relative;
}

/* Responsive breakpoints - maintain balanced proportions */
/* Note: --bento-gap inherited from :root, no need to override */
@media (max-width: 1400px) {
  .app-layout {
    grid-template-columns: minmax(300px, 17%) minmax(550px, 1fr) minmax(260px, 17%);
  }
}

@media (max-width: 1200px) {
  .app-layout {
    grid-template-columns: minmax(280px, 16%) minmax(500px, 1fr) minmax(240px, 16%);
  }
}

.controls-panel {
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: 0.75rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%; /* Fill grid cell height */
  max-height: 100%; /* Prevent growing beyond grid cell */
  overflow-y: auto; /* Internal scrolling */
  position: relative;
  z-index: 100; /* Create stacking context above canvas for dropdowns */
  overflow-x: hidden; /* Hide horizontal overflow */
  min-height: 0; /* Allow shrinking */
  /* Mobile-first: hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Explicit grid positioning for all panels */
.left-panel {
  grid-column: 1;
  grid-row: 1;
}

.canvas-panel {
  grid-column: 2;
  grid-row: 1;
}

.right-panel {
  grid-column: 3;
  grid-row: 1;
}

/* Production mode: Canvas expands to fill hidden right panel space */
body[data-feature-mode='production'] .canvas-panel {
  grid-column: 2 / 4;
}

.controls-panel::-webkit-scrollbar {
  display: none;
}

/* Desktop: show styled scrollbar */
@media (min-width: 769px) {
  .controls-panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 180, 255, 0.3) rgba(0, 0, 0, 0.1);
  }
  .controls-panel::-webkit-scrollbar {
    display: block;
    width: 6px;
  }
  .controls-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
  }
  .controls-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 180, 255, 0.3);
    border-radius: 3px;
  }
  .controls-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 180, 255, 0.5);
  }
}

/* DOPE tables - no inner scrollbar, let outer panel scroll */
.controls-panel #tableContainer,
#tableContainer {
  overflow-y: visible;
}

.controls-panel .table-rows,
.table-rows {
  overflow-y: visible;
}

.controls-panel
  button:not(.btn):not(.tool-header-btn):not(.folder-menu-item):not(.scene-selector__item),
.right-panel
  button:not(.btn):not(.tool-header-btn):not(.folder-menu-item):not(.scene-selector__item),
form button:not(.btn):not(.tool-header-btn):not(.folder-menu-item):not(.scene-selector__item) {
  font-family: var(--font-primary) !important;
  background: var(--btn-bg) !important;
  border: var(--btn-border) !important;
  color: var(--btn-text) !important;
}

.controls-panel
  button:not(.btn):not(.tool-header-btn):not(.folder-menu-item):not(
    .scene-selector__item
  ):hover:not(:disabled),
.right-panel
  button:not(.btn):not(.tool-header-btn):not(.folder-menu-item):not(
    .scene-selector__item
  ):hover:not(:disabled),
form
  button:not(.btn):not(.tool-header-btn):not(.folder-menu-item):not(
    .scene-selector__item
  ):hover:not(:disabled) {
  background: var(--btn-hover-bg) !important;
  border-color: var(--btn-hover-border) !important;
  box-shadow: var(--btn-hover-shadow) !important;
}

.controls-panel
  button:not(.btn):not(.tool-header-btn):not(.folder-menu-item):not(
    .scene-selector__item
  ):active:not(:disabled),
.right-panel
  button:not(.btn):not(.tool-header-btn):not(.folder-menu-item):not(
    .scene-selector__item
  ):active:not(:disabled),
form
  button:not(.btn):not(.tool-header-btn):not(.folder-menu-item):not(
    .scene-selector__item
  ):active:not(:disabled) {
  background: var(--btn-active-bg) !important;
  border-color: var(--btn-active-border) !important;
}

/* SCROLL BAR FIX v4: Max-height constraints with content preservation - RESTORED */

/* Rotation controls at bottom of canvas - FIXED TO BOTTOM */
.rotation-toolbar {
  /* Stick to bottom of canvas panel while allowing panel content to scroll */
  padding: 0.5rem;
  background: var(--surface-panel);
  border-top: 1px solid var(--border-default);
  border-bottom-left-radius: 0.75rem;
  border-bottom-right-radius: 0.75rem;
  z-index: 120;
  min-height: 45px;
  flex: 0 0 auto; /* Never shrink */
  position: sticky;
  bottom: 0;
}

/* Apply the same sticky behavior to the existing toolbar labeled Rotation controls */
.canvas-panel .toolbar[aria-label='Rotation controls'] {
  padding: 0.5rem;
  background: var(--surface-panel);
  border-top: 1px solid var(--border-default);
  border-bottom-left-radius: 0.75rem;
  border-bottom-right-radius: 0.75rem;
  z-index: 120;
  min-height: 45px;
  position: sticky;
  bottom: 0;
  order: 3; /* ensure it's after the figure */
  margin-top: auto; /* push to bottom in flex column */
}

/* Old tracker-dock styles removed - now using tracker-section below canvas */

.rpm-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
}

.rpm-control input {
  width: 60px;
  padding: 0.25rem;
  border: 1px solid var(--border-default);
  border-radius: 0.25rem;
  font-family: var(--font-primary);
}

.rpm-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rpm-arrows button {
  padding: 0 6px;
  line-height: 1;
  font-size: 10px;
  min-height: 14px;
  border: 1px solid var(--border-default);
  background: var(--surface-muted-strong);
  border-radius: 2px;
  cursor: pointer;
}

.rpm-arrows button:hover {
  background: var(--surface-muted-strong);
}

#angleDisplay {
  min-width: 45px;
  font-family: var(--font-primary);
  font-size: 0.9em;
}

/* Validation Error Modal Styles */
.validation-error-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-content.error-modal {
  font-family: var(--font-primary) !important;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--font-primary);
}

.modal-header.error {
  background: linear-gradient(135deg, var(--status-error), rgba(var(--status-error-rgb), 0.65));
  color: white;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header.error h2 {
  margin: 0;
  font-family: var(--font-primary);
}

.modal-close {
  background: none;
  border-radius: 50%;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  font-family: var(--font-primary);
  /* Mobile-first: hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal-body::-webkit-scrollbar {
  display: none;
}

.error-message,
.error-reason,
.error-suggestions {
  margin-bottom: 1.5rem;
}

.error-message strong,
.error-reason strong,
.error-suggestions strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.error-message p {
  background: var(--surface-warning);
  border-left: 4px solid var(--status-warning);
  padding: 1rem;
  margin: 0.5rem 0;
  border-radius: 4px;
}

.error-reason p {
  background: var(--surface-muted-strong);
  padding: 1rem;
  margin: 0.5rem 0;
  border-radius: 4px;
  color: var(--text-soft);
}

.error-suggestions ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.error-suggestions li {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--surface-positive);
  border-left: 4px solid var(--status-success);
  border-radius: 4px;
  position: relative;
  padding-left: 2rem;
}

.error-suggestions li::before {
  content: '✓';
  position: absolute;
  left: 0.75rem;
  color: var(--status-success);
  font-weight: bold;
}

.error-override {
  background: var(--surface-warning);
  padding: 1rem;
  border-radius: 4px;
  margin-top: 1rem;
}

.error-override label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: var(--surface-muted-strong);
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-primary);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.btn-acknowledge {
  padding: 0.75rem 1.5rem;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-acknowledge:hover {
  background: var(--accent-primary-strong);
}

.btn-override {
  padding: 0.75rem 1.5rem;
  background: var(--status-warning);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-override:disabled {
  background: var(--border-muted);
  cursor: not-allowed;
}

.btn-override:not(:disabled):hover {
  background: var(--status-warning-strong);
}

/* Auto-calculated field indicator */
input[readonly] {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(var(--accent-primary-rgb), 0.3);
  color: rgba(255, 255, 255, 0.9);
}

#size-indicator {
  pointer-events: auto;
  cursor: help;
}

.ruler-horizontal text,
.ruler-vertical text {
  font-family: var(--font-primary);
  -webkit-user-select: none;
  user-select: none;
}

/* Grid overlay */
#canvas-grid {
  pointer-events: none;
}

/* Material fit indicators */
.fit-good {
  color: var(--status-success);
}

.fit-warning {
  color: var(--status-warning);
}

.fit-error {
  color: var(--status-error);
}

/* Compact panels for smaller screens */
@media (max-width: 1400px) {
  .controls-panel {
    padding: 0.6rem;
    gap: 0.6rem;
  }
}

@media (max-width: 1200px) {
  .controls-panel {
    padding: 0.5rem;
    gap: 0.5rem;
  }
}

.controls-panel h2,
.controls-panel h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Compact field groups for full-screen viewing */
@media (max-width: 1400px) {
  .field-group {
    gap: 0.2rem;
  }
  .controls-panel h2,
  .controls-panel h3 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
  }
  label {
    font-size: 0.8rem;
  }
  input[type='number'],
  select,
  textarea {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
  }
}
.field-group > label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.field-group > input,
.field-group > select,
.field-group > textarea {
  width: 100%;
}
.field-group.compact > label {
  min-width: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.field-group.compact > input[type='number'],
.field-group.compact > input[type='range'],
.field-group.compact > select {
  flex: 1 1 auto;
  min-width: 0;
}
.label-text {
  display: none;
}

.field-group.inline {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
}

label {
  font-family: var(--font-primary) !important;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}
.field-label {
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}
/* Remove broken icon system */
label .control-warning {
  font-size: 0.8rem;
  margin-left: 0.25rem;
}

input[type='number'],
textarea {
  font-family: var(--font-primary) !important;
  border: 1px solid var(--border-muted);
  border-radius: 0.5rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.95rem;
}

textarea {
  resize: vertical;
}

/* Secondary button styling for specific contexts (preserves original sizing for canvas layout) */
button {
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 0.9rem;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: var(--btn-bg);
  border: var(--btn-border);
  color: var(--btn-text);
  transition: var(--btn-transition);
  font-family: var(--font-primary) !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

button:hover:not(:disabled) {
  background: var(--btn-hover-bg);
  border-color: var(--btn-hover-border);
  box-shadow: var(--btn-hover-shadow);
}

button:active:not(:disabled) {
  background: var(--btn-active-bg);
  border-color: var(--btn-active-border);
}

button:disabled {
  opacity: var(--btn-disabled-opacity);
  cursor: not-allowed;
  box-shadow: none;
}

button.ghost {
  background: rgba(0, 200, 255, 0.05);
  color: rgba(0, 200, 255, 0.9);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
}

.toggle-button {
  font-family: var(--font-primary) !important;
  background: var(--surface-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-muted);
}

.toggle-button.active {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-color: var(--accent-primary);
}

/* Canvas panel outer container - this is the bento box */
.canvas-panel {
  background: var(--surface-panel);
}

/* Inner layout containers - transparent, just for layout, not visual */
.canvas-main,
.canvas-stage {
  background: transparent !important;
}

/* Preview container - CSS handles background, no inline styles */
.preview {
  background: #e4ecf1 !important; /* Engineer View: light gray canvas - FORCED */
}

/* Field View: topo map background with night/day modes */
/* Default Field View is night mode - deep midnight, moon behind heavy clouds */
.preview.field-view,
.preview.field-view.field-night {
  background:
    linear-gradient(rgba(4, 6, 14, 0.94), rgba(2, 4, 10, 0.96)),
    image-set(
        url('/static/img/topo-background.webp') type('image/webp'),
        url('/static/img/topo-background.webp') type('image/jpeg')
      )
      center/cover !important;
  cursor: pointer; /* Indicate clickable for night/day toggle */
}

/* Day mode: very faint topo, bright outdoor simulation */
.preview.field-view.field-day {
  background:
    linear-gradient(rgba(245, 245, 240, 0.85), rgba(245, 245, 240, 0.85)),
    image-set(
        url('/static/img/topo-background.webp') type('image/webp'),
        url('/static/img/topo-background.webp') type('image/jpeg')
      )
      center/cover !important;
}

.canvas-panel {
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%; /* Fill grid cell height */
  max-height: 100%; /* Prevent growing beyond grid cell */
  min-height: 0; /* Allow shrinking */
  overflow: visible; /* Allow tools to extend into canvas area */
  position: relative; /* Critical for absolute positioning of trackers */
}

.canvas-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 0;
}

.canvas-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Hide layer toolbar completely - reclaim space for canvas */
.layer-toolbar {
  display: none !important;
}

.layer-toolbar {
  flex: 0 0 90px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start; /* Align buttons to top */
  align-self: flex-start; /* Don't stretch to full parent height */
  gap: 0.1rem;
  padding: 0.2rem;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: 0.25rem;
  max-height: 100%;
  overflow-y: auto;
  position: relative;
  /* Mobile-first: hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.layer-toolbar::-webkit-scrollbar {
  display: none;
}

/* Desktop: show thin scrollbar */
@media (min-width: 769px) {
  .layer-toolbar {
    scrollbar-width: thin;
  }
  .layer-toolbar::-webkit-scrollbar {
    display: block;
    width: 3px;
  }
  .layer-toolbar::-webkit-scrollbar-thumb {
    background: var(--border-muted);
    border-radius: 999px;
  }
}

.layer-toolbar button {
  font-family: var(--font-primary) !important;
  width: 100%;
  min-width: auto;
  padding: 0.15rem 0.3rem;
  font-size: 0.6rem;
  line-height: 1;
  justify-content: flex-start;
  border-radius: 0.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.layer-toolbar button {
  text-align: left;
}

.canvas-stage .preview {
  flex: 1 1 auto;
}

.right-panel {
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: 0.75rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  height: 100%; /* Fill grid cell height */
  overflow-y: auto; /* Internal scrolling */
  min-height: 0; /* Allow shrinking */
  /* Mobile-first: hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.right-panel::-webkit-scrollbar {
  display: none;
}

/* Desktop: show styled scrollbar */
@media (min-width: 769px) {
  .right-panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 180, 255, 0.3) rgba(0, 0, 0, 0.1);
  }
  .right-panel::-webkit-scrollbar {
    display: block;
    width: 6px;
  }
  .right-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
  }
  .right-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 180, 255, 0.3);
    border-radius: 3px;
  }
  .right-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 180, 255, 0.5);
  }
}

/* Compact panels for smaller screens */
@media (max-width: 1400px) {
  .canvas-panel {
    padding: 0.15rem;
  }
  .canvas-main {
    gap: 0.6rem;
  }
  .right-panel {
    padding: 0.6rem;
    gap: 0.5rem;
  }
}

@media (max-width: 1200px) {
  .canvas-panel {
    padding: 0.1rem;
  }
  .canvas-main {
    flex-direction: column;
  }
  .layer-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 0 0 auto;
    max-height: none;
    gap: 0.2rem; /* Tight gap for horizontal layout */
  }
  .layer-toolbar button {
    flex: 1 1 calc(50% - 0.2rem); /* Match tight gap */
    text-align: center;
    padding: 0.15rem 0.25rem; /* Ultra compact for mobile */
    font-size: 0.55rem; /* Tiny font */
    line-height: 1; /* Minimal line height */
    letter-spacing: -0.02em; /* Tighter letters */
  }
  .right-panel {
    padding: 0.5rem;
    gap: 0.4rem;
  }
}

/* ============================================
   FLOATING ROTATION CONTROLS
   Overlay canvas with square tile grid
   ============================================ */

/* Ensure preview figure creates positioning context */
.preview.relative {
  position: relative;
}

/* ============================================
   FLOATING TOOLBAR CONTROLS
   ============================================ */

/* Ballistics controls - top center of canvas-stage */
.ballistics-controls {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  pointer-events: none;
}

.ballistics-controls .rotation-toolbar {
  pointer-events: auto;
}

/* Rotation controls - bottom center of canvas-stage */
.rotation-controls {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  pointer-events: none;
}

.rotation-controls .rotation-toolbar {
  pointer-events: auto;
}

/* Ensure canvas-stage is a positioning context for the floating toolbars */
.canvas-stage {
  position: relative;
}

/* Compact input for floating toolbars */
.compact-input {
  width: 60px;
  height: 28px;
  padding: 2px 4px;
  font-size: 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: var(--text-primary);
}

.compact-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Extra small icon button for compact controls */
.btn--icon.btn--xs {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  font-size: 14px;
  line-height: 22px;
  border-radius: 4px;
}

/* Glyph controls in APPEARANCE drawer */
.glyph-controls {
  margin-bottom: 8px;
}

.glyph-controls .compact-input {
  width: 48px;
  height: 24px;
  font-size: 11px;
  padding: 2px;
}

/* Stepper component - compact +/value/- control */
.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--surface-panel, rgba(0, 0, 0, 0.2));
  border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.1));
  border-radius: 6px;
  overflow: hidden;
}

.stepper-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-primary, #fff);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stepper-btn:hover {
  background: var(--accent-primary, #00e5ff);
  color: var(--base-bg, #000);
}

.stepper-btn:active {
  transform: scale(0.95);
}

.stepper-value {
  width: 36px;
  height: 24px;
  padding: 0 2px;
  border: none;
  border-left: 1px solid var(--border-soft, rgba(255, 255, 255, 0.1));
  border-right: 1px solid var(--border-soft, rgba(255, 255, 255, 0.1));
  background: transparent;
  color: var(--text-primary, #fff);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  cursor: default;
}

/* Glyph row layout */
.glyph-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.glyph-row label {
  color: var(--text-secondary, #888);
}

/* Toolbar divider */
.toolbar-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 4px;
}

/* Controls label in toolbar */
.rotation-toolbar .controls-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rotation-toolbar .controls-unit {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.rotation-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: auto; /* Re-enable clicks on toolbar */
  height: 44px; /* Fixed height for consistency with canvas-color-float */
}

/* Standardize all rotation toolbar buttons to 32x32px with ghost color scheme */
.rotation-toolbar .btn--icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 14px;
  border-radius: 6px;
  background: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.05);
  border: 1px solid rgba(var(--accent-primary-rgb, 0, 229, 255), 0.3);
  color: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.9);
  transition: all 0.15s ease;
}

.rotation-toolbar .btn--icon:hover {
  background: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.15);
  border-color: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.5);
  box-shadow: 0 0 6px rgba(var(--accent-primary-rgb, 0, 229, 255), 0.3);
  color: var(--accent-primary, #00e5ff);
}

.rotation-toolbar .btn--toggle {
  height: 32px;
  padding: 0 12px;
  font-size: 11px;
  border-radius: 6px;
  background: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.05);
  border: 1px solid rgba(var(--accent-primary-rgb, 0, 229, 255), 0.3);
  color: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.9);
  transition: all 0.15s ease;
}

.rotation-toolbar .btn--toggle:hover {
  background: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.15);
  border-color: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.5);
  box-shadow: 0 0 6px rgba(var(--accent-primary-rgb, 0, 229, 255), 0.3);
  color: var(--accent-primary, #00e5ff);
}

/* RPM Selector - Compact dropdown with ghost color scheme */
.rpm-selector {
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.05);
  border: 1px solid rgba(var(--accent-primary-rgb, 0, 229, 255), 0.3);
  color: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.9);
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 80px;
}

.rpm-selector:hover {
  background: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.15);
  border-color: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.5);
  box-shadow: 0 0 6px rgba(var(--accent-primary-rgb, 0, 229, 255), 0.3);
}

.rpm-selector:focus {
  outline: none;
  border-color: rgba(var(--accent-primary-rgb, 0, 229, 255), 0.5);
  box-shadow: 0 0 6px rgba(var(--accent-primary-rgb, 0, 229, 255), 0.4);
}

/* Mini HUD - compact range/mils display in toolbar (matches .compact-input) */
.rotation-toolbar .mini-hud {
  display: inline-block;
  vertical-align: middle;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 2px;
}

.rotation-toolbar .mini-hud-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
  margin-right: 4px;
  vertical-align: middle;
}

/* Gene-spliced from bem-button.css #mvValue, #bcValue (lines 476-485) */
.rotation-toolbar .mini-hud-value {
  display: inline-block;
  width: 70px;
  text-align: center;
  background: var(--surface-input-bg, rgba(0, 0, 0, 0.5));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.2));
  color: var(--text-primary, #fff);
  padding: 4px;
  border-radius: var(--radius-sm, 3px);
  font-weight: bold;
  /* Layout alignment */
  vertical-align: middle;
  box-sizing: border-box;
}

/* Icon buttons: compact 32x32 tiles */
.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border-default);
  background: var(--surface-panel);
  color: var(--text-primary);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: all 0.2s ease;
  font-size: 14px;
}

.icon-button .icon {
  display: block;
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
}

.icon-button:hover {
  background: var(--surface-muted-strong);
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.icon-button:active {
  transform: scale(0.95);
}

.icon-button.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-inverse);
}

/* Ghost button variant for icon buttons */
.icon-button.ghost {
  background: transparent;
  border-color: var(--border-muted);
}

.icon-button.ghost:hover {
  background: var(--surface-muted-strong);
  border-color: var(--border-default);
}

/* Labeled icon button variant */
.icon-button.labeled {
  grid-column: span 3; /* Full width in grid */
  width: 100%;
  height: auto;
  min-height: 44px;
  padding: 6px 8px;
  flex-direction: column;
  gap: 2px;
  border-radius: 8px;
}

.icon-button.labeled .icon {
  font-size: 18px;
}

.icon-button.labeled .icon-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1;
  color: inherit;
  white-space: nowrap;
}

/* Checkbox button (for trackers toggle) */
.checkbox-button {
  position: relative;
  cursor: pointer;
}

.checkbox-button input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-button input[type='checkbox']:checked + .icon {
  color: var(--accent-primary);
}

/* Rotation Popover */
.rotation-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1201; /* Above rotation controls (z-index: 1200) */
  min-width: 280px;
  max-width: 320px;
  pointer-events: auto;
}

.rotation-popover[hidden] {
  display: none;
}

.popover-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Slider controls in popover */
.slider-control {
  display: grid;
  grid-template-columns: 60px 1fr 50px;
  gap: 8px;
  align-items: center;
}

.slider-label {
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.slider-value {
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  color: var(--accent-primary);
}

.slider-control input[type='range'] {
  width: 100%;
}

/* Responsive: adjust floating controls on small screens */
@media (max-width: 1024px) {
  .rotation-controls {
    bottom: 8px;
    right: 8px;
    left: 8px;
  }

  .rotation-toolbar {
    margin: 0 auto;
    max-width: 280px;
  }

  /* Tracker dock now in separate section, no overlap issues */
}

@media (max-width: 768px) {
  .rotation-controls {
    position: relative;
    bottom: auto;
    right: auto;
    left: auto;
    margin: 8px;
    z-index: auto; /* Reset z-index in normal flow */
  }

  .rotation-toolbar {
    max-width: none;
  }

  .rotation-popover {
    bottom: auto;
    top: calc(100% + 8px);
    right: auto;
    left: 0;
    min-width: auto;
    max-width: 100%;
  }

  /* Tracker section handles its own layout on mobile */
}

/* OLD toolbar styles (legacy - keep for other toolbars) */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
  flex: 0 0 auto; /* Don't grow or shrink */
  min-height: fit-content;
  justify-content: center;
  align-items: center;
}

/* Toolbar button styling - all buttons same size */
.toolbar button {
  padding: 12px 24px;
  font-size: 16.5px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-weight: 600;
  min-width: 120px;
}

/* Toolbar labels and inputs */
.toolbar label {
  color: rgba(255, 255, 255, 0.9) !important;
  font-family: var(--font-primary) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
}

.toolbar input[type='checkbox'] {
  accent-color: rgba(0, 200, 255, 0.8);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.toolbar input[type='range'] {
  accent-color: rgba(0, 200, 255, 0.8);
  height: 6px;
  border-radius: 3px;
  background: rgba(var(--accent-primary-rgb), 0.2);
  cursor: pointer;
}

.toolbar button {
  font-family: var(--font-primary) !important;
  background: var(--btn-bg) !important;
  border: var(--btn-border) !important;
  color: var(--btn-text) !important;
}

.toolbar button:hover {
  background: var(--btn-hover-bg) !important;
  border-color: var(--btn-hover-border) !important;
  box-shadow: var(--btn-hover-shadow) !important;
  transform: translateY(0) !important;
}

.toolbar .toggle-button {
  font-family: var(--font-primary) !important;
  background: var(--btn-bg) !important;
  border: var(--btn-border) !important;
  color: var(--btn-text) !important;
}

.toolbar .toggle-button:hover {
  background: var(--btn-hover-bg) !important;
  border-color: var(--btn-hover-border) !important;
  box-shadow: var(--btn-hover-shadow) !important;
  transform: translateY(0) !important;
}

.toolbar .toggle-button.active {
  background: var(--btn-active-bg) !important;
  color: var(--text-primary) !important;
  border-color: var(--btn-active-border) !important;
  box-shadow: 0 0 10px var(--cyan-50) !important;
}

.toolbar .toggle-button.active:hover {
  background: linear-gradient(145deg, var(--cyan-30), var(--cyan-40)) !important;
  border-color: var(--cyan-90) !important;
}

.toolbar .toggle-button.is-pan-zoom-inactive {
  background: linear-gradient(145deg, rgba(244, 67, 54, 0.85), rgba(183, 28, 28, 0.85)) !important;
  border-color: rgba(244, 67, 54, 1) !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(244, 67, 54, 0.4) !important;
}

.toolbar .toggle-button.is-pan-zoom-active {
  background: linear-gradient(145deg, rgba(76, 175, 80, 0.65), rgba(56, 142, 60, 0.65)) !important;
  border-color: rgba(76, 175, 80, 0.85) !important;
  color: #0f2612 !important;
  box-shadow: 0 0 12px rgba(76, 175, 80, 0.45) !important;
}

.preview {
  /* Square container to match SVG aspect-ratio */
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto; /* Center horizontally if container is wider */
  display: flex;
  justify-content: center;
  align-items: center;
  /* Background is set earlier in file - Engineer View: #E4ECF1, Field View: transparent */
  border: none;
  border-radius: 0.75rem;
  padding: 0;
  overflow: hidden; /* Clip content to container bounds */
  clip-path: inset(0 round 0.75rem); /* Force SVG/topo clipping to rounded corners */
  position: relative; /* Required for absolute positioning of CNC tracker and verification */
}

/* Responsive canvas sizing */
@media (max-width: 1400px) {
  .preview {
    padding: 0;
  }
  .toolbar {
    gap: 0.3rem;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 1200px) {
  .preview {
    padding: 0;
  }
  .toolbar {
    gap: 0.25rem;
    margin-bottom: 0.4rem;
  }
}

/* Height-based responsiveness */
@media (max-height: 800px) {
  .app-header {
    padding: 0.5rem 1rem 0.5rem;
  }
  .toolbar {
    margin-bottom: 0.2rem;
    gap: 0.2rem;
    font-size: 0.9rem;
  }
  .rotation-toolbar {
    padding: 0.3rem;
    min-height: 35px;
  }
  .preview {
    min-height: 0; /* Allow full collapse on small screens */
  }
}

@media (max-height: 600px) {
  .app-header {
    padding: 0.3rem 0.5rem;
  }
  .app-header h1 {
    font-size: 1.25rem;
  }
  .tagline {
    display: none; /* Hide tagline on very short screens */
  }
  .toolbar {
    font-size: 0.85rem;
    gap: 0.1rem;
    margin-bottom: 0.1rem;
  }
  .rotation-toolbar {
    padding: 0.2rem;
    font-size: 0.85rem;
    min-height: 32px;
  }
  .preview {
    padding: 0;
  }
}

@media (max-height: 500px) {
  .app-header {
    padding: 0.2rem 0.4rem;
  }
  .app-header h1 {
    font-size: 1rem;
  }
  .preview {
    padding: 0;
    min-height: 0;
    flex: 1 1 0; /* Ensure canvas can completely collapse if needed */
  }
  .rotation-toolbar {
    padding: 0.1rem;
    font-size: 0.75rem;
    min-height: 30px; /* Smaller but still visible */
  }
  .toolbar {
    font-size: 0.75rem;
    gap: 0.1rem;
    margin-bottom: 0.1rem;
  }
  /* Force very compact controls */
  .controls-panel,
  .right-panel {
    font-size: 0.85rem;
  }
}

/* ============================================
   DUAL-DISK ARCHITECTURE (V3)
   Side-by-side rendering for spiral and reticle
   ============================================ */

/* Dual-disk container - flexbox layout for side-by-side disks */
.dual-disk-container {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

/* Individual disk container */
.disk-container {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0; /* Allow shrinking */
}

/* Disk label */
.disk-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
  padding: 0.25rem 0.5rem;
  background: var(--surface-subtle);
  border-radius: 4px;
}

/* Disk canvas (SVG) */
.disk-canvas {
  width: 100%;
  height: 100%;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  touch-action: none;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-canvas);
}

/* OVERLAY MODE: Stack disks on same axle */
.dual-disk-container.overlay-mode {
  position: relative;
}

.dual-disk-container.overlay-mode .disk-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.dual-disk-container.overlay-mode .disk-reticle {
  z-index: 1; /* Bottom disk (reticle) behind */
}

.dual-disk-container.overlay-mode .disk-spiral {
  z-index: 2; /* Top disk (spiral) in front */
  opacity: 0.85; /* Slight transparency to see reticle underneath */
}

/* Hide labels in overlay mode */
.dual-disk-container.overlay-mode .disk-label {
  display: none;
}

/* Legacy support - keep #spiralPreview working */
#spiralPreview {
  width: 100%;
  height: 100%;
  max-height: 100%;
  max-width: 100%;
  border-radius: 0.75rem; /* Match bento container corners */
  overflow: hidden; /* Clip content to rounded corners */
  clip-path: inset(0 round 0.75rem); /* Force SVG content clipping */
  /* Container is now square, so SVG fills it completely */
  touch-action: none;
  background: transparent !important; /* Ensure no dark background on SVG */
}

/* New reticle preview canvas */
#reticlePreview {
  width: 100%;
  height: 100%;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  touch-action: none;
}

/* ============================================
   HUD VISIBILITY - Managed by HUDController.js
   Do NOT add display:none rules here!
   ============================================ */
/* Old bottom drawer (tracker-section) hidden - replaced by canvas HUDs */
.tracker-section {
  display: none !important;
}

/* Legacy mil tracker hidden - replaced by HUD gauges */
.knomad-mil-tracker {
  display: none !important;
}

/* Mil tracker responsive positioning */
.knomad-mil-tracker {
  max-width: min(280px, 25vw) !important;
  font-size: clamp(10px, 1.2vw, 14px) !important;
}

@media (max-width: 1400px) {
  .knomad-mil-tracker {
    max-width: min(240px, 22vw) !important;
    font-size: clamp(9px, 1.1vw, 12px) !important;
  }
}

@media (max-width: 1200px) {
  .knomad-mil-tracker {
    max-width: min(200px, 20vw) !important;
    font-size: clamp(8px, 1vw, 11px) !important;
  }
}

/* Integrated drop zone for radius table */
.drop-zone-integrated {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
}

.drop-zone-integrated textarea {
  width: 100%;
  position: relative;
  z-index: 1;
}

.drop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 132, 255, 0.1);
  border: 2px dashed var(--border-contrast);
  border-radius: 0.5rem;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}

.drop-zone-integrated.drag-over .drop-overlay {
  display: flex;
}

.drop-message {
  text-align: center;
  color: var(--accent-primary);
  font-weight: 600;
}

.drop-message small {
  display: block;
  font-size: 0.8rem;
  font-weight: normal;
  margin-top: 0.25rem;
  opacity: 0.8;
}

/* Removed design library drawer CSS - using inline design library */

.overlay-legend {
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  background: rgba(var(--text-inverse-rgb), 0.9);
  border: 1px solid var(--border-default);
  border-radius: 0.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  pointer-events: none;
  z-index: 5;
}
.overlay-legend .legend-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.overlay-legend .legend-swatch {
  width: 14px;
  height: 0;
  border-top-width: 3px;
  border-top-style: dashed;
}
/* Live CNC Mil Tracker - Aircraft Instrument Panel Styles */
.knomad-mil-tracker {
  font-family: var(--font-primary) !important;
  -webkit-user-select: none;
  user-select: none;
  animation: fadeInTracker 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-sizing: border-box;
  transform-origin: top left;
}

.knomad-mil-tracker:hover {
  border-color: rgba(var(--status-success-rgb), 0.8) !important;
  box-shadow:
    0 6px 20px rgba(0, 255, 100, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

.knomad-mil-tracker .data-container {
  border-radius: 0 0 10px 10px;
}

/* Aircraft-style glowing text effects */
.knomad-mil-tracker .primary-value {
  text-shadow:
    0 0 5px currentColor,
    0 0 10px currentColor,
    0 0 15px currentColor;
  filter: brightness(1.1);
}

@keyframes fadeInTracker {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
    filter: blur(5px);
  }
  50% {
    opacity: 0.8;
    transform: translateY(-5px) scale(0.98);
    filter: blur(1px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Toast notifications */
#toast.toast {
  font-family: var(--font-primary) !important;
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: rgba(15, 25, 35, 0.95);
  color: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.4);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  letter-spacing: 0.4px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  z-index: 9999;
  pointer-events: none;
}

#toast.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Glass cockpit inspired gradients */
@keyframes pulseGlow {
  0%,
  100% {
    box-shadow:
      0 4px 16px rgba(0, 255, 100, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
  50% {
    box-shadow:
      0 4px 24px rgba(0, 255, 100, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

.knomad-mil-tracker.active {
  animation: pulseGlow 2s ease-in-out infinite;
}

/* Responsive adjustments for mil tracker */
@media (max-width: 768px) {
  .knomad-mil-tracker {
    min-width: 240px !important;
    font-size: 12px !important;
  }

  .knomad-mil-tracker .primary-value {
    font-size: 24px !important;
  }

  .knomad-mil-tracker .decimal-value {
    font-size: 16px !important;
  }
}

@media (max-width: 480px) {
  .knomad-mil-tracker {
    min-width: 200px !important;
    transform: scale(0.9);
  }
}

.overlay-legend .legend-marker.number {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

/* App Essentials Family - Button row + Oracle dock container */
/* Sticky header - stays visible while Tesseract scrolls behind */
.app-essentials-family {
  position: sticky;
  top: 0;
  z-index: 10;
  border: 2px solid rgba(var(--accent-primary-rgb), 0.6);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(15, 25, 35, 0.95), rgba(25, 35, 45, 0.95));
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(var(--accent-primary-rgb), 0.1);
  padding: 12px;
  margin-bottom: 8px;
}

/* Button row inside app-essentials: container padding handles spacing,
   so zero out the row's own margin-bottom to prevent asymmetry */
.app-essentials-family > .button-row {
  margin-bottom: 0;
}

/* Table Section - G5 Cockpit Theme */
.table-section {
  border: 2px solid rgba(var(--accent-primary-rgb), 0.6);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(15, 25, 35, 0.95), rgba(25, 35, 45, 0.95));
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(var(--accent-primary-rgb), 0.1);
  padding: 12px;
  margin-bottom: 1rem;
}

/* Direct children buttons (TESSERACT & Spade) need spacing */
.table-section > button {
  margin-bottom: 8px;
}

.table-section > button:last-of-type {
  margin-bottom: 12px;
}

.table-section .control-dropdown {
  border: none;
  border-radius: 0;
  background: transparent;
  margin-bottom: 0;
}

.table-section .control-dropdown:first-child .dropdown-header {
  border-radius: 10px 10px 0 0;
}

.table-section .control-dropdown:last-child .dropdown-header {
  border-radius: 0;
}

.table-section .dropdown-header {
  font-family: var(--font-primary) !important;
  background: linear-gradient(
    90deg,
    rgba(var(--accent-primary-rgb), 0.15),
    rgba(var(--accent-primary-rgb), 0.25)
  );
  border-bottom: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
}

.table-section .dropdown-content {
  background: transparent;
  padding: 12px;
  border-top: none;
}

.table-section label {
  color: rgba(255, 255, 255, 0.9) !important;
}

.table-section select,
.table-section input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  color: rgba(255, 255, 255, 0.9) !important;
}

.table-section select:focus,
.table-section input:focus {
  border-color: rgba(var(--accent-primary-rgb), 0.6);
  outline: none;
}

.table-section select option {
  background: rgba(15, 25, 35, 0.98);
  color: rgba(255, 255, 255, 0.9);
}

.table-section * {
  color: rgba(255, 255, 255, 0.9);
}

.table-container {
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  border-radius: 6px;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  /* Kept flexible for drag-drop - no overflow or height restrictions */
  pointer-events: auto;
}

/* Empty state hint - shown before KNOMAD is built */
.dope-empty-hint {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-4) var(--space-2); /* 16px 8px */
  margin: 0;
}

.table-section table {
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font-primary);
}

.table-section table th {
  color: rgba(0, 200, 255, 0.9);
  background: rgba(var(--accent-primary-rgb), 0.1);
  border-bottom: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  font-weight: 600;
}

.table-section table td {
  color: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(var(--accent-primary-rgb), 0.1);
}

.table-section table tr:hover td {
  background: rgba(0, 200, 255, 0.05);
}

.table-section .field-hint,
.table-section div[style*='color: #666'] {
  color: rgba(255, 255, 255, 0.5) !important;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Pulsing button animation - draws attention until clicked */
.btn--pulse {
  animation: btnPulse 2s ease-in-out infinite;
}

.btn--pulse:hover,
.btn--pulse.active,
.btn--pulse:focus {
  animation: none; /* Stop pulsing when interacted with */
}

@keyframes btnPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(var(--accent-primary-rgb), 0.4);
  }
  50% {
    box-shadow: 0 0 12px 4px rgba(var(--accent-primary-rgb), 0.6);
  }
}

.toast {
  font-family: var(--font-primary) !important;
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(150%);
  background: rgba(0, 0, 0, 0.8);
  color: var(--text-inverse);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  transition:
    transform 180ms ease-in-out,
    opacity 180ms ease-in-out;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 920px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
}

/* UI scaling wrapper so the full app can shrink to fit smaller windows */
#uiWrap {
  --ui-zoom: 1;
  transform: scale(var(--ui-zoom));
  transform-origin: top left;
  /* Compensate dimensions so scaled content remains within viewport */
  width: calc(100% / var(--ui-zoom));
  height: calc(100% / var(--ui-zoom));
  max-height: calc(100% / var(--ui-zoom));
  /* Make header + main participate in vertical flex layout */
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  /* Allow children like .app-layout to shrink rather than overflow */
  min-height: 0;
  overflow: hidden; /* Prevent uiWrap from growing */
}

/* ============================================
   TRACKER DOCK - Static panel below canvas
   Static panel below canvas with always-visible tracker tiles
   Hidden by default in production mode
   ============================================ */

.tracker-section {
  grid-column: 1 / -1; /* Span full width (all 3 columns) */
  grid-row: 2; /* Second row, below main content */
  background: var(--surface-panel); /* Match controls-panel */
  display: none; /* Hidden by default - JS sets to flex in dev/beta mode */
  border: 1px solid var(--border-default); /* Match controls-panel */
  border-radius: 0.75rem; /* Match controls-panel */
  padding: 0.75rem; /* Match controls-panel */
  margin: 0;
  flex-direction: column;
  gap: 0.75rem; /* Match controls-panel */
  height: auto; /* Auto height for tracker section */
  max-height: 300px; /* Fixed max height like other panels */
  overflow: hidden; /* Hide outer overflow */
}

/* When trackers are shown (via JS), use flex layout */
.tracker-section[style*='block'],
.tracker-section.visible {
  display: flex !important;
}

/* Tracker dock - horizontal strip with smooth scrolling */
.tracker-dock {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap; /* Never wrap - always single row */
  align-items: flex-start;
  gap: clamp(12px, 1.5vw, 16px);
  overflow-x: auto; /* Horizontal scrolling */
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  flex: 1; /* Take available space within tracker-section */
  min-height: 0; /* Allow shrinking */
  /* Mobile-first: hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tracker-dock::-webkit-scrollbar {
  display: none;
}

/* Desktop: show styled horizontal scrollbar */
@media (min-width: 769px) {
  .tracker-dock {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 180, 255, 0.3) rgba(0, 0, 0, 0.1);
  }
  .tracker-dock::-webkit-scrollbar {
    display: block;
    height: 8px;
  }
  .tracker-dock::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
  }
  .tracker-dock::-webkit-scrollbar-thumb {
    background: rgba(0, 180, 255, 0.3);
    border-radius: 4px;
  }
  .tracker-dock::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 180, 255, 0.5);
  }
}

/* Tracker panels in dock - fixed width, no wrapping */
.tracker-dock .tracker-panel {
  display: block !important; /* Override any display:none */
  position: static;
  flex: 0 0 360px; /* Fixed width, no shrink/grow */
  min-width: 360px;
  max-width: 360px;
  height: auto;
}

/* Responsive adjustments - maintain full-width approach */
@media (max-width: 1400px) {
  /* Keep tracker tiles at 360px, just fewer visible */
  .tracker-dock .tracker-panel {
    flex: 0 0 360px;
    min-width: 360px;
    max-width: 360px;
  }
}

@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: minmax(280px, 15%) minmax(480px, 1fr) minmax(240px, 15%);
  }

  /* Slightly narrower tracker tiles */
  .tracker-dock .tracker-panel {
    flex: 0 0 340px;
    min-width: 340px;
    max-width: 340px;
  }
}

@media (max-width: 920px) {
  .app-layout {
    grid-template-columns: minmax(260px, 14%) minmax(450px, 1fr) minmax(220px, 14%);
  }

  .tracker-section {
    padding: var(--bento-gap);
  }

  /* Compact tracker tiles for narrow viewports */
  .tracker-dock .tracker-panel {
    flex: 0 0 320px;
    min-width: 320px;
    max-width: 320px;
  }
}

@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: minmax(240px, 13%) minmax(400px, 1fr) minmax(200px, 13%);
  }

  .tracker-section {
    padding: var(--bento-gap);
  }

  .tracker-dock {
    gap: 10px;
    /* Keep horizontal - never stack vertically */
  }

  /* Very compact tracker tiles */
  .tracker-dock .tracker-panel {
    flex: 0 0 300px;
    min-width: 300px;
    max-width: 300px;
  }
}

.math-info-body {
  max-width: 720px;
  /* Removed height constraint for dialog - let content determine size */
}

.placeholder-text {
  fill: var(--text-muted);
}

.rim-circle,
.hub-circle {
  stroke: var(--text-primary);
  stroke-width: 0.25;
  fill: none;
}

.spoke-line {
  stroke: var(--border-default);
  stroke-width: 0.2;
}

/* PRD §2: Theme-aware reticle scale (was hardcoded #000000) */
/* stroke-width 0.5 minimum — thinner values blur to invisibility under
   luminovaTransmit (stdDeviation=4) or even mild anti-aliasing */
.scale-axis {
  stroke: var(--text-primary, #1d1d1f);
  stroke-width: 0.5;
}

.scale-tick {
  stroke: var(--text-primary, #1d1d1f);
  stroke-width: 0.5; /* Minimum 0.5 — thinner blurs to invisibility (see comment above) */
}

.scale-label {
  /* font-size controlled by reticleLabelSize slider via JavaScript */
  font-family: var(--font-primary);
  font-weight: 400; /* Reduced from 700 (bold) to 400 (normal) for cleaner look */
  fill: var(--text-primary, #1d1d1f);
  opacity: 0.9;
  letter-spacing: 0.02em;
}

.spiral-path {
  stroke: var(--accent-primary);
  stroke-width: 0.3;
  fill: none;
}

.spiral-dot {
  fill: var(--accent-primary);
  stroke: var(--text-inverse);
  stroke-width: 0.15;
}

/* Ghost Spiral - MV/BC comparison visualization */
/* BRIGHT CRIMSON - no blur, crisp defined profile */
.ghost-spiral-pulse {
  animation: ghostPulse 1.5s ease-in-out infinite;
}

@keyframes ghostPulse {
  0%,
  100% {
    opacity: 0.85;
    filter: none;
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 1px #dc143c);
  }
}

/* Ghost spiral variable for color customization */
:root {
  --spiral-ghost: #ff3b30;
}

dialog#dotPopover {
  border: none;
  border-radius: 0.6rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
}

dialog#dotPopover::backdrop {
  background: transparent;
}

.empty {
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   DOPE Table - Clean Grid Layout
   ============================================ */
.table-rows {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.table-header,
.table-row {
  display: grid;
  /* Columns: Bezel, Mils, Wind, DA Low, DA High, G2 (Row hidden) */
  grid-template-columns: 2.5rem 2.5rem 2.5rem 2.5rem 2.5rem 2.5rem;
  gap: 0.25rem;
  align-items: center;
  font-size: 0.8rem;
}

.table-header {
  font-weight: 600;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.table-row {
  padding: 0.1rem 0;
}

.table-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* Row column - hidden but kept in DOM for debugging */
.row-index,
.header-index {
  display: none;
}

.bezel-value,
.header-bezel {
  text-align: right;
  font-weight: 600;
}

/* Mils column - read-only display, monospace for alignment */
.mil-value,
.header-mils {
  text-align: right;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  color: var(--text-primary);
}

/* Legacy: keep radius-input styling for fallback compatibility */
.radius-input {
  text-align: right;
  padding: 0.2rem 0.25rem;
  border: 1px solid var(--border-muted);
  border-radius: 0.2rem;
  background: var(--surface-input, #1a1a1a);
  font-size: 0.8rem;
  font-family: var(--font-mono, monospace);
}

/* Remove spinner arrows from RADIUS inputs only */
.radius-input::-webkit-inner-spin-button,
.radius-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.radius-input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* FORCE spinners to show for ALL number inputs in G7 Truing panel */
#g7TruingDropdown input[type='number']::-webkit-inner-spin-button,
#g7TruingDropdown input[type='number']::-webkit-outer-spin-button,
#g7TruingDropdown input[type='number']::-webkit-inner-spin-button,
#g7TruingDropdown input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: auto !important;
  display: block !important;
  opacity: 1 !important;
  height: auto !important;
  margin: 0 !important;
}

#g7TruingDropdown input[type='number'],
#g7TruingDropdown input[type='number'] {
  -moz-appearance: number-input !important;
  appearance: auto !important;
}

.header-mils {
  background: transparent;
  border: none;
  padding: 0;
  font-weight: 600;
}

/* Wind column - amber color */
.wind-value,
.header-wind {
  text-align: right;
  color: var(--status-warning, #f5a623);
  font-family: var(--font-mono, monospace);
}

.wind-value {
  font-weight: 500;
}

/* Lead column - green for moving target lead */
.lead-value,
.header-lead {
  text-align: right;
  color: var(--status-success, #4caf50);
  font-family: var(--font-mono, monospace);
}

.lead-value {
  font-weight: 500;
}

/* PRD-33: Lead source row marker indicator */
.lead-source-marker {
  color: var(--status-warning, #ff9800);
  font-weight: bold;
  margin-left: 2px;
  cursor: help;
}

/* DA Low column - cyan/info color */
.da-low-value,
.header-da-low {
  text-align: right;
  color: var(--cyan, #00bcd4);
  font-family: var(--font-mono, monospace);
}

/* DA High column - coral/warm color */
.da-high-value,
.header-da-high {
  text-align: right;
  color: var(--status-error, #ff6b6b);
  font-family: var(--font-mono, monospace);
}

/* G2/Rifle 2 column - purple to match spiral */
.rifle2-value,
.header-rifle2 {
  text-align: right;
  color: var(--spiral-rifle2, #9c27b0);
  font-family: var(--font-mono, monospace);
}
select {
  font-family: var(--font-primary) !important;
  border: 1px solid var(--border-muted);
  border-radius: 0.5rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.95rem;
  background: var(--surface-panel);
}

.design-library {
  border-top: 1px solid var(--border-soft);
  padding-top: 1rem;
}

.design-library h3 {
  margin-top: 0;
}
button.danger {
  background: var(--status-error);
  border: 1px solid var(--status-error);
}

button.danger:hover {
  background: var(--status-error-strong);
  border-color: var(--status-error-strong);
}

button.warning {
  background: var(--status-warning);
  color: var(--text-inverse);
  border: none;
}

button.warning:hover:not(:disabled) {
  background: var(--status-warning-strong);
}

button.success {
  background: var(--status-success);
  color: var(--text-inverse);
  border: none;
}

button.success:hover:not(:disabled) {
  background: var(--status-success-accent);
}

.metadata-panel {
  border: 1px solid var(--border-muted);
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: var(--surface-subtle);
  font-size: 0.9rem;
  min-height: 3.5rem;
  color: var(--text-primary);
}

.metadata-panel span {
  display: block;
  margin-bottom: 0.35rem;
}

.metadata-panel span:last-child {
  margin-bottom: 0;
}

#importIssuesDialog {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
  padding: 1.25rem 1.5rem;
  max-width: 420px;
}

#importIssuesDialog::backdrop {
  background: rgba(0, 0, 0, 0.25);
}

#issuesBody {
  margin: 0.75rem 0 1rem;
  padding-left: 1rem;
}

#issuesBody ul {
  margin: 0;
  padding-left: 1.2rem;
}

#issuesBody li {
  margin-bottom: 0.35rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.dialog-actions button {
  min-width: 110px;
}

.control-warning {
  margin-left: 0.35rem;
  font-size: 0.8rem;
  color: var(--status-error);
  visibility: hidden;
}

.control-warning.has-warning {
  visibility: visible;
}

/* Pan/Zoom cursors */
#spiralPreview.pan-zoom-active {
  cursor: grab;
}
#spiralPreview.pan-zoom-active.panning {
  cursor: grabbing;
}
.build-chip {
  position: absolute;
  right: 1rem;
  top: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: inline-block;
}

.overlay-legend {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(var(--text-inverse-rgb), 0.9);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text-primary);
}

/* OLD tracker styles (bezel/mils legacy trackers) */
#bezelTracker,
#milsTracker {
  position: absolute;
  bottom: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 300%;
  color: var(--text-primary);
  min-width: 140px;
  pointer-events: auto;
  z-index: 10;
}
#bezelTracker {
  left: 8px;
}
#milsTracker {
  right: 8px;
}

/* Single column of control rows inside the left form */
#controls-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem 1rem;
}
/* Make wide items span across the column */
#controls-form .field-group.inline,
#controls-form .field-group:has(#scalePreset),
#controls-form .field-group:has(#uiScale),
#controls-form .field-group:has(#tableInput) {
  grid-column: 1 / -1;
}

/* Minimal info icon and control tooltips */
.info-icon {
  margin-left: 0.2rem;
  cursor: help;
  background: none;
  border: 0;
  padding: 0;
  width: 1.2rem;
  height: 1.2rem;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.info-icon:hover {
  color: var(--text-primary);
}

/* Removed broken mask-image icon system */

.control-tooltip {
  position: fixed;
  max-width: 280px;
  background: linear-gradient(160deg, rgba(10, 15, 25, 0.98), rgba(18, 28, 38, 0.98));
  color: rgba(255, 255, 255, 0.95);
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  z-index: 9999;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}
.control-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.rim-number-text {
  font-size: 0.9px;
  fill: var(--text-primary);
}
.pod-title {
  grid-column: 1 / -1;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.2rem 0 0.1rem;
  padding-top: 0.2rem;
  border-top: 1px solid var(--border-soft);
}
/* First pod shouldn't show border */
#controls-form .pod-title:first-child {
  border-top: none;
  padding-top: 0;
}

label {
  cursor: help;
}

/* Unified Radius Table Section */
.unified-table {
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-top: 1rem;
}

.table-input-area {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--surface-muted);
  border-radius: 0.5rem;
  border: 2px dashed var(--border-default);
}

.table-input-area textarea {
  width: 100%;
  min-height: 120px;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  resize: vertical;
}

.table-input-area button {
  margin-top: 0.5rem;
  margin-right: 0.5rem;
}

.radius-display-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.radius-display-table thead {
  background: var(--surface-bg);
  border-bottom: 2px solid var(--border-default);
}

.radius-display-table th {
  padding: 0.5rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
}

.radius-display-table tbody tr {
  border-bottom: 1px solid var(--border-soft-muted);
}

.radius-display-table tbody tr:hover {
  background: var(--surface-muted);
}

.radius-display-table td {
  padding: 0.4rem 0.5rem;
  font-family: var(--font-primary);
}

.geometry-description {
  background: var(--surface-positive);
  border: 1px solid var(--status-success-border);
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 1rem;
  color: var(--status-success-accent);
  font-size: 0.85rem;
}

.geometry-description strong {
  color: var(--status-success-strong);
}

/* Geometry Info Section in Computation Panel */
.geometry-info {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--surface-muted);
  border-radius: 0.5rem;
  border: 1px solid var(--border-soft-muted);
}

.geometry-info h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  font-size: 0.85rem;
}

.info-label {
  color: var(--text-muted);
  flex: 1;
}

.info-value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  flex: 0 0 auto;
}

/* CNC Tracker (Lower-Left) */
.cnc-tracker {
  font-family: var(--font-primary);
}

/* ============================================
   COMPACT TRACKER HUD LAYOUT (v2)
   Horizontal stat blocks, ~110px height
   ============================================ */
.tracker-panel.compact {
  width: var(--tracker-width, 380px);
  min-height: auto;
  max-height: 140px;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Header: small labels above stats */
.tracker-panel .tracker-header-compact {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 4px 8px;
  gap: 8px;
  background: var(
    --tracker-header-bg,
    linear-gradient(90deg, rgba(76, 175, 80, 0.15), rgba(76, 175, 80, 0.25))
  );
  border-bottom: 1px solid var(--tracker-border-color, rgba(76, 175, 80, 0.3));
}

.tracker-panel .tracker-header-compact .header-label {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--tracker-text, rgba(255, 255, 255, 0.9));
}

.tracker-panel .tracker-header-compact .header-gear {
  flex: 0 0 auto;
  font-size: 14px;
  cursor: pointer;
  padding: 0 6px;
  color: var(--tracker-text-muted, rgba(255, 255, 255, 0.6));
}

.tracker-panel .tracker-header-compact .header-gear:hover {
  color: var(--tracker-text, rgba(255, 255, 255, 0.9));
}

/* Metrics: horizontal grid of stat blocks */
.tracker-panel .tracker-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 10px;
  padding: 6px 10px;
  flex: 1;
  align-items: center;
}

/* Individual stat block: large number over small label */
.tracker-panel .tracker-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 50px;
}

.tracker-panel .tracker-stat-value {
  font-size: clamp(22px, 2vw, 28px); /* Responsive size */
  font-weight: bold;
  line-height: 1;
  color: var(--tracker-value-color, #4caf50);
  margin-bottom: 1px;
}

.tracker-panel .tracker-stat-value .decimal {
  font-size: 0.72em;
  font-weight: normal;
  opacity: 0.75;
}

.tracker-panel .tracker-stat-label {
  font-size: clamp(9px, 0.8vw, 11px); /* Responsive label size */
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.65;
  margin-top: 1px;
}

/* Meta: thin footer strip for secondary info */
.tracker-panel .tracker-meta {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 4px 12px;
  gap: 12px;
  border-top: 1px solid var(--tracker-border-color, rgba(76, 175, 80, 0.2));
  background: var(--tracker-meta-bg, rgba(0, 0, 0, 0.2));
  font-size: 12px;
  color: var(--tracker-text-muted, rgba(255, 255, 255, 0.7));
}

.tracker-panel .tracker-meta-item {
  flex: 1;
  text-align: center;
}

.tracker-panel .tracker-meta-item .meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  opacity: 0.7;
  margin-right: 4px;
}

.tracker-panel .tracker-meta-item .meta-value {
  font-weight: 600;
}

/* Warning banner: integrated within height budget */
.tracker-panel .tracker-warning {
  padding: 5px 10px;
  margin: 0;
  background: var(--tracker-warning-bg, rgba(255, 149, 0, 0.2));
  border: 1px solid var(--tracker-warning-border, rgba(255, 149, 0, 0.5));
  border-left: none;
  border-right: none;
  color: var(--tracker-warning-text, #ff9500);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: none;
}

/* Disable all tracker warning banners - they cause container resize/bounce */
.tracker-panel .tracker-warning,
.tracker-panel .tracker-warning.show,
.tracker-panel .tracker-warning.visible {
  display: none !important;
}

/* Color variants for different stat types */
.tracker-stat.success .tracker-stat-value {
  color: var(--status-success, #4caf50);
}

.tracker-stat.info .tracker-stat-value {
  color: var(--status-info, #00ffff);
}

.tracker-stat.warning .tracker-stat-value {
  color: var(--status-warning, #ff9800);
}

.tracker-stat.accent .tracker-stat-value {
  color: var(--accent-primary, #00c8ff);
}

/* Header color variants for uniform theming */
.tracker-panel .tracker-header.success {
  color: var(--status-success, #4caf50);
}

.tracker-panel .tracker-header.info {
  color: var(--status-info, #00ffff);
}

.tracker-panel .tracker-header.warning {
  color: var(--status-warning, #ff9800);
}

.tracker-panel .tracker-header.accent {
  color: var(--accent-primary, #00c8ff);
}

/* Status banner color variants */
.tracker-panel .tracker-banner.success {
  background: var(--status-success, rgba(76, 175, 80, 0.2));
  border: 1px solid var(--status-success, rgba(76, 175, 80, 0.5));
  color: var(--status-success, #4caf50);
}

.tracker-panel .tracker-banner.info {
  background: var(--status-info, rgba(0, 255, 255, 0.2));
  border: 1px solid var(--status-info, rgba(0, 255, 255, 0.5));
  color: var(--status-info, #00ffff);
}

.tracker-panel .tracker-banner.warning {
  background: var(--status-warning, rgba(255, 152, 0, 0.2));
  border: 1px solid var(--status-warning, rgba(255, 152, 0, 0.5));
  color: var(--status-warning, #ff9800);
}

.tracker-panel .tracker-banner.accent {
  background: var(--accent-primary, rgba(0, 200, 255, 0.2));
  border: 1px solid var(--accent-primary, rgba(0, 200, 255, 0.5));
  color: var(--accent-primary, #00c8ff);
}

/* Meta value color variants */
.tracker-panel .meta-value.success {
  color: var(--status-success, #4caf50);
}

.tracker-panel .meta-value.info {
  color: var(--status-info, #00ffff);
}

.tracker-panel .meta-value.warning {
  color: var(--status-warning, #ff9800);
}

.tracker-panel .meta-value.accent {
  color: var(--accent-primary, #00c8ff);
}

/* Header label color variants for uniform theming */
.tracker-panel .header-label.success {
  color: var(--status-success, #4caf50);
}

.tracker-panel .header-label.info {
  color: var(--status-info, #00ffff);
}

.tracker-panel .header-label.warning {
  color: var(--status-warning, #ff9800);
}

.tracker-panel .header-label.accent {
  color: var(--accent-primary, #00c8ff);
}

/* Info text base styling */
.tracker-panel .info-text {
  color: var(--text-inverse, #ffffff);
}

/* Status banner base styling */
.tracker-panel .tracker-banner {
  font-family: var(--font-primary, 'Courier New', monospace);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}

/* HUD header background gradients for uniform theming */
.tracker-panel .hud-header.success {
  background: linear-gradient(90deg, rgba(76, 175, 80, 0.15), rgba(76, 175, 80, 0.25));
  border-bottom: 1px solid rgba(76, 175, 80, 0.3);
}

.tracker-panel .hud-header.info {
  background: linear-gradient(90deg, rgba(0, 255, 255, 0.15), rgba(0, 255, 255, 0.25));
  border-bottom: 1px solid rgba(0, 255, 255, 0.3);
}

.tracker-panel .hud-header.warning {
  background: linear-gradient(90deg, rgba(255, 152, 0, 0.15), rgba(255, 152, 0, 0.25));
  border-bottom: 1px solid rgba(255, 152, 0, 0.3);
}

.tracker-panel .hud-header.accent {
  background: linear-gradient(90deg, rgba(0, 200, 255, 0.15), rgba(0, 200, 255, 0.25));
  border-bottom: 1px solid rgba(0, 200, 255, 0.3);
}

/* HUD header base styling */
.tracker-panel .hud-header {
  padding: 6px 12px;
  display: grid;
  align-items: center;
}

/* Size variants */
.tracker-panel.compact .tracker-stat-value {
  font-size: clamp(24px, 2vw, 28px);
}

.tracker-panel.ultra-compact .tracker-stat-value {
  font-size: clamp(20px, 1.8vw, 24px);
}

.tracker-panel.compact .tracker-stat-label {
  font-size: 10px;
}

.tracker-panel.ultra-compact .tracker-stat-label {
  font-size: 9px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .tracker-panel.compact {
    --tracker-width: 320px;
  }

  .tracker-panel .tracker-stat-value {
    font-size: 22px;
  }

  .tracker-panel .tracker-stat-label {
    font-size: 9px;
    letter-spacing: 0.1px;
  }

  .tracker-panel .tracker-metrics {
    gap: 6px;
    padding: 5px 8px;
  }

  .tracker-panel .tracker-stat {
    min-height: 42px;
  }
}

.tracker-header,
.verification-header {
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-default);
}

.tracker-content,
.verification-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tracker-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.tracker-row span:first-child {
  color: var(--text-muted);
}

.tracker-row span:last-child {
  font-weight: 500;
  color: var(--accent-primary);
}

/* Verification Panel (Lower-Right) */
.verification-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: var(--surface-info);
  border-radius: 0.25rem;
}

.status-icon {
  font-size: 1.2rem;
  color: var(--status-success);
}

.verification-status.warning .status-icon {
  color: var(--status-warning);
}

.verification-status.error .status-icon {
  color: var(--status-error);
}

.verification-details {
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.85rem;
}

.status-indicator {
  font-size: 0.75rem;
  color: var(--status-success);
}

.status-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* File Saving Protocol Styles (Section 6A.6) */
.save-table-modal .modal-content,
.restore-confirm-modal .modal-content {
  max-width: 600px;
  width: 90%;
}

.save-summary {
  background: var(--surface-muted);
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.save-summary p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

.save-options {
  margin: 1rem 0;
}

.save-options label {
  display: block;
  margin: 0.5rem 0;
}

.save-options input[type='text'] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-default);
  border-radius: 0.25rem;
  font-family: var(--font-primary);
  margin-top: 0.25rem;
}

.export-options {
  background: var(--surface-muted);
  padding: 1rem;
  border-radius: 0.25rem;
  margin-top: 1rem;
}

.export-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.export-options input[type='checkbox'] {
  cursor: pointer;
}

.warning-box {
  background: var(--surface-danger);
  border: 1px solid var(--status-warning);
  border-left: 4px solid var(--status-warning);
  padding: 1rem;
  border-radius: 0.25rem;
  margin: 1rem 0;
}

.warning-box strong {
  color: var(--status-warning-accent);
  display: block;
  margin-bottom: 0.5rem;
}

.modal-buttons {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.btn-save,
.btn-save-db {
  background: var(--accent-primary-active);
  color: white;
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-save:hover,
.btn-save-db:hover {
  background: var(--accent-primary-hover);
}

.btn-cancel {
  background: var(--border-muted);
  color: white;
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-cancel:hover {
  background: var(--border-muted);
}

.btn-danger {
  background: var(--status-error);
  color: white;
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-danger:hover {
  background: var(--status-error-accent);
}

/* Ballistics panel styles */
.ballistics-panel {
  margin-top: 0.75rem;
}
.ballistics-results {
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 0.5rem;
  background: var(--surface-subtle);
  max-height: 220px;
  overflow: auto;
}
.ballistics-results.empty {
  color: var(--text-muted);
  font-style: italic;
}
.ballistics-bullet-meta {
  margin-top: var(--space-2);
  font-size: 0.9em;
  color: var(--text-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.ballistics-data-summary {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--surface-info);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-primary);
  font-size: 0.9em;
  line-height: 1.6;
  color: var(--text-secondary);
  box-shadow: 0 6px 18px rgba(var(--accent-primary-rgb), 0.12);
}
.ballistics-message {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  margin: var(--space-2) 0;
  font-size: 0.9em;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  transition:
    background 0.2s ease,
    border 0.2s ease,
    box-shadow 0.2s ease;
}
.ballistics-message--loading {
  background: rgba(var(--accent-primary-rgb), 0.12);
  border-color: rgba(var(--accent-primary-rgb), 0.45);
  color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(var(--accent-primary-rgb), 0.12);
}
.ballistics-message--success {
  background: rgba(var(--status-success-rgb), 0.12);
  border-color: rgba(var(--status-success-rgb), 0.45);
  color: var(--status-success);
  box-shadow: 0 4px 12px rgba(var(--status-success-rgb), 0.12);
}
.ballistics-message--warning {
  background: rgba(var(--status-warning-rgb), 0.12);
  border-color: rgba(var(--status-warning-rgb), 0.45);
  color: var(--status-warning);
  box-shadow: 0 4px 12px rgba(var(--status-warning-rgb), 0.12);
}
.ballistics-message--error {
  background: rgba(var(--status-error-rgb), 0.12);
  border-color: rgba(var(--status-error-rgb), 0.45);
  color: var(--status-error);
  box-shadow: 0 4px 12px rgba(var(--status-error-rgb), 0.12);
}
.ballistics-control-group--warning {
  margin-top: var(--space-4);
  background: rgba(var(--status-warning-rgb), 0.12);
  border: 1px solid rgba(var(--status-warning-rgb), 0.35);
}
.ballistics-section-title {
  margin-top: 0;
}
.ballistics-section-title--warning {
  color: var(--status-warning);
}
.ballistics-help-text {
  color: var(--text-soft);
  font-size: 0.9em;
}
.ballistics-error-text {
  color: var(--status-error);
}
.ballistics-callout {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.9em;
  line-height: 1.5;
  background: var(--surface-muted);
  border-left: 4px solid transparent;
  color: var(--text-secondary);
  box-shadow: var(--shadow-subtle);
}
.ballistics-callout--info {
  background: rgba(var(--accent-primary-rgb), 0.12);
  border-left-color: var(--accent-primary);
}
.ballistics-callout--warning {
  background: rgba(var(--status-warning-rgb), 0.12);
  border-left-color: var(--status-warning);
}
.ballistics-modal {
  display: none;
}
.ballistics-modal.is-open {
  display: block;
}
.is-hidden {
  display: none !important;
}

/* ============================================
   BALLISTICS CALCULATOR MODAL SYSTEM
   Migrated from addModalStyles() inline injection
   TODO(theme-js): Consolidated design system integration
   ============================================ */

.ballistics-modal {
  position: fixed;
  z-index: 10000;
  /* No background or blur - just position the modal content */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  /* Transparent overlay - no blur, allows interaction with canvas behind */
  background-color: transparent;
  pointer-events: none;
  /* Center content within this area */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.ballistics-modal-content {
  font-family: var(--font-primary) !important;
  background-color: var(--surface-panel);
  margin: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  width: 95%;
  max-width: 1100px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Glow edge effect */
  box-shadow:
    var(--shadow-lg),
    0 0 40px rgba(0, 200, 255, 0.15),
    0 0 80px rgba(0, 200, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(0, 200, 255, 0.2);
  /* Re-enable pointer events since parent has pointer-events: none */
  pointer-events: auto;
}

/* Tesseract Drag & Resize Support */
.ballistics-modal-content {
  position: relative;
}

.ballistics-modal-header {
  background: var(--gradient-accent-strong);
  padding: var(--space-4);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  cursor: grab;
}

.ballistics-modal-header:active {
  cursor: grabbing;
}

/* 4-way drag handle icon in header */
.tesseract-drag-handle {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.6);
  cursor: move;
  -webkit-user-select: none;
  user-select: none;
  transition: color 0.15s ease;
}

.tesseract-drag-handle:hover {
  color: rgba(255, 255, 255, 0.9);
}

/* Project indicator in TESSERACT header - shows when a project owns the canvas */
.tesseract-project-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 152, 0, 0.2);
  border: 1px solid rgba(255, 152, 0, 0.5);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #ff9800;
  letter-spacing: 0.3px;
}

.tesseract-project-indicator .project-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tesseract-project-indicator .project-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tesseract-project-indicator .project-clear-btn:hover {
  background: rgba(244, 67, 54, 0.3);
  border-color: rgba(244, 67, 54, 0.6);
  color: #f44336;
}

/* Resize handle in bottom-right corner */
.tesseract-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(0, 200, 255, 0.3) 50%);
  border-radius: 0 0 var(--radius-lg) 0;
  z-index: 101;
  transition: background 0.2s ease;
}

.tesseract-resize-handle:hover {
  background: linear-gradient(135deg, transparent 50%, rgba(0, 200, 255, 0.5) 50%);
}

/* Dragging state */
.tesseract--dragging {
  opacity: 0.95;
  box-shadow:
    var(--shadow-lg),
    0 0 60px rgba(0, 200, 255, 0.25),
    0 0 100px rgba(0, 200, 255, 0.15) !important;
  -webkit-user-select: none;
  user-select: none;
}

/* Resizing state */
.tesseract--resizing {
  -webkit-user-select: none;
  user-select: none;
}

.ballistics-modal-header h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1.5em;
}

.ballistics-modal-close {
  color: var(--text-inverse);
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: background-color 0.3s;
}

.ballistics-modal-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Learn dropdown in modal header */
.ballistics-learn-dropdown {
  position: relative;
  display: inline-block;
}

.ballistics-learn-btn::after {
  content: ' ▼';
  font-size: 0.7em;
}

.ballistics-learn-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(30, 30, 40, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  min-width: 140px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  padding-top: 4px;
}

/* Click-based toggle (JS adds .open class) */
.ballistics-learn-dropdown.open .ballistics-learn-menu {
  display: block;
}

.ballistics-learn-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  color: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 0.85em;
}

.ballistics-learn-item:hover {
  background: rgba(33, 150, 243, 0.3);
}

/* BUILD KNOMAD button in modal header - pulse when active */
.ballistics-knomad-btn {
  font-weight: 600;
  transition: all 0.2s ease;
}

.ballistics-knomad-btn:not(:disabled) {
  background: linear-gradient(135deg, #00bfa5, #00897b);
  border-color: #00bfa5;
  color: #fff;
}

/* Pulse animation removed per user request - too distracting */

/* Trajectory table bar with export button */
.ballistics-table-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 14px;
  background: rgba(0, 200, 255, 0.1);
  border-radius: 6px;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--cyan, #4dd0e1);
  user-select: none;
}

.ballistics-table-bar span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ballistics-table-bar span::before {
  content: '▶';
  font-size: 0.7em;
  transition: transform 0.2s ease;
}

details[open] .ballistics-table-bar span::before {
  transform: rotate(90deg);
}

.ballistics-table-bar .ballistics-export-btn {
  font-size: 0.75em;
  padding: 4px 10px;
}

/* Saved Profiles bar - green accent */
.ballistics-profiles-bar {
  background: rgba(0, 200, 100, 0.1);
  color: var(--green, #4caf50);
}

/* Bullet select row - wider to accommodate long names */
.ballistics-input-row select {
  min-width: 200px;
  flex: 2;
}

/* Draggable toolbar styles */
.draggable-toolbar {
  position: absolute;
  user-select: none;
  -webkit-user-select: none;
  transition:
    box-shadow 0.15s ease,
    width 0.2s ease,
    height 0.2s ease,
    opacity 0.2s ease;
}

.draggable-toolbar.is-dragging {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 100;
  opacity: 0.95;
}

/* Collapse toggle button */
.toolbar-collapse-toggle {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  margin-right: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.toolbar-collapse-toggle:hover {
  background: rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--text-primary);
}

/* Collapsed toolbar state */
.draggable-toolbar.is-collapsed {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px;
  min-height: 40px;
  overflow: hidden;
  border-radius: 10px;
  padding: 0 !important;
}

.draggable-toolbar.is-collapsed .rotation-toolbar {
  width: 40px;
  height: 40px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.draggable-toolbar.is-collapsed .rotation-toolbar > *:not(.toolbar-collapse-toggle) {
  display: none !important;
}

.draggable-toolbar.is-collapsed .toolbar-collapse-toggle {
  width: 28px;
  height: 28px;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono, 'Consolas', monospace);
  letter-spacing: 0;
}

.ballistics-modal-body {
  padding: var(--space-4);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  /* Mobile-first: hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ballistics-modal-body::-webkit-scrollbar {
  display: none;
}

.ballistics-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.ballistics-control-group {
  background: var(--surface-muted);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.ballistics-control-group h3 {
  margin: 0 0 var(--space-3) 0;
  color: var(--accent-primary);
  font-size: 1.1em;
}

/* Tesseract 3-column layout */
.ballistics-controls-grid.tesseract-3col {
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

@media (max-width: 1200px) {
  .ballistics-controls-grid.tesseract-3col {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 800px) {
  .ballistics-controls-grid.tesseract-3col {
    grid-template-columns: 1fr;
  }
}

/* 2-column row within bento */
.ballistics-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

/* Divider between sections */
.ballistics-divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-3) 0;
}

/* Collapsible subsections */
.ballistics-subsection {
  margin-top: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.15);
}

.ballistics-subsection summary {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9em;
  font-weight: 500;
  -webkit-user-select: none;
  user-select: none;
}

.ballistics-subsection summary:hover {
  color: var(--accent-primary);
}

.ballistics-subsection[open] summary {
  border-bottom: 1px solid var(--border-default);
}

.ballistics-subsection-content {
  padding: var(--space-2) var(--space-3);
}

/* Info button (small ? icon) */
.info-btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-size: 10px;
  cursor: help;
  padding: 0;
  margin-left: 4px;
  line-height: 1;
}

.info-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Checkbox label inline */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.checkbox-label input[type='checkbox'] {
  width: auto;
  height: auto;
}

/* Early dope action buttons */
.early-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.btn-early {
  padding: 4px 10px;
  background: rgba(100, 181, 246, 0.15);
  border: 1px solid rgba(100, 181, 246, 0.3);
  color: #90caf9;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8em;
}

.btn-early:hover {
  background: rgba(100, 181, 246, 0.25);
}

.btn-early--clear {
  background: rgba(244, 143, 177, 0.15);
  border-color: rgba(244, 143, 177, 0.3);
  color: #f8bbd0;
}

.btn-early--clear:hover {
  background: rgba(244, 143, 177, 0.25);
}

/* Suggestion text */
.suggestion-text {
  color: #c5e1a5;
  font-size: 0.85em;
}

/* PROFILE FOLDERS REMOVED - now in 06-domains/tesseract/profiles.css */

/* =========================================================================
   CUSTOM BULLET INLINE EDIT MODE
   When user selects "Custom" from library, dropdown transforms to editable input.
   ========================================================================= */

/* Wrapper for inline edit - replaces select when in custom mode */
.bullet-library-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
}

.bullet-library-wrapper select,
.bullet-library-wrapper input {
  width: 100%;
}

/* Inline edit input for custom bullet name */
.bullet-custom-input {
  padding: 4px 6px !important;
  background: var(--input-bg) !important;
  border: 1px solid var(--accent-primary, #566eff) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-primary) !important;
  font-size: 0.85em !important;
  box-shadow: 0 0 8px rgba(86, 110, 255, 0.3);
}

.bullet-custom-input::placeholder {
  color: var(--text-muted, rgba(255, 255, 255, 0.5));
  font-style: italic;
}

/* Flashing defaults animation for required fields */
@keyframes bullet-field-flash {
  0%,
  100% {
    border-color: var(--warning, #ff9800);
    box-shadow: 0 0 6px rgba(255, 152, 0, 0.4);
  }
  50% {
    border-color: var(--warning-bright, #ffb74d);
    box-shadow: 0 0 12px rgba(255, 152, 0, 0.6);
  }
}

.bullet-field--needs-edit {
  animation: bullet-field-flash 1s ease-in-out infinite;
  border-color: var(--warning, #ff9800) !important;
}

.bullet-field--needs-edit:focus {
  animation: none;
  border-color: var(--accent-primary, #566eff) !important;
  box-shadow: 0 0 8px rgba(86, 110, 255, 0.4);
}

/* Custom bullet indicator (small pencil icon) in dropdown for custom bullets */
.bullet-option--custom::before {
  content: '✎ ';
}

/* =============================================================================
   BULLET LIBRARY CONTEXT MENU
   Forensic match to folder-context-menu DNA (project_window.css)
   ============================================================================= */
.bullet-context-menu {
  position: fixed;
  z-index: 10000;

  /* Visual DNA from folder-context-menu */
  background: var(--dark-bg-1, rgba(15, 25, 35, 0.98));
  border: 1px solid var(--cyan-30, rgba(0, 200, 255, 0.3));
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  min-width: 180px;
  padding: 6px 0;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.bullet-context-menu-section {
  font-size: 10px;
  font-weight: 700;
  color: var(--cyan, rgb(0, 200, 255));
  padding: 6px 12px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bullet-context-menu-item {
  /* Reset box model */
  all: unset;
  box-sizing: border-box;

  /* Layout */
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;

  /* Typography */
  text-align: left;
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--text-primary, #fff);

  /* Spacing */
  padding: 8px 12px;

  /* Visual */
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;

  /* Interaction */
  cursor: pointer;
  transition: background 0.1s ease;
}

.bullet-context-menu-item:hover {
  background: var(--cyan-15, rgba(0, 200, 255, 0.15));
}

.bullet-context-menu-item--danger {
  color: var(--gt-danger, #ff6666);
}

.bullet-context-menu-item--danger:hover {
  background: rgba(255, 68, 68, 0.15);
  color: #ff4444;
}

.bullet-context-menu-divider {
  height: 1px;
  background: var(--cyan-15, rgba(0, 200, 255, 0.15));
  margin: 6px 0;
}

/* =============================================================================
   CALIBRATION STATUS BADGES
   Visual indicators for bullet verification status in dropdown
   ============================================================================= */

/* Calibration check marks: ✓✓✓ for full, MV✓ for partial */
.bullet-calibration-badge {
  font-size: 10px;
  font-weight: 600;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 4px;
}

.bullet-calibration-badge--calibrated {
  color: var(--gt-success, #4ade80);
  background: rgba(74, 222, 128, 0.15);
}

.bullet-calibration-badge--partial {
  color: var(--gt-warning, #fbbf24);
  background: rgba(251, 191, 36, 0.15);
}

.bullet-calibration-badge--factory {
  color: var(--text-muted, #8f94a7);
  background: transparent;
}

/* =========================================================================
   PROJECT DOMAIN REVEAL ANIMATION
   When SAVE transforms BUILD → PROJECT, project domains slide into view.
   Used by TesseractCellIlluminator.revealProjectDomains()
   ========================================================================= */

/* Initial state for project domain fields (hidden in BUILD mode) */
.profile-row--project-domain {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  transition:
    max-height 0.4s ease-out,
    opacity 0.3s ease-out 0.1s,
    padding 0.3s ease-out,
    margin 0.3s ease-out;
}

/* Revealed state - smooth slide down */
.profile-row--project-domain.profile-row--revealed {
  max-height: 60px;
  opacity: 1;
  padding-top: 4px;
  padding-bottom: 4px;
  margin-top: 2px;
  margin-bottom: 2px;
}

/* Section labels for project domains also animate */
.profile-section-label--project-domain {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  transition:
    max-height 0.4s ease-out,
    opacity 0.3s ease-out 0.1s,
    padding 0.3s ease-out,
    margin 0.3s ease-out;
}

.profile-section-label--project-domain.profile-row--revealed {
  max-height: 30px;
  opacity: 1;
  padding: 6px 0 4px 0;
  margin: 8px 0 4px 0;
}

/* Subtle glow on newly revealed project fields */
.profile-row--project-domain.profile-row--revealed {
  animation: projectRevealGlow 1.5s ease-out;
}

@keyframes projectRevealGlow {
  0% {
    background: rgba(100, 180, 255, 0.2);
    box-shadow: 0 0 8px rgba(100, 180, 255, 0.3);
  }
  100% {
    background: transparent;
    box-shadow: none;
  }
}

.profile-divider {
  height: 1px;
  background: var(--border-default);
  margin: 6px 0;
  opacity: 0.5;
}

.profile-note {
  display: block;
  color: var(--text-tertiary);
  font-size: 0.75em;
  font-style: italic;
  text-align: center;
  opacity: 0.7;
  margin-top: 4px;
}

/* =============================================================================
   BUTTON ROW - TESSERACT VARIANT
   EXTRACTED TO: static/css/05-components/button-row.css (lines 166-263)
   ============================================================================= */

/* =========================================================================
   BULLET PERFORMANCE THRESHOLD (Phase 4: Progressive Disclosure)
   3 thresholds that determine field visibility and data requirements
   ========================================================================= */
.goal-questions-section {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.goal-questions-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.goal-questions-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.goal-questions-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* MVP Method Button - Opens Planning Canvas for goal questions */
.mvp-method-btn {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cyan-80, rgba(0, 200, 255, 0.8));
  background: transparent;
  border: 1px solid var(--cyan-40, rgba(0, 200, 255, 0.4));
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mvp-method-btn:hover {
  background: var(--cyan-20, rgba(0, 200, 255, 0.2));
  border-color: var(--cyan-60, rgba(0, 200, 255, 0.6));
}

.mvp-method-btn:active {
  transform: scale(0.95);
}

.goal-show-all-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.goal-show-all-toggle:hover {
  opacity: 0.8;
}

.goal-show-all-toggle input[type='checkbox'] {
  width: 12px;
  height: 12px;
  accent-color: var(--cyan-60, rgba(0, 200, 255, 0.6));
  cursor: pointer;
}

.goal-toggle-label {
  font-size: 10px;
  color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.goal-show-all-toggle:has(input:checked) {
  opacity: 1;
}

.goal-show-all-toggle:has(input:checked) .goal-toggle-label {
  color: var(--cyan-80, rgba(0, 200, 255, 0.8));
}

/* ─────────────────────────────────────────────────────────────────────────
   THRESHOLD ROWS: Vertical layout with linked cells
   ───────────────────────────────────────────────────────────────────────── */
.goal-threshold-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.goal-threshold-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.goal-threshold-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, rgba(255, 255, 255, 0.85));
  min-width: 90px;
  flex-shrink: 0;
}

.goal-linked-cells {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
}

.goal-cell-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.goal-link-symbol {
  font-size: 12px;
  color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
  user-select: none;
}

/* ─────────────────────────────────────────────────────────────────────────
   INPUT FIELDS
   ───────────────────────────────────────────────────────────────────────── */
.goal-input {
  width: 60px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 200, 255, 0.3);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, rgba(255, 255, 255, 0.95));
  text-align: center;
  /* Hide native number spinners - they overlap text */
  -moz-appearance: textfield;
}

/* Hide spinners in WebKit browsers */
.goal-input::-webkit-outer-spin-button,
.goal-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Primary inputs (user-editable) - slightly brighter border */
.goal-input-primary {
  border-color: rgba(0, 200, 255, 0.4);
}

/* Secondary inputs (computed) - dimmer to show they're derived */
.goal-input-secondary {
  border-color: rgba(0, 200, 255, 0.2);
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

.goal-unit {
  font-size: 10px;
  color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
  min-width: 24px;
}

/* Converted value (display-only) - shows equivalent in other unit */
.goal-converted-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  min-width: 40px;
  text-align: center;
}

/* ─────────────────────────────────────────────────────────────────────────
   GOAL STEPPERS - Context-specific width overrides only
   Base styles inherited from .stepper pattern (lines 2691-2735)
   ───────────────────────────────────────────────────────────────────────── */

/* Wider stepper values for range (4 digits: 3000, 2743) */
.goal-threshold-rows #goal_rangeYards {
  width: 52px;
}

/* Standard width for precision (3 digits + decimal) */
.goal-threshold-rows #goal_targetSize {
  width: 44px;
}

/* Narrower for shots (2 digits: 10) */
.goal-threshold-rows #goal_attempts {
  width: 36px;
}

/* ─────────────────────────────────────────────────────────────────────────
   TOLERANCE DROPDOWN
   ───────────────────────────────────────────────────────────────────────── */
.goal-tolerance-group {
  margin-left: 8px;
}

.goal-select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 200, 255, 0.3);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, rgba(255, 255, 255, 0.95));
  cursor: pointer;
  min-width: 80px;
  height: 29px; /* Match input cell height exactly */
  line-height: 29px;
}

.goal-select:focus {
  outline: none;
  border-color: rgb(0, 200, 255);
}

.goal-select option {
  background: #1a1a2e;
  color: var(--text-primary, rgba(255, 255, 255, 0.95));
}

.goal-tolerance-info {
  font-size: 12px;
  color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
  cursor: help;
  margin-left: 4px;
}

.goal-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  font-size: 11px;
}

.goal-summary-text {
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

.goal-difficulty {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-left: 6px;
}

.goal-difficulty--easy {
  background: rgba(76, 175, 80, 0.2);
  color: #81c784;
}

.goal-difficulty--moderate {
  background: rgba(255, 193, 7, 0.2);
  color: #ffd54f;
}

.goal-difficulty--demanding {
  background: rgba(244, 67, 54, 0.2);
  color: #ef9a9a;
}

.goal-fields-count {
  color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
  font-style: italic;
}

/* ============================================
   GOAL PROGRESS METER
   Bullet performance only (no human factors)
   Shows: Trajectory Precision % + Bullet Capability
   ============================================ */
.goal-progress-meter {
  width: 100%;
  padding: 8px 0 0;
}

.goal-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.goal-progress-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.goal-progress-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary, rgba(255, 255, 255, 0.95));
}

.goal-progress-bar-track {
  height: 6px;
  background: var(--dark-bg-2, rgba(0, 0, 0, 0.4));
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.goal-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gt-accent, #00c8ff), var(--gt-accent-light, #40d8ff));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Capable - bullet can achieve goal (green) */
.goal-progress-bar-fill.goal-status--capable {
  background: linear-gradient(90deg, #4caf50, #66bb6a);
}

/* Incapable - bullet precision exceeds budget (red) */
.goal-progress-bar-fill.goal-status--incapable {
  background: linear-gradient(90deg, #f44336, #ff7043);
}

.goal-progress-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
}

.goal-status-icon {
  font-size: 11px;
}

.goal-status-text {
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

/* Capable status - green */
.goal-progress-status.goal-status--capable .goal-status-text,
.goal-progress-status.goal-status--capable .goal-status-icon {
  color: var(--success-color, #4caf50);
}

/* Incapable status - red */
.goal-progress-status.goal-status--incapable .goal-status-text,
.goal-progress-status.goal-status--incapable .goal-status-icon {
  color: var(--error-color, #f44336);
}

/* Hint for next action */
.goal-progress-hint {
  margin-top: 4px;
  font-size: 9px;
  color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
  font-style: italic;
}

/* Unverified variable warning - ALWAYS shown when using defaults */
.goal-unverified-warning {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 6px;
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 4px;
  font-size: 9px;
}

.goal-unverified-icon {
  color: var(--warning-color, #ffc107);
  font-size: 10px;
  flex-shrink: 0;
}

.goal-unverified-text {
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  line-height: 1.3;
}

/* Multiple unverified - slightly more prominent */
.goal-unverified-warning.goal-unverified--multiple {
  background: rgba(255, 152, 0, 0.15);
  border-color: rgba(255, 152, 0, 0.4);
}

/* ============================================
   Light Up Paradigm - Lit/Dim Cell States
   Cells illuminate based on relevance to user goals
   ============================================ */

/* Base cell - contains label + input pair */
.profile-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  transition:
    opacity 0.3s ease,
    filter 0.3s ease;
}

/* Lit state - fully visible, accent highlight */
.profile-cell.lit {
  opacity: 1;
}

.profile-cell.lit .profile-lbl {
  color: var(--text-primary);
}

.profile-cell.lit input,
.profile-cell.lit select {
  background: var(--input-bg);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px rgba(var(--accent-primary-rgb), 0.15);
}

/* Dim state - reduced visibility for less relevant cells */
.profile-cell.dim {
  opacity: 0.35;
}

.profile-cell.dim input,
.profile-cell.dim select {
  background: rgba(0, 0, 0, 0.1);
  border-color: var(--border-subtle);
}

/* Clickable label with info popup pattern */
.profile-lbl[data-info] {
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  text-decoration-color: var(--text-tertiary);
}

.profile-lbl[data-info]:hover {
  color: var(--accent-primary);
  text-decoration-color: var(--accent-primary);
}

/* Section labels for Four Forces domains */
.profile-section-label {
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 6px 0 4px 0;
  margin-top: 8px;
  border-top: 1px solid var(--border-subtle);
  opacity: 0.7;
}

.profile-section-label:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

/* Light Up grid layout - 3 columns on desktop, 2 on mobile */
.profile-checklist--lightup {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 12px;
  flex-direction: unset !important;
}

/* Section labels span full width */
.profile-checklist--lightup .profile-section-label {
  grid-column: 1 / -1;
}

/* Cells within Light Up grid */
.profile-checklist--lightup .profile-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0; /* Allow flex shrink */
}

.profile-checklist--lightup .profile-cell .profile-lbl {
  flex-shrink: 0;
  font-size: 11px;
  min-width: 45px;
}

.profile-checklist--lightup .profile-cell input,
.profile-checklist--lightup .profile-cell select {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 4px 6px;
}

/* Divider and note span full width */
.profile-checklist--lightup .profile-divider,
.profile-checklist--lightup .profile-note {
  grid-column: 1 / -1;
}

/* Responsive: 2 columns on narrow containers */
@media (max-width: 500px) {
  .profile-checklist--lightup {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Budget display (readonly) for goals */
.profile-budget-display {
  font-size: 0.75em;
  color: var(--text-tertiary);
  background: rgba(0, 0, 0, 0.1);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

/* Info popup overlay */
.profile-info-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.15s ease;
}

.profile-info-popup {
  background: var(--surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.15s ease;
}

.profile-info-popup h4 {
  margin: 0 0 8px 0;
  color: var(--accent-primary);
  font-size: 1em;
}

.profile-info-popup p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.85em;
  line-height: 1.5;
}

.profile-info-popup .close-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.2em;
  cursor: pointer;
}

.profile-info-popup .close-btn:hover {
  color: var(--text-primary);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================
   iPhone Prototype Popout (Dev Mode Only)
   Dimensions: iPhone SE 375x667
   ============================================ */
.iphone-prototype-popout {
  position: fixed;
  width: 375px;
  height: 667px;
  background: var(--surface-card, #1a1d28);
  border: 3px solid var(--border-accent, #566eff);
  border-radius: 24px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleIn 0.2s ease;
}

.iphone-prototype-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-elevated, #22252f);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.iphone-prototype-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.iphone-prototype-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.iphone-prototype-close:hover {
  color: var(--accent-error, #ff5555);
}

.iphone-prototype-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* Force 3-column layout inside iPhone popout */
.iphone-prototype-content .profile-checklist {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 6px;
}

.iphone-prototype-content .profile-section-label {
  grid-column: 1 / -1;
  font-size: 9px;
  padding: 4px 0 2px 0;
}

.iphone-prototype-content .profile-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.iphone-prototype-content .profile-row--dual {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 4px;
  grid-column: span 2;
}

.iphone-prototype-content .profile-lbl {
  font-size: 9px;
}

.iphone-prototype-content input,
.iphone-prototype-content select {
  font-size: 11px;
  padding: 3px 4px;
}

.iphone-prototype-content .profile-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  padding-top: 8px;
}

.iphone-prototype-content .btn--sm {
  font-size: 10px;
  padding: 4px 8px;
}

.btn--xs {
  padding: 4px 10px;
  font-size: 11px;
}

.ballistics-input-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.ballistics-input-row label {
  color: var(--text-secondary);
  font-size: 0.9em;
  flex: 1;
}

.ballistics-input-row input,
.ballistics-input-row select {
  background: var(--input-bg);
  border: var(--input-border);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  width: 120px;
  font-size: 0.9em;
}

.ballistics-input-row input[type='number'] {
  width: 140px; /* Wider to accommodate spinner arrows */
}

.ballistics-input-row input:focus,
.ballistics-input-row select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 5px rgba(var(--accent-primary-rgb), 0.3);
}

.ballistics-calculate-section {
  text-align: center;
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.ballistics-calculate-btn {
  background: var(--gradient-success);
  color: var(--text-inverse);
  border: none;
  padding: 12px 30px;
  font-size: 1.1em;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: var(--space-2);
}

.ballistics-calculate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--status-success-rgb), 0.3);
}

.ballistics-auto-calc {
  color: var(--text-secondary);
  font-size: 0.9em;
}

.ballistics-results-section {
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  padding: var(--space-3);
  margin: var(--space-4) 0;
  max-height: 400px;
  overflow-y: auto;
}

.ballistics-results-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}

.ballistics-results-table th,
.ballistics-results-table td {
  padding: 8px 6px;
  text-align: center;
  border: 1px solid var(--border-default);
}

.ballistics-results-table th {
  background: var(--surface-subtle);
  color: var(--accent-primary);
  font-weight: bold;
  position: sticky;
  top: 0;
}

.ballistics-results-table td {
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.ballistics-results-table tr:nth-child(even) td {
  background: var(--surface-subtle);
}

.ballistics-modal-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border-default);
}

/* Match canvas toolbar button DNA */
.ballistics-action-btn {
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  letter-spacing: var(--btn-letter-spacing);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--btn-transition);
  background: var(--btn-bg) !important;
  border: var(--btn-border) !important;
  color: var(--btn-text) !important;
}

.ballistics-action-btn:not(:disabled) {
  color: var(--text-primary) !important; /* Illuminate when enabled */
}

.ballistics-action-btn:hover:not(:disabled) {
  background: var(--btn-hover-bg) !important;
  border-color: var(--btn-hover-border) !important;
  box-shadow: var(--btn-hover-shadow) !important;
  transform: translateY(0) !important;
  color: var(--white) !important; /* Full brightness on hover */
}

.ballistics-action-btn:active:not(:disabled) {
  background: var(--btn-active-bg) !important;
  border-color: var(--btn-active-border) !important;
}

.ballistics-action-btn:disabled {
  opacity: var(--btn-disabled-opacity);
  cursor: not-allowed;
  box-shadow: none;
}

/* Reset Defaults Button - Compact circular arrow matching main menu reset */
.ballistics-reset-btn {
  padding: var(--space-2) var(--space-3) !important;
  font-size: 1.1rem !important;
  min-width: 32px;
  line-height: 1;
}

.ballistics-reset-btn:hover:not(:disabled) {
  color: var(--accent-primary, #00e5ff) !important;
}

/* Calibrate Button States - Text Color Only */
button.btn-calibrate:not(:disabled),
.control-button.btn-calibrate:not(:disabled) {
  color: rgba(255, 255, 255, 0.95) !important;
}

button.btn-calibrate:disabled,
.control-button.btn-calibrate:disabled {
  color: rgba(255, 255, 255, 0.35) !important;
}

/* Build Button States - Text Color Only */
button.btn-build:not(:disabled),
.control-button.btn-build:not(:disabled) {
  color: rgba(255, 255, 255, 0.95) !important;
}

button.btn-build:disabled,
.control-button.btn-build:disabled {
  color: rgba(255, 255, 255, 0.35) !important;
}

/* Export Button States - Text Color Only */
button.btn-export:not(:disabled),
.control-button.btn-export:not(:disabled) {
  color: rgba(255, 255, 255, 0.95) !important;
}

button.btn-export:disabled,
.control-button.btn-export:disabled {
  color: rgba(255, 255, 255, 0.35) !important;
}

/* V-LOG Status Color Classes */
.vlog-status-origl {
  color: #888888 !important;
  font-weight: 600;
}

.vlog-status-blend {
  color: #ffaa00 !important;
  font-weight: 600;
}

.vlog-status-calib {
  color: #00ff00 !important;
  font-weight: 600;
}

.vlog-status-warn {
  color: #ffaa00 !important;
  font-weight: 600;
}

.vlog-status-fail {
  color: #ff4444 !important;
  font-weight: 600;
}

.vlog-status-pass {
  color: #00ff00 !important;
  font-weight: 600;
}

.vlog-delta-positive {
  color: #ffaa00 !important;
}

.vlog-delta-negative {
  color: #00aaff !important;
}

/* V-LOG Status: ORIG (was ORIGL) */
.vlog-status-orig {
  color: #888888 !important;
  font-weight: 600;
}

/* V-LOG Prediction Uncertainty (σ) Classes */
.vlog-sigma-excellent {
  color: #00ff00 !important; /* Green - <0.05 mil */
  font-weight: 600;
}

.vlog-sigma-good {
  color: #00ffff !important; /* Cyan - 0.05-0.15 mil */
  font-weight: 500;
}

.vlog-sigma-fair {
  color: #ffaa00 !important; /* Yellow - 0.15-0.30 mil */
  font-weight: 500;
}

.vlog-sigma-poor {
  color: #ff4444 !important; /* Red - >0.30 mil */
  font-weight: 600;
}

/* V-LOG Prediction Confidence (PC) Classes */
.vlog-pc-excellent {
  color: #00ff00 !important; /* Green - 95%+ */
  font-weight: 600;
}

.vlog-pc-good {
  color: #00ffff !important; /* Cyan - 85-95% */
  font-weight: 500;
}

.vlog-pc-fair {
  color: #ffaa00 !important; /* Yellow - 70-85% */
  font-weight: 500;
}

.vlog-pc-poor {
  color: #ff4444 !important; /* Red - <70% */
  font-weight: 600;
}

/* V-LOG Blend Weight Classes */
.vlog-blend-original {
  color: #888888 !important; /* Gray - pure G7 */
}

.vlog-blend-calibrated {
  color: #00ff00 !important; /* Green - fully calibrated */
}

.vlog-blend-transition {
  color: #ffaa00 !important; /* Yellow - blending */
}

.da-sweep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.da-input-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.da-input-row label {
  font-size: 0.85em;
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
}

.da-input-row input {
  background: var(--input-bg);
  border: var(--input-border);
  color: var(--input-text, rgba(255, 255, 255, 0.95));
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  text-align: center;
  width: 100%;
}

.da-input-row input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 3px rgba(var(--accent-primary-rgb), 0.3);
}

/* ============================================
   MATERIAL BOUNDS PHYSICAL PREVIEW
   TODO(theme-js): Supports bezel box calibration
   ============================================ */
/* Utility */
.material-bounds-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(6px);
  padding: var(--space-4);
}

.material-bounds-dialog {
  background: var(--surface-panel);
  border: 3px solid var(--status-success);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  width: min(700px, 92vw);
  box-shadow: var(--shadow-strong);
  color: var(--text-primary);
  text-align: center;
}

.material-bounds-dialog h2 {
  margin: 0 0 var(--space-4) 0;
  color: var(--status-success);
  font-size: 24px;
}

.material-bounds-dialog p {
  margin: 0 0 var(--space-3) 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.material-bounds-info {
  margin: 0 0 var(--space-4) 0;
  padding: var(--space-3);
  background: rgba(var(--status-success-rgb), 0.08);
  border: 1px solid rgba(var(--status-success-rgb), 0.25);
  border-radius: var(--radius-md);
}

.material-bounds-info__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.material-bounds-info__value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--status-success);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.material-bounds-info__hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.material-calibration-section {
  margin: var(--space-5) 0 var(--space-4);
  padding: var(--space-4);
  background: var(--surface-panel);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(var(--status-success-rgb), 0.2);
}

.material-calibration-ruler {
  width: 240px;
  max-width: 100%;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--status-success) 0%,
    var(--status-success) 48%,
    var(--text-inverse) 48%,
    var(--text-inverse) 52%,
    var(--status-success) 52%,
    var(--status-success) 100%
  );
  margin: var(--space-4) auto;
  box-shadow: 0 0 10px rgba(var(--status-success-rgb), 0.5);
}

.material-bounds-instruction {
  color: var(--status-success);
  font-size: 0.8rem;
  margin-top: var(--space-2);
}

.material-bounds-input-group {
  margin: var(--space-5) 0;
}

.material-bounds-input-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--status-success);
}

.material-bounds-input {
  width: 200px;
  max-width: 100%;
  padding: var(--space-2);
  font-size: 1rem;
  border: 2px solid var(--status-success);
  border-radius: var(--radius-sm);
  background: var(--surface-panel);
  color: var(--status-success);
  text-align: center;
  font-weight: 600;
}

.material-bounds-input:focus {
  outline: none;
  box-shadow: 0 0 8px rgba(var(--status-success-rgb), 0.35);
}

.material-bounds-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.material-bounds-actions {
  margin-top: var(--space-5);
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.material-bounds-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
  border: none;
  color: var(--text-inverse);
}

.material-bounds-button--primary {
  background: var(--status-success);
  box-shadow: 0 6px 16px rgba(var(--status-success-rgb), 0.25);
}

.material-bounds-button--primary:hover {
  filter: saturate(1.08);
  box-shadow: 0 8px 18px rgba(var(--status-success-rgb), 0.35);
}

.material-bounds-button--danger {
  background: var(--status-error);
  box-shadow: 0 6px 16px rgba(var(--status-error-rgb), 0.25);
}

.material-bounds-button--danger:hover {
  filter: saturate(1.08);
  box-shadow: 0 8px 18px rgba(var(--status-error-rgb), 0.35);
}

.material-bounds-button:active {
  transform: translateY(1px);
}

.material-jig-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.material-bounds-tips {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: rgba(var(--status-success-rgb), 0.12);
  border: 1px solid rgba(var(--status-success-rgb), 0.25);
  border-radius: var(--radius-md);
  color: var(--status-success);
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.6;
}

.material-bounds-tips strong {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--status-success);
}

.material-bounds-tips ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-secondary);
  list-style: disc;
}

.material-bounds-tips li {
  margin-bottom: 0.35rem;
}

.material-axle-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px dashed var(--status-warning);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1000;
}

.material-axle-label {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: bold;
  color: var(--status-warning);
  white-space: nowrap;
  pointer-events: none;
}

.material-preview-active {
  border: 4px solid var(--status-success) !important;
  box-shadow: 0 0 20px rgba(var(--status-success-rgb), 0.4) !important;
  background: rgba(0, 0, 0, 0.05) !important;
}

.material-size-display {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.material-size-value {
  width: 100%;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: var(--surface-panel);
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.material-size-value--bezel {
  border-color: var(--status-success);
  color: var(--status-success);
  background: rgba(var(--status-success-rgb), 0.08);
  font-size: 1rem;
}

.material-size-value--stock {
  border-color: var(--status-warning);
  color: var(--status-warning);
  background: rgba(var(--status-warning-rgb), 0.1);
  font-size: 0.9rem;
}

.material-jig-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-1);
}

.material-jig-slider {
  width: 120px;
}

/* Math Info Dialog */
.math-info-callout {
  background: var(--surface-info);
  padding: var(--space-3);
  border-left: 4px solid var(--accent-primary);
  margin: var(--space-4) 0;
  border-radius: var(--radius-sm);
}

.math-info-divider {
  margin: var(--space-5) 0;
  border: none;
  border-top: 1px solid var(--border-soft);
}

.math-info-code {
  background: var(--surface-muted);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* Ballistics Integration Styles */
.ballistics-message {
  padding: 10px;
  border-radius: 4px;
  margin: 5px 0;
  font-size: 0.9em;
  border: 1px solid;
}

.ballistics-message--loading {
  background: rgba(33, 150, 243, 0.2);
  border-color: rgba(33, 150, 243, 0.5);
  color: #64b5f6;
}

.ballistics-message--success {
  background: rgba(76, 175, 80, 0.2);
  border-color: rgba(76, 175, 80, 0.5);
  color: #81c784;
}

.ballistics-message--error {
  background: rgba(244, 67, 54, 0.2);
  border-color: rgba(244, 67, 54, 0.5);
  color: #ef5350;
}

.ballistics-message--warning {
  background: rgba(255, 152, 0, 0.2);
  border-color: rgba(255, 152, 0, 0.5);
  color: #ffb74d;
}

.ballistics-bullet-meta {
  margin-top: 8px;
  font-size: 0.9em;
}

.ballistics-data-summary {
  margin-top: 20px;
  padding: 15px;
  background: rgba(0, 200, 255, 0.1);
  border-radius: 8px;
  border-left: 4px solid #00c8ff;
}

/* G7 Truing and Drag Models modals - higher z-index to appear in front */
.g7-truing-modal,
.drag-models-modal {
  z-index: 10001 !important;
}

.g7-truing-modal .modal-content,
.drag-models-modal .modal-content {
  z-index: 10001 !important;
}

/* ============================================================================
   BALLISTICS MODAL UTILITY CLASSES
   Theme-aware classes to replace inline styles in ballistics_calculator_modal.js
   ============================================================================ */

/* Modal Container Backgrounds */
.modal-bg-dark {
  background: var(--surface-panel);
  color: var(--text-primary);
}

.modal-container {
  background: var(--surface-panel);
  color: var(--text-primary);
  padding: 20px;
  font-family: var(--font-primary);
  border-radius: 8px;
  max-width: 900px;
  margin: 20px auto;
  max-height: 90vh;
  overflow-y: auto;
}

/* Headers */
.modal-header-accent {
  color: var(--accent-primary);
  margin-top: 0;
  font-family: var(--font-primary);
}

.modal-header-warning {
  color: var(--status-warning);
  border-bottom: 2px solid var(--status-warning);
  padding-bottom: 8px;
  font-family: var(--font-primary);
}

.modal-header-success {
  color: var(--status-success);
  border-bottom: 2px solid var(--status-success);
  padding-bottom: 8px;
  font-family: var(--font-primary);
}

.modal-header-error {
  color: var(--status-error);
  border-bottom: 2px solid var(--status-error);
  padding-bottom: 8px;
  font-family: var(--font-primary);
}

/* INFO CARDS REMOVED - now in 05-components/cards.css */

/* Lists */
.info-list {
  margin: 10px 0;
  line-height: 1.8;
  padding-left: 20px;
}

.monospace-list {
  font-family: var(--font-primary);
  line-height: 1.8;
}

/* Text Styles */
.text-accent {
  color: var(--accent-primary);
}

.text-warning {
  color: var(--status-warning);
  font-weight: bold;
}

.text-success {
  color: var(--status-success);
}

.text-error {
  color: var(--status-error);
}

.text-monospace {
  font-family: var(--font-primary);
}

/* Tables */
.table-clean {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.table-clean thead {
  position: sticky;
  top: 0;
  background: var(--surface-panel);
  z-index: 10;
}

.table-clean tr {
  border-bottom: 2px solid var(--accent-primary);
}

.table-clean th,
.table-clean td {
  padding: 10px;
  text-align: left;
}

/* Buttons */
.btn-modal-close {
  margin-top: 15px;
  padding: 10px 20px;
  background: var(--accent-primary);
  color: var(--text-inverse);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.btn-modal-close:hover {
  background: var(--accent-primary-hover);
}

/* Spacing Utilities */
.mt-15 {
  margin-top: 15px;
}
.mb-15 {
  margin-bottom: 15px;
}
.mt-20 {
  margin-top: 20px;
}
.mb-20 {
  margin-bottom: 20px;
}
.p-15 {
  padding: 15px;
}
.p-20 {
  padding: 20px;
}

/* Grid Layouts */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
}

/* Strong/Bold text that respects theme */
.strong-accent {
  color: var(--accent-primary);
  font-weight: bold;
}

.strong-warning {
  color: var(--status-warning);
  font-weight: bold;
}

.strong-success {
  color: var(--status-success);
  font-weight: bold;
}

/* Status Banner - Notification Messages
   Layout: [◂ resize] [▾ toggle] [message text (flex)] [resize ▸]
   - Absolutely centered in header between Oracle and Black Team LLC
   - Resize handles on BOTH ends for symmetric dragging
   - Toggle on left, text in middle, always stays centered
*/
.status-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 25, 35, 0.95);
  color: rgba(255, 255, 255, 0.95) !important;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: var(--font-primary);
  border: 1px solid rgba(0, 200, 255, 0.3);
  display: none; /* Mobile-first: hidden on small screens */
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    width 0.1s ease;
  min-width: 180px;
  max-width: calc(100% - 200px); /* CSS fallback; JS calculates precise max from button positions */
  width: 320px; /* Default width, can be resized via drag handles */
  z-index: var(--z-panel); /* Below Oracle dropdown but above other elements */
}

/* Desktop: show status banner */
@media (min-width: 769px) {
  .status-banner {
    display: flex;
  }
}

.status-banner.show {
  opacity: 1;
}

.status-banner.resizing {
  -webkit-user-select: none;
  user-select: none;
  transition: none; /* Disable transition during drag for responsiveness */
}

.status-banner.info {
  border-color: rgba(0, 200, 255, 0.5);
  background: linear-gradient(90deg, rgba(0, 200, 255, 0.05), rgba(0, 200, 255, 0.1));
}

.status-banner.success {
  border-color: #34c759;
  background: linear-gradient(90deg, rgba(52, 199, 89, 0.1), rgba(52, 199, 89, 0.15));
}

.status-banner.warning {
  border-color: #ff9500;
  background: linear-gradient(90deg, rgba(255, 149, 0, 0.1), rgba(255, 149, 0, 0.15));
}

.status-banner.error {
  border-color: #ff3b30;
  background: linear-gradient(90deg, rgba(255, 59, 48, 0.1), rgba(255, 59, 48, 0.15));
}

/* BUILD level - White background, reserved for KNOMAD build confirmations */
.status-banner.build {
  border-color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a1a !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.status-banner.build #statusBannerText {
  color: #1a1a1a !important;
  font-weight: 600;
}

.status-banner.build .status-toggle {
  color: #444 !important;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.status-banner.build .status-toggle:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #1a1a1a !important;
}

/* History item for build level */
.status-history .history-item.build {
  background: rgba(255, 255, 255, 0.1);
  border-left: 3px solid rgba(255, 255, 255, 0.8);
}

/* Text takes remaining space with ellipsis for overflow */
#statusBannerText {
  flex: 1;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0; /* Allow shrinking below content size */
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

/* Toggle on LEFT side - dropdown arrow */
.status-toggle {
  flex-shrink: 0;
  order: -1; /* Force to start of flexbox */
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.9) !important;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.status-toggle:hover {
  background: rgba(0, 200, 255, 0.15);
  color: rgba(0, 200, 255, 0.9) !important;
}

/* Resize handles on BOTH edges - symmetric resize to stay centered */
.status-resizer {
  flex-shrink: 0;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  position: relative;
}

/* Left resizer extends into left padding */
.status-resizer.left {
  order: -2; /* Before toggle */
  margin-left: -8px;
}

/* Right resizer extends into right padding */
.status-resizer.right {
  margin-right: -8px;
}

.status-resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 14px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 1px;
  transition: background 0.15s ease;
}

.status-resizer:hover::after,
.status-banner.resizing .status-resizer::after {
  background: rgba(0, 200, 255, 0.8);
}

/* Build level - dark resizer styling */
.status-banner.build .status-resizer::after {
  background: rgba(0, 0, 0, 0.15);
}

.status-banner.build .status-resizer:hover::after {
  background: rgba(0, 0, 0, 0.4);
}

.status-history {
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  background: rgba(15, 25, 35, 0.98);
  border: 1px solid rgba(0, 200, 255, 0.3);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 200, 255, 0.3);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: all 0.2s ease;
}

.status-history.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.history-item {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 200, 255, 0.1);
  display: flex;
  gap: 8px;
  align-items: center;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item .time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-primary);
  min-width: 60px;
}

.history-item .text {
  flex: 1;
  color: rgba(255, 255, 255, 0.9);
}

.history-item.info .text {
  color: rgba(0, 200, 255, 0.9);
}
.history-item.success .text {
  color: #34c759;
}
.history-item.warning .text {
  color: #ff9500;
}
.history-item.error .text {
  color: #ff3b30;
}

.history-empty {
  padding: 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
}

/* ============================================
   Calibration Profile Status Badge
   ============================================ */
.profile-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  margin-left: 8px;
  vertical-align: middle;
}

.profile-status-badge.saved {
  background: rgba(52, 199, 89, 0.15);
  color: #34c759;
  border: 1px solid rgba(52, 199, 89, 0.3);
}

.profile-status-badge.unsaved {
  background: rgba(255, 149, 0, 0.15);
  color: #ff9500;
  border: 1px solid rgba(255, 149, 0, 0.3);
  animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* ============================================
   Profile Identity Cell (Calibration Tool)
   Links calibration to Tesseract profile
   ============================================ */
.profile-identity-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.08), rgba(100, 50, 200, 0.12));
  border: 1px solid rgba(138, 43, 226, 0.25);
  border-radius: 6px;
  font-size: 0.85rem;
}

/* Unnamed profile state - amber warning styling */
.profile-identity-cell.unnamed,
.profile-identity-cell:has(#profileUnnamedState:not([style*='none'])) {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.08), rgba(255, 152, 0, 0.12));
  border-color: rgba(255, 193, 7, 0.35);
}

.profile-identity-cell .profile-icon {
  font-size: 1rem;
}

.profile-identity-cell .profile-icon.warning {
  color: #ffc107;
  font-size: 1.1rem;
  filter: drop-shadow(0 0 3px rgba(255, 193, 7, 0.5));
}

.profile-identity-cell .profile-name {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  flex: 1;
}

.profile-identity-cell .profile-version {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: rgba(138, 43, 226, 0.8);
  background: rgba(138, 43, 226, 0.15);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.profile-identity-cell .profile-prompt {
  color: rgba(255, 255, 255, 0.6);
  flex: 1;
}

.profile-identity-cell .profile-name-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 193, 7, 0.4);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
}

.profile-identity-cell .profile-name-input:focus {
  border-color: rgba(255, 193, 7, 0.7);
  box-shadow: 0 0 4px rgba(255, 193, 7, 0.3);
}

.profile-identity-cell .profile-name-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.profile-identity-cell .profile-action-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s ease;
}

.profile-identity-cell .profile-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.profile-identity-cell .profile-name-btn {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.25), rgba(255, 152, 0, 0.35));
  border: 1px solid rgba(255, 193, 7, 0.6);
  color: #ffc107;
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s ease;
  animation: pulse-soft 2s infinite;
}

.profile-identity-cell .profile-name-btn:hover {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.4), rgba(255, 152, 0, 0.5));
  color: #fff;
  animation: none;
}

@keyframes pulse-soft {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

#profileNamedState {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

#profileUnnamedState {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

/* ============================================================================
   MV SD CALCULATOR STYLES
   ============================================================================ */

.mvsd-tool {
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.mvsd-header {
  margin: 0 0 12px 0;
  font-size: 0.95em;
  color: #00c8ff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mvsd-info-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.7em;
  padding: 0;
  line-height: 1;
}

.mvsd-info-btn:hover {
  background: rgba(0, 200, 255, 0.2);
  border-color: #00c8ff;
}

/* PyBal Integration Section */
.mvsd-pybal-section {
  margin-bottom: 12px;
  padding: 8px;
  background: rgba(0, 200, 255, 0.05);
  border: 1px solid rgba(0, 200, 255, 0.2);
  border-radius: 4px;
}

.mvsd-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85em;
  cursor: pointer;
}

.mvsd-toggle-label input[type='checkbox'] {
  width: 14px;
  height: 14px;
  accent-color: #00c8ff;
}

.mvsd-pybal-info {
  margin-top: 6px;
  font-size: 0.8em;
  color: rgba(255, 255, 255, 0.6);
}

.mvsd-linked {
  color: #00ff88;
}

.mvsd-standalone {
  color: #ffaa00;
}

.mvsd-waiting {
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

/* Input Section */
.mvsd-input-section {
  margin-bottom: 12px;
}

.mvsd-input-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.mvsd-velocity-input {
  flex: 1;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #fff;
  font-size: 0.9em;
}

.mvsd-velocity-input:focus {
  outline: none;
  border-color: #00c8ff;
}

.mvsd-add-btn {
  padding: 8px 12px;
  background: #00c8ff;
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.85em;
}

.mvsd-add-btn:hover {
  background: #00e8ff;
}

.mvsd-import-row {
  display: flex;
  gap: 6px;
}

.mvsd-bulk-input {
  flex: 1;
  padding: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #fff;
  font-size: 0.8em;
  resize: vertical;
  min-height: 40px;
}

.mvsd-bulk-input:focus {
  outline: none;
  border-color: #00c8ff;
}

.mvsd-import-btn {
  padding: 6px 10px;
  background: rgba(0, 200, 255, 0.2);
  color: #00c8ff;
  border: 1px solid rgba(0, 200, 255, 0.4);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8em;
  align-self: flex-start;
}

.mvsd-import-btn:hover {
  background: rgba(0, 200, 255, 0.3);
}

/* Readings Section */
.mvsd-readings-section {
  margin-bottom: 12px;
}

.mvsd-readings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.7);
}

.mvsd-clear-btn {
  background: transparent;
  border: none;
  color: #ff5252;
  cursor: pointer;
  font-size: 0.75em;
  padding: 2px 6px;
}

.mvsd-clear-btn:hover {
  text-decoration: underline;
}

.mvsd-readings-list {
  max-height: 120px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  padding: 4px;
}

.mvsd-reading-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  font-size: 0.8em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mvsd-reading-item:last-child {
  border-bottom: none;
}

.mvsd-reading-num {
  color: rgba(255, 255, 255, 0.4);
  min-width: 25px;
}

.mvsd-reading-val {
  flex: 1;
  color: #fff;
}

.mvsd-remove-btn {
  background: transparent;
  border: none;
  color: #ff5252;
  cursor: pointer;
  font-size: 1.1em;
  padding: 0 4px;
  opacity: 0.5;
}

.mvsd-remove-btn:hover {
  opacity: 1;
}

.mvsd-empty {
  text-align: center;
  padding: 12px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.8em;
  font-style: italic;
}

.mvsd-more {
  text-align: center;
  padding: 4px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75em;
}

/* Statistics Display */
.mvsd-stats-display {
  padding: 10px;
  background: rgba(0, 200, 255, 0.05);
  border: 1px solid rgba(0, 200, 255, 0.2);
  border-radius: 4px;
  margin-bottom: 10px;
}

.mvsd-no-stats {
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8em;
  padding: 8px;
}

.mvsd-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mvsd-stat-item {
  padding: 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  text-align: center;
}

.mvsd-stat-primary {
  grid-column: span 2;
  padding: 10px;
}

.mvsd-stat-small {
  grid-column: span 2;
  padding: 4px;
}

.mvsd-stat-label {
  display: block;
  font-size: 0.7em;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.mvsd-stat-value {
  display: block;
  font-size: 1.1em;
  font-weight: bold;
  color: #fff;
}

.mvsd-stat-primary .mvsd-stat-value {
  font-size: 1.5em;
}

.mvsd-stat-quality {
  display: block;
  font-size: 0.7em;
  margin-top: 2px;
}

/* SD Quality Colors */
.mvsd-sd-good .mvsd-stat-value,
.mvsd-sd-good .mvsd-stat-quality {
  color: #00ff88;
}

.mvsd-sd-fair .mvsd-stat-value,
.mvsd-sd-fair .mvsd-stat-quality {
  color: #ffaa00;
}

.mvsd-sd-poor .mvsd-stat-value,
.mvsd-sd-poor .mvsd-stat-quality {
  color: #ff5252;
}

/* Footer */
.mvsd-footer {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mvsd-footer small {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75em;
  line-height: 1.4;
}

/* SCENE SELECTOR REMOVED - now in 05-components/dropdowns.css */

/* ============================================
   DOPE Modal - Right Tool Rail Modal
   ============================================ */
.dope-modal__table {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--cyan-20, rgba(0, 200, 255, 0.2));
  border-radius: 8px;
  padding: 12px;
}

.dope-modal__table .table-header,
.dope-modal__table .table-row {
  /* 7 columns: Row, Bezel, Mils, Wind, DA Low, DA High, G2 */
  grid-template-columns: 2rem 3rem 3.5rem 3rem 3.5rem 3.5rem 2.5rem;
  gap: 8px;
  font-size: 12px;
}

.dope-modal__table .row-index,
.dope-modal__table .header-index {
  display: block;
  color: var(--text-tertiary, #666);
  font-size: 10px;
}

.dope-modal__table .table-header {
  color: var(--text-secondary, #aaa);
  font-size: 10px;
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.dope-modal__table .table-row {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dope-modal__table .table-row:last-child {
  border-bottom: none;
}

.dope-modal__table .mil-value,
.dope-modal__table .wind-value,
.dope-modal__table .da-low-value,
.dope-modal__table .da-high-value,
.dope-modal__table .rifle2-value {
  font-family: var(--font-mono, 'Consolas', monospace);
  text-align: right;
}

.dope-modal__table .bezel-value {
  font-weight: 600;
  color: var(--text-primary, #fff);
}

/* ============================================
   SPIRAL NODE TOOLTIPS - Velocity/Mach Data
   ============================================ */
.spiral-node {
  cursor: pointer;
  transition:
    r 0.15s ease,
    opacity 0.15s ease;
}

.spiral-node:hover {
  opacity: 0.8;
}

/* Transonic regime warning styling */
.node-transonic {
  stroke: #ff9500 !important;
  stroke-width: 1.5 !important;
}

/* Subsonic regime styling */
.node-subsonic {
  stroke: #ff3b30 !important;
  stroke-width: 1.5 !important;
}

/* Anchor point highlight */
.node-anchor {
  stroke-width: 2 !important;
  filter: drop-shadow(0 0 2px currentColor);
}

/* Spiral tooltip container */
.spiral-tooltip {
  position: fixed;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--cyan-40, rgba(0, 200, 255, 0.4));
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11px;
  font-family: var(--font-mono, 'Consolas', monospace);
  color: var(--text-primary, #fff);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
  max-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.spiral-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.spiral-tooltip__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}

.spiral-tooltip__label {
  color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
}

.spiral-tooltip__value {
  font-weight: 600;
  color: var(--text-primary, #fff);
}

.spiral-tooltip__value.transonic {
  color: #ff9500;
}

.spiral-tooltip__value.subsonic {
  color: #ff3b30;
}

.spiral-tooltip__value.supersonic {
  color: #30d158;
}

/* ============================================
   BEZEL NUMBER REGIME COLORING (LAB View Only)
   Colors bezel range numbers by velocity regime
   Toggle: MACH button in layer toolbar
   ============================================ */

/* Base class for regime-colored bezel numbers */
.bezel-number.regime-supersonic {
  fill: #30d158 !important; /* Green - safe supersonic flight */
}

.bezel-number.regime-transonic {
  fill: #ff9500 !important; /* Orange - transonic warning zone */
}

.bezel-number.regime-subsonic {
  fill: #ff3b30 !important; /* Red - subsonic regime */
}

/* Anchor point emphasis */
.bezel-number.regime-anchor {
  font-weight: bold;
  filter: drop-shadow(0 0 2px currentColor);
}

/* Ensure regime colors only apply in LAB view, not Field view */
.field-view .bezel-number.regime-supersonic,
.field-view .bezel-number.regime-transonic,
.field-view .bezel-number.regime-subsonic {
  fill: inherit !important; /* Let Field view luminova CSS take over */
}

/* ============================================
   REGIME ZONE ARCS (LAB View Only)
   Visual arc overlays showing velocity regimes
   Toggle: ZONES button in layer toolbar
   ============================================ */

.regime-zones {
  pointer-events: none; /* Don't interfere with spiral interaction */
}

/* Transonic zone arc - orange warning band */
.regime-zone-arc.transonic {
  fill: none;
  stroke: #ff9500;
  stroke-opacity: 0.25;
  stroke-width: 8;
  stroke-linecap: round;
}

/* Subsonic zone arc - red warning band */
.regime-zone-arc.subsonic {
  fill: none;
  stroke: #ff3b30;
  stroke-opacity: 0.25;
  stroke-width: 8;
  stroke-linecap: round;
}

/* Transonic entry marker - thin line at transition point */
.regime-zone-marker.transonic-entry {
  stroke: #ff9500;
  stroke-width: 1.5;
  stroke-dasharray: 4 2;
  stroke-opacity: 0.8;
}

/* Subsonic entry marker - thin line at transition point */
.regime-zone-marker.subsonic-entry {
  stroke: #ff3b30;
  stroke-width: 1.5;
  stroke-dasharray: 4 2;
  stroke-opacity: 0.8;
}

/* Field view: hide regime zones entirely */
.field-view .regime-zones {
  display: none !important;
}

/* ============================================
   VISIBILITY CONTROLS PANEL
   Floating panel for layer toggles
   Toggle: V button in right tool rail
   ============================================ */

.visibility-controls {
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  pointer-events: auto;
}

.visibility-toolbar {
  background: rgba(20, 20, 25, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  min-width: 180px;
}

.visibility-header {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.visibility-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
}

.visibility-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.visibility-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 10px 0;
}

.visibility-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Visibility toggle buttons */
.vis-btn {
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.vis-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.8);
}

.vis-btn--active,
.vis-btn[aria-pressed='true'] {
  background: rgba(0, 200, 255, 0.15);
  border-color: rgba(0, 200, 255, 0.4);
  color: #00c8ff;
}

.vis-btn--active:hover,
.vis-btn[aria-pressed='true']:hover {
  background: rgba(0, 200, 255, 0.25);
  border-color: rgba(0, 200, 255, 0.5);
}

.vis-btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.1);
}

.vis-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ============================================
   VISUAL COMMAND CENTER - TABBED INTERFACE
   ============================================ */

.vcc-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.vcc-tab {
  flex: 1;
  padding: 6px 8px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.15s ease;
}

.vcc-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

.vcc-tab--active,
.vcc-tab[aria-selected='true'] {
  background: rgba(0, 200, 255, 0.15);
  border-color: rgba(0, 200, 255, 0.4);
  color: #00c8ff;
}

.vcc-panel {
  display: none;
}

.vcc-panel--active {
  display: block;
}

/* Slider Controls */
.vcc-slider-group {
  margin-bottom: 10px;
}

.vcc-slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 4px;
}

.vcc-slider-value {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 10px;
  color: #00c8ff;
  min-width: 32px;
  text-align: right;
}

.vcc-slider {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.vcc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #00c8ff;
  cursor: pointer;
  border: 2px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.vcc-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #00c8ff;
  cursor: pointer;
  border: 2px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.vcc-slider:hover::-webkit-slider-thumb {
  background: #33d4ff;
  transform: scale(1.1);
}

/* Color Picker Controls */
.vcc-color-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.vcc-color-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}

.vcc-color {
  width: 28px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  background: none;
}

.vcc-color::-webkit-color-swatch-wrapper {
  padding: 1px;
}

.vcc-color::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}
