:root {
  color-scheme: light;
  --ink: #1c1c1c;
  --ink-soft: #2a2a2a;
  --muted: #6a6c66;
  --muted-soft: #8a8c85;
  --line: #ececec;
  --line-strong: #d8d8d8;
  --paper: #fafaf7;
  --panel: #ffffff;
  --green: #00805d;
  --green-deep: #005a3f;
  --mint: #e3f5ec;
  --amber: #b16010;
  --amber-bg: #fff2d9;
  --red: #d64123;
  --red-bg: #ffe9e2;
  --gold: #f6b100;
  --shadow-sm: 0 4px 12px rgba(20, 20, 20, 0.05);
  --shadow: 0 14px 38px rgba(20, 20, 20, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

#alerts, #favorites, #rankings, #blog, #directory {
  scroll-margin-top: 140px;
}
@media (max-width: 640px) {
  #alerts, #favorites, #rankings, #blog, #directory {
    scroll-margin-top: 80px;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, "Helvetica Neue", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

/* ============== Topbar ============== */

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 12px clamp(16px, 4vw, 44px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  text-decoration: none;
}

.brand small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.brand-mark {
  align-items: center;
  background: var(--green);
  border-radius: 10px;
  color: #fff;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  width: 38px;
  letter-spacing: 0.04em;
}

.nav {
  display: flex;
  gap: 6px;
}

.nav-toggle,
.header-search {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: none;
  flex-direction: column;
  gap: 4px;
  height: 40px;
  justify-content: center;
  padding: 0 10px;
  width: 44px;
}

.header-search {
  align-items: center;
  color: var(--ink);
}

.nav-toggle span {
  background: var(--ink);
  border-radius: 2px;
  display: block;
  height: 2px;
  width: 20px;
}

.nav a {
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 14px;
  text-decoration: none;
}

.nav a:hover {
  background: #f0eee7;
  color: var(--ink);
}

.nav-button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  min-height: 36px;
  padding: 6px 14px;
}

.nav-button:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.auth-chip {
  background: var(--mint);
  border-radius: 999px;
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
  max-width: 200px;
  overflow: hidden;
  padding: 6px 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  margin: 0 auto;
  max-width: 1440px;
  padding: 18px clamp(16px, 4vw, 44px) 60px;
}

/* ============== Hero ============== */

.status-band {
  align-items: center;
  background:
    linear-gradient(120deg, rgba(0, 70, 50, 0.94) 0%, rgba(0, 128, 93, 0.74) 55%, rgba(0, 50, 36, 0.92) 100%),
    url("https://images.unsplash.com/photo-1517248135467-4c7edcad34c4?auto=format&fit=crop&w=1800&q=80");
  background-position: center;
  background-size: cover;
  border-radius: var(--radius);
  color: #fff;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.85fr);
  padding: clamp(28px, 4vw, 48px);
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.eyebrow.light,
.status-band .eyebrow {
  color: rgba(255, 255, 255, 0.85);
}

h1 {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.01em;
  max-width: 760px;
}

h2 {
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

h3 {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.hero-copy {
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.5;
  margin-top: 14px;
  max-width: 640px;
}

.source-note {
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  align-items: flex-start;
}

.source-note a {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  color: var(--green-deep);
  font-weight: 700;
  font-size: 13px;
  padding: 7px 12px;
  text-decoration: none;
}

/* ============== Stats grid ============== */

.stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0;
}

.stats-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stats-grid span {
  color: var(--ink);
  display: block;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.stats-grid small,
.muted,
.meta-line,
.address-line,
.inspection-line {
  color: var(--muted);
}

.muted.small {
  font-size: 12px;
}

/* ============== Filter bar ============== */

.filter-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 14px;
  padding: 14px 16px;
  position: sticky;
  top: 70px;
  z-index: 5;
}

.filter-row {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(0, 1fr)) auto auto auto;
}

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

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

input,
select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 12px;
  width: 100%;
  transition: border-color 0.15s;
}

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--green);
  outline: 3px solid rgba(0, 128, 93, 0.18);
  outline-offset: 0;
}

.checkline {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  font-weight: 600;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  white-space: nowrap;
}

.checkline input {
  height: 16px;
  min-height: 16px;
  width: 16px;
  margin: 0;
}

button {
  background: var(--ink);
  border: 0;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 16px;
  transition: filter 0.15s, transform 0.05s;
}

button:hover {
  filter: brightness(0.92);
}

button:active {
  transform: translateY(1px);
}

.secondary {
  background: var(--green);
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost:hover {
  background: #f5f5f0;
  filter: none;
}

/* ============== Quick links / chip rail ============== */

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.quick-links button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  min-height: unset;
  padding: 9px 16px;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.quick-links button:hover {
  border-color: var(--green);
  color: var(--green);
  filter: none;
}

.quick-links button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* ============== Results header ============== */

.section-head {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 22px 0 14px;
}

.section-head.compact {
  margin: 0 0 10px;
}

.count-pill {
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 8px 14px;
}

/* ============== Restaurant grid ============== */

.restaurant-list {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.restaurant-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.restaurant-card:hover,
.restaurant-card:focus-visible {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  outline: none;
}

/* Card hero — cuisine-matched photo with grade-tinted gradient overlay */
.card-hero {
  align-items: flex-end;
  background-image: var(--photo-url);
  background-position: center;
  background-size: cover;
  color: #fff;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr auto;
  height: 170px;
  overflow: hidden;
  padding: 18px 20px;
  position: relative;
}
.card-hero-overlay {
  bottom: 0;
  left: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 0;
}
.card-hero.grade-a .card-hero-overlay {
  background: linear-gradient(135deg, rgba(0, 90, 63, 0.86) 0%, rgba(0, 128, 93, 0.55) 50%, rgba(0, 50, 36, 0.78) 100%);
}
.card-hero.grade-b .card-hero-overlay {
  background: linear-gradient(135deg, rgba(120, 60, 10, 0.86) 0%, rgba(177, 96, 16, 0.55) 50%, rgba(80, 40, 10, 0.78) 100%);
}
.card-hero.grade-c .card-hero-overlay {
  background: linear-gradient(135deg, rgba(120, 30, 10, 0.88) 0%, rgba(214, 65, 35, 0.62) 50%, rgba(80, 20, 10, 0.82) 100%);
}
.card-hero.grade-pending .card-hero-overlay {
  background: linear-gradient(135deg, rgba(40, 40, 40, 0.82) 0%, rgba(100, 100, 100, 0.55) 50%, rgba(40, 40, 40, 0.82) 100%);
}
.card-hero > * { position: relative; z-index: 1; }
.card-hero .grade-letter {
  font-size: 60px;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
.card-hero .grade-letter small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.2;
  margin-top: 6px;
  opacity: 0.85;
  text-shadow: none;
  text-transform: uppercase;
}
.card-hero .score-badge {
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  padding: 8px 12px;
  text-align: center;
}
.card-hero .score-badge strong {
  display: block;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
}
.card-hero .score-badge span {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin-top: 4px;
  opacity: 0.9;
  text-transform: uppercase;
}
.card-hero .ribbon {
  background: rgba(0, 0, 0, 0.32);
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 4px 9px;
  position: absolute;
  right: 12px;
  text-transform: uppercase;
  top: 12px;
}
.card-hero .save-button {
  background: rgba(255, 255, 255, 0.94);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  min-height: unset;
  padding: 6px 12px;
  position: absolute;
  right: 12px;
  text-transform: uppercase;
  top: 12px;
}
.card-hero .save-button.saved {
  background: var(--ink);
  color: #fff;
}
/* Watch list ribbon overrides save when present (saved button moves to bottom) */
.card-hero:has(.ribbon) .save-button {
  bottom: 12px;
  top: auto;
}

.restaurant-card .card-body {
  display: grid;
  gap: 6px;
  padding: 16px 20px 18px;
}
.restaurant-card .card-body h3 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.012em;
  line-height: 1.22;
  margin: 0;
}
.restaurant-card .stats-row {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 600;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 10px;
}
.restaurant-card .stats-row strong {
  color: var(--ink);
  display: block;
  font-size: 13px;
  margin-top: 2px;
}
.restaurant-card .stats-row .danger strong { color: var(--red); }
.restaurant-card .stats-row .warn strong { color: var(--amber); }

.restaurant-card:hover .card-photo,
.restaurant-card:focus-visible .card-photo {
  transform: scale(1.04);
}

.card-photo-frame {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  position: relative;
}

.card-photo {
  background:
    linear-gradient(180deg, rgba(20, 20, 20, 0) 55%, rgba(20, 20, 20, 0.32)),
    var(--photo-url);
  background-position: center;
  background-size: cover;
  height: 100%;
  transition: transform 0.4s ease;
  width: 100%;
}

.card-photo-top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  left: 12px;
  position: absolute;
  right: 12px;
  top: 12px;
}

.card-photo-bottom {
  bottom: 12px;
  display: flex;
  justify-content: flex-end;
  left: 12px;
  position: absolute;
  right: 12px;
}

.save-button {
  background: rgba(255, 255, 255, 0.96);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(20, 20, 20, 0.18);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  min-height: unset;
  padding: 7px 14px;
  position: absolute;
  right: 12px;
  text-transform: uppercase;
  top: 12px;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}

.save-button:hover {
  background: var(--ink);
  color: #fff;
  filter: none;
}

.save-button.saved {
  background: var(--green);
  color: #fff;
}

.save-button.saved:hover {
  background: var(--green-deep);
}

.pill {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(20, 20, 20, 0.18);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 6px 11px;
  text-transform: uppercase;
}

.pill.clean {
  background: var(--green);
  color: #fff;
}

.pill.danger {
  background: var(--red);
  color: #fff;
}

.grade-pill {
  background: #fff;
  border: 0;
  border-radius: 12px;
  color: var(--green-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  height: 44px;
  min-width: 44px;
  padding: 0 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
}

.grade-pill.warn {
  background: var(--amber-bg);
  border-color: rgba(181, 96, 16, 0.28);
  color: var(--amber);
}

.grade-pill.danger {
  background: var(--red-bg);
  border-color: rgba(214, 65, 35, 0.28);
  color: var(--red);
}

.card-body {
  display: grid;
  gap: 10px;
  padding: 16px 18px 18px;
}

.card-title-row {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.card-title-row h3 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.012em;
  line-height: 1.2;
}

.clean-score {
  background: var(--mint);
  border-radius: 8px;
  color: var(--green-deep);
  font-size: 13px;
  font-weight: 800;
  padding: 5px 10px;
  white-space: nowrap;
}

.rating-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 6px;
}

.rating-row strong {
  font-size: 16px;
  font-weight: 800;
}

.rating-row .muted {
  font-size: 13px;
}

.demo-tag,
.live-tag,
.soon-tag,
.unclaimed-tag {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  text-transform: uppercase;
}

.demo-tag {
  background: #f1efe8;
  color: var(--muted);
}

.unclaimed-tag {
  background: #f1efe8;
  color: var(--muted);
}


.unclaimed-tag.light {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.9);
}

.live-tag {
  background: var(--mint);
  color: var(--green-deep);
}

.soon-tag {
  background: var(--amber-bg);
  color: var(--amber);
}

.demo-tag.light {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.9);
}

.live-tag.light {
  background: rgba(0, 200, 140, 0.28);
  color: #d6ffe9;
}

.platform-chip.demo {
  opacity: 0.85;
}

.platform-chip.live {
  border-color: rgba(0, 128, 93, 0.4);
}

.stars {
  color: var(--gold);
  display: inline-flex;
  font-size: 16px;
  letter-spacing: 1px;
  line-height: 1;
}

.star.empty {
  color: #e0d8c2;
}

.star.half {
  background: linear-gradient(90deg, var(--gold) 50%, #e0d8c2 50%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.platform-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.platform-chip {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  padding: 4px 9px 4px 4px;
}

.platform-mark {
  align-items: center;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 10px;
  font-weight: 900;
  height: 22px;
  justify-content: center;
  letter-spacing: 0.02em;
  min-width: 22px;
  padding: 0 6px;
}

.platform-mark.google {
  background: #4285f4;
}

.platform-mark.yelp {
  background: #d32323;
}

.platform-mark.ubereats {
  background: #06c167;
}

.platform-mark.doordash {
  background: #ff3008;
}

.meta-line {
  align-items: center;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
  gap: 8px;
}

.dot {
  background: var(--muted-soft);
  border-radius: 50%;
  display: inline-block;
  height: 3px;
  width: 3px;
}

.address-line {
  font-size: 13px;
  margin-top: -2px;
}

.inspection-line {
  background: var(--paper);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.action-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.action-link:hover {
  border-color: var(--ink);
}

.action-link.google:hover {
  background: #4285f4;
  border-color: #4285f4;
  color: #fff;
}

.action-link.yelp:hover {
  background: #d32323;
  border-color: #d32323;
  color: #fff;
}

.empty-state {
  background: var(--panel);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  grid-column: 1 / -1;
  padding: 56px 28px;
  text-align: center;
}

/* ============== Badges (legacy + detail) ============== */

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
}

.badge.clean {
  background: var(--mint);
  border-color: rgba(0, 128, 93, 0.22);
  color: var(--green-deep);
}

.badge.warn {
  background: var(--amber-bg);
  border-color: rgba(181, 96, 16, 0.28);
  color: var(--amber);
}

.badge.danger {
  background: var(--red-bg);
  border-color: rgba(214, 65, 35, 0.28);
  color: var(--red);
}

/* ============== Rankings / blog / alerts panels ============== */

.rankings-panel,
.alerts-panel,
.blog-panel,
.favorites-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-top: 26px;
  padding: 22px;
}

.favorites-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.favorite-row {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 12px 14px;
  transition: border-color 0.15s, background-color 0.15s;
}

.favorite-row:hover {
  background: #fff;
  border-color: var(--green);
}

.favorite-row strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 4px;
}

.favorite-row .small {
  font-size: 12px;
}

.favorite-row .ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  min-height: 32px;
  padding: 6px 12px;
}

.favorite-row .ghost:hover {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
}

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

.ranking-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ranking-card:hover {
  border-color: var(--green);
  box-shadow: var(--shadow-sm);
}

.ranking-card button {
  margin-top: 14px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ranking-card button:hover {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

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

.blog-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.blog-image {
  background:
    linear-gradient(180deg, transparent 40%, rgba(20, 20, 20, 0.62)),
    var(--photo-url);
  background-position: center;
  background-size: cover;
  min-height: 180px;
  position: relative;
}

.blog-image span {
  bottom: 14px;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  left: 14px;
  position: absolute;
  right: 14px;
}

.blog-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.blog-body button {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  justify-self: start;
}

.blog-body button:hover {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.alerts-panel {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 0.9fr) minmax(340px, 1.1fr);
}

.alert-form {
  display: grid;
  gap: 12px;
}

.alert-form button {
  background: var(--green);
}

.saved-alerts {
  grid-column: 1 / -1;
}

.saved-alert {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 8px;
  padding: 10px 12px;
}

/* ============== Detail dialog ============== */

.detail-dialog {
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(20, 20, 20, 0.32);
  max-width: min(980px, calc(100vw - 28px));
  padding: 0;
  width: 980px;
}

.detail-dialog::backdrop {
  background: rgba(15, 24, 19, 0.55);
}

.icon-button {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  height: 36px;
  justify-content: center;
  min-height: 36px;
  padding: 0;
  position: absolute;
  right: 14px;
  top: 14px;
  width: 36px;
  z-index: 2;
}

.detail-layout {
  display: grid;
  gap: 18px;
  padding: 0 22px 22px;
}

.detail-hero {
  background:
    linear-gradient(180deg, rgba(20, 20, 20, 0) 30%, rgba(20, 20, 20, 0.85) 100%),
    var(--photo-url);
  background-position: center;
  background-size: cover;
  border-radius: var(--radius) var(--radius) 0 0;
  color: #fff;
  display: flex;
  align-items: flex-end;
  margin: 0 -22px;
  min-height: 340px;
  padding: 32px;
  position: relative;
}

.detail-hero h2 {
  color: #fff;
  font-size: clamp(28px, 3.4vw, 40px);
  margin-top: 8px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.detail-hero-overlay {
  display: grid;
  gap: 8px;
}

.detail-address {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
}

.detail-rating {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 8px;
  margin-top: 6px;
}

.detail-rating .stars {
  font-size: 18px;
}

.detail-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 6px;
}

.detail-summary div {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: left;
}

.detail-summary strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  white-space: nowrap;
}

.detail-summary div:nth-child(4) strong {
  font-size: 15px;
  letter-spacing: 0;
}

.detail-summary .muted {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-summary .grade-pill {
  box-shadow: none;
  font-size: 16px;
  height: 32px;
}

.reviews-panel,
.history-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.review-list {
  display: grid;
  gap: 10px;
}

.review-row {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 8px;
  grid-template-columns: 28px 100px 1fr auto auto auto;
  padding: 10px 12px;
}

.review-row.coming-soon {
  grid-template-columns: 28px 1fr;
}

.review-row .platform-name {
  font-weight: 700;
}

.review-row .review-stars {
  display: inline-flex;
}

.review-row a {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  text-decoration: none;
}

.review-row a:hover {
  border-color: var(--green);
  color: var(--green);
}

.inspection-history {
  display: grid;
  gap: 10px;
}

.inspection-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.inspection-item ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.closed-note {
  background: var(--mint);
  border: 1px solid rgba(0, 128, 93, 0.22);
  border-radius: var(--radius-sm);
  color: var(--green-deep);
  font-weight: 700;
  padding: 10px 12px;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.source-actions a {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  text-decoration: none;
}

.source-actions a:hover {
  border-color: var(--green);
  color: var(--green);
}

/* ============== Responsive ============== */

/* ============== Settings dialog ============== */

.settings-dialog {
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(20, 20, 20, 0.32);
  max-width: min(560px, calc(100vw - 28px));
  padding: 0;
  width: 560px;
}

.settings-dialog::backdrop {
  background: rgba(15, 24, 19, 0.55);
}

.settings-body {
  display: grid;
  gap: 14px;
  padding: 24px;
  position: relative;
}

.settings-head {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.settings-head .icon-button {
  position: static;
}

.settings-notes {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  list-style: disc;
  margin: 0;
  padding: 14px 16px 14px 32px;
}

.settings-notes li + li {
  margin-top: 6px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.settings-actions button {
  background: var(--green);
}

.settings-actions .ghost {
  background: transparent;
  color: var(--ink);
}

.status-good {
  color: var(--green-deep) !important;
  font-weight: 700;
}

.danger-text {
  color: var(--red) !important;
  font-weight: 700;
}

/* ============== Cookie banner ============== */
.cookie-banner {
  align-items: center;
  background: var(--ink);
  border-radius: 12px;
  bottom: 22px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
  color: #fff;
  display: flex;
  gap: 12px;
  left: 22px;
  max-width: 460px;
  padding: 14px 16px;
  position: fixed;
  right: 22px;
  z-index: 60;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { font-size: 13px; line-height: 1.5; margin: 0; }
.cookie-banner a { color: #fff; text-decoration: underline; }
.cookie-banner button {
  background: #fff;
  color: var(--ink);
  flex: 0 0 auto;
  font-size: 13px;
  min-height: 36px;
  padding: 0 16px;
}

/* ============== Site footer ============== */
.site-footer {
  background: #1d2327;
  color: #d2d4d6;
  margin-top: 60px;
  padding: 36px clamp(16px, 4vw, 44px) 0;
}
.site-footer strong {
  color: #fff;
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
}
.site-footer .eyebrow {
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
}
.site-footer .muted {
  color: #9fa3a7;
}
.site-footer-inner {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 1280px;
  padding-bottom: 28px;
}
.site-footer-inner a {
  color: #6ed1ad;
  display: block;
  font-weight: 600;
  margin-top: 4px;
  text-decoration: none;
}
.site-footer-inner a:hover {
  color: #fff;
  text-decoration: underline;
}
.site-footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0 auto;
  max-width: 1280px;
  padding: 18px 0 24px;
}
.site-footer-bottom .muted {
  color: #6f7378;
  font-size: 12px;
}
@media (max-width: 800px) {
  .site-footer-inner {
    gap: 22px;
    grid-template-columns: 1fr;
  }
}

/* ============== Legal pages ============== */
.legal-page {
  margin: 0 auto;
  max-width: 760px;
  padding: 36px clamp(16px, 4vw, 44px) 60px;
}
.legal-page h1 {
  font-size: clamp(28px, 4vw, 40px);
  margin: 8px 0 18px;
}
.legal-page h2 {
  font-size: 20px;
  margin: 28px 0 8px;
}
.legal-page p, .legal-page li {
  font-size: 15px;
  line-height: 1.6;
}
.legal-page ul { padding-left: 20px; }
.legal-page li { margin-bottom: 6px; }
.legal-page a {
  color: var(--green-deep);
  text-decoration: underline;
}

.admin-override {
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  margin-top: 14px;
  padding: 12px 14px;
}

.admin-override-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.admin-override-row input {
  flex: 1;
  min-height: 38px;
}

.admin-override-row button {
  min-height: 38px;
  padding: 0 16px;
}

.admin-place-status:empty {
  display: none;
}

.auth-dialog .auth-signed-only {
  display: none;
}

.auth-divider {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  gap: 12px;
  letter-spacing: 0.08em;
  margin: 6px 0;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  background: var(--line);
  content: "";
  flex: 1;
  height: 1px;
}

.auth-google-btn {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 600;
  gap: 10px;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  width: 100%;
}
.auth-google-btn:hover {
  background: #f5f5f0;
  filter: none;
}

.auth-dialog.signed-in .auth-signed-only {
  display: inline-flex;
}

/* Subtle pulse while live data is being fetched */
.detail-dialog.loading .detail-rating::after {
  animation: pulse 1.2s ease-in-out infinite;
  background: var(--gold);
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 8px;
  margin-left: 6px;
  width: 8px;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

@media (max-width: 1100px) {
  .filter-row {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .filter-row .field {
    grid-column: span 1;
  }
  .filter-row .field:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .status-band,
  .alerts-panel {
    grid-template-columns: 1fr;
  }

  .ranking-grid,
  .stats-grid,
  .blog-grid,
  .detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-row {
    grid-template-columns: 28px 1fr;
    grid-auto-flow: row;
  }

  .review-row .platform-name {
    grid-column: 2;
  }

  .review-row .review-stars,
  .review-row strong,
  .review-row .muted,
  .review-row a {
    grid-column: 2;
  }
}

.filter-mobile-head {
  display: none;
}

.see-results-btn {
  display: none;
}

.filters-fab,
.back-to-top {
  display: none;
}

.back-to-top {
  align-items: center;
  background: var(--ink);
  border: 0;
  border-radius: 50%;
  bottom: 22px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  color: #fff;
  cursor: pointer;
  height: 48px;
  justify-content: center;
  padding: 0;
  position: fixed;
  right: 22px;
  width: 48px;
  z-index: 40;
}

.back-to-top:hover {
  background: #000;
  filter: none;
}

body.scrolled .back-to-top {
  display: flex;
}

@media (max-width: 640px) {
  .topbar {
    align-items: center;
    flex-direction: row;
    padding: 10px 14px;
  }

  .brand small {
    display: none;
  }

  .nav-toggle,
  .header-search {
    display: flex;
  }

  .nav {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    position: absolute;
    right: 12px;
    top: 60px;
    width: 220px;
    z-index: 30;
  }

  .nav.open {
    display: flex;
  }

  .status-band {
    grid-template-columns: 1fr;
    padding: 14px 16px;
    gap: 8px;
  }

  .status-band h1 {
    font-size: 18px;
    line-height: 1.2;
  }

  .status-band .eyebrow {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .hero-copy,
  .status-band .source-note {
    display: none;
  }

  /* Hide the filter bar by default on mobile. FAB opens it as a sheet. */
  .filter-bar {
    display: none;
  }

  .filter-bar.open-mobile {
    background: var(--paper);
    border-radius: 18px 18px 0 0;
    bottom: 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 10px;
    left: 0;
    max-height: 86vh;
    overflow-y: auto;
    padding: 16px 16px 24px;
    position: fixed;
    right: 0;
    top: auto;
    z-index: 50;
  }

  .filter-bar.open-mobile::before {
    background: var(--line-strong);
    border-radius: 999px;
    content: "";
    display: block;
    height: 4px;
    margin: 0 auto 6px;
    width: 44px;
  }

  .filter-mobile-head {
    display: none; /* replaced by FAB pattern */
  }

  .filter-bar.open-mobile .filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .filter-bar.open-mobile .quick-links {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .filter-bar.open-mobile .see-results-btn {
    background: var(--green);
    color: #fff;
    display: block;
    font-size: 16px;
    margin-top: 4px;
    min-height: 48px;
    width: 100%;
  }

  .filters-fab {
    align-items: center;
    background: var(--green);
    border: 0;
    border-radius: 50%;
    bottom: 22px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    color: #fff;
    cursor: pointer;
    display: none;
    height: 56px;
    justify-content: center;
    padding: 0;
    position: fixed;
    right: 22px;
    width: 56px;
    z-index: 40;
  }


  .filters-fab:hover {
    background: var(--green-deep);
    filter: none;
  }

  /* Backdrop when sheet is open */
  body.filters-mobile-open::after {
    background: rgba(15, 24, 19, 0.5);
    bottom: 0;
    content: "";
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 45;
  }

  body.filters-mobile-open .filters-fab {
    display: none;
  }

  .ranking-grid,
  .blog-grid,
  .detail-summary,
  .restaurant-list {
    grid-template-columns: 1fr;
  }

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

  .stats-grid article {
    padding: 8px 6px;
    text-align: center;
  }

  .stats-grid span {
    font-size: 16px;
  }

  .stats-grid small {
    font-size: 10px;
    line-height: 1.2;
  }

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

/* ============== SEO pages ============== */

.seo-main {
  margin: 0 auto;
  max-width: 1280px;
  padding: 28px clamp(16px, 4vw, 44px) 60px;
}

.seo-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(22px, 3.4vw, 36px);
  margin-bottom: 22px;
}

.seo-hero h1 {
  font-size: clamp(28px, 3.4vw, 40px);
  margin-bottom: 12px;
}

.seo-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.seo-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.18s ease;
}

.seo-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.seo-card-link {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
}

.seo-card-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.seo-card h3 {
  font-size: 17px;
  margin: 4px 0 0;
}

.breadcrumbs {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.breadcrumbs a {
  color: var(--green-deep);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.seo-detail-hero {
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  margin-bottom: 22px;
  padding: clamp(20px, 3vw, 32px);
}

.seo-detail-hero h1 {
  font-size: clamp(28px, 3.6vw, 42px);
  margin: 8px 0 12px;
}

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

.seo-grade-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.seo-grade-box strong,
.seo-grade-box .grade-pill {
  display: inline-block;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}

.seo-grade-box small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.seo-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  padding: clamp(18px, 2.4vw, 28px);
}

.seo-section h2 {
  margin-bottom: 12px;
}

.violation-list {
  margin: 12px 0 0;
  padding-left: 18px;
}

.violation-list li {
  margin-bottom: 6px;
}

.cta-button {
  background: var(--green);
  border-radius: 999px;
  color: #fff;
  display: inline-block;
  font-weight: 700;
  margin-top: 8px;
  padding: 12px 22px;
  text-decoration: none;
}

.cta-button:hover {
  background: var(--green-deep);
}

.watchlist-banner {
  background: var(--red-bg);
  border: 1px solid rgba(214, 65, 35, 0.28);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-weight: 700;
  margin-bottom: 18px;
  padding: 12px 16px;
}

.seo-footer {
  background: var(--panel);
  border-top: 1px solid var(--line);
  margin-top: 60px;
  padding: 28px clamp(16px, 4vw, 44px);
}

.seo-footer-inner {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 1280px;
}

.seo-footer a {
  color: var(--green-deep);
  display: block;
  font-weight: 600;
  margin-top: 4px;
  text-decoration: none;
}

.seo-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 800px) {
  .seo-detail-hero,
  .seo-footer-inner {
    grid-template-columns: 1fr;
  }
}
