/* ============================================================================
   SCOPE v0.2.0 (fusion) — theme: "Brass & Soundings, Second Charting"
   The Horizon parent's chartroom-after-hours, carried forward and
   extended for the fusion's wider chart table: deep sea-ink walls,
   chart-cream paper panels, brass fittings, figures set like depth
   soundings in mono. New in the second charting: kind badges for the
   three doors (Detector brass · Sentinel bone · Wigle teal), the big
   brass import lever, sounding-rule dividers, and the inspector's
   chart frame. Every surface wears this theme; a build that cannot
   name its theme is not finished (Horizon Finish Standard §11).
   Palette:
     --ink        #0c1a24  sea-ink (page ground)
     --ink-2      #122633  raised ink (header, map ground, chart ground)
     --paper      #f2e9d5  chart cream (panels)
     --paper-2    #e7dcc0  shaded chart cream
     --brass      #c9a227  brass (accents, BLE, Detector)
     --brass-deep #8a6d14  brass shadow
     --teal       #2e8f86  Wi-Fi / Wigle
     --violet     #7d6bb3  Bluetooth Classic
     --bone       #d8d2c0  Sentinel bone
     --rust       #b3402a  refusal / disagreement
     --ok         #3d7a44  seal verified / agreement
     --text       #1d2a33  ink on paper
     --text-dim   #5a6a72  pencil notes
   ========================================================================== */
:root {
  --ink: #0c1a24; --ink-2: #122633; --paper: #f2e9d5; --paper-2: #e7dcc0;
  --brass: #c9a227; --brass-deep: #8a6d14; --teal: #2e8f86; --violet: #7d6bb3;
  --bone: #d8d2c0; --rust: #b3402a; --ok: #3d7a44; --text: #1d2a33; --text-dim: #5a6a72;
  --line: #c9bc97; --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--ink); color: var(--text);
  font: 16px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding: env(safe-area-inset-top) 14px calc(20px + env(safe-area-inset-bottom));
}
.mono { font-family: var(--mono); }

/* ---------- chrome ---------- */
#chrome-top {
  display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: flex-end;
  justify-content: space-between; padding: 18px 6px 12px; color: var(--paper);
  border-bottom: 1px solid rgba(201,162,39,.35);
}
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-name { margin: 0; font-size: 34px; letter-spacing: .04em; font-weight: 700; color: var(--paper); }
.local-badge, .edition-badge {
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em;
  border: 1px solid var(--brass); color: var(--brass); border-radius: 3px; padding: 3px 8px 2px;
}
.edition-badge { border-color: var(--teal); color: #7fc7bf; }
.tagline { margin: 2px 0 0; color: #b8c4c9; font-size: 14px; letter-spacing: .05em; }
#counts-strip { display: flex; gap: 18px; flex-wrap: wrap; }
.count-cell { text-align: right; }
.count-cell .n { display: block; font-family: var(--mono); font-size: 22px; color: var(--brass); }
.count-cell .l { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #93a5ad; }

main { display: flex; flex-direction: column; gap: 14px; max-width: 1240px; margin: 0 auto; }
.panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
  padding: 16px 18px; box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.panel h2 {
  margin: 0 0 8px; font-size: 15px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--brass-deep); border-bottom: 1px solid var(--line); padding-bottom: 6px;
}
.sub-head { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--brass-deep); margin: 16px 0 6px; }
.basis { color: var(--text-dim); font-size: 13.5px; margin: 6px 0 10px; }
button {
  font: inherit; font-size: 14px; background: var(--ink-2); color: var(--paper);
  border: 1px solid var(--brass-deep); border-radius: 4px; padding: 7px 14px; cursor: pointer;
}
button:hover, button:focus-visible { background: var(--ink); border-color: var(--brass); outline: none; }
select, input[type="datetime-local"], input[type="text"], textarea {
  font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 4px; background: #fffdf4; color: var(--text);
}

/* ---------- share banner ---------- */
#share-banner {
  display: none; background: var(--paper-2); border: 1px solid var(--brass);
  color: var(--text); border-radius: 6px; padding: 10px 14px; font-size: 14.5px;
}
#share-banner.show { display: block; }

/* ---------- import ---------- */
.import-big {
  display: block; width: 100%; font-size: 19px; font-weight: 700; letter-spacing: .02em;
  padding: 16px; margin: 10px 0; background: linear-gradient(180deg, #d9b93a, var(--brass));
  color: #241d05; border: 1px solid var(--brass-deep); border-radius: 6px;
  box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.import-big:hover, .import-big:focus-visible { background: linear-gradient(180deg, #e6c94e, #d9b93a); }
#drop-zone {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  border: 2px dashed var(--brass-deep); border-radius: 6px; padding: 20px 16px;
  background: var(--paper-2); color: var(--text); font-size: 15.5px; cursor: pointer; text-align: center;
}
#drop-zone.drag-over { background: #dccfa9; border-color: var(--brass); }
#drop-zone:focus-visible { outline: 2px solid var(--brass-deep); outline-offset: 2px; }
.drop-glyph { font-size: 22px; color: var(--brass-deep); }
.import-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
#import-log { list-style: none; margin: 12px 0 0; padding: 0; font-size: 14px; }
#import-log li { padding: 6px 10px; border-left: 4px solid var(--line); margin-bottom: 6px; background: #fffdf4; border-radius: 0 4px 4px 0; }
#import-log li.ok { border-left-color: var(--ok); }
#import-log li.refused { border-left-color: var(--rust); color: #6d2417; }
#import-log li.note { border-left-color: var(--brass); }

/* ---------- filters ---------- */
.filter-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.filter-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }

/* ---------- workbench: sets + map ---------- */
#workbench { display: grid; grid-template-columns: minmax(330px, 5fr) minmax(380px, 7fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { #workbench { grid-template-columns: 1fr; } }

.set-card { position: relative; border: 1px solid var(--line); border-radius: 5px; background: #fffdf4; padding: 12px 14px; margin-bottom: 10px; }
.set-card h3 { margin: 0 0 2px; font-family: var(--mono); font-size: 15px; word-break: break-all; }
.kind-badge {
  position: absolute; top: 10px; right: 12px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .12em; text-transform: uppercase; border-radius: 3px; padding: 2px 7px;
  border: 1px solid var(--brass-deep); color: var(--brass-deep); background: var(--paper-2);
}
.set-card.kind-sentinel .kind-badge { border-color: #8b8574; color: #5c5747; background: var(--bone); }
.set-card.kind-wigle .kind-badge { border-color: var(--teal); color: var(--teal); background: #e2efec; }
.set-meta { color: var(--text-dim); font-size: 13px; margin: 0 0 8px; padding-right: 120px; }
.fig-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 6px 0; }
.fig-table th, .fig-table td { text-align: left; padding: 3px 6px; border-bottom: 1px dotted var(--line); vertical-align: top; }
.fig-table td.n { font-family: var(--mono); text-align: right; white-space: nowrap; }
.fig-table th { color: var(--text-dim); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.chip { display: inline-block; font-family: var(--mono); font-size: 11.5px; border-radius: 3px;
  padding: 2px 7px; margin: 2px 4px 2px 0; border: 1px solid var(--line); background: var(--paper-2); }
.chip.seal-verified, .chip.seal-partial { border-color: var(--ok); color: var(--ok); }
.chip.seal-none { color: var(--text-dim); }
.chip.coords-no { color: var(--rust); border-color: var(--rust); }
.disagreement { background: #f6ded7; border: 1px solid var(--rust); color: #6d2417;
  border-radius: 4px; padding: 8px 10px; font-size: 13.5px; margin: 8px 0; }
.agree-note { color: var(--ok); font-size: 13.5px; }
.alerts-line { color: #6d4a17; font-size: 13.5px; }
.set-actions { margin-top: 8px; display: flex; gap: 8px; }
.set-actions button { font-size: 13px; padding: 5px 10px; }
.coverage-line { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

/* ---------- map ---------- */
.map-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.map-head h2 { border: none; padding: 0; }
.map-controls { display: flex; gap: 6px; }
.map-controls button { padding: 5px 11px; font-size: 13px; }
#map-view {
  position: relative; height: 460px; border: 1px solid var(--brass-deep); border-radius: 5px;
  overflow: hidden; background: var(--ink-2); touch-action: none;
}
#tile-layer { position: absolute; inset: 0; }
#tile-layer img { position: absolute; width: 256px; height: 256px; user-select: none; -webkit-user-drag: none; }
#map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
#map-canvas:active { cursor: grabbing; }
.map-empty {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  text-align: center; color: #cfd8db; padding: 30px; font-size: 15px; pointer-events: none;
}
.map-empty.show { display: flex; }
.attrib { font-size: 12px; color: var(--text-dim); margin: 6px 0 0; }

/* ---------- devices table ---------- */
#devices-list { overflow-x: auto; }
.devices-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.devices-table th, .devices-table td { text-align: left; padding: 5px 8px; border-bottom: 1px dotted var(--line); vertical-align: top; }
.devices-table th { color: var(--text-dim); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.devices-table td.n { font-family: var(--mono); text-align: right; }
.device-row { cursor: pointer; }
.device-row:hover { background: #fdf6dd; }
.device-row.selected { background: #fdf6dd; outline: 1px solid var(--brass-deep); }
.fav-cell { color: var(--brass-deep); font-size: 15px; }
.d-sub { display: block; font-size: 12.5px; color: var(--text-dim); }
.note-line { color: #6d4a17; }

/* ---------- inspector ---------- */
.insp-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.insp-head h3 { margin: 0; font-size: 17px; word-break: break-all; }
.fav-star { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }
.fav-star.on { color: var(--brass-deep); }
.d-name { font-weight: 600; margin: 4px 0 0; }
.d-meta { color: var(--text-dim); font-size: 13px; margin: 2px 0; }
.d-figs { font-family: var(--mono); font-size: 13px; margin: 6px 0; }
.chart-title { font-size: 13.5px; color: var(--text-dim); margin: 10px 0 4px; }
#insp-chart { width: 100%; max-width: 720px; height: auto; border: 1px solid var(--brass-deep); border-radius: 5px; background: var(--ink-2); }
.row-peek {
  font-family: var(--mono); font-size: 12px; background: var(--ink-2); color: #cfd8db;
  border-radius: 5px; padding: 10px 12px; overflow-x: auto; white-space: pre;
}
.annot-form { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.annot-form h4 { margin: 0 0 8px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--brass-deep); }
.annot-check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin-bottom: 8px; }
.annot-input { display: block; width: 100%; margin-bottom: 8px; }

/* ---------- seen again + leads ---------- */
.again-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.again-table th, .again-table td { text-align: left; padding: 5px 8px; border-bottom: 1px dotted var(--line); vertical-align: top; }
.again-table th { color: var(--text-dim); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.again-table td.n, .again-table td.mono { font-family: var(--mono); }
.again-row { cursor: pointer; }
.again-row:hover { background: #fdf6dd; }
.lead-explainer {
  background: var(--paper-2); border: 1px solid var(--brass-deep); border-radius: 5px;
  padding: 10px 12px; font-size: 14.5px; margin: 4px 0 10px;
}
.lead-grade { font-family: var(--mono); font-weight: 700; color: #6d4a17; }
td.evidence { font-size: 12.5px; color: var(--text-dim); }
.watch-card { border: 1px solid var(--line); border-radius: 5px; background: #fffdf4; padding: 8px 12px; margin-bottom: 8px; font-size: 14px; }

.empty-note { color: var(--text-dim); font-size: 14.5px; border: 1px dashed var(--line);
  border-radius: 5px; padding: 18px; text-align: center; background: #fffdf4; }

/* ---------- about / footer ---------- */
.wipe-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
#chrome-bottom {
  display: flex; gap: 18px; flex-wrap: wrap; color: #93a5ad; font-size: 13px;
  font-family: var(--mono); padding: 14px 6px 0; max-width: 1240px; margin: 0 auto;
}
#about-panel p { margin: 8px 0; }
