/* Theme tokens copied verbatim from the approved "Dance Finder B" design. */
:root {
  --bg:#e7e5df; --text:#222; --subtitle:#6f6d68; --card:#fff; --ink:#2b2b2b;
  --muted:#9a988f; --muted2:#777; --label:#555; --panel:#fbfaf7; --field:#fff;
  --field-text:#333; --field-border:#888; --divider:#e2e0da; --dash:#e6e4de;
  --chrome:#f4f3f0; --chrome-border:#b8b6b0; --link:#2f5fbf; --accent:#e8a33d;
  --highlight:#fdf3df; --overlay:rgba(43,43,43,0.34); --shadow:rgba(43,43,43,0.18);
}
[data-theme="dark"] {
  --bg:#181818; --text:#e9e7e1; --subtitle:#9a988f; --card:#222; --ink:#cfcdc6;
  --muted:#8f8d86; --muted2:#a6a39c; --label:#b8b5ad; --panel:#262626; --field:#1d1d1d;
  --field-text:#d8d6cf; --field-border:#666; --divider:#383838; --dash:#333;
  --chrome:#2c2c2c; --chrome-border:#444; --link:#86a8ff; --accent:#e8a33d;
  --highlight:#3a3320; --overlay:rgba(0,0,0,0.55); --shadow:rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: 'Architects Daughter', 'Comic Sans MS', cursive;
  background: var(--bg); color: var(--text); transition: background .2s;
}

.app-wrap { min-height: 100vh; display: flex; }
.card { flex: 1; min-width: 0; background: var(--card); display: flex; min-height: 100vh; }

/* ---- sidebar ---- */
.sidebar {
  width: 236px; flex: none; border-right: 1.5px solid var(--divider);
  padding: 18px 16px; display: flex; flex-direction: column; gap: 20px; background: var(--panel);
}
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { font-size: 22px; }
.theme-toggle {
  flex: none; cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center;
  justify-content: center; border: 1.5px solid var(--ink); border-radius: 50%;
  background: var(--card); color: var(--text); font-size: 15px;
}
.section-label { font-size: 12px; color: var(--muted); font-family: monospace; margin-bottom: 9px; }
.checks { display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.check { color: var(--muted); cursor: pointer; user-select: none; }
.check.on { color: var(--text); }

.field {
  padding: 8px 10px; border: 1.5px solid var(--field-border); border-radius: 6px;
  background: var(--field); font-size: 13px; color: var(--field-text);
}
.link { color: var(--link); cursor: pointer; }
.disabled { opacity: .5; pointer-events: none; }
.radius-row { font-size: 13px; color: var(--label); margin-top: 13px; display: flex; justify-content: space-between; }
.slider { height: 7px; border: 1.5px solid var(--field-border); border-radius: 6px; margin-top: 6px; position: relative; background: var(--field); }
.slider .knob { position: absolute; left: 45%; top: -5px; width: 14px; height: 14px; background: var(--accent); border: 1.5px solid var(--ink); border-radius: 50%; }

.dates { display: flex; flex-direction: column; gap: 8px; }
.date-pair { display: flex; align-items: center; gap: 8px; }
.date-pair .date-lbl { flex: none; width: 34px; font-size: 12px; color: var(--muted); font-family: monospace; }
.date-field {
  flex: 1; min-width: 0; width: 100%; padding: 7px 8px; border: 1.5px solid var(--field-border);
  border-radius: 6px; background: var(--field); color: var(--field-text);
  font-family: inherit; font-size: 13px;
}
.radios { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.radio-row {
  display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 5px 8px;
  margin: -5px -8px; border-radius: 5px; color: var(--muted); background: transparent; user-select: none;
}
.radio-row.on { color: var(--text); background: var(--highlight); }

/* ---- content ---- */
.content { flex: 1; padding: 18px 20px; display: flex; flex-direction: column; min-width: 0; }
.content-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.count { font-size: 16px; color: var(--label); }
.tabs { display: inline-flex; border: 1.5px solid var(--field-border); border-radius: 6px; overflow: hidden; font-size: 13px; }
.tab { cursor: pointer; padding: 6px 14px; color: var(--label); user-select: none; }
.tab.on { background: var(--accent); color: #222; }

.list-head, .row { display: grid; grid-template-columns: 1fr 92px 110px 56px 80px 120px; gap: 0; }
.list-head { font-size: 12px; color: var(--muted); font-family: monospace; padding-bottom: 8px; border-bottom: 1.5px solid var(--ink); }
.list-head .sortable { cursor: pointer; user-select: none; }
.row { font-size: 14px; padding: 11px 0; cursor: pointer; border-bottom: 1.5px dashed var(--dash); background: transparent; }
.row:hover { background: var(--highlight); }
.row.sel { background: var(--highlight); }
.row .cell-muted { color: var(--muted2); }
.row.cancelled .series-name { text-decoration: line-through; color: var(--muted); }
.series-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.series-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 9px; border: 1.5px solid var(--ink); border-radius: 3px; padding: 0 5px; white-space: nowrap; }
.empty { color: var(--muted); font-size: 14px; padding: 24px 0; }

#mapView { flex: 1; display: flex; flex-direction: column; min-height: 0; }
/* z-index:0 + position contains Leaflet's internal z-indexes so they can't paint over the modal */
#map { flex: 1; min-height: 380px; border: 1.5px solid var(--divider); border-radius: 6px; position: relative; z-index: 0; }
.map-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.leaflet-container { font-family: inherit; }

/* location / radius controls */
.loc-status { font-size: 12px; color: var(--muted); margin-top: 6px; min-height: 14px; }
.loc-status.active { color: var(--link); cursor: pointer; }
.radius-range { width: 100%; margin-top: 6px; accent-color: var(--accent); cursor: pointer; }

/* ---- modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: center;
  justify-content: center; padding: 24px; z-index: 5000;   /* above Leaflet panes/controls (~1000) */
}
.modal {
  width: 380px; max-width: 100%; background: var(--card); border: 2px solid var(--ink);
  border-radius: 6px; padding: 22px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 7px 7px 0 var(--shadow);
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-title { font-size: 23px; line-height: 1.15; color: var(--text); }
.modal-close { font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-when { font-size: 14px; color: var(--label); }
.modal-divider { height: 1.5px; background: var(--divider); }
.modal-field { font-size: 14px; color: var(--text); line-height: 1.5; }
.modal-field .lbl { color: var(--muted); }
.modal-link { font-size: 14px; color: var(--link); text-decoration: none; }
.modal-actions { display: flex; gap: 8px; margin-top: 4px; }
.btn { flex: 1; text-align: center; padding: 10px; border: 1.5px solid var(--ink); border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--text); background: var(--card); }
.btn.primary { background: var(--accent); color: #222; }
.hidden { display: none !important; }

/* sidebar "add a listing" + modal "report" affordances */
.add-btn {
  margin-top: 4px; text-align: center; padding: 9px; border: 1.5px solid var(--ink);
  border-radius: 6px; font-size: 14px; cursor: pointer; color: var(--text); background: var(--card);
}
/* secondary, rare action — tucked into the modal's bottom-right corner, muted */
.report-row { text-align: right; margin-top: 2px; }
.report-link { font-size: 11px; color: var(--muted); cursor: pointer; }
.report-link:hover { color: var(--link); text-decoration: underline; }

/* submission form modal */
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 12px; color: var(--muted); font-family: monospace; }
.form-input {
  width: 100%; padding: 8px 10px; border: 1.5px solid var(--field-border); border-radius: 6px;
  background: var(--field); color: var(--field-text); font-family: inherit; font-size: 14px;
}
textarea.form-input { resize: vertical; min-height: 56px; }
.form-status { font-size: 13px; min-height: 16px; color: var(--muted); }
.form-status.ok { color: #2e7d32; }
.form-status.err { color: #c0392b; }
/* honeypot: kept in the DOM and focusable-by-bots, but off-screen for humans */
.hp-wrap { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }
