:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --input: #ffffff;
  --accent: #0f172a;
  --accent-text: #ffffff;
  --wp: #2563eb;
  --req: #dc2626;
  --nav: #16a34a;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --panel: #111827;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #1f2937;
    --input: #0b1120;
    --accent: #e5e7eb;
    --accent-text: #0f172a;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, textarea { font: inherit; color: inherit; }

.app { display: flex; flex-direction: column; min-height: 100%; }
.map { height: 58vh; min-height: 320px; flex: none; z-index: 0; }
.panel { background: var(--panel); padding: 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 400px 1fr; height: 100vh; }
  .panel { grid-column: 1; grid-row: 1; overflow-y: auto; border-right: 1px solid var(--border); }
  .map { grid-column: 2; grid-row: 1; height: 100%; }
}

.title-input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 20px;
  font-weight: 650;
  padding: 4px 0;
  outline: none;
}
.title-input::placeholder { color: var(--muted); font-weight: 500; }

.share-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.status { margin: 8px 0 0; font-size: 13px; color: var(--muted); min-height: 1em; overflow-wrap: anywhere; }
.status a { color: inherit; }

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 550;
}
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.danger { color: var(--req); }
.btn.subtle { border: 0; background: transparent; padding: 8px 0; margin-top: 12px; }
.btn:disabled { opacity: .6; cursor: default; }

.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-top: 14px; }
.card summary { cursor: pointer; font-weight: 600; }
.card textarea {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input);
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  resize: vertical;
}
.paste-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.hint:empty { display: none; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; cursor: pointer; font-size: 14px; }
.seg input:checked + span { background: var(--border); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--wp); outline-offset: -2px; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.wp { background: var(--wp); }
.dot.req { background: var(--req); }

.list-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.list-head h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); font-weight: 400; }
.filters { display: flex; gap: 12px; font-size: 13px; }
.filters label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

.list { list-style: none; margin: 10px 0 0; padding: 0; }
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.item.active { background: color-mix(in srgb, var(--wp) 8%, transparent); }
.badge {
  flex: none;
  min-width: 34px;
  height: 28px;
  border-radius: 14px;
  border: 0;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 8px;
}
.badge.wp { background: var(--wp); }
.badge.req { background: var(--req); }
.item-main { flex: 1; min-width: 0; cursor: pointer; }
.item .name {
  width: 100%;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: transparent;
  padding: 2px 0;
  outline: none;
}
.item .name:focus { border-bottom-color: var(--muted); }
.item .name::placeholder { color: var(--muted); }
.coords { display: block; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-btn {
  flex: none;
  background: var(--nav);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 8px;
}
.del { flex: none; border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 4px; }
.del:hover { color: var(--req); }
.empty { color: var(--muted); font-size: 14px; }

/* Map markers and popups */
.pin {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font: 700 11px/1 system-ui, sans-serif;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  width: 26px;
  height: 26px;
}
.pin.wp { background: var(--wp); }
.pin.req { background: var(--req); border-radius: 4px; transform: rotate(45deg); }
.pin.req span { transform: rotate(-45deg); }
.me-dot { width: 16px; height: 16px; background: #0ea5e9; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 6px rgba(14, 165, 233, .25); }

.leaflet-popup-content { margin: 12px 14px; min-width: 200px; font: 14px/1.4 system-ui, sans-serif; }
.pop-title { font-weight: 650; font-size: 15px; margin-bottom: 2px; }
.pop-cat { font-size: 12px; font-weight: 600; }
.pop-cat.wp { color: var(--wp); }
.pop-cat.req { color: var(--req); }
.pop-coords { color: #64748b; font-size: 12px; margin: 4px 0 10px; font-variant-numeric: tabular-nums; }
.pop-name { width: 100%; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 6px; margin-bottom: 8px; color: #0f172a; background: #fff; }
.pop-nav {
  display: block;
  text-align: center;
  background: var(--nav);
  color: #fff !important;
  text-decoration: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: 650;
}
