:root {
  --bg: #faf4e8;
  --bg-elev: #ffffff;
  --ink: #2b2118;
  --ink-soft: #5a4a3d;
  --ink-muted: #8a7a6c;
  --line: #e6dccb;
  --line-strong: #d4c5ab;

  --forest: #2d5e3e;
  --forest-deep: #1f4530;
  --tan: #d4a574;
  --tan-deep: #b3854f;
  --barn: #8b3a3a;
  --ridge: #3a5a78;
  --honey: #e7b73b;

  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(43, 33, 24, 0.06), 0 2px 6px rgba(43, 33, 24, 0.04);
  --shadow-md: 0 4px 14px rgba(43, 33, 24, 0.10), 0 2px 6px rgba(43, 33, 24, 0.06);

  --font-serif: "Fraunces", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.25rem; }

a { color: var(--forest); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--ink-muted); }
.hint { font-size: 0.85rem; color: var(--ink-muted); margin: -0.25rem 0 0.5rem; }

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-link { display: flex; align-items: center; gap: 0.75rem; color: inherit; }
.brand-link:hover { text-decoration: none; }
.brand-mark { font-size: 1.75rem; }
.brand-text h1 { font-size: 1.25rem; color: var(--forest-deep); }
.tagline { margin: 0; font-size: 0.8rem; color: var(--ink-muted); font-style: italic; }
.site-nav { display: flex; gap: 1.25rem; }
.site-nav a { font-weight: 500; color: var(--ink-soft); }
.site-nav a.muted { color: var(--ink-muted); }

/* ---------- Map layout ---------- */
.map-shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: calc(100vh - 65px);
  height: calc(100dvh - 65px); /* dvh adapts to mobile browser chrome */
}
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg-elev);
  overflow-y: auto;
  padding: 1rem 1rem 2rem;
}
.sidebar h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.filters { margin-bottom: 1.5rem; }
.category-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--tan-deep); color: var(--ink); }
.chip.active {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--bg);
}
/* Delivers filter — same chip shape, honey accent so it reads as a different axis. */
.chip-delivers { margin-left: 0.35rem; }
.chip-delivers.active {
  background: var(--honey);
  border-color: var(--honey);
  color: var(--ink);
}

.delivery-badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--honey);
  color: var(--ink);
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.stand-list-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.5rem; }
.count { font-size: 0.8rem; color: var(--ink-muted); }
.stand-list { list-style: none; padding: 0; margin: 0; }
.stand-list .empty { color: var(--ink-muted); font-style: italic; padding: 0.5rem 0; }
.stand-item {
  padding: 0.7rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}
.stand-item:hover { background: var(--bg); border-color: var(--line); }
.stand-item.active { background: #f3ead7; border-color: var(--tan); }
.stand-item h4 { margin: 0 0 0.15rem; font-family: var(--font-serif); font-size: 1rem; color: var(--forest-deep); }
.stand-item p { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.stand-item .categories { font-size: 0.75rem; color: var(--ink-muted); margin-top: 0.2rem; }

.map-pane { position: relative; }
#map { width: 100%; height: 100%; background: #e8e0d0; }
.map-status {
  position: absolute; top: 1rem; left: 50%; transform: translateX(-50%);
  background: var(--barn); color: white; padding: 0.6rem 1rem; border-radius: 8px;
  font-size: 0.9rem; box-shadow: var(--shadow-md); z-index: 5;
}

/* ---------- Detail card ---------- */
.detail-card {
  position: fixed;
  bottom: 1rem; right: 1rem;
  width: 360px; max-width: calc(100vw - 2rem);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 30;
}
.detail-card .close {
  position: absolute; top: 0.5rem; right: 0.6rem;
  background: rgba(255,255,255,0.85);
  border: none; width: 32px; height: 32px; border-radius: 50%;
  font-size: 1.3rem; line-height: 1; cursor: pointer;
  color: var(--ink-soft);
}
.detail-card .close:hover { background: white; color: var(--ink); }
.detail-photo {
  height: 140px;
  background: linear-gradient(135deg, var(--forest) 0%, var(--tan) 100%);
  background-size: cover; background-position: center;
}
.detail-body { padding: 1rem 1.25rem 1.25rem; }
.detail-body h3 { color: var(--forest-deep); margin-bottom: 0.25rem; }
.detail-categories {
  margin: 0 0 0.75rem;
  font-size: 0.8rem; color: var(--tan-deep);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.detail-meta { margin: 0 0 1rem; }
.meta-row { margin-bottom: 0.6rem; }
.meta-row dt {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-muted); margin-bottom: 0.15rem; font-weight: 600;
}
.meta-row dd { margin: 0; color: var(--ink); font-size: 0.92rem; }
.weekly-hours-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.18rem 0.8rem;
}
.weekly-hours-list .day {
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.weekly-hours-list .time { font-size: 0.9rem; }
.weekly-hours-list .closed {
  color: var(--ink-muted);
  font-style: italic;
}
.directions-link {
  display: inline-block; padding: 0.5rem 0.9rem;
  background: var(--forest); color: var(--bg);
  border-radius: 8px; font-weight: 500; font-size: 0.9rem;
}
.directions-link:hover { background: var(--forest-deep); text-decoration: none; }

/* ---------- Forms ---------- */
.form-shell { max-width: 720px; margin: 2rem auto; padding: 0 1.25rem 4rem; }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card h2 { color: var(--forest-deep); margin-bottom: 0.5rem; }
.card-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.card.success { border-color: var(--forest); background: #f0f6ee; }

.stand-form { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 0.5rem; }
.stand-form label {
  display: flex; flex-direction: column; gap: 0.35rem;
  font-size: 0.85rem; color: var(--ink-soft); font-weight: 500;
}
.stand-form input[type=text],
.stand-form input[type=email],
.stand-form input[type=password],
.stand-form input[type=number],
.stand-form input[type=time],
.stand-form textarea {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}
.stand-form input:focus, .stand-form textarea:focus {
  outline: none;
  border-color: var(--forest);
  background: var(--bg-elev);
  box-shadow: 0 0 0 3px rgba(45, 94, 62, 0.12);
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.input-wrap { position: relative; }
.autocomplete-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
}
.autocomplete-item {
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.active {
  background: #f3ead7;
  color: var(--forest-deep);
}
.autocomplete-item .secondary {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-top: 0.1rem;
}

/* ---------- Hours form ---------- */
.hours-fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.85rem 0.85rem;
  margin: 0;
}
.hours-fieldset legend {
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 500;
  padding: 0 0.4rem;
}
.hours-mode-toggle {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.7rem;
  font-size: 0.9rem;
}
.hours-mode-toggle label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  cursor: pointer;
}
.hours-section input[type=text].hours-text {
  width: 100%;
}
.hours-weekly { display: flex; flex-direction: column; gap: 0.15rem; }
/* `display: flex` above overrides the `hidden` attribute's default — restore it. */
.hours-section[hidden] { display: none; }
.day-row {
  display: grid;
  grid-template-columns: 44px 1fr auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}
.day-row .day-label { font-weight: 500; color: var(--ink-soft); font-size: 0.9rem; }
.day-row .day-dash { color: var(--ink-muted); text-align: center; }
.day-row input[type=time] { padding: 0.4rem 0.5rem; font-size: 0.9rem; }
.day-row input[type=time]:disabled { opacity: 0.4; }
.day-closed-wrap {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem !important;
  color: var(--ink-muted);
  font-weight: 400 !important;
  cursor: pointer;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.4rem;
  margin-top: 0.25rem;
}
.checkbox-grid label {
  display: flex; flex-direction: row; align-items: center; gap: 0.4rem;
  font-size: 0.9rem; color: var(--ink); font-weight: 400;
  padding: 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); cursor: pointer;
}
.checkbox-grid label:has(input:checked) {
  border-color: var(--forest); background: #eef4ec; color: var(--forest-deep);
}

.form-actions { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.5rem; flex-wrap: wrap; }
.status { font-size: 0.85rem; color: var(--ink-muted); }
.status.ok { color: var(--forest); }
.status.err { color: var(--barn); }
.error { color: var(--barn); font-size: 0.9rem; margin-top: 0.5rem; }

button.primary, .button-link {
  font: inherit; font-weight: 500;
  background: var(--forest); color: var(--bg);
  border: none; padding: 0.6rem 1.1rem; border-radius: 8px; cursor: pointer;
  display: inline-block; text-decoration: none;
}
button.primary:hover, .button-link:hover { background: var(--forest-deep); text-decoration: none; }
button.primary:disabled { background: var(--ink-muted); cursor: not-allowed; }

button.ghost {
  font: inherit; background: transparent; color: var(--ink-soft);
  border: 1px solid var(--line-strong); padding: 0.55rem 1rem; border-radius: 8px; cursor: pointer;
}
button.ghost:hover { background: var(--bg); color: var(--ink); }

/* ---------- Admin list ---------- */
.admin-list { list-style: none; padding: 0; margin: 0; }
.admin-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 0; border-bottom: 1px solid var(--line);
  gap: 1rem;
}
.admin-list li:last-child { border-bottom: none; }
.admin-list .meta h4 { margin: 0 0 0.1rem; font-family: var(--font-serif); font-size: 1rem; color: var(--forest-deep); }
.admin-list .meta p { margin: 0; font-size: 0.85rem; color: var(--ink-muted); }
.admin-list .actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.admin-list .actions button {
  font: inherit; font-size: 0.85rem;
  background: transparent; border: 1px solid var(--line-strong);
  padding: 0.3rem 0.65rem; border-radius: 6px; cursor: pointer; color: var(--ink-soft);
}
.admin-list .actions button:hover { background: var(--bg); color: var(--ink); }
.admin-list .actions button.danger:hover { background: var(--barn); color: white; border-color: var(--barn); }
.admin-list .actions button.approve:hover { background: var(--forest); color: white; border-color: var(--forest); }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  /* Stack the sidebar above the map. auto/1fr lets the map claim the remaining space. */
  .map-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 35vh;
    padding: 0.75rem 0.85rem 1rem;
  }
  .sidebar h2 { font-size: 0.7rem; margin-bottom: 0.4rem; }
  .filters { margin-bottom: 1rem; }
  .stand-list-header { margin-bottom: 0.25rem; }
  .stand-item { padding: 0.55rem 0.5rem; }
  .stand-item h4 { font-size: 0.95rem; }

  .detail-card { right: 0.5rem; left: 0.5rem; bottom: 0.5rem; width: auto; }
  .detail-photo { height: 110px; }

  .site-header { padding: 0.5rem 0.75rem; }
  .brand { gap: 0.5rem; }
  .brand-mark { font-size: 1.4rem; }
  .brand-text h1 { font-size: 1rem; }
  .tagline { font-size: 0.72rem; }
  .site-nav { gap: 0.85rem; }
  .site-nav a { font-size: 0.85rem; white-space: nowrap; }

  .row-2 { grid-template-columns: 1fr; }
  .form-shell { margin: 1rem auto; padding: 0 0.85rem 3rem; }
  .card { padding: 1.1rem 1.1rem; }
  .day-row {
    grid-template-columns: 40px 1fr auto 1fr;
    grid-template-areas:
      "label open dash close"
      "closed closed closed closed";
    row-gap: 0.2rem;
  }
  .day-row .day-label { grid-area: label; }
  .day-row .day-open { grid-area: open; }
  .day-row .day-dash { grid-area: dash; }
  .day-row .day-close { grid-area: close; }
  .day-row .day-closed-wrap { grid-area: closed; justify-self: start; padding-left: 48px; }
}

@media (max-width: 480px) {
  /* Very narrow phones — hide the tagline to keep the header on one line. */
  .tagline { display: none; }
  .brand-text h1 { font-size: 0.98rem; }
  .site-nav { gap: 0.7rem; }
  .site-nav a { font-size: 0.8rem; }
  .sidebar { max-height: 32vh; }
}
