:root {
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f9fafb;
  --card: #ffffff;
  --accent: #2563eb;
  --accent-dark: #1e40af;
  --good: #047857;
  --bad: #b91c1c;
  --labor: #d97706;
  --cost: #64748b;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.page-header {
  background: #1f2937;
  color: #fff;
  padding: 28px 0 24px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #bfdbfe;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
  line-height: 1.2;
}

.lede {
  margin: 0;
  max-width: 68ch;
  color: #e5e7eb;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 24px 0 48px;
}

.panel, .results, .card, .compare article, .service {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.panel { padding: 18px 18px 22px; }

.results {
  padding: 18px;
  position: sticky;
  top: 16px;
}

h2, .section-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.section-title { margin-top: 22px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 0.92rem;
  font-weight: 600;
}

.field input, .field select {
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  width: 100%;
}

.field input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

.hint, .source, .rate-line, .rbt-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
}

.rate-line {
  margin-top: 8px;
  color: var(--accent-dark);
  font-weight: 600;
}

.warn {
  margin: 6px 0 0;
  color: var(--bad);
  font-size: 0.82rem;
}

.services {
  border: 0;
  margin: 8px 0 18px;
  padding: 0;
}

.services legend {
  font-weight: 700;
  margin-bottom: 10px;
}

.service {
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: none;
}

.service.is-off { opacity: 0.72; }

.check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 600;
}

.check input { margin-top: 3px; }

.service-grid, .cost-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.cost-grid { grid-template-columns: 1fr 1fr; }

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.card { padding: 14px; box-shadow: none; }

.card h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.figure {
  margin: 6px 0 2px;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.sub { margin: 0; color: var(--muted); font-size: 0.82rem; }

.card-accent { background: #eff6ff; border-color: #bfdbfe; }

.figure.good { color: var(--good); }
.figure.bad { color: var(--bad); }

.callout {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f0fdf4;
  color: #14532d;
}

.callout.warn {
  background: #fef2f2;
  color: #7f1d1d;
}

.compare {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.compare article {
  padding: 12px;
  box-shadow: none;
}

.compare article.is-current { outline: 2px solid var(--accent); }

.compare h3 { margin: 0 0 6px; font-size: 0.95rem; }
.compare p { margin: 0; font-size: 0.82rem; color: var(--muted); }
.compare strong { color: var(--ink); font-variant-numeric: tabular-nums; }

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

.bar-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; font-size: 0.85rem; }

.track {
  height: 14px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.fill { height: 100%; border-radius: 999px; }
.fill.revenue { background: var(--accent); }
.fill.labor { background: var(--labor); }
.fill.cost { background: var(--cost); }

.bar-value { font-variant-numeric: tabular-nums; font-weight: 600; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  text-align: right;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

th:first-child, td:first-child { text-align: left; white-space: normal; }

th { color: var(--muted); font-size: 0.75rem; font-weight: 600; }

.rbt-line, .source { margin-top: 12px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .results { position: static; order: -1; }
  .compare, .cards, .service-grid, .cost-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .cards, .compare, .service-grid, .cost-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr; }
  h1 { font-size: 1.45rem; }
}
