/* ==========================================================================
   Compare-Heights.com Core Height Chart Engine - Prototype Styles
   Pure Vanilla CSS - Modern, responsive, decoupled architecture
   ========================================================================== */

:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Restrained Blue + Cyan/Teal Visual Identity */
  --bg-app: #f4f8fc;
  --bg-surface: #ffffff;
  --bg-subtle: #eff6ff;
  --bg-subtle-accent: #e0f2fe;
  --border-subtle: #d7e3f0;
  --border-strong: #b9d0e8;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  /* Accent & status */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-cyan: #06b6d4;
  --color-cyan-hover: #0891b2;
  --color-cyan-subtle: #ecfeff;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;

  /* Baseline & Grid lines */
  --grid-line-color: rgba(148, 163, 184, 0.35);
  --grid-line-major: rgba(100, 116, 139, 0.6);
  --baseline-color: #0f172a;
  --ruler-bg: #ffffff;
  --ruler-border: #d7e3f0;

  /* Chart Layout Constants */
  --ruler-width: 68px;
  --person-col-min-width: 130px;
  --chart-min-height: 480px;
  --chart-max-height: 620px;
  --chart-plotting-height: 520px;
}

@media (max-width: 640px) {
  :root {
    --chart-plotting-height: 440px;
    --ruler-width: 48px;
  }
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: 0 0 40px;
  min-height: 100vh;
}

.app-container,
.prototype-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 16px 40px;
}

@media (max-width: 640px) {
  .app-container,
  .prototype-container {
    padding: 10px 8px 32px;
    gap: 12px;
  }
}

/* --------------------------------------------------------------------------
   Header / Prototype Title Bar
   -------------------------------------------------------------------------- */
.prototype-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.prototype-title-area h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.prototype-title-area p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.prototype-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Debug switch */
.debug-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  background: var(--bg-surface);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s ease;
}

.debug-toggle-label:hover {
  border-color: var(--border-strong);
}

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

/* --------------------------------------------------------------------------
   Test Case Bar (Built-in Test Scenarios)
   -------------------------------------------------------------------------- */
.test-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.test-bar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.test-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.test-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 12px;
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.test-btn:hover {
  background: #e2e8f0;
  border-color: var(--border-strong);
}

.test-btn.active {
  background: #eff6ff;
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
}

.test-btn-clear {
  color: var(--color-danger);
  border-color: rgba(220, 38, 38, 0.2);
  margin-left: auto;
}

.test-btn-clear:hover {
  background: #fee2e2;
  border-color: var(--color-danger);
}

/* --------------------------------------------------------------------------
   Temporary Person Density Toolbar (Visibly positioned directly above chart)
   -------------------------------------------------------------------------- */
.density-toolbar {
  background: #0f172a;
  border: 2px solid #38bdf8;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.density-toolbar-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.density-badge {
  background: #0284c7;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.density-title {
  color: #f8fafc;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.density-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.density-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  cursor: pointer;
  transition: all 0.15s ease;
}

.density-btn-adaptive {
  background: #064e3b;
  color: #34d399;
  border-color: #059669;
}

.density-btn-adaptive:hover {
  background: #047857;
  color: #ffffff;
  border-color: #10b981;
}

.density-btn-adaptive.active {
  background: #059669;
  color: #ffffff;
  border-color: #34d399;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.4);
}

.density-btn:hover {
  background: #334155;
  color: #ffffff;
  border-color: #38bdf8;
}

.density-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4);
}

.density-status-text {
  color: #94a3b8;
  font-size: 0.8rem;
  font-family: var(--font-mono, monospace);
}

/* --------------------------------------------------------------------------
   Adaptive Layout Debug Information Panel
   -------------------------------------------------------------------------- */
.adaptive-debug-panel {
  width: 100%;
  margin-top: 8px;
  background: #070d19;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 16px;
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: #94a3b8;
}

.adaptive-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
}

.adaptive-metric-label {
  color: #64748b;
  white-space: nowrap;
}

.adaptive-metric strong {
  color: #f1f5f9;
  text-align: right;
}

.adaptive-metric-mode {
  grid-column: 1 / -1;
  border-bottom: none;
  padding-top: 4px;
  justify-content: flex-start;
  gap: 12px;
}

.adaptive-mode-badge {
  background: #0284c7;
  color: #ffffff;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.adaptive-mode-badge.comfortable {
  background: #059669;
}

.adaptive-mode-badge.compact {
  background: #0284c7;
}

.adaptive-mode-badge.touching {
  background: #d97706;
}

.adaptive-mode-badge.overlap {
  background: #ea580c;
}

.adaptive-mode-badge.scroll {
  background: #6366f1;
}

@media (max-width: 640px) {
  .density-toolbar {
    padding: 8px 12px;
    gap: 10px;
  }
  .density-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
}

/* --------------------------------------------------------------------------
   Chart Visualization Stage
   -------------------------------------------------------------------------- */
.chart-viewport-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Top toolbar above chart */
.chart-top-bar {
  padding: 10px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.chart-stats {
  display: flex;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.chart-stat-item strong {
  color: var(--text-primary);
}

/* The primary interactive chart frame */
.chart-stage {
  position: relative;
  min-height: var(--chart-plotting-height);
  height: auto;
  width: 100%;
  display: flex;
  overflow: hidden;
  background: #ffffff;
}

@media (max-width: 640px) {
  .chart-stage {
    min-height: var(--chart-plotting-height);
    height: auto;
  }
}

/* Sticky Ruler on Left */
.chart-ruler {
  position: sticky;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--ruler-width);
  min-width: var(--ruler-width);
  height: var(--chart-plotting-height);
  background: var(--ruler-bg);
  border-right: 1px solid var(--ruler-border);
  z-index: 25;
  user-select: none;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.ruler-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ruler-tick-major {
  stroke: #475569;
  stroke-width: 1.5;
}

.ruler-tick-minor {
  stroke: #94a3b8;
  stroke-width: 1;
}

.ruler-label-cm {
  fill: #1e293b;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-anchor: end;
  dominant-baseline: middle;
}

.ruler-label-ft {
  fill: #64748b;
  font-family: var(--font-mono);
  font-size: 9px;
  text-anchor: end;
  dominant-baseline: middle;
}

/* Scrollable People Canvas Track */
.chart-canvas-scroll-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  display: flex;
  scroll-behavior: smooth;
  /* subtle scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.chart-canvas-scroll-container::-webkit-scrollbar {
  height: 8px;
}
.chart-canvas-scroll-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Inner track holding grid backdrop + people columns */
.chart-track {
  position: relative;
  height: var(--chart-plotting-height);
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

/* Grid lines layer */
.chart-grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  box-sizing: border-box;
}

.chart-grid-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--grid-line-color);
  pointer-events: none;
}

.chart-grid-line.major {
  background-color: var(--grid-line-major);
}

/* Ground Baseline (0 cm) */
.chart-baseline {
  position: absolute;
  left: 0;
  width: 100%;
  bottom: 0;
  height: 3px;
  background-color: var(--baseline-color);
  z-index: 10;
  box-sizing: border-box;
}

.chart-baseline-label {
  display: none !important;
}

/* --------------------------------------------------------------------------
   People Columns & Silhouettes
   -------------------------------------------------------------------------- */
.people-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  box-sizing: border-box;
}

.person-column {
  position: absolute;
  bottom: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  pointer-events: auto;
  box-sizing: border-box;
}

/* Silhouette wrapper anchored to baseline */
.person-silhouette-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  /* Height and width are set dynamically by geometry engine:
     height: Xpx; width: (X * naturalAspectRatio) px */
}

.person-silhouette-wrapper svg,
.person-svg-container svg,
.person-svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06));
  transition: fill 0.15s ease;
}

/* Overhead label (Name + Original Height) */
.person-label-box {
  position: absolute;
  bottom: 100%;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 3px 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  pointer-events: auto;
  z-index: 12;
  cursor: default;
}

.person-label-stem {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  background: #94a3b8;
  pointer-events: none;
  z-index: 7;
}

.person-label-box::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px;
  border-style: solid;
  border-color: var(--border-strong) transparent transparent transparent;
}

.person-label-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.person-label-height {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.1;
  margin-top: 2px;
}

.person-label-height-sub {
  font-size: 0.68rem;
  color: var(--text-tertiary, #64748b);
  margin-top: 1px;
}

/* Head alignment guideline in debug mode */
.person-head-guideline {
  display: none;
  position: absolute;
  top: 0;
  left: -2000px;
  right: 0;
  height: 1px;
  border-top: 1px dashed rgba(220, 38, 38, 0.7);
  pointer-events: none;
  z-index: 6;
}

body.debug-mode .person-head-guideline {
  display: block;
}

/* Debug metric tag underneath head line */
.person-debug-badge {
  display: none;
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 12;
  pointer-events: none;
}

body.debug-mode .person-debug-badge {
  display: block;
}

/* --------------------------------------------------------------------------
   Debug HUD & Invariant Acceptance Verification Panel
   -------------------------------------------------------------------------- */
.debug-panel {
  display: none;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 8px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

body.debug-mode .debug-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.debug-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #334155;
  padding-bottom: 8px;
}

.debug-panel-title {
  font-weight: 700;
  color: #38bdf8;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.debug-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.debug-metric-box {
  background: #1e293b;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #334155;
}

.debug-metric-box label {
  color: #94a3b8;
  display: block;
  font-size: 0.7rem;
  margin-bottom: 2px;
}

.debug-metric-box span {
  font-weight: 600;
  color: #f1f5f9;
}

/* --------------------------------------------------------------------------
   Debug Person Density Experiment Section
   -------------------------------------------------------------------------- */
.debug-density-section {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.debug-density-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #334155;
  padding-bottom: 6px;
}

.debug-density-title {
  font-weight: 700;
  color: #38bdf8;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.debug-density-subtitle {
  color: #94a3b8;
  font-size: 0.68rem;
}

.density-controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.density-label {
  color: #cbd5e1;
  font-weight: 600;
  font-size: 0.75rem;
}

.density-select {
  background: #0f172a;
  color: #38bdf8;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.density-select:focus {
  outline: none;
  border-color: #38bdf8;
}

.density-presets-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.density-presets-label {
  color: #94a3b8;
  font-size: 0.7rem;
  margin-right: 4px;
}

.density-preset-btn {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.density-preset-btn:hover {
  background: #1e293b;
  border-color: #38bdf8;
  color: #38bdf8;
}

.density-preset-btn.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  font-weight: 600;
}

.density-telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.density-telemetry-box {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 6px 8px;
}

.density-telemetry-box label {
  color: #94a3b8;
  display: block;
  font-size: 0.68rem;
  margin-bottom: 2px;
}

.density-telemetry-box span {
  color: #4ade80;
  font-weight: 600;
  font-size: 0.76rem;
}

/* Staggered label connecting stem */
.person-label-stem {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  background: #64748b;
  pointer-events: none;
  z-index: 7;
}

/* Invariants Test List */
.invariants-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.invariants-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.invariant-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: #1e293b;
  border-radius: 4px;
  border-left: 3px solid #10b981;
}

.invariant-item.failed {
  border-left-color: #ef4444;
}

.invariant-name {
  color: #e2e8f0;
  font-size: 0.72rem;
}

.invariant-status {
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.68rem;
}

.invariant-status.pass {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.invariant-status.fail {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* --------------------------------------------------------------------------
   Controls & People Manager
   -------------------------------------------------------------------------- */
.controls-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 800px) {
  .controls-layout {
    grid-template-columns: 1fr;
  }
}

.control-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

/* Add person form */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

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

.form-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input, .form-select {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.height-inputs-row {
  display: flex;
  gap: 6px;
}

.height-inputs-row input {
  width: 100%;
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-color-picker {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 38px;
  height: 34px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
}

.form-color-picker::-webkit-color-swatch {
  border-radius: 4px;
  border: none;
}

.btn-primary {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  align-self: flex-start;
  transition: background-color 0.15s ease;
}

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

/* People List in Manager */
.people-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.person-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 0.82rem;
}

.person-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.person-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.person-item-name {
  font-weight: 600;
  color: var(--text-primary);
}

.person-item-type {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.person-item-height {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-remove {
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--color-danger);
  background: transparent;
  border: 1px solid rgba(220, 38, 38, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-remove:hover {
  background: #fee2e2;
  border-color: var(--color-danger);
}

.empty-state {
  font-size: 0.825rem;
  color: var(--text-muted);
  text-align: center;
  padding: 20px 0;
}

/* --------------------------------------------------------------------------
   Person Interaction Layer (Desktop Hover/Select & Mobile Tap/Actions)
   -------------------------------------------------------------------------- */
.person-column {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.person-column:hover .person-silhouette-wrapper {
  filter: drop-shadow(0 0 4px rgba(37, 99, 235, 0.35));
}

.person-column.is-selected .person-silhouette-wrapper {
  filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.65));
}

.person-column.is-selected .person-label-box {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3), 0 4px 8px rgba(0, 0, 0, 0.15);
  background: #eff6ff;
}

/* Desktop Compact Inline Hover/Selected Actions */
.person-inline-actions {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 3px 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

@media (hover: hover) and (min-width: 641px) {
  .person-column:hover .person-inline-actions,
  .person-column.is-selected .person-inline-actions {
    opacity: 1;
    pointer-events: auto;
  }
}

.person-inline-btn {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: #f8fafc;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.3;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.person-inline-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

.person-inline-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.person-inline-btn.btn-inline-del {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.person-inline-btn.btn-inline-del:hover {
  background: #ef4444;
  color: #ffffff;
}

/* Mobile & Stage Action Dock (Appears when a person is selected) */
.person-action-dock {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  box-sizing: border-box;
}

.person-action-dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
}

.person-action-dock-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f8fafc;
  font-size: 0.85rem;
  font-weight: 600;
}

.person-action-dock-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.person-action-dock-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.person-action-dock-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.dock-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 44px; /* Strictly touch-friendly on mobile */
  padding: 8px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.dock-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
}

.dock-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.dock-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.08);
}

.dock-btn.dock-btn-edit {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
}

.dock-btn.dock-btn-edit:hover {
  background: #1d4ed8;
}

.dock-btn.dock-btn-del {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.dock-btn.dock-btn-del:hover {
  background: #dc2626;
  color: #ffffff;
}

/* Secondary Cancel Button */
.btn-secondary {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* List Row Action Buttons */
.person-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-row-action {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-row-action:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: var(--border-strong);
}

.btn-row-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ==========================================================================
   PRODUCTION WEBSITE BUILD: PHASE 1 UI STYLES
   ========================================================================== */

/* --------------------------------------------------------------------------
   Header & Mobile Navigation Drawer
   -------------------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  z-index: 40;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  user-select: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.brand-name-accent {
  color: var(--color-primary);
  font-weight: 800;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  user-select: none;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

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

/* Mobile Drawer */
.menu-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.menu-drawer-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: #ffffff;
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

.menu-drawer.open {
  transform: translateX(0);
}

.menu-drawer-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-drawer-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.menu-drawer-links {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-nav-item {
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

.drawer-nav-item:hover {
  background: var(--bg-subtle);
}

.drawer-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 8px 0;
}

/* --------------------------------------------------------------------------
   Page Intro (Compact H1 & Lead)
   -------------------------------------------------------------------------- */
.page-intro {
  margin-bottom: 2px;
  text-align: center;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-lead {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

@media (max-width: 640px) {
  .page-title {
    font-size: 1.2rem;
  }
  .page-lead {
    font-size: 0.8rem;
  }
}

/* --------------------------------------------------------------------------
   Chart Toolbar (Directly above the chart - Unified & Expandable)
   -------------------------------------------------------------------------- */
.chart-toolbar-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.chart-toolbar {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  white-space: nowrap;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  max-width: 100%;
}

.toolbar-cluster {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
}

.toolbar-cluster-secondary {
  display: none;
}

.chart-toolbar.expanded .toolbar-cluster-secondary {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  animation: toolbarClusterFade 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toolbarClusterFade {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.toolbar-divider {
  display: none;
}

.tb-btn {
  font-family: inherit;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
}

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

.tb-btn:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.tb-btn-add {
  background: var(--color-primary);
  color: #ffffff;
  border: 1px solid var(--color-primary);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}

.tb-btn-add:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: #ffffff;
}

.tb-btn-more .icon-more-close {
  display: none;
}

.tb-btn-more.active {
  background: var(--bg-subtle);
  color: var(--color-primary);
  border-color: var(--border-strong);
}

.tb-btn-more.active .icon-more-dots {
  display: none;
}

.tb-btn-more.active .icon-more-close {
  display: block;
}

.tb-btn-danger:hover {
  background: #fee2e2;
  color: var(--color-danger);
  border-color: rgba(220, 38, 38, 0.3);
}

@media (max-width: 360px) {
  .chart-toolbar {
    gap: 3px;
    padding: 3px;
  }

  .chart-toolbar.expanded .toolbar-cluster-secondary {
    gap: 3px;
  }

  .tb-btn {
    width: 35px;
    height: 35px;
  }
}

/* --------------------------------------------------------------------------
   Chart Empty State
   -------------------------------------------------------------------------- */
.chart-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: auto;
  z-index: 15;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(2px);
  padding: 20px;
  text-align: center;
}

.chart-empty-icon {
  color: #94a3b8;
  margin-bottom: 2px;
}

.chart-empty-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-empty-subtitle,
.chart-empty-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 300px;
  line-height: 1.4;
}

.chart-empty-btn,
.btn-empty-add,
#empty-add-person-btn {
  margin-top: 6px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  min-height: 42px;
  border-radius: 8px;
  background-color: #2563eb;
  color: #ffffff;
  border: 1px solid #2563eb;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  user-select: none;
  -webkit-user-select: none;
}

.chart-empty-btn:hover,
.btn-empty-add:hover,
#empty-add-person-btn:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.35);
}

.chart-empty-btn:active,
.btn-empty-add:active,
#empty-add-person-btn:active {
  background-color: #1e40af;
  border-color: #1e40af;
  transform: translateY(1px);
}

.chart-empty-btn:focus-visible,
.btn-empty-add:focus-visible,
#empty-add-person-btn:focus-visible {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

/* --------------------------------------------------------------------------
   Controls & Add/Edit Person Section (Full-width clean layout)
   -------------------------------------------------------------------------- */
.controls-section {
  display: block;
  width: 100%;
}

.control-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  padding: 18px 20px;
}

@media (max-width: 640px) {
  .control-card {
    padding: 16px;
  }
}

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

.card-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.card-title-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-cyan);
  display: inline-block;
  flex-shrink: 0;
}

/* Compact Segmented Mode Selector: [ Custom Person ] [ Celebrity ] */
.add-mode-selector {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.mode-tab {
  appearance: none;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
  line-height: 1.2;
}

.mode-tab:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(226, 232, 240, 0.6);
}

.mode-tab.active {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.mode-tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

@media (max-width: 540px) {
  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .add-mode-selector {
    width: 100%;
    display: flex;
  }

  .mode-tab {
    flex: 1;
    text-align: center;
    justify-content: center;
    padding: 8px 10px;
    min-height: 40px;
    display: flex;
    align-items: center;
  }
}

/* ==========================================================================
   Celebrity Search V1 UI
   ========================================================================== */
.celebrity-search-container {
  padding: 2px 0 14px 0;
  position: relative;
}

.celebrity-search-field-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.celebrity-search-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.celebrity-search-input-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.celebrity-search-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.celebrity-search-input {
  width: 100%;
  padding-left: 40px !important;
  padding-right: 36px !important;
  height: 44px;
  font-size: 0.95rem;
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.celebrity-search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.celebrity-search-clear {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  z-index: 2;
  transition: background 0.15s ease, color 0.15s ease;
}

.celebrity-search-clear:hover {
  color: var(--text-primary);
  background: #f1f5f9;
}

/* Suggestion Dropdown (Max ~8 items, Name only) */
.celebrity-suggestions-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  z-index: 50;
  overflow: hidden;
}

.celebrity-suggestions-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 360px;
  overflow-y: auto;
}

.celebrity-suggestion-item {
  padding: 12px 16px;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
  user-select: none;
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.celebrity-suggestion-item:last-child {
  border-bottom: none;
}

.celebrity-suggestion-item:hover {
  background: #f8fafc;
  color: var(--text-primary);
}

.celebrity-suggestion-item.active,
.celebrity-suggestion-item[aria-selected="true"] {
  background: #eff6ff;
  color: var(--color-primary);
  font-weight: 600;
}

.celebrity-no-results,
.celebrity-load-error {
  padding: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  background: #ffffff;
}

.celebrity-load-error {
  color: #b45309;
  background: #fffbeb;
}

.person-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Desktop layout: multi-column row for inputs */
@media (min-width: 769px) {
  .person-form-grid {
    display: grid;
    grid-template-columns: 1.3fr 1.6fr 1.1fr 1.3fr;
    gap: 14px;
    align-items: end;
  }

  .person-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
  }
}

@media (max-width: 768px) {
  .person-form-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .person-form-footer {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
  }
}

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

.form-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input,
.form-select {
  font-family: inherit;
  font-size: 0.875rem;
  padding: 8px 12px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  min-height: 40px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.height-dual-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.color-picker-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
}

.form-color-picker {
  -webkit-appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  width: 38px;
  height: 36px;
  padding: 2px;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.form-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-picker-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-primary {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: 7px;
  background: var(--color-primary);
  color: #ffffff;
  border: 1px solid var(--color-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-secondary {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 7px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
}

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

/* Person Item Row in Manager */
.person-item-row {
  cursor: pointer;
  transition: all 0.15s ease;
}

.person-item-row.selected {
  border-color: var(--color-primary);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.person-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-item-action {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-item-edit {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.btn-item-edit:hover {
  background: #f1f5f9;
}

.btn-item-remove {
  background: transparent;
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: var(--color-danger);
}

.btn-item-remove:hover {
  background: #fee2e2;
  border-color: var(--color-danger);
}

/* --------------------------------------------------------------------------
   Production Footer
   -------------------------------------------------------------------------- */
.app-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.12s ease;
}

.footer-link:hover {
  color: var(--color-primary);
}

.footer-dot {
  color: var(--border-strong);
}

/* --------------------------------------------------------------------------
   App Toast Notification
   -------------------------------------------------------------------------- */
.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --------------------------------------------------------------------------
   Multilingual & Language Selector Dropdown
   -------------------------------------------------------------------------- */
.lang-selector-dropdown {
  position: relative;
  display: inline-block;
}

.lang-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  letter-spacing: 0.04em;
  user-select: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  min-height: 32px;
}

.lang-pill:hover,
.lang-selector-dropdown.open .lang-pill {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.lang-pill-arrow {
  transition: transform 0.2s ease;
  color: var(--text-secondary);
}

.lang-selector-dropdown.open .lang-pill-arrow {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  min-width: 150px;
  padding: 4px 0;
  z-index: 120;
  display: none;
}

[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}

.lang-selector-dropdown.open .lang-menu,
.lang-menu.open {
  display: block;
}

.lang-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

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

.lang-menu-item.active {
  background-color: #eff6ff;
  color: var(--color-primary);
  font-weight: 700;
}

.lang-menu-item-code {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 5px;
  background: var(--bg-subtle);
  border-radius: 3px;
  color: var(--text-secondary);
}

.lang-menu-item.active .lang-menu-item-code {
  background: #dbeafe;
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Arabic RTL Chroming & Safe Isolation
   Chart stage is always LTR to maintain exact Cartesian coordinate math.
   -------------------------------------------------------------------------- */
[dir="rtl"] .chart-viewport-card,
[dir="rtl"] .chart-stage,
[dir="rtl"] .chart-canvas-scroll-container,
[dir="rtl"] .chart-track,
[dir="rtl"] .people-container {
  direction: ltr !important;
  text-align: left !important;
}

[dir="rtl"] .chart-ruler {
  left: 0 !important;
  right: auto !important;
}

[dir="rtl"] .menu-drawer {
  right: auto;
  left: 0;
  transform: translateX(-100%);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

[dir="rtl"] .menu-drawer.open {
  transform: translateX(0);
}

[dir="rtl"] .card-title-indicator {
  margin-right: 0;
  margin-left: 8px;
}

[dir="rtl"] .celebrity-search-icon {
  left: auto;
  right: 12px;
}

[dir="rtl"] .celebrity-search-input {
  padding-left: 36px;
  padding-right: 38px;
}

[dir="rtl"] .celebrity-search-clear {
  right: auto;
  left: 8px;
}

/* --------------------------------------------------------------------------
   Editorial & SEO Explanatory Section
   -------------------------------------------------------------------------- */
.editorial-section {
  margin-top: 24px;
  margin-bottom: 24px;
}

.editorial-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.editorial-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.editorial-subheading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 20px;
  margin-bottom: 10px;
}

.editorial-body {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.editorial-body p {
  margin-bottom: 12px;
}

.editorial-body ol,
.editorial-body ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

[dir="rtl"] .editorial-body ol,
[dir="rtl"] .editorial-body ul {
  padding-left: 0;
  padding-right: 20px;
}

.editorial-body li {
  margin-bottom: 8px;
}

.editorial-section-group {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.editorial-faq-group {
  margin-top: 16px;
}

.editorial-faq-item {
  margin-bottom: 18px;
}

.editorial-faq-item:last-child {
  margin-bottom: 0;
}

.editorial-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.editorial-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

[dir="rtl"] .editorial-table {
  text-align: right;
}

.editorial-table th {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.editorial-table td {
  padding: 10px 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

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

.editorial-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 640px) {
  .editorial-card {
    padding: 16px;
    border-radius: 10px;
  }
  .editorial-heading {
    font-size: 1.05rem;
  }
  .editorial-subheading {
    font-size: 0.95rem;
  }
  .editorial-body {
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   Informational & Legal Pages (About, Privacy, Terms)
   ========================================================================== */
.info-breadcrumb {
  margin-bottom: 16px;
}

.info-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--brand-primary, #2563EB);
  text-decoration: none;
  padding: 6px 12px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.info-back-link:hover {
  background: var(--bg-surface-hover, #f8fafc);
  border-color: var(--border-strong, #cbd5e1);
}

.info-back-icon {
  flex-shrink: 0;
}

.info-page-card {
  max-width: 860px;
  margin: 0 auto 32px auto;
  padding: 32px 36px;
}

.info-page-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
}

.info-page-h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  margin-bottom: 12px;
  line-height: 1.3;
}

.info-page-lead {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary, #475569);
  margin: 0;
}

.info-page-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.info-page-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-section-h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  margin-top: 8px;
  margin-bottom: 4px;
}

.info-page-section p {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-secondary, #334155);
  margin: 0;
}

.info-bullet-point {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary, #334155);
  padding-left: 12px;
}

[dir="rtl"] .info-bullet-point {
  padding-left: 0;
  padding-right: 12px;
}

.info-page-cta-box {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle, #e2e8f0);
  display: flex;
  justify-content: flex-start;
}

[dir="rtl"] .info-page-cta-box {
  justify-content: flex-start;
}

.info-page-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 8px;
  text-decoration: none;
}

@media (max-width: 640px) {
  .info-page-card {
    padding: 20px 16px;
  }
  .info-page-h1 {
    font-size: 1.35rem;
  }
  .info-page-lead {
    font-size: 0.95rem;
  }
  .info-section-h2 {
    font-size: 1.05rem;
  }
  .info-page-section p,
  .info-bullet-point {
    font-size: 0.875rem;
  }
  .info-page-cta-btn {
    width: 100%;
  }
}



