:root {
  color-scheme: light;
  --accent: #c91623;
  --accent-2: #ef4444;
  --accent-dark: #9d0d18;
  --ink: #151515;
  --muted: #6b6f76;
  --line: #dedede;
  --paper: rgba(255, 255, 255, 0.96);
  --soft: #f5f6f7;
  --field: #ffffff;
  --dark: #151515;
  --success: #207a46;
  --shadow: 0 20px 60px rgba(18, 18, 18, 0.12);
  --shadow-soft: 0 14px 44px rgba(22, 22, 22, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(201, 22, 35, 0.28), rgba(245, 246, 247, 0) 230px),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.74), transparent 520px),
    #eef0f2;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px 18px 28px;
}

.panel,
.metric {
  --card-bg: var(--paper);
  --accent-line: linear-gradient(90deg, var(--accent), rgba(201, 22, 35, 0));
  position: relative;
  overflow: visible;
  background:
    var(--accent-line) top left / 100% 4px no-repeat,
    var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.panel::before,
.metric::before {
  content: none;
}

.intro {
  --card-bg: linear-gradient(120deg, #111 0%, #252525 100%);
  --accent-line: linear-gradient(90deg, var(--accent), var(--accent-2) 72%, transparent 92%);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 440px);
  column-gap: 22px;
  row-gap: 8px;
  align-items: center;
  min-height: 232px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  color: #fff;
}

.intro::before {
  content: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.brand-logo {
  display: block;
  width: 192px;
  height: auto;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro .eyebrow {
  color: #ffb7bd;
}

.brand-sub,
.lede,
.metric small,
.total-card span,
.bars small {
  color: var(--muted);
}

.intro .brand-sub,
.intro .lede {
  color: #e4e4e4;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 0.88rem;
}

.intro-grid {
  display: contents;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: none;
  font-size: clamp(2.05rem, 3.5vw, 3.25rem);
  line-height: 0.96;
}

h2 {
  font-size: 1.32rem;
  line-height: 1.06;
}

.lede {
  max-width: 680px;
  margin: 10px 0 0;
  font-size: 0.94rem;
  line-height: 1.42;
}

.assumption-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(201, 22, 35, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.assumption-card span,
.control span,
.money-grid span,
.metric span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border-radius: 999px;
  background: rgba(201, 22, 35, 0.1);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  text-transform: none;
  cursor: help;
}

.help::after {
  content: attr(data-help);
  position: absolute;
  z-index: 200;
  left: 50%;
  bottom: calc(100% + 10px);
  width: min(280px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid rgba(201, 22, 35, 0.24);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(18, 18, 18, 0.18);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: none;
  transform: translate(-50%, 4px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.help:hover::after,
.help:focus::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.intro .help {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.assumption-card .help,
.control .help,
.money-grid .help {
  color: var(--accent);
  font-size: 0.68rem;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}

.intro .assumption-card .help {
  color: #fff;
}

.assumption-card span {
  color: #d7d7d7;
}

.assumption-card strong {
  color: #fff;
  font-size: 1.78rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(460px, 1.18fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.controls {
  padding: 20px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.fixed-head {
  margin-top: 18px;
}

.ghost {
  min-width: 82px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(201, 22, 35, 0.22);
}

.control {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}

.control strong {
  font-size: 1.12rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.money-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.money-grid label {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.money-grid input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  font-weight: 750;
  padding: 0 14px;
}

.money-grid input:focus {
  outline: 3px solid rgba(201, 22, 35, 0.16);
  border-color: var(--accent);
}

.money-grid input[readonly] {
  background: #f5f6f7;
  color: var(--accent);
  cursor: default;
}

.results {
  display: grid;
  gap: 12px;
}

.total-card {
  --card-bg: linear-gradient(180deg, rgba(17, 17, 17, 0.98), rgba(34, 34, 34, 0.94));
  padding: 20px;
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.total-card .eyebrow {
  color: #ffb7bd;
}

.total-card strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(2.55rem, 5.8vw, 4.45rem);
  line-height: 0.94;
}

.total-card span {
  display: block;
  margin-top: 6px;
  color: #d7d7d7;
}

.action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.action-card h2 {
  margin-top: -4px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.action-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(201, 22, 35, 0.22);
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font-weight: 850;
  box-shadow: 0 10px 22px rgba(18, 18, 18, 0.07);
}

.action-button:hover,
.action-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.action-button.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 20px rgba(201, 22, 35, 0.22);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  display: grid;
  gap: 5px;
  min-height: 96px;
  padding: 14px;
}

.metric strong {
  font-size: 1.32rem;
  line-height: 1.05;
}

.breakdown {
  padding: 20px;
}

.breakdown .section-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.breakdown .section-head > strong {
  color: var(--accent);
  font-size: 1.45rem;
}

.bars {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: grid;
  gap: 5px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-weight: 800;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  background: #eceeef;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  background: var(--accent);
  border-radius: inherit;
}

.bar-row:nth-child(1) .bar-fill {
  background: #151515;
}

.bar-row:nth-child(3) .bar-fill,
.bar-row:nth-child(5) .bar-fill {
  background: var(--accent-2);
}

.disclaimer {
  padding: 18px 20px;
}

.disclaimer h2 {
  margin-bottom: 10px;
}

.disclaimer p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.48;
}

.disclaimer p + p {
  margin-top: 10px;
}

@media (max-width: 1040px) {
  .intro,
  .workspace,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    max-width: 14ch;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 16px 12px 32px;
  }

  .intro,
  .controls,
  .breakdown,
  .total-card {
    padding: 20px;
  }

  .money-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-logo {
    width: 176px;
  }

  .action-card {
    align-items: stretch;
    flex-direction: column;
  }

  .action-row {
    justify-content: stretch;
  }

  .action-button {
    flex: 1 1 160px;
  }

  .ghost {
    width: max-content;
  }

  h1 {
    font-size: 2.45rem;
  }
}

@media print {
  :root {
    --paper: #ffffff;
    --shadow: none;
    --shadow-soft: none;
  }

  body {
    background: #ffffff;
  }

  .shell {
    width: 100%;
    padding: 0;
  }

  .panel,
  .metric {
    break-inside: avoid;
    box-shadow: none;
  }

  .intro {
    min-height: 0;
  }

  .workspace {
    grid-template-columns: 0.9fr 1.1fr;
  }

  .action-row,
  .help {
    display: none;
  }

  input[type="range"] {
    display: none;
  }

  .money-grid input {
    border-color: #cfd3d8;
  }
}
