:root {
  --bg: #f7f5ef;
  --card: #ffffff;
  --ink: #1b2a24;
  --muted: #6b7570;
  --line: #e4e0d5;
  --brand: #1f5c46;
  --brand-ink: #ffffff;
  --brand-soft: #e8f0eb;
  --star: #e8a93d;
  --star-soft: #fbf0db;
  --good: #1f5c46;
  --good-soft: #e8f0eb;
  --warn: #7a2e2e;
  --warn-soft: #fbeaea;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(27, 42, 36, 0.05), 0 8px 28px rgba(27, 42, 36, 0.06);
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12150f;
    --card: #1c201a;
    --ink: #f0ede4;
    --muted: #9aa39b;
    --line: #2e3329;
    --brand: #4fa97f;
    --brand-ink: #0e1a14;
    --brand-soft: #1a2b22;
    --star: #f0b953;
    --star-soft: #2e2612;
    --good: #4fa97f;
    --good-soft: #1a2b22;
    --warn: #e5a3a3;
    --warn-soft: #33201f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  padding: 20px 16px 56px;
  display: flex;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

/* ------------------------------------------------------------------ auth bar */

.authbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  margin-bottom: 16px;
}
.authbar a { color: var(--brand); font-weight: 600; text-decoration: none; white-space: nowrap; }
.authbar a:hover { text-decoration: underline; }

/* --------------------------------------------------------------- hero header */

.hero { text-align: center; margin: 8px 0 24px; }

.hero .eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.hero h1 {
  font-family: var(--serif);
  font-size: 1.95rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
  margin: 8px 0 0;
}

.hero .hero-sub { margin-top: 10px; font-size: 0.88rem; color: var(--muted); }

.hero .hero-meta {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.skeleton {
  display: inline-block;
  width: 210px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--line) 25%, var(--bg) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.wrap { width: 100%; max-width: 560px; }
.wrap--wide { max-width: 760px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}

h1 {
  font-family: var(--serif);
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 0 0 8px;
  font-weight: 700;
}
h2 { font-size: 1.02rem; margin: 0 0 12px; letter-spacing: -0.01em; font-weight: 700; }
p  { margin: 0 0 12px; }

.muted { color: var(--muted); font-size: 0.9rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ------------------------------------------------------------- form controls */

label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; }

input[type='text'],
input[type='url'],
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

textarea { min-height: 150px; resize: vertical; line-height: 1.6; }

/* The draft review is the thing to read on the page, so it gets the warm tint. */
#review { background: var(--star-soft); border-color: var(--line); font-size: 0.97rem; }
#review:focus { border-color: var(--star); box-shadow: 0 0 0 3px var(--star-soft); }

button {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 13px 18px;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s, background 0.15s;
}
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: var(--brand-ink); width: 100%; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); }

.btn-google {
  background: var(--good);
  color: var(--brand-ink);
  width: 100%;
  font-size: 1.02rem;
  padding: 17px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(31, 92, 70, 0.3);
}
.btn-google:hover:not(:disabled) { filter: brightness(1.07); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--ink); }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* --------------------------------------------------------------- star rating */

.stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 2px; }

.star {
  background: none;
  border: 0;
  padding: 4px;
  font-size: 2.35rem;
  line-height: 1;
  color: var(--line);
  transition: transform 0.12s, color 0.12s;
  user-select: none;
}
.star.on { color: var(--star); transform: scale(1.12); }
.star:active { transform: scale(0.92); }

.rating-label { min-height: 1.4em; font-weight: 600; font-size: 0.95rem; }

/* --------------------------------------------------------------------- chips */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  background: var(--bg);
  border: 1.5px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.chip.on {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

/* ----------------------------------------------------- free-text "Other" chip */

.chip-other { border-style: dashed; }

.other-box { margin-top: 12px; }

.other-box input {
  background: var(--card);
  border-color: var(--brand);
}

.other-hint { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); }

/* ------------------------------------------------------------------ business */

.biz { display: flex; gap: 12px; align-items: flex-start; }

.biz-avatar {
  flex: 0 0 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.15rem;
}

.biz-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.biz-meta { color: var(--muted); font-size: 0.86rem; }

.pill {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ------------------------------------------------------------------- notices */

.notice {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.notice-error { background: var(--warn-soft); color: var(--warn); }
.notice-ok { background: var(--good-soft); color: var(--good); }

.step-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

/* --------------------------------------------------------------------- setup */

.qr-box { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr-box img {
  width: 168px;
  height: 168px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
}

.link-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.86rem;
  word-break: break-all;
}

/* ---------------------------------------------------------- candidate picker */

.cand {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  font-weight: 400;
}
.cand:hover { border-color: var(--brand); background: var(--brand-soft); }

.cand-best { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.cand-name { font-weight: 700; font-size: 1rem; }
.cand-addr { color: var(--muted); font-size: 0.84rem; line-height: 1.4; }
.cand-meta { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }

.cand-tag {
  flex: 0 0 auto;
  align-self: flex-start;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ------------------------------------------------ owner-editable chip lists */

.editable { display: flex; flex-wrap: wrap; gap: 8px; }

.editable .tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 8px 7px 14px;
  font-size: 0.9rem;
}

.editable .tag button {
  background: none;
  border: 0;
  padding: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  display: grid;
  place-items: center;
}
.editable .tag button:hover { background: var(--warn-soft); color: var(--warn); }

.editable .empty { color: var(--muted); font-size: 0.88rem; font-style: italic; }

.kw { display: flex; flex-wrap: wrap; gap: 6px; }
.kw span {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 0.82rem;
  color: var(--muted);
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

footer { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 8px; }
footer a { color: var(--muted); }

/* --------------------------------------------------------------------- audit */

a.btn-ghost, a.btn-primary {
  display: flex; align-items: center; justify-content: center;
  padding: 13px 18px; border-radius: 12px; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; line-height: 1.2;
}
a.btn-ghost { border-color: var(--line); color: var(--muted); }
a.btn-ghost:hover { background: var(--bg); color: var(--ink); }
a.btn-primary { background: var(--brand); color: var(--brand-ink); }

.q-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .q-grid { grid-template-columns: 1fr 1fr; } }

.q-label { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  background: var(--bg);
  border: 1.5px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.84rem;
  font-weight: 500;
}
.seg button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }

.score-top { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.score-ring { flex: 0 0 128px; }
.score-text { flex: 1; min-width: 220px; }
.score-text h1 { margin: 4px 0 8px; font-size: 1.7rem; }
.score-text .headline { font-weight: 600; font-size: 1rem; }

.action { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.action:first-of-type { border-top: 0; }
.action-n {
  flex: 0 0 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 0.9rem;
}
.action-body { flex: 1; min-width: 0; }
.action-title { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.action-why { margin: 4px 0 8px; font-size: 0.9rem; color: var(--muted); }
.action-steps { margin: 0; padding-left: 20px; font-size: 0.9rem; }
.action-steps li { margin-bottom: 4px; }

.impact, .effort {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  border-radius: 999px; padding: 2px 8px;
}
.impact-high { background: var(--warn-soft); color: var(--warn); }
.impact-medium { background: var(--star-soft); color: #8a5a10; }
.impact-low { background: var(--bg); color: var(--muted); }
.effort { background: var(--bg); color: var(--muted); border: 1px solid var(--line); text-transform: none; letter-spacing: 0; }

details.section { border-top: 1px solid var(--line); padding: 12px 0 4px; }
details.section summary { cursor: pointer; list-style: none; }
details.section summary::-webkit-details-marker { display: none; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.section-title { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-weight { font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.section-pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.bar-fill { height: 100%; border-radius: 999px; transition: width 0.4s; }

.check { padding: 10px 0 8px; border-top: 1px dashed var(--line); }
.check-head { display: flex; gap: 10px; align-items: flex-start; }
.check-icon {
  flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.78rem; font-weight: 700; margin-top: 1px;
}
.check-pass .check-icon { background: var(--good-soft); color: var(--good); }
.check-warn .check-icon { background: var(--star-soft); color: #8a5a10; }
.check-fail .check-icon { background: var(--warn-soft); color: var(--warn); }
.check-unknown .check-icon, .check-info .check-icon { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.check-body { flex: 1; min-width: 0; }
.check-label { font-weight: 600; font-size: 0.92rem; }
.check-detail { font-size: 0.86rem; color: var(--muted); }
.check-pts { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.check-fix { margin: 6px 0 0 32px; font-size: 0.86rem; }
.check-source { margin: 4px 0 0 32px; font-size: 0.72rem; color: var(--muted); font-style: italic; }

.scroll { overflow-x: auto; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.cmp th, table.cmp td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.cmp td:first-child, table.cmp th:first-child { white-space: normal; min-width: 160px; }
table.cmp th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
table.cmp tr.you td { background: var(--brand-soft); font-weight: 600; }

ol.pack { margin: 6px 0 0; padding-left: 22px; font-size: 0.88rem; }
ol.pack li { padding: 4px 6px; border-radius: 8px; }
ol.pack li.you { background: var(--brand-soft); font-weight: 600; }
.pack-meta { color: var(--muted); font-size: 0.8rem; margin-left: 6px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.photo-grid figcaption { font-size: 0.72rem; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.draft { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; background: var(--bg); }
.draft-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.draft-head button { padding: 6px 12px; font-size: 0.82rem; }
.draft-text { margin: 0; font-size: 0.92rem; white-space: pre-wrap; }

ul.plain { margin: 0; padding-left: 20px; font-size: 0.9rem; }
ul.plain li { margin-bottom: 6px; }
.faq { margin-top: 10px; font-size: 0.9rem; }
.faq p { margin: 2px 0 0; color: var(--muted); }

/* ------------------------------------------------------------------ insights */

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px 11px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
}
.seg button.on { background: var(--brand); color: var(--brand-ink); }

/* KPI row. Values use the font's proportional figures - tabular digits make a
   large standalone number look loose. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0 18px; }
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tile-n { font-size: 1.7rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
.tile-l { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.tile-d { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }

.ins-h { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.ins-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 20px; }
.ins-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 22px; margin-bottom: 20px; }
@media (max-width: 560px) { .ins-grid { grid-template-columns: 1fr; } }

/* Horizontal bars: thin, square at the baseline, 4px rounded data-end, a 2px
   surface gap between neighbours, single hue with the track a lighter step of
   the same ramp so the whole bar reads as one thing. Counts sit as text, in
   text ink - the mark carries identity, the label carries the number. */
.hbar { display: grid; grid-template-columns: minmax(64px, 36%) 1fr auto; align-items: center; gap: 10px; padding: 3px 0; }
.hbar-label { font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 10px; background: var(--brand-soft); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; min-width: 2px; transition: width 0.4s; }
.hbar-n { font-size: 0.84rem; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 2ch; text-align: right; }
.hbar-typed { font-size: 0.7rem; color: var(--muted); font-style: italic; margin-left: 6px; }

/* The complaints list is a status use, not a second series: its own heading
   carries a warning glyph so the meaning never rides on colour alone. */
.issues .hbar-track { background: var(--warn-soft); }
.issues .hbar-fill { background: var(--warn); }

.ranked:empty::after, #ratingBars:empty::after {
  content: 'Nothing yet'; color: var(--muted); font-size: 0.86rem; font-style: italic;
}

/* 12-week strip: past weeks in the de-emphasis step, the current week in the
   accent. A 2px stub keeps empty weeks on the baseline. */
.sparkbars { display: flex; align-items: flex-end; gap: 3px; height: 64px; padding-top: 4px; }
.sparkbars i {
  flex: 1; display: block; background: var(--brand); opacity: 0.42;
  border-radius: 3px 3px 0 0; min-height: 2px; transition: height 0.4s;
}
.sparkbars i.now { opacity: 1; }
.sparkbars i:hover { opacity: 0.85; }
.spark-axis { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--muted); margin-top: 4px; }

.quotes { list-style: none; margin: 0; padding: 0; }
.quotes li { border-left: 3px solid var(--star); padding: 4px 0 4px 12px; margin-bottom: 10px; font-size: 0.92rem; }
.quotes li.low { border-left-color: var(--warn); }
.quotes .q-meta { display: block; font-size: 0.76rem; color: var(--muted); margin-top: 2px; }

/* --------------------------------------------------------------- why section */

.why { display: grid; gap: 12px; }
.why-row { display: flex; gap: 12px; align-items: flex-start; font-size: 0.92rem; line-height: 1.5; }
.why-row b { font-weight: 700; }
.why-icon {
  flex: 0 0 32px; height: 32px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 0.95rem;
}

/* Chosen listing stays visible and marked while the describe step opens below. */
.cand.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-soft); }
.cand.selected .cand-name::after { content: ' \2713'; color: var(--brand); }

/* Clerk sign-in box: centred under the hero on every page it mounts on. */
.cl-rootBox { margin: 0 auto !important; }
