:root {
  --navy-950: #08111d;
  --navy-900: #0d1b2a;
  --navy-800: #14304d;
  --navy-700: #21466d;
  --sand-50: #fcfaf6;
  --sand-100: #f5efe3;
  --sand-200: #ece2cf;
  --ink-900: #12253a;
  --ink-700: #34516e;
  --ink-500: #62758a;
  --gold-500: #c29b46;
  --gold-400: #d7b463;
  --green-500: #1e8a61;
  --blue-500: #2474a8;
  --red-500: #b94935;
  --white: #ffffff;
  --line: rgba(18, 37, 58, 0.12);
  --line-strong: rgba(18, 37, 58, 0.18);
  --card: rgba(255, 255, 255, 0.84);
  --card-strong: rgba(255, 255, 255, 0.94);
  --shadow: 0 18px 42px rgba(10, 23, 36, 0.12);
  --shadow-soft: 0 10px 26px rgba(10, 23, 36, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --control-bg: rgba(255, 255, 255, 0.9);
  --control-bg-hover: rgba(255, 255, 255, 0.98);
  --control-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] {
  --sand-50: #050c14;
  --sand-100: #09131f;
  --sand-200: #101e2e;
  --ink-900: #edf2f8;
  --ink-700: #c7d3df;
  --ink-500: #8ea3b8;
  --line: rgba(201, 168, 76, 0.16);
  --line-strong: rgba(201, 168, 76, 0.24);
  --card: rgba(10, 21, 34, 0.82);
  --card-strong: rgba(10, 21, 34, 0.94);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.28);
  --control-bg: rgba(9, 18, 30, 0.92);
  --control-bg-hover: rgba(13, 25, 39, 0.98);
  --control-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "DM Sans", sans-serif;
  color: var(--ink-900);
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(194, 155, 70, 0.22), transparent 65%),
    radial-gradient(960px 560px at 100% 0%, rgba(33, 70, 109, 0.18), transparent 62%),
    linear-gradient(160deg, var(--sand-50) 0%, var(--sand-100) 48%, var(--sand-200) 100%);
}

[data-theme="dark"] body {
  background:
    radial-gradient(920px 540px at 10% -10%, rgba(194, 155, 70, 0.16), transparent 65%),
    radial-gradient(980px 580px at 100% 0%, rgba(36, 116, 168, 0.16), transparent 62%),
    linear-gradient(160deg, #040a12 0%, #07121f 46%, #0a1725 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.home-btn,
.theme-btn,
.auto-btn,
.quick-btn {
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  text-decoration: none;
  color: var(--ink-700);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.home-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(194, 155, 70, 0.48);
  background: var(--white);
}

[data-theme="dark"] .home-btn {
  background: rgba(9, 18, 30, 0.8);
}

.theme-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
}

.theme-btn:hover {
  transform: rotate(14deg);
  border-color: rgba(194, 155, 70, 0.5);
  color: var(--gold-500);
}

[data-theme="dark"] .theme-btn {
  background: rgba(9, 18, 30, 0.82);
  color: var(--gold-400);
}

.ico-moon {
  display: block;
}

.ico-sun {
  display: none;
}

[data-theme="dark"] .ico-moon {
  display: none;
}

[data-theme="dark"] .ico-sun {
  display: block;
}

.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px;
  margin-bottom: 18px;
}

.hero-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(194, 155, 70, 0.32);
  background: rgba(194, 155, 70, 0.12);
  color: var(--gold-500);
  font-family: "Syne", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1,
.section-head h2,
.summary-head h2,
.card-head h2 {
  margin: 0;
  font-family: "Syne", sans-serif;
  letter-spacing: -0.03em;
}

.hero h1 {
  margin-top: 0;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  line-height: 1.1;
}

.hero p {
  margin: 4px 0 0;
  max-width: 64ch;
  color: var(--ink-700);
  line-height: 1.5;
}

.hero-metrics {
  display: grid;
  gap: 14px;
}

.hero-chip,
.mini-stat,
.cost-row,
.insight-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(245, 239, 227, 0.72));
  border: 1px solid var(--line);
}

[data-theme="dark"] .hero-chip,
[data-theme="dark"] .mini-stat,
[data-theme="dark"] .cost-row,
[data-theme="dark"] .insight-card {
  background: linear-gradient(145deg, rgba(12, 24, 38, 0.94), rgba(11, 23, 36, 0.78));
}

.hero-chip-label,
.spotlight-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--ink-500);
}

.hero-chip-sub {
  display: block;
  margin-top: 8px;
  color: var(--ink-700);
  line-height: 1.5;
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 24px;
  align-self: start;
}

.results-col {
  min-width: 0;
}

.panel-section + .panel-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.section-head,
.card-head,
.profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-head {
  margin-bottom: 16px;
}

.section-head > div,
.card-head > div,
.profile-head > div {
  min-width: 0;
}

.section-head p,
.summary-footnote,
.explainer-copy,
.profile-summary {
  margin: 6px 0 0;
  color: var(--ink-700);
  line-height: 1.6;
}

.section-index {
  flex: 0 0 auto;
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--navy-900);
  color: #fff;
  font-family: "Syne", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
}

[data-theme="dark"] .section-index {
  background: rgba(194, 155, 70, 0.16);
  color: var(--gold-400);
  border: 1px solid rgba(194, 155, 70, 0.26);
}

.section-head[data-toggle-section] {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  margin-bottom: 0;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.06));
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.section-head[data-toggle-section]:hover .section-index {
  transform: scale(1.06);
}

.section-head[data-toggle-section]:hover {
  transform: translateY(-1px);
  border-color: rgba(194, 155, 70, 0.26);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.18));
}

[data-theme="dark"] .section-head[data-toggle-section] {
  background: linear-gradient(145deg, rgba(18, 32, 49, 0.82), rgba(10, 21, 34, 0.32));
}

[data-theme="dark"] .section-head[data-toggle-section]:hover {
  background: linear-gradient(145deg, rgba(20, 35, 54, 0.92), rgba(10, 21, 34, 0.56));
}

.chevron-icon {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: center;
  transition: transform 0.3s ease;
  color: var(--ink-500);
}

.panel-section.collapsed .chevron-icon {
  transform: rotate(-90deg);
}

.section-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.35s ease;
}

.panel-section.collapsed .section-body {
  grid-template-rows: 0fr;
}

.section-body-inner {
  overflow: hidden;
  min-height: 0;
  padding-top: 16px;
}

.field,
.field-grid {
  display: grid;
  gap: 8px;
}

.field + .field,
.field-grid + .field,
.field + .field-grid {
  margin-top: 14px;
}

.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--ink-700);
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--control-bg);
  color: var(--ink-900);
  box-shadow: var(--control-shadow);
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

[data-theme="dark"] .field input,
[data-theme="dark"] .field select {
  background: var(--control-bg);
}

.field input:hover,
.field select:hover {
  background: var(--control-bg-hover);
  border-color: rgba(194, 155, 70, 0.32);
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(36, 116, 168, 0.18);
  outline-offset: 1px;
  border-color: rgba(36, 116, 168, 0.48);
  box-shadow: 0 0 0 4px rgba(36, 116, 168, 0.08);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 50px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-500) 50%),
    linear-gradient(135deg, var(--ink-500) 50%, transparent 50%),
    linear-gradient(to right, rgba(18, 37, 58, 0.12), rgba(18, 37, 58, 0.12));
  background-position:
    calc(100% - 20px) calc(50% - 3px),
    calc(100% - 14px) calc(50% - 3px),
    calc(100% - 38px) 50%;
  background-size: 6px 6px, 6px 6px, 1px 60%;
  background-repeat: no-repeat;
}

[data-theme="dark"] .field select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold-400) 50%),
    linear-gradient(135deg, var(--gold-400) 50%, transparent 50%),
    linear-gradient(to right, rgba(201, 168, 76, 0.2), rgba(201, 168, 76, 0.2));
}

.field select::-ms-expand {
  display: none;
}

.field select option {
  color: #12253a;
  background: #ffffff;
}

[data-theme="dark"] .field select option {
  color: #edf2f8;
  background: #0d1b2a;
}

.field input::placeholder {
  color: var(--ink-500);
}

.field-hint,
.breakdown-meta,
.kpi-sub,
.formula-row span {
  color: var(--ink-500);
  line-height: 1.55;
  font-size: 0.84rem;
}

.quick-row,
.profile-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-row {
  margin-top: 2px;
}

.quick-btn,
.auto-btn,
.pill,
.badge,
.callout {
  border-radius: 999px;
  font-size: 0.78rem;
}

.quick-btn {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-700);
  padding: 8px 12px;
}

.quick-btn:hover,
.auto-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(194, 155, 70, 0.48);
  color: var(--gold-500);
}

.input-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.auto-btn {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-700);
  padding: 0 14px;
}

[data-theme="dark"] .auto-btn {
  background: rgba(9, 18, 30, 0.82);
}

.auto-btn.active {
  background: rgba(194, 155, 70, 0.14);
  color: var(--gold-500);
  border-color: rgba(194, 155, 70, 0.36);
}

.profile-card,
.spotlight-card,
.detail-card,
.insight-card {
  padding: 20px;
}

.profile-card {
  margin-top: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(239, 233, 218, 0.74));
}

[data-theme="dark"] .profile-card {
  background: linear-gradient(145deg, rgba(12, 24, 38, 0.92), rgba(8, 18, 29, 0.78));
}

.profile-head strong {
  font-size: 1rem;
}

.profile-head {
  flex-wrap: wrap;
}

.badge,
.pill,
.callout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-700);
}

[data-theme="dark"] .badge,
[data-theme="dark"] .pill,
[data-theme="dark"] .callout {
  background: rgba(9, 18, 30, 0.82);
}

.results-col {
  display: grid;
  gap: 18px;
}

.summary-footnote {
  color: var(--ink-700);
  line-height: 1.55;
}

.spotlight-card {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
  gap: 22px;
  align-items: center;
}

.spotlight-copy {
  display: grid;
  gap: 12px;
}

.spotlight-price {
  display: block;
  font-family: "Syne", sans-serif;
  font-size: clamp(2.8rem, 7vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 14px;
}

.mini-stat {
  position: relative;
  overflow: hidden;
}

.mini-stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent, var(--gold-500));
}

.accent-green {
  --accent: var(--green-500);
}

.accent-blue {
  --accent: var(--blue-500);
}

.accent-red {
  --accent: var(--red-500);
}

.mini-stat span,
.ring-label,
.cost-share {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-500);
}

.mini-stat strong {
  display: block;
  margin-top: 8px;
  font-family: "Syne", sans-serif;
  font-size: 1.45rem;
  line-height: 1;
}

.spotlight-visual {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.cost-ring {
  width: min(280px, 78vw);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 20px;
  display: grid;
  place-items: center;
  background: conic-gradient(
    #d8b96f 0 20%,
    #4896c7 20% 40%,
    #30a977 40% 60%,
    #d96d58 60% 80%,
    #75879b 80% 100%
  );
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), var(--shadow-soft);
}

.cost-ring-center {
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
}

[data-theme="dark"] .cost-ring-center {
  background: rgba(9, 18, 30, 0.94);
}

.ring-value {
  display: block;
  margin-top: 8px;
  font-family: "Syne", sans-serif;
  font-size: 1.35rem;
  line-height: 1.1;
}

.ring-caption {
  color: var(--ink-500);
  font-size: 0.85rem;
}

.detail-card .card-head {
  margin-bottom: 16px;
}

.stack-bar {
  display: flex;
  height: 20px;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(18, 37, 58, 0.08);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}

.stack-segment {
  display: block;
  width: 0;
  transition: width 0.25s ease;
}

.depreciation {
  background: linear-gradient(90deg, #d8b96f, #c29b46);
}

.fuel {
  background: linear-gradient(90deg, #4896c7, #2474a8);
}

.maintenance {
  background: linear-gradient(90deg, #30a977, #1e8a61);
}

.insurance {
  background: linear-gradient(90deg, #d96d58, #b94935);
}

.other {
  background: linear-gradient(90deg, #75879b, #52677f);
}

.cost-list {
  display: grid;
  gap: 12px;
}

.cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(110px, 0.95fr) auto;
  grid-template-areas:
    "main bar value"
    "main bar share";
  column-gap: 14px;
  row-gap: 6px;
  align-items: center;
}

.cost-row-main {
  grid-area: main;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cost-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.dot-depreciation {
  background: #c29b46;
}

.dot-fuel {
  background: #2474a8;
}

.dot-maintenance {
  background: #1e8a61;
}

.dot-insurance {
  background: #b94935;
}

.dot-other {
  background: #52677f;
}

.cost-row-bar {
  grid-area: bar;
  height: 6px;
  border-radius: 999px;
  background: rgba(18, 37, 58, 0.06);
  overflow: hidden;
  align-self: center;
  min-width: 0;
}

[data-theme="dark"] .cost-row-bar {
  background: rgba(255, 255, 255, 0.06);
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  width: 0;
  transition: width 0.4s ease;
}

.cost-row:hover .bar-fill {
  filter: brightness(1.15);
}

.cost-row-value {
  grid-area: value;
  font-family: "Syne", sans-serif;
  font-size: 1.1rem;
  line-height: 1;
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

.cost-share {
  grid-area: share;
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

.insight-strip {
  display: grid;
}

.insights-list {
  margin: 12px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--ink-700);
}

.insights-list li {
  line-height: 1.55;
}

.mini-stat,
.cost-row {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mini-stat:hover,
.cost-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

@media (min-width: 1081px) {
  .results-col {
    align-self: start;
  }
}

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

  .panel {
    order: 2;
  }

  .results-col {
    order: 1;
  }

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

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 18px, 100%);
    padding-top: 18px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 18px 20px;
  }

  .field-grid,
  .mini-stat-grid,
  .spotlight-card {
    grid-template-columns: 1fr;
  }

  .cost-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main value"
      "bar bar"
      "share share";
    row-gap: 8px;
  }

  .cost-row-bar {
    display: block;
    width: 100%;
  }

  .cost-share {
    justify-self: start;
    text-align: left;
  }

  .input-with-action {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .page-shell {
    width: min(100% - 12px, 100%);
    padding-top: 14px;
  }

  .panel,
  .spotlight-card,
  .detail-card,
  .insight-card {
    padding: 16px;
  }

  .hero {
    padding: 16px;
  }

  .section-head[data-toggle-section] {
    padding: 12px 14px;
  }

  .field-grid {
    gap: 12px;
  }

  .quick-row {
    gap: 6px;
  }

  .quick-btn,
  .auto-btn,
  .pill,
  .badge,
  .callout {
    font-size: 0.74rem;
  }

  .spotlight-price {
    font-size: clamp(2.3rem, 12vw, 3.6rem);
  }
}
