/* SEO Visibility Panel — "field instrument" theme.
   Deep petrol graphite, one teal signal accent, instrument-style readouts. */

:root {
  --bg: #0a0f14;
  --panel: #101822;
  --panel-2: #0d141c;
  --line: #1d2833;
  --line-2: #2a3947;
  --ink: #e8eff5;
  --ink-2: #9fb0bf;
  --muted: #667888;
  --accent: #5fe3c7;
  --accent-ink: #04120e;
  --signal: #f2b94b;
  --pos: #3ddc97;
  --neg: #ff6b6b;
  --warn: #f2b94b;
  --radius: 14px;
  --radius-sm: 9px;
  --font-display: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 14.5px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

::selection { background: rgba(95, 227, 199, .25); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── shell ───────────────────────────────────────────────────────────── */

.app { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }

.rail {
  background: var(--panel-2);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.rail-brand { padding: 2px 10px 20px; display: flex; align-items: center; gap: 10px; }
.rail-mark {
  width: 26px; height: 26px; flex: 0 0 26px; border: 1px solid var(--line-2);
  border-radius: 7px; display: grid; place-items: center; position: relative; overflow: hidden;
}
.rail-mark::before, .rail-mark::after {
  content: ""; position: absolute; background: var(--line-2);
}
.rail-mark::before { left: 0; right: 0; top: 50%; height: 1px; }
.rail-mark::after { top: 0; bottom: 0; left: 50%; width: 1px; }
.rail-mark i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); z-index: 1; }
.rail-name { font: 700 14px/1.2 var(--font-display); letter-spacing: .2px; }
.rail-name span { display: block; font: 500 10.5px/1.4 var(--font-body); color: var(--muted); letter-spacing: .3px; }

.nav-label {
  font-size: 10.5px; color: var(--muted); letter-spacing: .4px;
  padding: 12px 10px 6px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  border-left: 2px solid transparent; color: var(--ink-2);
  transition: background .14s ease, color .14s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .035); color: var(--ink); }
.nav-item.active { background: var(--panel); border-left-color: var(--accent); color: var(--ink); }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; color: var(--muted); }
.nav-item.active svg, .nav-item:hover svg { color: var(--accent); }
.nav-item .t { font-weight: 600; font-size: 13.5px; font-family: var(--font-display); }
.nav-item .s { font-size: 11px; color: var(--muted); }

.rail-foot {
  margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); line-height: 1.7;
}
.rail-foot a:hover { color: var(--accent); }

/* ── main + instrument bar ───────────────────────────────────────────── */

.main { min-width: 0; padding: 0 0 60px; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(180deg, rgba(10, 15, 20, .96), rgba(10, 15, 20, .86));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 16px 26px 14px;
}
.view-head { display: flex; flex-direction: column; gap: 1px; }
.view-head h1 { font: 700 19px/1.2 var(--font-display); }
.view-head .sub { font-size: 12px; color: var(--muted); }

.readouts { display: flex; gap: 22px; margin-left: auto; flex-wrap: wrap; }
.readout { display: flex; flex-direction: column; gap: 1px; }
.readout .v {
  font: 600 15px/1.2 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink);
}
.readout .k { font-size: 10.5px; color: var(--muted); letter-spacing: .3px; }

.graticule {
  height: 7px; border-top: 1px solid var(--line);
  background-image: repeating-linear-gradient(90deg, var(--line-2) 0 1px, transparent 1px 14px);
  opacity: .5;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

/* ── buttons / inputs ────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2); background: var(--panel);
  color: var(--ink); border-radius: 999px; padding: 8px 16px;
  font: 600 13px var(--font-display); cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.btn-primary:hover { background: #7fefd6; border-color: #7fefd6; color: var(--accent-ink); }
.btn-danger { color: var(--neg); border-color: rgba(255, 107, 107, .35); }
.btn-danger:hover { border-color: var(--neg); color: var(--neg); background: rgba(255, 107, 107, .07); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

.input, textarea.input, select.input {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2);
  color: var(--ink); border-radius: var(--radius-sm); padding: 10px 13px;
  font: 14px var(--font-body);
}
.input:focus { outline: none; border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 11px; color: var(--muted); letter-spacing: .3px; }
.field .hint { font-size: 11.5px; color: var(--muted); }

/* ── content ─────────────────────────────────────────────────────────── */

.content { padding: 22px 26px 0; }

.section-head {
  display: flex; align-items: baseline; gap: 12px; margin: 6px 0 12px;
}
.section-head h2 { font: 700 15px var(--font-display); }
.section-head .meta { color: var(--muted); font-size: 12px; }

.panel {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  overflow: hidden; margin-bottom: 18px;
}
.panel-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--line);
}
.panel-head h3 { font: 700 14.5px var(--font-display); }
.panel-head .meta { margin-left: auto; color: var(--muted); font-size: 12px; }
.panel-body { padding: 16px 18px; }
.panel-body.flush { padding: 0; }

.readout-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border-bottom: 1px solid var(--line);
}
.readout-cell { padding: 15px 18px; border-right: 1px solid var(--line); }
.readout-cell:last-child { border-right: none; }
.readout-cell .v {
  font: 600 23px/1.15 var(--font-mono); font-variant-numeric: tabular-nums;
}
.readout-cell .k { font-size: 10.5px; color: var(--muted); margin-top: 3px; letter-spacing: .3px; }
.readout-cell .d { font-size: 11.5px; font-family: var(--font-mono); }
.d.up { color: var(--pos); } .d.down { color: var(--neg); } .d.flat { color: var(--muted); }

/* ── tables ──────────────────────────────────────────────────────────── */

.table-wrap { overflow: auto; max-height: 560px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font: 600 10.5px var(--font-body); letter-spacing: .3px;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--panel); z-index: 1; white-space: nowrap;
}
td {
  padding: 9px 14px; border-bottom: 1px solid rgba(255, 255, 255, .055);
  font-size: 13px; color: var(--ink-2); vertical-align: top;
}
tr:last-child td { border-bottom: none; }
td.kw { color: var(--ink); font-weight: 500; }
td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.who { color: var(--muted); font-size: 11.5px; font-family: var(--font-mono); }

.pill {
  display: inline-block; font: 600 10.5px var(--font-body); letter-spacing: .3px;
  border-radius: 999px; padding: 2px 9px; border: 1px solid var(--line-2); white-space: nowrap;
}
.pill.ok { color: var(--pos); border-color: rgba(61, 220, 151, .4); }
.pill.miss { color: var(--neg); border-color: rgba(255, 107, 107, .4); }
.pill.none { color: var(--muted); }
.pill.warn { color: var(--warn); border-color: rgba(242, 185, 75, .4); }

/* ── chips ───────────────────────────────────────────────────────────── */

.chips { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip {
  background: none; border: 1px solid var(--line-2); color: var(--ink-2);
  border-radius: 999px; padding: 5px 12px; font: 500 12.5px var(--font-body);
  cursor: pointer; transition: border-color .14s ease, color .14s ease, background .14s ease;
}
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip.on { color: var(--accent); border-color: rgba(95, 227, 199, .5); background: rgba(95, 227, 199, .08); }
.chip-x { color: var(--muted); margin-left: 6px; font-size: 11px; display: none; }
.chip:hover .chip-x { display: inline; }
.chip-x:hover { color: var(--neg); }

/* ── charts + misc ───────────────────────────────────────────────────── */

.chart { width: 100%; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 11.5px; margin-bottom: 10px; }
.legend .swatch { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.empty { padding: 34px 18px; color: var(--muted); text-align: center; font-size: 13px; }
.split { display: grid; grid-template-columns: 300px 1fr; gap: 0; }
.split > div { min-width: 0; }
.split > div:first-child { border-right: 1px solid var(--line); padding: 16px 18px; }
.split > div:last-child { padding: 16px 18px; }
.sublbl { font-size: 10.5px; color: var(--muted); letter-spacing: .3px; margin-bottom: 10px; }

/* ── map ─────────────────────────────────────────────────────────────── */

.map { height: 540px; width: 100%; background: #070b10; }
.leaflet-container { background: #070b10; font-family: var(--font-body); }
.leaflet-control-attribution { background: rgba(0, 0, 0, .55) !important; color: #6f7d8a !important; }
.leaflet-control-attribution a { color: #9fb0bf !important; }
.gpin {
  display: grid; place-items: center; font: 700 12px var(--font-mono); color: #04120e;
  border-radius: 50%; border: 2px solid rgba(0, 0, 0, .5); box-shadow: 0 2px 7px rgba(0, 0, 0, .55);
}
.gpin .delta { position: absolute; top: -7px; right: -7px; font-size: 9px; font-weight: 700; border-radius: 6px; line-height: 14px; padding: 0 3px; }

.map-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.runsel { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.runsel button { background: none; border: 1px solid var(--line-2); color: var(--ink-2); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: 15px; }
.runsel button:hover:not(:disabled) { color: var(--accent); border-color: rgba(95, 227, 199, .4); }
.runsel button:disabled { opacity: .3; cursor: default; }
.runsel .rlabel { font-size: 12px; color: var(--ink-2); min-width: 160px; text-align: center; font-family: var(--font-mono); }
.cmp { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.cmp input {
  appearance: none; -webkit-appearance: none; width: 16px; height: 16px;
  border: 1px solid var(--line-2); border-radius: 5px; background: transparent;
  cursor: pointer; position: relative; flex: 0 0 16px;
}
.cmp input:hover { border-color: var(--accent); }
.cmp input:checked { background: var(--accent); border-color: var(--accent); }
.cmp input:checked::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 4px; height: 9px;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.leaflet-bar a, .leaflet-control-zoom a {
  background: var(--panel) !important; color: var(--ink) !important; border-color: var(--line-2) !important;
}
.leaflet-bar a:hover { background: #16202b !important; color: var(--accent) !important; }

/* ── modal / toast ───────────────────────────────────────────────────── */

.overlay {
  position: fixed; inset: 0; z-index: 3000; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(4, 8, 11, .74); backdrop-filter: blur(3px);
}
.overlay.open { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px;
  padding: 24px; width: 100%; max-width: 470px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.modal h3 { font: 700 17px var(--font-display); margin-bottom: 4px; }
.modal .mhint { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.5; }
.modal .mlbl { font-size: 11px; color: var(--muted); margin: 16px 0 8px; }
.modal .mrow { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(14px);
  background: #141c25; border: 1px solid var(--line-2); color: var(--ink);
  border-radius: 12px; padding: 11px 20px; font-size: 13.5px; z-index: 3100;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  max-width: min(560px, 92vw); box-shadow: 0 14px 40px rgba(0, 0, 0, .55);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(61, 220, 151, .45); }
.toast.err { border-color: rgba(255, 107, 107, .5); }

/* ── progress ────────────────────────────────────────────────────────── */

.progress { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s ease; }
.jobs { display: flex; flex-direction: column; gap: 8px; }
.job { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; }
.job .row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.job .row .m { margin-left: auto; color: var(--muted); font-family: var(--font-mono); }

/* ── login ───────────────────────────────────────────────────────────── */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; }
.login-wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px; opacity: .25;
  mask-image: radial-gradient(ellipse at 50% 40%, #000, transparent 72%);
}
.login-card {
  position: relative; width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--line-2); border-radius: 18px; padding: 32px 28px;
}
.login-card .mark { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-card h1 { font: 700 21px var(--font-display); margin-bottom: 4px; }
.login-card p { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card .err { color: var(--neg); font-size: 12.5px; margin-bottom: 14px; }

/* ── responsive ──────────────────────────────────────────────────────── */

@media (max-width: 940px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px; }
  .rail-brand { padding: 0 12px 0 0; }
  .rail .nav-label { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { width: auto; }
  .rail-foot { display: none; }
  .split { grid-template-columns: 1fr; }
  .split > div:first-child { border-right: none; border-bottom: 1px solid var(--line); }
  .readouts { margin-left: 0; width: 100%; }
}
