/* ==========================================================================
   הערכת מצב אישית — UI shell styles
   Dark navy canvas, VIOLET accent (#8b7bf0) — LifeOS growth-domain variant.
   RTL Hebrew. Guided funnel wizard + decision journal + calibration loop.
   ========================================================================== */

:root {
  /* Canvas / surfaces */
  --bg-canvas: #05060d;
  --bg-secondary: #090b16;
  --glass-035: rgba(255, 255, 255, .035);
  --glass-06: rgba(255, 255, 255, .06);
  --glass-09: rgba(255, 255, 255, .09);
  --glass-12: rgba(255, 255, 255, .12);
  --border-default: rgba(255, 255, 255, .08);
  --border-soft: rgba(255, 255, 255, .05);

  /* Text */
  --text-primary: #f2f4fb;
  --text-muted: #9aa3bd;
  --text-faint: #5c6484;

  /* Accent — violet (growth domain) */
  --accent: #8b7bf0;
  --accent-glow: rgba(139, 123, 240, .3);
  --accent-gradient: linear-gradient(135deg, #8b7bf0, #b06de0);
  --danger: #e8608f;
  --success: #3fd0b0;
  --info: #4c86e8;
  --warn: #e0a23c;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radius */
  --radius-control: 12px;
  --radius-card: 20px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .4);
  --glow-accent: 0 0 28px rgba(139, 123, 240, .25);
  --focus-ring: 0 0 0 3px rgba(139, 123, 240, .35);

  /* Type */
  --font-stack: "Inter", "Segoe UI", system-ui, sans-serif;

  /* Motion */
  --ease-standard: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 0.18s;
  --dur-slow: 0.32s;
}

/* ==========================================================================
   Reset / base
   ========================================================================== */

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

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 1200px 600px at 15% -10%, rgba(139, 123, 240, .08), transparent 60%),
    radial-gradient(ellipse 900px 500px at 100% 0%, rgba(76, 134, 232, .05), transparent 55%),
    var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-stack);
  font-size: 15px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, fieldset, legend, ol, ul { margin: 0; padding: 0; border: 0; list-style: none; }

h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); }

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

* { scrollbar-width: thin; scrollbar-color: var(--glass-12) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--glass-12); border-radius: var(--radius-pill); }

[dir="ltr"] { text-align: left; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.decision-card, .step-panel, .card {
  animation: fade-up var(--dur-slow) var(--ease-standard) both;
}

/* ==========================================================================
   Header
   ========================================================================== */

#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  background: var(--glass-035);
  border-bottom: 1px solid var(--border-default);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-title-block h1 { color: var(--text-primary); }

.subtitle {
  margin-top: var(--sp-1);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  appearance: none;
  cursor: pointer;
  touch-action: manipulation;
  border-radius: var(--radius-control);
  padding: var(--sp-2) var(--sp-4);
  min-height: 44px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-default);
  background: var(--glass-06);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  transition: transform var(--dur-fast) var(--ease-standard),
              background var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}

.btn:hover { background: var(--glass-09); border-color: var(--glass-12); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #0c0a1a;
  box-shadow: var(--glow-accent);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 0 34px rgba(139, 123, 240, .35); }

.btn-secondary { background: var(--glass-035); }

.btn-danger { color: var(--danger); border-color: rgba(232, 96, 143, .3); }
.btn-danger:hover { background: rgba(232, 96, 143, .1); }

.btn-icon { padding: var(--sp-2) var(--sp-3); line-height: 1; min-width: 44px; justify-content: center; }

.btn:disabled { cursor: not-allowed; opacity: 0.4; filter: none; box-shadow: none; transform: none; }

.btn-link {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  padding: var(--sp-1);
  min-height: 44px;
}

/* ==========================================================================
   Cards (shared)
   ========================================================================== */

.card {
  background: var(--glass-035);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}

.card-caption {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: var(--sp-1);
}

/* ==========================================================================
   Main layout
   ========================================================================== */

#app-main {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-6) var(--sp-12);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.view { display: none; }
.view.active { display: flex; flex-direction: column; gap: var(--sp-5); }

/* ==========================================================================
   Journal (home)
   ========================================================================== */

.due-banner {
  border: 1px solid rgba(139, 123, 240, .35);
  border-radius: var(--radius-card);
  background:
    radial-gradient(ellipse 500px 160px at 50% -20%, rgba(139, 123, 240, .14), transparent 60%),
    var(--glass-035);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  position: relative;
  overflow: hidden;
}

.due-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(139, 123, 240, .45);
  animation: pulse-ring 2.4s var(--ease-standard) infinite;
  pointer-events: none;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(139, 123, 240, .35); }
  70% { box-shadow: 0 0 0 14px rgba(139, 123, 240, 0); }
  100% { box-shadow: 0 0 0 0 rgba(139, 123, 240, 0); }
}

.due-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.due-list { display: flex; flex-direction: column; gap: var(--sp-2); }

.due-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-control);
  background: var(--bg-secondary);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  min-height: 44px;
  transition: border-color var(--dur-fast) var(--ease-standard);
}
.due-item:hover { border-color: var(--accent-glow); }

.due-item-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.due-item-date { font-size: 11px; color: var(--text-muted); }

.calibration-summary {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex-wrap: wrap;
}

.calibration-stat { display: flex; flex-direction: column; gap: 2px; }
.calibration-stat-label { font-size: 11px; color: var(--text-muted); }
.calibration-stat-value { font-size: 22px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

.calibration-line {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1 1 220px;
}

.trend-arrow { font-size: 18px; }
.trend-arrow.up { color: var(--success); }
.trend-arrow.down { color: var(--danger); }
.trend-arrow.flat { color: var(--text-muted); }

.filter-chips {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.chip {
  appearance: none;
  cursor: pointer;
  touch-action: manipulation;
  padding: var(--sp-2) var(--sp-4);
  min-height: 44px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--glass-06);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}
.chip:hover { background: var(--glass-09); color: var(--text-primary); }
.chip.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #0c0a1a;
  box-shadow: var(--glow-accent);
}

.decision-list { display: flex; flex-direction: column; gap: var(--sp-3); }

.decision-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-card);
  background: var(--glass-035);
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}
.decision-card:hover { border-color: var(--glass-12); transform: translateY(-1px); }

.decision-card-main { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.decision-card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.decision-card-meta { display: flex; gap: var(--sp-3); font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.decision-card-side { display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; }

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--sp-3);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.status-chip.draft { background: var(--glass-09); color: var(--text-muted); }
.status-chip.committed { background: rgba(76, 134, 232, .14); color: var(--info); }
.status-chip.due { background: rgba(139, 123, 240, .16); color: var(--accent); }
.status-chip.closed { background: rgba(63, 208, 176, .12); color: var(--success); }

.reversibility-icon { flex-shrink: 0; color: var(--text-muted); }
.reversibility-icon.irreversible { color: var(--danger); }
.reversibility-icon.hard { color: var(--warn); }

.empty-state {
  padding: var(--sp-10) var(--sp-5);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
}

.fab {
  position: fixed;
  bottom: var(--sp-6);
  left: var(--sp-6);
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  min-height: 52px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent-gradient);
  color: #0c0a1a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--glow-accent), var(--shadow-lg);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--dur-fast) var(--ease-standard);
}
.fab:active { transform: scale(0.96); }

/* ==========================================================================
   Modal (template picker)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 4, 10, .7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  padding: var(--sp-6);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.modal-title { font-size: 17px; font-weight: 700; }
.modal-caption { font-size: 12px; color: var(--text-muted); }

.template-list { display: flex; flex-direction: column; gap: var(--sp-2); }

.template-option {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  align-items: flex-start;
  padding: var(--sp-4);
  min-height: 44px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-default);
  background: var(--glass-035);
  color: var(--text-primary);
  cursor: pointer;
  text-align: right;
  width: 100%;
  font-family: inherit;
  transition: border-color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard);
}
.template-option:hover { border-color: var(--accent-glow); background: var(--glass-06); }
.template-option-name { font-size: 14px; font-weight: 700; }
.template-option-desc { font-size: 12px; color: var(--text-muted); }

.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }

/* ==========================================================================
   Wizard
   ========================================================================== */

.wizard-header { display: flex; flex-direction: column; gap: var(--sp-3); }

.wizard-progress-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--glass-09);
  overflow: hidden;
}
.wizard-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-pill);
  transition: width var(--dur-slow) var(--ease-standard);
}

.wizard-step-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.wizard-step-label strong { color: var(--accent); }

.step-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.step-title { font-size: 19px; font-weight: 700; }
.step-caption {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  padding-bottom: var(--sp-1);
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: var(--sp-3);
}

.explainer-box {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-control);
  background: rgba(139, 123, 240, .08);
  border: 1px solid rgba(139, 123, 240, .25);
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
}

.field { display: flex; flex-direction: column; gap: var(--sp-1); }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.field-hint { font-size: 11px; color: var(--text-faint); }

input[type="text"], input[type="date"], input[type="number"], textarea, select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-control);
  color: var(--text-primary);
  padding: var(--sp-3);
  font-size: 16px;
  font-family: inherit;
  min-height: 44px;
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

input:hover, textarea:hover, select:hover { border-color: var(--glass-12); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.quick-picks { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.radio-cards { display: flex; flex-direction: column; gap: var(--sp-2); }

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  min-height: 44px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-default);
  background: var(--glass-035);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard);
}
.radio-card:hover { border-color: var(--accent-glow); }
.radio-card.selected { border-color: var(--accent); background: rgba(139, 123, 240, .08); }
.radio-card input[type="radio"] { accent-color: var(--accent); width: 22px; height: 22px; margin-top: 2px; flex-shrink: 0; }
.radio-card-body { display: flex; flex-direction: column; gap: 2px; }
.radio-card-title { font-size: 14px; font-weight: 700; }
.radio-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.consequence-note {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-control);
  background: rgba(224, 162, 60, .08);
  border: 1px solid rgba(224, 162, 60, .3);
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.6;
}
.consequence-note.danger { background: rgba(232, 96, 143, .08); border-color: rgba(232, 96, 143, .3); }

/* Criteria rows */
.dynamic-list { display: flex; flex-direction: column; gap: var(--sp-2); }

.criterion-row, .alt-row, .prediction-row, .premortem-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-control);
  background: var(--bg-secondary);
  border: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.criterion-row input[type="text"], .alt-row input[type="text"] { flex: 1 1 140px; min-width: 0; }

.stepper {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  background: var(--glass-06);
  border-radius: var(--radius-pill);
  padding: 2px;
}
.stepper-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease-standard);
}
.stepper-btn:hover { background: var(--glass-12); }
.stepper-btn:disabled { opacity: .3; cursor: not-allowed; }
.stepper-value {
  min-width: 28px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.remove-row-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}
.remove-row-btn:hover { color: var(--danger); border-color: rgba(232, 96, 143, .3); }

.warning-note {
  font-size: 12px;
  color: var(--warn);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-control);
  background: rgba(224, 162, 60, .08);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  min-height: 44px;
  cursor: pointer;
  border-radius: var(--radius-control);
  background: var(--glass-035);
  border: 1px solid var(--border-default);
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--glass-12);
  border-radius: var(--radius-pill);
  transition: background var(--dur-fast) var(--ease-standard);
  pointer-events: none;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--dur-fast) var(--ease-standard);
}
.switch input:checked + .switch-track { background: var(--accent-gradient); }
.switch input:checked + .switch-track::after { transform: translateX(-20px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus-ring); }

.pairwise-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.pairwise-item { display: flex; flex-direction: column; gap: var(--sp-2); }
.pairwise-prompt { font-size: 12px; color: var(--text-muted); }
.pairwise-buttons { display: flex; gap: var(--sp-2); }
.pairwise-btn {
  flex: 1;
  padding: var(--sp-3);
  min-height: 44px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-default);
  background: var(--glass-035);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard);
}
.pairwise-btn:hover { border-color: var(--accent-glow); }
.pairwise-btn.picked { border-color: var(--accent); background: rgba(139, 123, 240, .12); }

/* Matrix (scoring) */
.matrix-scroll { overflow-x: auto; border-radius: var(--radius-control); border: 1px solid var(--border-soft); }
.matrix-table { border-collapse: collapse; width: 100%; min-width: 480px; }
.matrix-table th, .matrix-table td {
  padding: var(--sp-2) var(--sp-3);
  text-align: center;
  font-size: 12px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.matrix-table th { color: var(--text-muted); font-weight: 600; background: var(--bg-secondary); }
.matrix-table td:first-child, .matrix-table th:first-child { text-align: right; font-weight: 600; color: var(--text-primary); position: sticky; right: 0; background: var(--bg-secondary); }
.matrix-weight-badge {
  display: inline-block;
  font-size: 10px;
  color: var(--accent);
  font-weight: 700;
  margin-top: 2px;
}
.matrix-lock-note {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--text-muted);
}

/* Results (Step 6) */
.result-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.result-card {
  padding: var(--sp-4);
  border-radius: var(--radius-card);
  background: var(--glass-035);
  border: 1px solid var(--border-default);
}
.result-card.winner {
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
  background: radial-gradient(ellipse 400px 140px at 50% -30%, rgba(139, 123, 240, .12), transparent 60%), var(--glass-035);
}
.result-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.result-rank { font-size: 12px; font-weight: 700; color: var(--accent); }
.result-name { font-size: 15px; font-weight: 700; }
.result-score { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.result-bar-track { height: 8px; border-radius: var(--radius-pill); background: var(--glass-09); overflow: hidden; }
.result-bar-fill { height: 100%; border-radius: var(--radius-pill); background: var(--accent-gradient); transition: width var(--dur-slow) var(--ease-standard); }
.result-ev { margin-top: var(--sp-2); font-size: 12px; color: var(--text-muted); }

.tipping-card { display: flex; flex-direction: column; gap: var(--sp-3); }
.tipping-verdict {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-control);
  font-size: 13px;
  font-weight: 700;
}
.tipping-verdict.robust { background: rgba(63, 208, 176, .1); color: var(--success); }
.tipping-verdict.fragile { background: rgba(232, 96, 143, .1); color: var(--danger); }
.tipping-item { font-size: 13px; color: var(--text-primary); padding: var(--sp-2) 0; border-top: 1px solid var(--border-soft); }
.tipping-item:first-of-type { border-top: none; }

.ev-branch-row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.ev-branch-row input[type="text"] { flex: 1 1 100px; }
.ev-branch-row input[type="number"] { width: 76px; flex: 0 0 auto; }

/* Pre-mortem */
.premortem-row { flex-direction: column; align-items: stretch; gap: var(--sp-3); }
.premortem-row-top { display: flex; gap: var(--sp-3); align-items: center; }
.premortem-row-top input[type="text"] { flex: 1; }
.likelihood-alert {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--radius-control);
  background: rgba(232, 96, 143, .08);
  border: 1px solid rgba(232, 96, 143, .3);
}
.likelihood-alert-actions { display: flex; gap: var(--sp-2); }

/* Predictions */
.prediction-row { align-items: stretch; flex-direction: column; gap: var(--sp-2); }
.prediction-row-top { display: flex; gap: var(--sp-2); align-items: center; }
.prediction-row-top input[type="text"] { flex: 1; }
.prediction-row-bottom { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.prediction-row-bottom input[type="number"] { width: 90px; }
.prediction-row-bottom input[type="date"] { flex: 1 1 140px; }

/* Confidence slider */
.confidence-block { display: flex; flex-direction: column; gap: var(--sp-2); }
.confidence-value { font-size: 32px; font-weight: 800; color: var(--accent); text-align: center; font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: var(--radius-pill); background: var(--glass-12); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: var(--radius-pill); background: var(--glass-12); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: -9px;
  border-radius: 50%; background: var(--accent-gradient); border: 3px solid #0c0a1a; box-shadow: var(--glow-accent);
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent-gradient); border: 3px solid #0c0a1a; box-shadow: var(--glow-accent);
}
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--focus-ring), var(--glow-accent); }

.commit-block { display: flex; flex-direction: column; gap: var(--sp-2); }

/* ==========================================================================
   Wizard nav
   ========================================================================== */

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding-top: var(--sp-4);
  padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-soft);
  position: sticky;
  bottom: 0;
  z-index: 40;
  background: var(--glass-035);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* keep step content clear of the sticky nav bar */
.step-panel { padding-bottom: var(--sp-2); }

.save-indicator {
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.save-indicator.saved { color: var(--success); }

/* ==========================================================================
   Calibration view
   ========================================================================== */

.calibration-readonly { display: flex; flex-direction: column; gap: var(--sp-3); }
.readonly-row { display: flex; flex-direction: column; gap: 2px; }
.readonly-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.readonly-value { font-size: 14px; color: var(--text-primary); }

.verdict-buttons { display: flex; gap: var(--sp-2); }
.verdict-btn {
  flex: 1;
  padding: var(--sp-3);
  min-height: 44px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-default);
  background: var(--glass-035);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.verdict-btn.picked { border-color: var(--accent); background: rgba(139, 123, 240, .12); color: var(--accent); }

.prediction-resolve-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-control);
  background: var(--bg-secondary);
  border: 1px solid var(--border-soft);
}
.tf-buttons { display: flex; gap: var(--sp-2); }
.tf-btn {
  padding: var(--sp-2) var(--sp-4);
  min-height: 44px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--glass-06);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.tf-btn.picked-true { border-color: var(--success); color: var(--success); background: rgba(63, 208, 176, .1); }
.tf-btn.picked-false { border-color: var(--danger); color: var(--danger); background: rgba(232, 96, 143, .1); }

/* ==========================================================================
   Live region (visually hidden, announces step changes / saves)
   ========================================================================== */

#live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==========================================================================
   Footer
   ========================================================================== */

#app-footer {
  padding: var(--sp-6);
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
}

/* ==========================================================================
   Responsive — ≤430px phone
   ========================================================================== */

@media (max-width: 430px) {
  #app-header { padding: var(--sp-4); flex-direction: column; align-items: stretch; }
  .header-controls { justify-content: flex-start; }
  #app-main { padding: var(--sp-4) var(--sp-4) var(--sp-12); }
  .decision-card { flex-direction: column; align-items: flex-start; }
  .decision-card-side { width: 100%; justify-content: space-between; }
  .fab { left: var(--sp-4); right: var(--sp-4); justify-content: center; bottom: var(--sp-4); }
  .confidence-value { font-size: 28px; }
  .pairwise-buttons { flex-direction: column; }
}
