:root {
  --bg: #f7f8f6;
  --panel: #ffffff;
  --ink: #222624;
  --muted: #68706b;
  --line: #dfe4df;
  --green: #0f8f68;
  --green-soft: #e3f5ee;
  --amber: #b96e00;
  --amber-soft: #fff1d6;
  --coral: #c94f3d;
  --coral-soft: #ffe7e2;
  --teal: #087d8d;
  --shadow: 0 12px 30px rgba(31, 38, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
}

.side-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #fbfcfa;
  padding: 24px;
}

.brand-block,
.map-toolbar,
.rankings-header,
.top-strip,
.split-controls,
.search-row,
.legend,
.tabs {
  display: flex;
  align-items: center;
}

.brand-block,
.map-toolbar,
.rankings-header {
  justify-content: space-between;
  gap: 18px;
}

.brand-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.brand-block h1,
.map-toolbar h2,
.rankings-header h2,
.detail-panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 28px;
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #b7d8d4;
  border-radius: 999px;
  background: #edf8f6;
  color: #075d66;
  font-size: 12px;
  font-weight: 800;
}

.language-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid #cbd5cf;
  border-radius: 999px;
  background: #fff;
}

.lang-button {
  min-width: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 900;
}

.lang-button.is-active {
  background: var(--green-soft);
  color: #075f51;
}

.control-section,
.detail-panel,
.creator-card,
.summary-card,
.insight-card,
.rankings-section,
.map-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-section,
.detail-panel,
.creator-card {
  margin-top: 20px;
  padding: 18px;
}

.creator-card {
  box-shadow: none;
}

.creator-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: 0;
}

.creator-card p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.creator-links {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.creator-links a {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #cbd5cf;
  border-radius: 999px;
  background: #fff;
  color: #075f51;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.creator-links a:hover {
  border-color: #0e7d6b;
  background: var(--green-soft);
}

.field-label {
  display: block;
  margin: 14px 0 7px;
  color: #39413c;
  font-size: 12px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  border: 1px solid #cfd7d0;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 10px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(8, 125, 141, 0.2);
  border-color: var(--teal);
}

.search-row {
  gap: 8px;
}

.icon-button {
  flex: 0 0 40px;
  height: 40px;
  border: 1px solid #cfd7d0;
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.split-controls {
  align-items: flex-end;
  gap: 12px;
}

.split-controls label {
  flex: 1 1 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: #303632;
  font-weight: 700;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

.muted {
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.metric-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfb;
}

.metric-grid span,
.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.metric-grid strong,
.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.detail-link {
  display: inline-flex;
  margin-top: 14px;
  color: var(--teal);
  font-weight: 850;
  text-decoration: none;
}

.main-panel {
  min-width: 0;
  padding: 24px;
}

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

.summary-card {
  padding: 16px;
}

.map-section {
  margin-top: 18px;
  overflow: hidden;
}

.map-toolbar {
  padding: 18px 18px 12px;
}

.map-toolbar h2,
.rankings-header h2 {
  font-size: 22px;
}

#map,
.fallback-map {
  height: min(58vh, 620px);
  min-height: 430px;
  border-top: 1px solid var(--line);
}

.legend {
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border-radius: 50%;
  vertical-align: -1px;
}

.dot.clean {
  background: var(--green);
}

.dot.warm {
  background: var(--amber);
}

.dot.hot {
  background: var(--coral);
}

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

.insight-card {
  padding: 18px;
}

.insight-card h3 {
  margin: 0 0 8px;
  font-size: 19px;
}

.insight-card p:last-child {
  margin: 0;
  color: #47504a;
  line-height: 1.45;
}

.accent-green {
  border-top: 5px solid var(--green);
}

.accent-amber {
  border-top: 5px solid var(--amber);
}

.accent-coral {
  border-top: 5px solid var(--coral);
}

.rankings-section {
  margin-top: 18px;
  overflow: hidden;
}

.rankings-header {
  padding: 18px;
  align-items: flex-start;
}

.tabs {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tab {
  border: 1px solid #cbd5cf;
  border-radius: 999px;
  background: #fff;
  color: #39413c;
  padding: 8px 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.tab.is-active {
  border-color: #0e7d6b;
  background: var(--green-soft);
  color: #075f51;
}

.table-wrap {
  overflow: auto;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7f4;
  color: #4d5751;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

tr {
  cursor: pointer;
}

tr:hover {
  background: #f8fbf9;
}

.restaurant-name {
  font-weight: 850;
}

.subtext {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 850;
}

.badge.clean {
  background: var(--green-soft);
  color: #0b654c;
}

.badge.notice {
  background: var(--amber-soft);
  color: #845000;
}

.badge.hot {
  background: var(--coral-soft);
  color: #993427;
}

.star-bars {
  display: grid;
  gap: 7px;
}

.star-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
  color: #4d5751;
  font-size: 12px;
  font-weight: 800;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ece8;
}

.bar-fill {
  display: block;
  min-width: 2px;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.bar-fill.is-empty {
  min-width: 0;
}

.leaflet-popup-content {
  margin: 10px 12px;
}

.popup-title {
  margin: 0 0 5px;
  font-weight: 900;
}

.popup-meta {
  margin: 0;
  color: #58625c;
}

.fallback-map {
  position: relative;
  background: #eef3ef;
}

.fallback-point {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 720px) {
  .side-panel,
  .main-panel {
    padding: 16px;
  }

  .top-strip,
  .insight-grid,
  .split-controls {
    grid-template-columns: 1fr;
    display: grid;
  }

  .map-toolbar,
  .rankings-header,
  .brand-block {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  #map,
  .fallback-map {
    min-height: 360px;
  }
}
