/* ==========================================================================
   Design system
   - Brutalist/monochrome: near-black background, sharp corners, one accent.
   - Strict 3-size type scale. Hierarchy comes from weight/case/color, not
     from adding more sizes.
   - No gradients, no blur, no shadows, no floaty transitions. Interactions
     are instant color/border shifts.
   ========================================================================== */

:root {
  /* ---- surfaces ---- */
  --bg-0: #0B0B0C;        /* page background */
  --bg-1: #141416;        /* panel background */
  --bg-2: #1C1C1F;        /* recessed elements: tracks, inputs */
  --border: #2A2A2E;
  --border-strong: #3D3D42;

  /* ---- text ---- */
  --ink-0: #F2F1ED;       /* primary text - warm off-white, not pure white */
  --ink-1: #8B8B90;       /* muted/secondary text */
  --ink-2: #59595E;       /* lowest-contrast text: fine print */

  /* ---- single restrained accent, used ONLY for primary actions and
     interactive emphasis - not decoration ---- */
  --accent: #D97A3F;
  --accent-strong: #B8632E;
  --on-accent: #14100C;

  /* ---- status colors for risk tiers - intentionally distinct from the
     accent so a tier badge is never mistaken for an interactive element ---- */
  --tier-severe: #A6433A;
  --tier-high: #A67C3D;
  --tier-moderate: #6E7A4E;
  --tier-low: #565F66;

  /* ---- strict 3-size type scale ---- */
  --fs-lg: 2.5rem;      /* hero figures only */
  --fs-md: 0.9375rem;   /* default body/label/button size */
  --fs-sm: 0.75rem;     /* eyebrows, captions, fine print */

  --space-unit: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---- top bar ---- */
.topbar {
  border-bottom: 1px solid var(--border);
  padding: 32px 40px;
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-mark {
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: var(--fs-sm);
  color: var(--ink-1);
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.02em;
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 40px 100px;
}

/* ---- layout ---- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  main { padding: 32px 20px 80px; }
  .topbar { padding: 24px 20px; }
}

/* ---- panels: flat, sharp-cornered, bordered. Panels vary in width and
   content shape rather than repeating an identical card pattern. ---- */
.panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 36px;
  margin-bottom: 0;
}

.panel-wide {
  margin-bottom: 24px;
}

/* ---- typography hierarchy: 3 sizes total, weight/case/color do the rest ---- */
.eyebrow {
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-0);
  margin: 0 0 6px;
}

.eyebrow-sm {
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-1);
  margin: 28px 0 14px;
}

.lede {
  font-size: var(--fs-sm);
  color: var(--ink-1);
  margin: 0 0 28px;
}

/* ---- form controls ---- */
label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-1);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

select {
  width: 100%;
  padding: 13px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 0;
  color: var(--ink-0);
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-md);
  margin-bottom: 24px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-1) 50%), linear-gradient(135deg, var(--ink-1) 50%, transparent 50%);
  background-position: calc(100% - 20px) center, calc(100% - 15px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: border-color 80ms linear;
}

select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---- checkbox lists: a divided list, not a repeated card grid ---- */
.check-list {
  border-top: 1px solid var(--border);
}

.check-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.check-item label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-md);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-0);
  margin-bottom: 0;
  cursor: pointer;
}

.check-item .explain {
  font-size: var(--fs-sm);
  color: var(--ink-1);
  margin: 6px 0 0 28px;
  line-height: 1.5;
}

input[type=checkbox] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background-color 80ms linear, border-color 80ms linear;
}

input[type=checkbox]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type=checkbox]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type=checkbox]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- buttons: sharp, instant feedback, no floaty transitions ---- */
button {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 0;
  cursor: pointer;
  transition: background-color 80ms linear, color 80ms linear, border-color 80ms linear;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  padding: 14px 22px;
  width: 100%;
}

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

.btn-primary:active {
  background: var(--on-accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-0);
  border: 1px solid var(--border-strong);
  padding: 13px 20px;
  width: 100%;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- results headline ---- */
.result-block {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tier-badge {
  display: inline-block;
  padding: 5px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-0);
  background: var(--tier-low);
  margin-bottom: 16px;
}

.tier-badge[data-tier="Severe"] { background: var(--tier-severe); }
.tier-badge[data-tier="High"] { background: var(--tier-high); color: var(--on-accent); }
.tier-badge[data-tier="Moderate"] { background: var(--tier-moderate); }
.tier-badge[data-tier="Low"] { background: var(--tier-low); }

.range-line {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-0);
}

.range-sep {
  color: var(--ink-2);
  margin: 0 10px;
  font-weight: 400;
}

.midpoint-line {
  font-size: var(--fs-sm);
  color: var(--ink-1);
  margin-top: 10px;
  font-family: 'IBM Plex Mono', monospace;
}

.midpoint-line span {
  color: var(--ink-0);
  font-weight: 600;
}

/* ---- control impact callout ---- */
.control-impact {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.impact-figure {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 70px;
}

.impact-figure-neutral {
  color: var(--ink-1);
}

.impact-copy {
  font-size: var(--fs-sm);
  color: var(--ink-1);
  line-height: 1.6;
  padding-top: 4px;
}

/* ---- multiplier detail table ---- */
.multiplier-detail {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--fs-sm);
  color: var(--ink-1);
  margin-bottom: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row span:last-child {
  color: var(--ink-0);
}

.detail-total {
  border-bottom: none;
  padding-top: 10px;
  font-weight: 700;
}

.detail-total span {
  color: var(--ink-0) !important;
}

/* ---- breakdown bars ---- */
.bar-row {
  margin-bottom: 14px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm);
  color: var(--ink-1);
  margin-bottom: 6px;
}

.bar-label span:last-child {
  color: var(--ink-0);
  font-family: 'IBM Plex Mono', monospace;
}

.bar-track {
  height: 6px;
  background: var(--bg-2);
}

.bar-fill {
  height: 100%;
  background: var(--accent);
}

/* ---- executive summary ---- */
.exec-summary-text {
  font-size: var(--fs-md);
  color: var(--ink-0);
  line-height: 1.7;
  max-width: 74ch;
  margin: 0;
}

/* ---- ranked opportunities: a list with a highlighted first row, not a
   grid of identical cards ---- */
#opportunitiesList {
  border-top: 1px solid var(--border);
}

.opportunity-row {
  display: flex;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}

.opportunity-rank {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink-2);
  flex-shrink: 0;
  width: 56px;
  line-height: 1;
}

.opportunity-row:first-child .opportunity-rank {
  color: var(--accent);
}

.opportunity-body {
  flex: 1;
  min-width: 0;
}

.opportunity-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.opportunity-label {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink-0);
}

.opportunity-reduction {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--accent);
}

.opportunity-impact {
  font-size: var(--fs-sm);
  color: var(--ink-1);
  line-height: 1.6;
  margin: 0 0 8px;
}

.opportunity-stat {
  font-size: var(--fs-sm);
  color: var(--ink-0);
  font-style: italic;
  margin: 0 0 10px;
}

.opportunity-meta {
  display: flex;
  gap: 24px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--fs-sm);
  color: var(--ink-1);
}

.opportunity-note {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  font-style: italic;
  margin: 8px 0 0;
}

.confidence-flag {
  color: var(--ink-2);
}

.empty-note {
  font-size: var(--fs-sm);
  color: var(--ink-1);
  padding: 24px 0;
}

/* ---- sources ---- */
.sources-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  border-top: 1px solid var(--border);
}

.sources-list li {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}

.source-stat {
  color: var(--ink-0);
  flex: 1;
}

.source-name {
  color: var(--ink-1);
  font-family: 'IBM Plex Mono', monospace;
  text-align: right;
  flex-shrink: 0;
}

.methodology-note {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  line-height: 1.6;
  margin: 0;
}
