:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #667085;
  --line: #d8dee8;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-solid: #ffffff;
  --field: #f7f9fb;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --danger: #b42318;
  --shadow: 0 16px 38px rgba(22, 34, 51, 0.18);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background: #eef2f6;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.map {
  position: absolute;
  inset: 0;
  background: #dde6df;
}

.map-topbar {
  position: absolute;
  z-index: 500;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.brand,
.segmented,
.top-actions,
.map-status,
.sheet,
.leaflet-control {
  pointer-events: auto;
}

.brand {
  display: inline-grid;
  min-width: 52px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(30, 41, 59, 0.12);
  border-radius: var(--radius);
  color: #0f3f3c;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  text-decoration: none;
  font-weight: 800;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  height: 40px;
  padding: 3px;
  border: 1px solid rgba(30, 41, 59, 0.12);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.segment {
  min-width: 0;
  border: 0;
  border-radius: 6px;
  color: #475467;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.segment.is-active {
  color: #ffffff;
  background: var(--brand);
}

.top-actions {
  display: flex;
  gap: 6px;
}

.icon-button,
.button {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  border: 1px solid rgba(30, 41, 59, 0.14);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
}

.icon-button.primary,
.button.primary {
  color: #ffffff;
  border-color: var(--brand);
  background: var(--brand);
}

.button {
  padding: 0 14px;
}

.button.danger {
  color: #ffffff;
  border-color: var(--danger);
  background: var(--danger);
}

.button-row,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.text-link {
  width: auto;
  padding: 0 12px;
  font-size: 0.82rem;
}

.map-status {
  position: absolute;
  z-index: 520;
  left: 14px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  max-width: min(340px, calc(100vw - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(30, 41, 59, 0.12);
  border-radius: var(--radius);
  color: #344054;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
}

.sheet {
  position: absolute;
  z-index: 540;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  max-height: min(74vh, 680px);
  overflow: auto;
  border: 1px solid rgba(30, 41, 59, 0.16);
  border-radius: 8px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.sheet[hidden],
.sheet-view[hidden],
.map-status[hidden],
.photo-strip[hidden] {
  display: none;
}

.sheet-grip {
  position: sticky;
  top: 0;
  width: 52px;
  height: 4px;
  margin: 10px auto 2px;
  border-radius: 99px;
  background: #c8d0da;
}

.sheet-view {
  padding: 10px 14px 16px;
}

.sheet-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.sheet h1,
.login-card h1,
.admin-header h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.sheet h2,
.admin-section h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.score-row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 28px;
  margin: 12px 0;
  color: #344054;
  font-weight: 700;
}

.score-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  background: #6b7280;
}

.photo-strip {
  display: grid;
  grid-auto-columns: 96px;
  grid-auto-flow: column;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.photo-strip img {
  width: 96px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.reviews {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.review-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.review-card strong {
  display: block;
  margin-bottom: 4px;
}

.review-card p {
  margin: 6px 0 0;
  color: #344054;
}

.stacked-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.stacked-form label {
  display: grid;
  gap: 5px;
  color: #344054;
  font-size: 0.86rem;
  font-weight: 800;
}

.stacked-form input,
.stacked-form select,
.stacked-form textarea,
.inline-form input,
.copy-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--field);
  padding: 10px 11px;
}

.stacked-form textarea {
  resize: vertical;
}

.two-col,
.rating-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rating-grid label:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.exit-marker {
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff;
  background: var(--marker-color, #6b7280);
  box-shadow: 0 2px 9px rgba(15, 23, 42, 0.35);
  transform: rotate(45deg);
}

.leaflet-container {
  font-family: inherit;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
  background: linear-gradient(180deg, #dfeee9 0%, #f4f1ea 100%);
}

.login-card {
  width: min(390px, 100%);
  padding: 22px;
  border: 1px solid rgba(30, 41, 59, 0.12);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.form-error,
.notice {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #fff4ed;
  color: #9a3412;
  font-weight: 700;
}

.notice {
  background: #ecfdf3;
  color: #067647;
}

.admin-page {
  background: #f4f6f8;
}

.admin-shell {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.admin-section {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

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

th {
  color: #475467;
  font-size: 0.76rem;
  text-transform: uppercase;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-list li {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.admin-list span,
.admin-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

@media (min-width: 760px) {
  .map-topbar {
    left: 18px;
    right: auto;
    grid-template-columns: auto 360px auto;
  }

  .sheet {
    left: auto;
    right: 18px;
    bottom: 18px;
    width: 390px;
    max-height: calc(100vh - 108px);
  }
}

@media (max-width: 560px) {
  .map-topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .top-actions {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .segment {
    font-size: 0.76rem;
  }

  .two-col,
  .rating-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-header {
    align-items: flex-start;
  }
}
