:root {
  --paper: #e7e2d2;
  --paper-raised: #f1ecdd;
  --ink: #23281e;
  --ink-soft: #565b4d;
  --moss: #3f5d3a;
  --clay: #b5652d;
  --steel: #46707d;
  --mustard: #a8842b;
  --plum: #6b4a5e;
  --line: #bdb69d;
  --line-strong: #8f886f;
  --focus: #1d6fb8;
  --danger: #a3392b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'Fraunces', serif; font-weight: 600; margin: 0; text-align: left; }
body, p, div, label, li { text-align: left; }

a { color: var(--focus); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

button {
  font-family: inherit;
  cursor: pointer;
}

.btn {
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
}
.btn:hover { background: var(--paper); }
.btn.primary { background: var(--moss); border-color: var(--moss); color: #fff; }
.btn.primary:hover { background: #35502f; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #862c20; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input[type="checkbox"], input[type="radio"] {
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  flex: none;
  accent-color: var(--ink);
}
label { font-size: 0.8rem; font-weight: 500; display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }

/* --- app shell shared by index.html --- */
.app {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "header header" "sidebar map";
  min-height: 100vh;
}
header.top {
  grid-area: header;
  padding: 20px 28px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
header.top h1 { font-size: clamp(1.4rem, 2.2vw, 1.9rem); letter-spacing: -0.01em; margin-bottom: 4px; text-align: left; }
header.top p { margin: 0; color: var(--ink-soft); font-size: 0.9rem; max-width: 60ch; line-height: 1.45; text-align: left; }

aside.sidebar {
  grid-area: sidebar;
  border-right: 1px solid var(--line);
  padding: 16px 16px 24px;
  overflow-y: auto;
  max-height: calc(100vh - 96px);
}

.filter-row {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: 3px; cursor: pointer;
  font-size: 0.86rem; user-select: none;
}
.filter-row:hover { background: var(--paper-raised); }
.swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.size-dot { border-radius: 50%; background: var(--ink-soft); flex: none; }

.filter-group { margin-bottom: 4px; }
.filter-group-heading {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-soft); font-family: 'IBM Plex Sans', sans-serif;
  border-top: 1px solid var(--line); padding-top: 12px; margin: 10px 0 4px;
}
.filter-group:first-child .filter-group-heading { border-top: none; padding-top: 0; }
.scroll-filters { max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; padding: 4px; }

.op-block {
  border: 1px solid var(--line-strong); border-radius: 5px; padding: 14px 14px 4px;
  margin-bottom: 14px; background: rgba(255,255,255,0.4);
}
.op-block-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.85rem; }

.mat-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.mat-badge {
  font-size: 0.68rem; background: var(--paper); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 2px 7px; color: var(--ink-soft);
}

.place-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px; border-radius: 3px; cursor: pointer; border: 1px solid transparent;
}
.place-item:hover { background: var(--paper-raised); }
.place-item .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; }
.place-item .name { font-size: 0.84rem; font-weight: 500; line-height: 1.3; }
.place-item .borough { font-size: 0.75rem; color: var(--ink-soft); }

main.mapwrap { grid-area: map; position: relative; }
#leaflet-map { width: 100%; height: 100%; }

.pin-icon {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* --- modal --- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 20, 14, 0.45);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--paper-raised); border-radius: 6px; border: 1px solid var(--line-strong);
  width: 460px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 20px 22px 22px; position: relative;
}
.modal h2 { font-size: 1.2rem; margin-bottom: 4px; }
.modal .sub { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 16px; }
.modal button.close {
  position: absolute; top: 12px; right: 14px; background: none; border: none;
  font-size: 1.2rem; color: var(--ink-soft);
}

.pick-row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.pick-row .coords { font-size: 0.78rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.picking #leaflet-map { cursor: crosshair; }

.msg { font-size: 0.82rem; padding: 10px 12px; border-radius: 4px; margin-bottom: 12px; }
.msg.success { background: #e4ecdf; color: var(--moss); border: 1px solid var(--moss); }
.msg.error { background: #f3e0da; color: var(--danger); border: 1px solid var(--danger); }

.floating-btn {
  position: absolute; right: 16px; bottom: 16px; z-index: 400;
}

.leaflet-popup-content h3 { font-size: 0.95rem; margin-bottom: 2px; }
.leaflet-popup-content .cat-tag {
  display: inline-block; font-size: 0.68rem; color: #fff; padding: 2px 7px; border-radius: 8px; margin-bottom: 6px;
}
.leaflet-popup-content .borough { font-size: 0.75rem; color: var(--ink-soft); margin-bottom: 6px; }
.leaflet-popup-content .desc { font-size: 0.82rem; line-height: 1.4; margin-bottom: 8px; }
.leaflet-popup-content .contact { font-size: 0.78rem; line-height: 1.6; border-top: 1px dashed var(--line); padding-top: 6px; }
.leaflet-popup-content .contact div { display: flex; gap: 6px; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; grid-template-areas: "header" "sidebar" "map"; }
  aside.sidebar { max-height: 220px; border-right: none; border-bottom: 1px solid var(--line); }
}

/* --- admin --- */
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 28px 20px 60px; }
.admin-wrap header { margin-bottom: 24px; }
.admin-wrap header p { color: var(--ink-soft); font-size: 0.9rem; margin-top: 4px; }
.login-box {
  max-width: 340px; margin: 60px auto; background: var(--paper-raised);
  border: 1px solid var(--line); border-radius: 6px; padding: 24px;
}
.login-box h2 { margin-bottom: 14px; font-size: 1.2rem; }
.pending-card {
  background: var(--paper-raised); border: 1px solid var(--line);
  border-radius: 6px; padding: 16px 18px; margin-bottom: 14px;
}
.pending-card h3 { font-size: 1.05rem; margin-bottom: 2px; }
.pending-card .meta { font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 10px; }
.pending-card .desc { font-size: 0.85rem; margin-bottom: 10px; line-height: 1.5; }
.pending-card .contact { font-size: 0.8rem; color: var(--ink-soft); margin-bottom: 12px; line-height: 1.6; }
.pending-card .actions { display: flex; gap: 8px; }
.empty-state { color: var(--ink-soft); font-size: 0.9rem; padding: 40px 0; text-align: center; }
