/* Baratelli Institute Simulators — Shared Design System */
:root {
  --navy:#0d2747;
  --gold:#c89000;
  --orange:#c87214;
  --cream:#fff8e7;
  --paper:#fafaf7;
  --ink:#1a1a1a;
  --muted:#5a5a5a;
  --rule:#d8d6cf;
  --green:#2e7d32;
  --red:#c62828;
  --blue:#0d2747;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: var(--ink); background: var(--paper); line-height: 1.5; }

.banner { background: var(--navy); color: white; padding: 14px 0; border-bottom: 4px solid var(--gold); }
.banner-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.brand { display: flex; flex-direction: column; }
.brand-name { font-size: 14px; letter-spacing: 2.5px; font-weight: 600; }
.brand-tag { font-size: 11px; letter-spacing: 1px; opacity: 0.8; margin-top: 2px; }
.banner-cta { font-size: 13px; opacity: 0.9; }
.banner-cta a { color: var(--gold); text-decoration: none; font-weight: 600; }

.hero { background: linear-gradient(180deg, white 0%, var(--paper) 100%); padding: 60px 24px 40px; text-align: center; border-bottom: 1px solid var(--rule); }
.hero-inner { max-width: 900px; margin: 0 auto; }
.hero-eyebrow { font-size: 12px; letter-spacing: 3px; color: var(--gold); font-weight: 700; margin-bottom: 16px; }
.hero-title { font-family: Georgia, 'Times New Roman', serif; font-size: 44px; line-height: 1.15; color: var(--navy); margin-bottom: 18px; font-weight: 700; }
.hero-subtitle { font-size: 18px; color: var(--muted); max-width: 720px; margin: 0 auto 28px; line-height: 1.55; }
.hero-stat-row { display: flex; justify-content: center; gap: 50px; margin-top: 32px; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat-num { font-family: Georgia, serif; font-size: 32px; color: var(--navy); font-weight: 700; }
.hero-stat-label { font-size: 11px; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; margin-top: 4px; }

.app-container { max-width: 1200px; margin: 0 auto; padding: 40px 24px 80px; display: grid; grid-template-columns: 280px 1fr; gap: 32px; }
@media (max-width: 900px) { .app-container { grid-template-columns: 1fr; } }

.stage-nav { background: white; border: 1px solid var(--rule); border-radius: 6px; padding: 20px 0; position: sticky; top: 20px; height: fit-content; }
.stage-nav-title { font-size: 11px; letter-spacing: 2px; color: var(--muted); font-weight: 700; padding: 0 20px 14px; border-bottom: 1px solid var(--rule); }
.stage-item { padding: 12px 20px; cursor: pointer; border-left: 3px solid transparent; display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink); transition: all 0.2s; }
.stage-item:hover { background: var(--paper); }
.stage-item.active { background: var(--paper); border-left-color: var(--gold); font-weight: 600; color: var(--navy); }
.stage-item.complete .stage-num { background: var(--green); color: white; }
.stage-num { width: 24px; height: 24px; border-radius: 50%; background: var(--paper); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; border: 1px solid var(--rule); flex-shrink: 0; }
.stage-item.active .stage-num { background: var(--navy); color: white; border-color: var(--navy); }

.stage-panel { background: white; border: 1px solid var(--rule); border-radius: 6px; padding: 36px; display: none; }
.stage-panel.active { display: block; }
.stage-eyebrow { font-size: 11px; letter-spacing: 2.5px; color: var(--gold); font-weight: 700; margin-bottom: 8px; }
.stage-title { font-family: Georgia, serif; font-size: 28px; color: var(--navy); margin-bottom: 8px; font-weight: 700; }
.stage-intro { font-size: 15px; color: var(--muted); margin-bottom: 28px; line-height: 1.55; }

.field-group { margin-bottom: 20px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; display: block; }
.field-help { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.field-input, .field-select { width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid var(--rule); border-radius: 4px; background: white; font-family: inherit; color: var(--ink); transition: border-color 0.2s; }
.field-input:focus, .field-select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 144, 0, 0.1); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.input-with-prefix { position: relative; }
.input-prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.input-with-prefix .field-input { padding-left: 28px; }

.toggle-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.toggle-card { border: 1.5px solid var(--rule); border-radius: 6px; padding: 14px; cursor: pointer; background: white; transition: all 0.2s; }
.toggle-card:hover { border-color: var(--gold); }
.toggle-card.selected { background: var(--cream); border-color: var(--gold); }
.toggle-card-title { font-weight: 600; font-size: 14px; color: var(--navy); margin-bottom: 4px; }
.toggle-card-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }

.btn-row { display: flex; justify-content: space-between; margin-top: 32px; gap: 12px; }
.btn { padding: 12px 24px; font-size: 14px; font-weight: 600; border: none; border-radius: 4px; cursor: pointer; font-family: inherit; transition: all 0.2s; }
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--gold); }
.btn-secondary { background: white; color: var(--navy); border: 1px solid var(--rule); }
.btn-secondary:hover { background: var(--paper); border-color: var(--gold); }

.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
@media (max-width: 700px) { .results-grid { grid-template-columns: 1fr; } }
.result-card { border: 1px solid var(--rule); border-radius: 6px; padding: 24px; background: white; }
.result-card.bad { background: linear-gradient(180deg, white 0%, #fff5f5 100%); border-color: #f8d7d7; }
.result-card.good { background: linear-gradient(180deg, white 0%, #f1f8ee 100%); border-color: #d4e6cf; }
.result-eyebrow { font-size: 11px; letter-spacing: 2px; color: var(--muted); font-weight: 700; text-transform: uppercase; margin-bottom: 8px; }
.result-title { font-size: 16px; color: var(--navy); margin-bottom: 14px; font-weight: 600; }
.result-headline { font-family: Georgia, serif; font-size: 36px; color: var(--navy); font-weight: 700; line-height: 1; margin-bottom: 6px; }
.result-card.bad .result-headline { color: var(--red); }
.result-card.good .result-headline { color: var(--green); }
.result-sub { font-size: 13px; color: var(--muted); }

.differential-banner { background: var(--cream); border: 1px solid var(--gold); border-left: 5px solid var(--gold); padding: 20px 24px; border-radius: 6px; margin-top: 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.diff-text { flex: 1; }
.diff-headline { font-family: Georgia, serif; font-size: 22px; color: var(--navy); margin-bottom: 6px; font-weight: 700; }
.diff-detail { font-size: 14px; color: var(--ink); line-height: 1.5; }
.diff-amount { font-family: Georgia, serif; font-size: 42px; color: var(--navy); font-weight: 700; }

.detailed-table { width: 100%; border-collapse: collapse; margin-top: 24px; font-size: 13px; }
.detailed-table th { background: #f4f6fb; text-align: left; padding: 10px 12px; border-bottom: 1.5px solid var(--navy); font-size: 11px; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.detailed-table td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.detailed-table tr.subtotal td { background: #f4f6fb; font-weight: 600; }
.detailed-table tr.total td { background: var(--cream); font-weight: 700; border-top: 1.5px solid var(--gold); }
.detailed-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.detailed-table .pos { color: var(--green); }
.detailed-table .neg { color: var(--red); }

.rec-card { border-left: 4px solid var(--gold); background: white; padding: 18px 22px; margin-bottom: 14px; border-radius: 0 4px 4px 0; border-top: 1px solid var(--rule); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.rec-priority { font-size: 10px; letter-spacing: 1.5px; color: var(--gold); font-weight: 700; text-transform: uppercase; margin-bottom: 4px; }
.rec-title { font-size: 16px; color: var(--navy); font-weight: 700; margin-bottom: 6px; }
.rec-desc { font-size: 13px; color: var(--ink); line-height: 1.55; }
.rec-magnitude { display: inline-block; background: var(--cream); color: var(--navy); padding: 3px 10px; border-radius: 3px; font-size: 12px; font-weight: 600; margin-top: 8px; font-family: Georgia, serif; }

.cta-section { background: var(--navy); color: white; padding: 32px; border-radius: 6px; margin-top: 40px; text-align: center; }
.cta-eyebrow { font-size: 11px; letter-spacing: 2.5px; color: var(--gold); margin-bottom: 8px; font-weight: 700; }
.cta-title { font-family: Georgia, serif; font-size: 24px; margin-bottom: 8px; }
.cta-desc { font-size: 14px; opacity: 0.85; margin-bottom: 22px; max-width: 580px; margin-left: auto; margin-right: auto; line-height: 1.6; }
.cta-form { display: flex; gap: 8px; max-width: 480px; margin: 0 auto; }
.cta-input { flex: 1; padding: 12px 14px; font-size: 14px; border: none; border-radius: 4px; font-family: inherit; }
.cta-btn { background: var(--gold); color: var(--navy); border: none; padding: 12px 20px; font-size: 14px; font-weight: 700; border-radius: 4px; cursor: pointer; }
.cta-btn:hover { background: white; }

footer { background: var(--paper); border-top: 1px solid var(--rule); padding: 32px 24px; text-align: center; font-size: 12px; color: var(--muted); }
footer a { color: var(--navy); text-decoration: none; font-weight: 600; }
footer a:hover { color: var(--gold); }

.disclaimer { font-size: 11px; color: var(--muted); font-style: italic; margin-top: 24px; padding: 14px 16px; background: var(--paper); border-left: 3px solid var(--rule); line-height: 1.5; }

.progress-bar { height: 4px; background: var(--rule); border-radius: 2px; overflow: hidden; margin-bottom: 24px; }
.progress-fill { height: 100%; background: var(--gold); transition: width 0.3s; }

/* Cross-sell card */
.cross-sell { border: 1px solid var(--rule); border-radius: 6px; padding: 18px 20px; background: white; margin-top: 16px; display: flex; align-items: center; gap: 16px; }
.cross-sell-icon { width: 44px; height: 44px; background: var(--navy); color: var(--gold); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-family: Georgia, serif; font-size: 20px; font-weight: 700; flex-shrink: 0; }
.cross-sell-text { flex: 1; }
.cross-sell-title { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 2px; }
.cross-sell-desc { font-size: 12px; color: var(--muted); }
.cross-sell a { color: var(--gold); text-decoration: none; font-weight: 600; font-size: 13px; }

/* ===========================================================
   P0 LAYER (May 2026 committee-review fixes)
   - Mobile touch-target compliance (44px minimum)
   - Print stylesheet
   - Action bar (Share / Print / Email)
   - Show-the-math collapsible panel
   - Toast for "link copied"
   =========================================================== */

/* Mobile / touch targets */
@media (max-width: 700px) {
  .stage-item { padding: 14px 18px; min-height: 48px; }
  .toggle-card { padding: 16px; min-height: 56px; }
  .btn { padding: 14px 22px; min-height: 48px; font-size: 15px; }
  .field-input, .field-select { padding: 14px 14px; font-size: 16px; min-height: 48px; }
  .stage-panel { padding: 24px 20px; }
  .hero-title { font-size: 32px; }
  .hero-subtitle { font-size: 16px; }
  .hero { padding: 40px 18px 28px; }
  .stage-nav { position: relative; top: auto; padding: 14px 0; margin-bottom: 16px; }
  .stage-nav-title { padding: 0 18px 10px; }
  .detailed-table { font-size: 12px; }
  .detailed-table th, .detailed-table td { padding: 8px 8px; }
  .diff-amount { font-size: 32px; }
  .diff-headline { font-size: 18px; }
  .result-headline { font-size: 28px; }
  .app-container { padding: 24px 16px 60px; gap: 20px; }
  .action-bar { flex-direction: column; align-items: stretch; }
  .action-btn { justify-content: center; }
}

/* Action bar — Share / Print / Reset */
.action-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-top: 18px; padding: 14px 16px;
  background: white; border: 1px solid var(--rule);
  border-radius: 6px;
}
.action-bar-label {
  font-size: 11px; letter-spacing: 1.5px; color: var(--muted);
  text-transform: uppercase; font-weight: 700; margin-right: 4px;
}
.action-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; font-size: 13px; font-weight: 600;
  background: white; color: var(--navy);
  border: 1px solid var(--rule); border-radius: 4px;
  cursor: pointer; font-family: inherit;
  transition: all 0.18s; min-height: 40px;
}
.action-btn:hover { border-color: var(--gold); background: var(--paper); color: var(--navy); }
.action-btn svg { width: 16px; height: 16px; }
.action-btn.primary { background: var(--navy); color: white; border-color: var(--navy); }
.action-btn.primary:hover { background: var(--gold); border-color: var(--gold); color: white; }

/* Share-link toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: white;
  padding: 12px 22px; border-radius: 6px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(13, 39, 71, 0.25);
  opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 1000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .check { color: var(--gold); margin-right: 8px; }

/* Show-the-math collapsible panel */
.math-panel {
  margin-top: 20px; border: 1px solid var(--rule);
  border-radius: 6px; background: white; overflow: hidden;
}
.math-panel-header {
  padding: 14px 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--paper); border-bottom: 1px solid var(--rule);
  user-select: none;
}
.math-panel-header:hover { background: #f0eee5; }
.math-panel-title {
  font-size: 13px; font-weight: 700; color: var(--navy);
  display: flex; align-items: center; gap: 8px;
}
.math-panel-title-eyebrow {
  font-size: 10px; letter-spacing: 1.5px; color: var(--gold);
  font-weight: 700; text-transform: uppercase;
}
.math-panel-toggle {
  font-size: 12px; color: var(--muted); font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.math-panel-arrow { transition: transform 0.2s; }
.math-panel.open .math-panel-arrow { transform: rotate(180deg); }
.math-panel-body { display: none; padding: 18px 22px; }
.math-panel.open .math-panel-body { display: block; }
.math-step {
  display: grid; grid-template-columns: 1fr auto;
  gap: 12px; padding: 8px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 13px;
}
.math-step:last-child { border-bottom: none; }
.math-step-label { color: var(--ink); }
.math-step-value {
  font-variant-numeric: tabular-nums; font-weight: 600;
  color: var(--navy); text-align: right; white-space: nowrap;
}
.math-step.subtotal {
  background: var(--paper); margin: 6px -22px; padding: 10px 22px;
  border-bottom: 1px solid var(--rule);
}
.math-step.total {
  background: var(--cream); margin: 8px -22px 0; padding: 14px 22px;
  border-top: 2px solid var(--gold); border-bottom: none;
  font-size: 14px; font-weight: 700;
}
.math-step.total .math-step-value { font-family: Georgia, serif; font-size: 16px; }
.math-step-note {
  grid-column: 1 / -1; font-size: 11px; color: var(--muted);
  font-style: italic; padding: 2px 0 4px 14px; line-height: 1.4;
}
.math-section-header {
  font-size: 11px; letter-spacing: 1.5px; color: var(--gold);
  font-weight: 700; text-transform: uppercase;
  margin: 14px 0 4px; padding-top: 6px;
  border-top: 1px solid var(--rule);
}
.math-section-header:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* Print stylesheet */
@media print {
  @page { size: letter; margin: 0.6in 0.5in; }
  body { background: white; color: black; font-size: 10.5pt; line-height: 1.4; }
  .banner { background: white !important; color: var(--navy); border-bottom: 2px solid var(--navy); padding: 8px 0; }
  .banner-inner { padding: 0; }
  .brand-name, .brand-tag { color: var(--navy) !important; }
  .banner-cta { display: none; }
  .hero { padding: 16px 0 12px; border-bottom: 1px solid var(--navy); }
  .hero-title { font-size: 22pt; margin-bottom: 6px; }
  .hero-subtitle { font-size: 11pt; max-width: none; }
  .hero-stat-row { gap: 32px; margin-top: 14px; }
  .hero-stat-num { font-size: 18pt; }
  .stage-nav, .btn-row, .action-bar, .cta-section, footer, .banner-cta { display: none !important; }
  .app-container { display: block; padding: 12px 0 0; max-width: none; }
  .stage-panel { display: block !important; page-break-inside: avoid;
    border: none; padding: 12px 0; box-shadow: none; }
  .stage-panel + .stage-panel { border-top: 1px solid var(--rule); margin-top: 12px; }
  .stage-title { font-size: 16pt; }
  .stage-eyebrow { color: var(--navy); }
  .math-panel { break-inside: avoid; }
  .math-panel-body { display: block !important; }
  .math-panel-toggle, .math-panel-arrow { display: none; }
  .differential-banner { break-inside: avoid; }
  .result-card { break-inside: avoid; box-shadow: none; }
  .results-grid { display: block; }
  .results-grid > * { margin-bottom: 12px; }
  .toggle-card { break-inside: avoid; }
  .rec-card { break-inside: avoid; box-shadow: none; }
  .toast, .print-only { display: none !important; }
  a { color: var(--navy); text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: var(--muted); }
  .print-footer {
    display: block !important;
    margin-top: 24px; padding-top: 10px;
    border-top: 1px solid var(--rule);
    font-size: 9pt; color: var(--muted); text-align: center;
  }
}
.print-footer { display: none; }
.print-only { display: none; }
