/* MWSC Tracker — same family as MWSC Radar: quiet slate chrome, the map does the talking */
:root {
  --ground: #11161d; --panel: #161d26; --raised: #1e2732; --line: #2a3442; --line-soft: #222b37;
  --text: #e3e9f0; --muted: #8e9bab; --faint: #637082; --you: #47d3e6; --ok: #3ccf7a; --bad: #ff4b55;
  --sans: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif; --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --top: 52px; --r: 8px; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--ground); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--you); }
:focus-visible { outline: 2px solid var(--you); outline-offset: 2px; }
h1 { font-size: 26px; margin: 0 0 4px; } h2 { font-size: 17px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; } h3 { font-size: 13px; color: var(--muted); margin: 18px 0 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { font-family: var(--mono); } .grow { flex: 1; } .lead { margin: 0 0 20px; }
.row { display: flex; gap: 8px; align-items: center; } .row.wrap { flex-wrap: wrap; }
.error { color: #ffb3b8; background: rgba(255,75,85,.12); border: 1px solid rgba(255,75,85,.45); padding: 8px 10px; border-radius: var(--r); }
code { font-family: var(--mono); font-size: 13px; background: var(--ground); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; word-break: break-all; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--raised); color: var(--text); font: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a4757; }
.btn.primary { background: var(--you); border-color: var(--you); color: #071419; font-weight: 700; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.danger:hover { color: #ffb3b8; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 46px; font-size: 16px; width: 100%; }
.icon-btn { border: 0; background: transparent; color: var(--muted); width: 30px; height: 30px; border-radius: 6px; cursor: pointer; font-size: 15px; }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.input { height: 36px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--ground); color: var(--text); font: inherit; min-width: 0; }
.input.sm { height: 28px; font-size: 13px; }
.input:focus { outline: none; border-color: var(--you); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.check input { accent-color: var(--you); }
.tag { font-size: 12px; font-weight: 400; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: var(--ground); color: var(--muted); padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; border-right: 1px solid var(--line-soft); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--text); color: var(--ground); font-weight: 700; }
.dot { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); position: relative; }
.st { font-size: 12px; padding: 1px 8px; border-radius: 10px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); white-space: nowrap; }
.live { font-size: 11px; color: var(--ok); border: 1px solid rgba(60,207,122,.5); border-radius: 8px; padding: 0 5px; margin-left: 4px; }

/* Top bar */
.top { height: var(--top); display: flex; align-items: center; gap: 18px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--you); text-decoration: none; }
.brand span { color: var(--text); font-size: 16px; } .brand.big span { font-size: 22px; }
.top nav { display: flex; gap: 2px; }
.top nav a { color: var(--muted); text-decoration: none; padding: 7px 11px; border-radius: 7px; }
.top nav a:hover { color: var(--text); }
.top nav a.on { color: var(--text); background: var(--raised); font-weight: 700; }
.who { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 14px; }

/* Pages */
.page { max-width: 760px; margin: 0 auto; padding: 28px 18px 60px; }
.page.wide { max-width: 1200px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
body.center { display: grid; place-items: center; padding: 16px; min-height: 100%; }
.card.narrow { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.steps form { margin-top: 8px; }
.code { font: 500 34px var(--mono); letter-spacing: .12em; text-align: center; padding: 10px; background: var(--ground); border: 1px dashed var(--line); border-radius: 10px; }
.code.inline { display: inline-block; font-size: 22px; padding: 2px 12px; margin-left: 6px; vertical-align: middle; }
.dev { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.dev:last-child { border-bottom: 0; }
.offline { opacity: .55; }
.u-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
td.actions { white-space: nowrap; text-align: right; }
.log { padding: 4px 0; border-bottom: 1px solid var(--line-soft); }

/* Live map */
.mapapp { height: calc(100% - var(--top)); display: grid; grid-template-columns: 340px 1fr; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; gap: 10px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); }
.side-head .input { flex: 1; }
.list { flex: 1; overflow: auto; min-height: 0; }
.grp { font-size: 12px; color: var(--faint); padding: 12px 14px 4px; font-weight: 700; }
.u { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.u:hover, .u.on { background: var(--raised); }
.u-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.empty { padding: 30px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }
.detail { border-top: 1px solid var(--line); padding: 12px 16px 16px; max-height: 55%; overflow: auto; background: var(--ground); }
.d-head { display: flex; align-items: center; gap: 10px; }
.d-head h2 { margin: 0; flex: 1; }
.detail dl { display: grid; grid-template-columns: 76px 1fr; gap: 4px 10px; font-size: 14px; margin: 12px 0; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }
.hist { margin-top: 8px; } .hist .input { flex: 1; min-width: 150px; height: 30px; font-size: 13px; }
.map { position: relative; background: #0c1015; }
.map.full { position: fixed; inset: 0; }
.leaflet-container { font-family: var(--sans); background: #0c1015; }
.leaflet-control-attribution { background: rgba(17,22,29,.7) !important; color: var(--faint) !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a { background: var(--panel) !important; color: var(--text) !important; border-color: var(--line) !important; }
.pin { overflow: visible; }
.pin .dot { width: 16px; height: 16px; border: 2.5px solid #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent), 0 2px 6px rgba(0,0,0,.5); }
.pin .dot i { position: absolute; left: 50%; top: -12px; margin-left: -5px; border: 5px solid transparent; border-bottom: 9px solid #fff; transform-origin: 5px 17px; }
.pin .lbl { position: absolute; left: 20px; top: -2px; font: 700 12px var(--sans); color: #fff; background: rgba(17,22,29,.88); padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
.pin.off .dot { --c: #637082 !important; border-color: #9aa5b3; }
.pin.sel .dot { box-shadow: 0 0 0 6px rgba(71,211,230,.45), 0 2px 6px rgba(0,0,0,.5); }
.pin.emer .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(255,43,214,.35); } }
.tip { background: rgba(17,22,29,.92); color: var(--text); border: 1px solid var(--line); font: 12px var(--mono); box-shadow: none; }
.tip::before { display: none; }

/* Share page */
.share-card { position: fixed; z-index: 800; left: 14px; top: 14px; display: flex; flex-direction: column; padding: 10px 14px; border-radius: 12px; background: rgba(17,22,29,.92); border: 1px solid var(--line); }
.share-card b { font-size: 18px; }
.share-card span { color: var(--muted); font-size: 14px; }
.embed .share-card { top: auto; bottom: 14px; }

.toasts { position: fixed; z-index: 3000; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 14px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 14px; }
.toast.ok { border-color: rgba(60,207,122,.55); } .toast.bad { border-color: rgba(255,75,85,.7); background: #3b1117; }

@media (max-width: 800px) {
  .top { gap: 8px; padding: 0 8px; } .brand span, .who span { display: none; }
  .top nav a { padding: 6px 8px; font-size: 14px; }
  .mapapp { grid-template-columns: 1fr; grid-template-rows: 1fr 42%; }
  .mapapp .map { grid-row: 1; } .side { grid-row: 2; border-right: 0; border-top: 1px solid var(--line); }
  .detail { max-height: 70%; }
  td.actions .btn { margin-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) { .pin.emer .dot { animation: none; } }
