:root {
  --bg: #f5f6f8;
  --surface: #fff;
  --text: #1c2430;
  --muted: #667085;
  --border: #dde1e8;
  --primary: #2459d6;
  --primary-dark: #1a44a8;
  --danger: #c0392b;
  --ok: #1e7f4f;
  --warn: #b26a00;
  --star: #f5a623;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 { font-size: 1.6rem; margin: .4em 0 .3em; line-height: 1.2; }
h2 { font-size: 1.2rem; margin: 1em 0 .4em; }
h3 { font-size: 1.05rem; margin: .8em 0 .3em; }
a { color: var(--primary); }
small { font-size: .85em; }
code { font-size: .85em; word-break: break-all; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
.nav {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.nav .brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 700; color: var(--text); text-decoration: none; margin-right: auto;
}
.nav .brand-logo { width: 28px; height: 28px; flex-shrink: 0; display: block; }
.nav .brand small { color: var(--muted); font-weight: 400; }
.nav nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.nav nav a { text-decoration: none; }
.nav form { margin: 0; }

.container { max-width: 640px; margin: 0 auto; padding: 1rem; }
.container.wide { max-width: 1100px; }
.stack > * + * { margin-top: 1rem; }
.stack > h1, .stack > h2, .stack > h3 { margin-bottom: 0; }
.row { display: flex; gap: .75rem; align-items: center; }
.row.wrap { flex-wrap: wrap; align-items: flex-end; }
.row.between { justify-content: space-between; margin: 1rem 0; }
.narrow { max-width: 380px; margin: 2rem auto; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card.has-error { border-color: var(--danger); }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: .25rem; }
.field { min-width: 0; }
.field.grow { flex: 1; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit;
  padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
.grid-form { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: .75rem; align-items: end; }
.field-error { color: var(--danger); margin: .3rem 0 0; font-size: .9rem; }
details summary { cursor: pointer; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-block; font: inherit; font-weight: 600; text-decoration: none; text-align: center;
  padding: .6rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer;
}
.btn:hover { background: #f0f2f6; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.big { width: 100%; padding: .85rem 1rem; font-size: 1.05rem; }
.btn.small { padding: .3rem .65rem; font-size: .9rem; }
button.link {
  font: inherit; background: none; border: 0; padding: .2rem 0; color: var(--primary);
  cursor: pointer; text-decoration: underline;
}

/* Alerts and badges */
.alert { padding: .7rem .9rem; border-radius: 8px; margin: 0 0 1rem; }
.alert.success { background: #e7f6ee; color: #14573a; }
.alert.error { background: #fdecea; color: #8e2418; }
.alert.warn { background: #fff4e0; color: #7a4700; }
.badge { font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: #eceff4; color: var(--muted); font-style: normal; }
.badge.ok { background: #e7f6ee; color: var(--ok); }
.badge.warn { background: #fff4e0; color: var(--warn); }

/* Rating form & searchable builder input (combobox) */
.builder-combobox { position: relative; }
.builder-combobox-input-wrap { position: relative; display: flex; align-items: center; }
.builder-combobox-input-wrap input[role="combobox"] {
  padding-right: 5.5rem;
  transition: border-color .12s, background-color .12s, box-shadow .12s;
}
.builder-combobox.has-selection input[role="combobox"] {
  border-color: var(--primary);
  background: #f4f8ff;
  font-weight: 600;
}
.card.has-error .builder-combobox-input-wrap input[role="combobox"] {
  border-color: var(--danger);
}
.builder-combobox-input-wrap .htmx-indicator {
  position: absolute; right: 2.2rem; top: 50%; transform: translateY(-50%);
  font-size: .8rem; pointer-events: none;
}
.builder-combobox-clear {
  position: absolute; right: .45rem; top: 50%; transform: translateY(-50%);
  width: 1.6rem; height: 1.6rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: .85rem; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.builder-combobox-clear[hidden] { display: none; }
.builder-combobox-clear:hover { background: #eceff4; color: var(--text); }
.builder-suggestions {
  position: absolute; top: calc(100% + .35rem); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(16, 24, 40, .14); padding: .35rem;
  max-height: 16rem; overflow-y: auto;
}
.builder-options { display: flex; flex-direction: column; gap: 2px; }
.option {
  display: flex; justify-content: space-between; gap: .6rem; align-items: center;
  font-weight: 400; margin: 0; padding: .55rem .7rem; border: 0; border-radius: 8px;
  cursor: pointer; background: transparent; transition: background .1s;
}
.option:hover, .option.is-active { background: #f0f4ff; }
.option:has(input:checked) { background: #eef3ff; color: var(--primary-dark); }
.builder-option-label { display: inline-flex; align-items: center; gap: .55rem; min-width: 0; }
.builder-option-check {
  color: var(--primary); font-weight: 700; opacity: 0; flex-shrink: 0;
}
.option:has(input:checked) .builder-option-check { opacity: 1; }
.builder-no-results { margin: .4rem .5rem; font-size: .9rem; }
.builder-icon { width: 20px; height: 20px; object-fit: contain; border-radius: 3px; flex-shrink: 0; }
.category-head { display: flex; flex-direction: column; margin-bottom: .4rem; }

/* Value Hero banner */
.rating-hero {
  background: linear-gradient(135deg, #f0f5ff 0%, #ffffff 100%);
  border: 1px solid #c9d8fb;
  margin-bottom: 1.25rem;
}
.rating-hero h1 { font-size: 1.45rem; margin: .2rem 0; }
.rating-hero .hero-badge { align-self: flex-start; }

/* Scale rating (1-10) */
.scale-rating { display: flex; flex-direction: column; gap: .35rem; margin-top: .4rem; }
.scale-buttons { display: flex; gap: .25rem; width: 100%; }
.scale-btn {
  flex: 1; padding: .65rem .1rem; font: inherit; font-size: .95rem; font-weight: 700;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
  color: var(--text); cursor: pointer; text-align: center;
  transition: all .12s ease-in-out;
}
.scale-btn:hover { border-color: var(--primary); background: #f0f4ff; }
.scale-btn.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 0 0 2px rgba(36, 89, 214, .25);
  transform: translateY(-1px);
}
.scale-labels {
  display: flex; justify-content: space-between; font-size: .8rem;
  padding: 0 .2rem;
}

/* Page 2 Benchmark card */
.benchmark-card { border-top: 3px solid var(--primary); }

.star-rating { display: flex; gap: .25rem; }
.star {
  font-size: 2.2rem; line-height: 1; padding: .1rem .15rem; border: 0; background: none;
  color: #cfd4dc; cursor: pointer; transition: color .12s, transform .12s;
}
.star.on { color: var(--star); }
.star:hover { transform: scale(1.12); }
.stars { color: var(--star); letter-spacing: 1px; white-space: nowrap; }

/* HTMX indicators (the default styles are disabled in the htmx-config meta tag) */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; }
td.actions form { display: inline; }
.tabs { display: flex; gap: .25rem; }
.tabs a { padding: .35rem .8rem; border-radius: 999px; text-decoration: none; color: var(--muted); }
.tabs a.active { background: var(--primary); color: #fff; }

/* Dashboard */
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1rem; }
.stat { text-align: center; margin: 0; }
.stat strong { display: block; font-size: 1.8rem; }
.stat span { color: var(--muted); font-size: .9rem; }

/* Comparison */
.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.compare-layout { display: grid; gap: 1rem; }
@media (min-width: 900px) { .compare-layout { grid-template-columns: 1.4fr 1fr; align-items: start; } }
table.compare td:first-child { min-width: 11rem; }
.big-score { font-size: 1.4rem; margin: 0; }
.bars { display: grid; gap: .4rem; }
.bar-row { display: grid; grid-template-columns: 8.5rem 1fr 2.2rem; gap: .6rem; align-items: center; font-size: .9rem; }
.bar-row strong { text-align: right; }
.bar { background: #eceff4; border-radius: 999px; height: .6rem; overflow: hidden; }
.bar > div { background: var(--star); height: 100%; }
.dist { display: flex; flex-direction: column-reverse; }
blockquote { margin: 0; padding-left: .8rem; border-left: 3px solid var(--border); }
blockquote p { margin: 0 0 .2rem; }
blockquote + blockquote { margin-top: .8rem; }

/* Landing page hero */
.landing-hero {
  min-height: calc(100vh - 2rem);
  min-height: calc(100dvh - 2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1.25rem;
}
.landing-hero-content {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .85rem;
}
.landing-eyebrow {
  display: inline-block;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  background: #e8f0fe;
  border: 1px solid #c9d8fb;
  padding: .3rem .85rem;
  border-radius: 999px;
}
.landing-hero h1.landing-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}
.landing-logo {
  width: clamp(2.2rem, 5.5vw, 3.4rem);
  height: clamp(2.2rem, 5.5vw, 3.4rem);
  flex-shrink: 0;
  display: block;
}
.landing-tagline {
  font-size: clamp(1.25rem, 3.5vw, 1.85rem);
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  color: var(--primary);
}
.landing-subtext {
  font-size: clamp(.98rem, 2.2vw, 1.12rem);
  line-height: 1.6;
  margin: .25rem 0 0;
  max-width: 540px;
  color: var(--muted);
}
@media (max-width: 600px) {
  .landing-hero {
    padding: 2rem 1rem;
  }
}

