:root {
  --bg: #f7f4ed;
  --surface: #ffffff;
  --surface-2: #eef5f0;
  --text: #1e2930;
  --muted: #62727a;
  --line: #d7dfda;
  --brand: #0f766e;
  --brand-dark: #0b5f59;
  --brand-soft: #d9f2ec;
  --accent: #ca8a04;
  --danger: #b42318;
  --warning: #8a5a00;
  --shadow: 0 18px 40px rgba(15, 45, 49, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--brand);
}

.loading-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
}

.app-shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(30, 41, 48, 0.1);
  background: rgba(247, 244, 237, 0.94);
  backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  position: relative;
}

.brand-lockup {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 0;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}

.brand-title {
  display: block;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.main-nav {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 220px;
  position: absolute;
  top: calc(100% + 8px);
  right: 20px;
  z-index: 20;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 8px;
}

.site-header.is-menu-open .main-nav {
  display: flex;
}

.admin-nav-slot {
  display: contents;
}

.menu-toggle {
  display: inline-grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 8px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.nav-link,
.button,
.ghost-button,
.danger-button,
.status-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  gap: 8px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 9px 14px;
  text-decoration: none;
  font-weight: 700;
}

.nav-link {
  color: var(--text);
  justify-content: flex-start;
  width: 100%;
}

.nav-link.is-active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button:hover,
.button:focus-visible {
  background: var(--brand-dark);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.ghost-button,
.status-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.ghost-button:hover,
.ghost-button:focus-visible,
.status-button:hover,
.status-button:focus-visible {
  border-color: var(--brand);
  color: var(--brand-dark);
}

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

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 20px 48px;
}

.page-narrow {
  max-width: 820px;
}

.embed-page {
  min-height: auto;
  background: transparent;
}

.embed-page .page {
  padding: 0;
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.4rem);
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
}

h3 {
  font-size: 1.05rem;
}

.lead {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 24px;
}

.confirmation-page {
  display: grid;
  min-height: calc(100svh - 110px);
  place-items: center;
}

.confirmation-panel {
  width: min(100%, 760px);
  padding: 34px;
  text-align: center;
}

.confirmation-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.confirmation-panel h1 {
  margin-top: 16px;
}

.confirmation-panel .lead {
  margin-inline: auto;
}

.confirmation-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.admin-login-panel {
  width: min(100%, 820px);
  margin-inline: auto;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

label,
.label {
  color: #263238;
  font-weight: 800;
}

fieldset {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

legend {
  padding: 0;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.text-input,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #bac8c2;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 12px 13px;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

.text-input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
  outline: 0;
}

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

.item-option {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border: 1px solid #adc0b8;
  border-radius: var(--radius);
  background: #fbfaf5;
  padding: 8px 12px;
  color: var(--text);
  user-select: none;
}

.item-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.item-key {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #8fb2a7;
  border-radius: 6px;
  color: var(--brand);
  font-weight: 900;
}

.item-label {
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 800;
}

.item-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.item-option:has(input:focus-visible) {
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.message {
  display: none;
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.45;
}

.message.is-visible {
  display: block;
}

.message.success {
  border: 1px solid #a7d7c5;
  background: #ecfdf3;
  color: #0f5132;
}

.message.error {
  border: 1px solid #f3b8b1;
  background: #fff2f0;
  color: var(--danger);
}

.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.setup-panel {
  padding: 22px;
}

.setup-list {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.65;
}

.map-page {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 0;
  max-width: none;
  min-width: 0;
  height: calc(100svh - 69px);
  min-height: calc(100svh - 69px);
  padding: 0;
  overflow: hidden;
}

.map-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: calc(100svh - 69px);
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}

.map-sidebar-header {
  flex: 0 0 auto;
  min-width: 0;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
  margin-top: 0;
  overflow: visible;
  padding-bottom: 0;
}

.filter-chip {
  flex: 0 1 auto;
  max-width: 100%;
  min-height: 36px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 7px 12px;
  font-weight: 400;
}

.filter-chip.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.map-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.listing-card {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  overflow: visible;
}

.listing-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 8px;
}

.listing-card h3 {
  min-width: 0;
  margin: 0;
  line-height: 1.18;
  overflow-wrap: anywhere;
  word-break: normal;
}

.address-link {
  color: inherit;
  text-decoration: none;
}

.address-link:hover,
.address-link:focus-visible {
  color: var(--brand-dark);
  text-decoration: underline;
}

.directions-link {
  flex: 0 0 auto;
  color: var(--brand-dark);
  font-size: 0.86rem;
  font-weight: 400;
  text-decoration: none;
}

.directions-link:hover,
.directions-link:focus-visible {
  text-decoration: underline;
}

.item-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #20463f;
  padding: 4px 9px;
  font-size: 0.84rem;
  font-weight: 400;
}

.map-canvas {
  position: sticky;
  top: 69px;
  height: calc(100svh - 69px);
  min-height: calc(100svh - 69px);
  background: #dde7e0;
}

.map-empty {
  display: grid;
  min-height: 280px;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.map-info {
  max-width: 250px;
  color: var(--text);
}

.map-info strong {
  display: block;
  margin-bottom: 5px;
}

.map-info p {
  margin: 0 0 8px;
}

.admin-layout {
  display: grid;
  gap: 18px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  padding: 0;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-button:hover,
.link-button:focus-visible {
  color: var(--brand);
}

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

.stat {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  padding: 14px;
  text-align: left;
  font: inherit;
}

.stat:hover,
.stat:focus-visible {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.stat.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.stat-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 900;
}

.status-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.status-button.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.admin-list {
  display: grid;
  gap: 14px;
}

.admin-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.admin-access-card {
  background: #fbfdfb;
}

.admin-access-form {
  align-items: end;
}

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

.admin-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.admin-user-main {
  min-width: 0;
}

.admin-user-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 3px 8px;
  font-size: 0.74rem;
}

.role-badge.muted {
  background: #e2e8f0;
  color: #475569;
}

.admin-uid {
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
}

.admin-user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-user-edit {
  grid-column: 1 / -1;
  width: 100%;
}

.admin-edit-actions {
  align-self: end;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: capitalize;
}

.status-pill.pending {
  background: #fff7db;
  color: var(--warning);
}

.status-pill.approved {
  background: #dcfce7;
  color: #166534;
}

.status-pill.draft {
  background: #e2e8f0;
  color: #334155;
}

.status-pill.rejected {
  background: #fee2e2;
  color: #991b1b;
}

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

.detail {
  min-width: 0;
}

.detail-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-value {
  overflow-wrap: anywhere;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.edit-panel {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.inline-warning {
  border: 1px solid #efd58a;
  border-radius: var(--radius);
  background: #fff8df;
  color: #6c4b00;
  padding: 10px 12px;
}

@media (max-width: 860px) {
  .site-header {
    position: static;
  }

  .intro-band,
  .admin-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 10px;
  }

  .main-nav {
    flex: 0 0 100%;
    min-width: 0;
    position: static;
    width: 100%;
  }

  .intro-band {
    display: block;
  }

  .form-grid,
  .item-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-page {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(258px, 41svh) auto;
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .map-canvas {
    order: 1;
    position: relative;
    top: auto;
    height: auto;
    min-height: 41svh;
  }

  .map-sidebar {
    order: 2;
    height: auto;
    min-height: auto;
    border-right: 0;
    border-top: 1px solid var(--line);
    overflow: visible;
  }

  .map-sidebar-header {
    padding: 16px 14px 10px;
  }

  .map-sidebar-header .lead {
    font-size: 0.96rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .map-list {
    flex: 0 0 auto;
    min-height: auto;
    padding: 12px;
    overflow: visible;
    overscroll-behavior: auto;
    scrollbar-gutter: auto;
  }

  .listing-card {
    padding: 12px;
  }

  .listing-card h3 {
    font-size: 1rem;
  }

  .listing-title-row {
    align-items: flex-start;
    gap: 8px;
  }

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

  .admin-toolbar-actions {
    align-items: stretch;
    width: 100%;
  }

  .link-button {
    justify-content: center;
  }

  .admin-user-row {
    grid-template-columns: 1fr;
  }

  .admin-user-actions,
  .admin-edit-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-actions .button,
  .admin-user-row .danger-button,
  .admin-user-row .ghost-button,
  .admin-edit-actions .button,
  .admin-actions .ghost-button,
  .admin-actions .danger-button,
  .admin-actions .status-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .header-inner {
    padding: 10px 12px;
  }

  .main-nav {
    width: 100%;
  }

  .brand-title {
    font-size: 0.98rem;
    line-height: 1.12;
  }

  .page {
    padding: 18px 12px 34px;
  }

  .page h1 {
    font-size: 2rem;
  }

  .lead {
    font-size: 0.98rem;
    line-height: 1.48;
  }

  .form-panel {
    padding: 16px;
  }

  .confirmation-page {
    min-height: auto;
  }

  .confirmation-panel {
    padding: 24px 18px;
  }

  .text-input,
  textarea {
    font-size: 16px;
    min-height: 48px;
  }

  .button,
  .ghost-button,
  .danger-button,
  .status-button {
    width: 100%;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .map-page {
    grid-template-rows: minmax(252px, 40svh) auto;
  }

  .map-canvas {
    min-height: 40svh;
  }

  .filter-row {
    gap: 6px;
  }

  .filter-chip {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 0.8rem;
    line-height: 1;
  }

  .item-option {
    min-height: 54px;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 561px) and (max-width: 860px) and (hover: hover) and (pointer: fine) {
  .map-page {
    grid-template-columns: minmax(360px, 42vw) minmax(0, 1fr);
    grid-template-rows: auto;
    height: calc(100svh - 69px);
    min-height: calc(100svh - 69px);
    overflow: hidden;
  }

  .map-canvas {
    order: initial;
    position: sticky;
    top: 69px;
    height: calc(100svh - 69px);
    min-height: calc(100svh - 69px);
  }

  .map-sidebar {
    order: initial;
    height: calc(100svh - 69px);
    min-height: 0;
    border-top: 0;
    border-right: 1px solid var(--line);
    overflow: hidden;
  }

  .map-list {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px;
    overflow-x: hidden;
    overflow-y: scroll;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
}

@media (max-width: 390px) {
  .filter-chip {
    padding-inline: 7px;
    font-size: 0.76rem;
  }

  .admin-actions {
    grid-template-columns: 1fr;
  }

}
