/* Dead Drop admin: the app's near-black ground, lime accent and mono labels. */
:root {
  color-scheme: dark;
  --ground: #0D0D0F; --surface: #17171B; --surface2: #1C1C21; --border: #2A2A31;
  --text: #F4F4F5; --soft: #C4C4CC; --muted: #A1A1AA; --accent: #D4FF3A; --danger: #FF6B5A;
  --people: #D4FF3A; --drop: #F4F4F5; --spot: #7CF2FF; --thread: #C9A7FF;
  --mono: Menlo, 'Roboto Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: 15px/1.45 -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); font-size: 14px; }
.tag { display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: 2px; color: var(--ground); background: var(--accent);
       border-radius: 6px; padding: 2px 6px; vertical-align: middle; font-weight: 700; }

.btn { border: 0; border-radius: 999px; background: var(--accent); color: var(--ground); font-weight: 800; padding: 12px 22px; }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--accent); padding: 0; }

/* Sign in */
.gate { min-height: 100%; display: grid; place-items: center; padding: 32px 16px; }
.gate-card { text-align: center; max-width: 360px; width: 100%; }
.gate h1 { font-size: 40px; letter-spacing: 4px; margin: 0; font-weight: 800; }
.gate .tag { margin: 8px 0 20px; }
.gate .btn { width: 100%; margin-top: 10px; }
.lock { width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 36px; border: 2px solid var(--accent); color: var(--accent); display: grid; place-items: center; }

/* Layout */
.app { display: grid; grid-template-columns: 1fr 420px; height: 100%; }
.map-wrap { position: relative; min-height: 0; }
.map { position: absolute; inset: 0; }
.side { background: var(--ground); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }

.topbar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { font-weight: 800; letter-spacing: 3px; background: rgba(13,13,15,.85); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; }
.stats { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.stat { font-family: var(--mono); font-size: 12px; color: var(--muted); background: rgba(13,13,15,.85); border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; }
.stat b { color: var(--text); font-weight: 700; }
.stat.warn b { color: var(--danger); }

.placing { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--ground); font-weight: 700;
           border-radius: 12px; padding: 10px 14px; max-width: calc(100% - 32px); }
.placing .link { color: var(--ground); text-decoration: underline; margin-left: 8px; }

.layers { position: absolute; left: 12px; bottom: 28px; background: rgba(13,13,15,.9); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px 10px; margin: 0; }
.layers legend { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; color: var(--accent); padding: 0 4px; }
.layers label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--soft); padding: 2px 0; cursor: pointer; }
.layers input { accent-color: var(--accent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 5px; }
.dot.people { background: var(--people); box-shadow: 0 0 6px var(--people); }
.dot.drop { background: var(--drop); }
.dot.spot { border: 2px solid var(--spot); }
.dot.thread { background: var(--thread); }

/* Sidebar */
.side-head { padding: 12px 16px 0; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 6px; }
.tab { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13px; }
.tab.on { background: var(--text); color: var(--ground); border-color: var(--text); }
.badge { background: var(--danger); color: var(--ground); border-radius: 999px; padding: 0 6px; font-size: 11px; margin-left: 2px; }
.who { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; font-size: 13px; gap: 8px; }
.who .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.list { overflow-y: auto; padding: 12px 16px 24px; flex: 1; }
.empty { color: var(--muted); text-align: center; padding: 40px 12px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; }
.item:hover { border-color: #3A3A43; }
.item.sel { border-color: var(--accent); }
.item.off { opacity: .55; }
.meta { font-family: var(--mono); font-size: 11px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.meta .who-name { font-family: inherit; font-weight: 700; }
.pill { border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; }
.pill.team { color: var(--ground); background: var(--accent); border-color: var(--accent); }
.pill.bad { color: var(--danger); border-color: var(--danger); }
.text { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.counts { font-family: var(--mono); font-size: 11px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }

.detail { border-bottom: 1px solid var(--border); padding: 14px 16px; background: var(--surface2); max-height: 60%; overflow-y: auto; }
.detail h3 { margin: 0 0 4px; font-size: 16px; }
.detail .close { float: right; }
.detail label, .dialog label { display: block; font-size: 12px; color: var(--muted); margin-top: 10px; }
textarea, select, input[type=text] { width: 100%; margin-top: 4px; background: var(--ground); color: var(--text); border: 1px solid var(--border);
                                     border-radius: 10px; padding: 10px; font: inherit; }
textarea:focus, select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.replies { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.reply { padding: 8px 0; border-bottom: 1px solid var(--border); }
.reasons { margin: 6px 0; font-size: 13px; color: var(--soft); }

.dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 18px; padding: 20px; width: min(460px, calc(100% - 32px)); }
.dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog h2 { margin: 0 0 4px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--ground); border-radius: 12px;
         padding: 10px 16px; font-weight: 600; z-index: 10; max-width: calc(100% - 32px); }

/* Map popups */
.maplibregl-popup-content { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: 13px; max-width: 260px; }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-popup-close-button { color: var(--muted); }
.maplibregl-ctrl-group { background: var(--surface); }
.maplibregl-ctrl-group button + button { border-top-color: var(--border); }
.maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib { background: rgba(13,13,15,.7) !important; color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.map.placing-mode canvas { cursor: crosshair; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 55vh auto; height: auto; min-height: 100%; }
  .side { border-left: 0; border-top: 1px solid var(--border); }
  .list { overflow: visible; }
  .layers { bottom: 12px; }
  .stats { display: none; }
}
