:root {
  --bg: #0a0e15;
  --panel: #111723;
  --panel-2: #161e2d;
  --line: #243046;
  --text: #e6ebf2;
  --muted: #8b97ab;
  --accent: #ffd166;
  --accent-ink: #1b1400;
  --origin: #5ce1e6;
  --target: #ff5d73;
  --ok: #4cc38a;
  --warn: #f0a33a;
  --bad: #ff5d73;
  --high: #4acff3;
  --low: #de6a0c;
  --null: #b1325f;
  --radius: 10px;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; font-size: 15px; line-height: 1.4; }
a { color: var(--high); text-decoration: none; }
a:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* top bar */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); letter-spacing: .2px; white-space: nowrap; }
.brand .logo { color: var(--accent); margin-right: 4px; }
.nav { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--text); }
.nav form { margin: 0; }
.demo-banner { background: #2a2140; color: #d9c8ff; font-size: 13px; padding: 4px 16px; border-bottom: 1px solid #3b2f5c; }

.btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a4a66; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.icon { width: 36px; height: 36px; padding: 0; font-size: 18px; }
button.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
button.link:hover { color: var(--text); }

/* target form + autocomplete */
.target { display: flex; gap: 8px; align-items: center; flex: 1 1 520px; max-width: 760px; }
.combo { position: relative; flex: 1; }
.combo input { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; font: inherit; }
.combo input:focus { outline: 2px solid #35507a; border-color: #35507a; }
.suggest { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px 0;
  list-style: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); max-height: 320px; overflow: auto; }
.suggest li { padding: 7px 12px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.suggest li.active, .suggest li:hover { background: #1f2a3d; }
.suggest .region { color: var(--muted); font-size: 13px; margin-left: auto; }

/* security chip */
.sec { display: inline-block; min-width: 30px; text-align: center; border-radius: 5px; padding: 0 5px;
  font-size: 12.5px; font-weight: 700; color: #071018; }

/* split layout: list left, map right */
.split { flex: 1; display: grid; grid-template-columns: minmax(360px, 440px) 1fr; min-height: 0; }
.list-pane { overflow: auto; border-right: 1px solid var(--line); padding: 14px 14px 24px; background: var(--panel); }
.map-pane { position: relative; min-height: 0; background: #05080d; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#map.dragging { cursor: grabbing; }

.target-info { margin-bottom: 10px; }
.target-info h1 { font-size: 20px; margin: 0 0 2px; display: flex; gap: 10px; align-items: center; }
.target-info .sub { color: var(--muted); font-size: 13.5px; }
.hint { color: var(--muted); margin: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.chip { font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); cursor: pointer; }
.chip:hover { color: var(--text); }

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.row:hover { border-color: #3a4a66; }
.row.selected { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); background: #1b2333; }
.row .rank { color: var(--muted); font-weight: 700; text-align: center; }
.row .name { font-weight: 650; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row .ship, .row .where, .row .meta { font-size: 13.5px; color: var(--muted); }
.row .ship b { color: var(--text); font-weight: 600; }
.row .where { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row .jumps { text-align: right; min-width: 64px; }
.row .jumps b { display: block; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.row .jumps span { font-size: 12px; color: var(--muted); }
.row.unreachable .jumps b { font-size: 15px; color: var(--muted); }
.badge { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; text-transform: uppercase;
  letter-spacing: .3px; }
.badge.closest { background: var(--accent); color: var(--accent-ink); }
.badge.pod { background: #3b2a12; color: var(--warn); }
.badge.err { background: #3a1620; color: var(--bad); }
.badge.stale { background: #2d2a17; color: #e2c35a; }
.badge.limited { background: #2d2a17; color: #e2c35a; }
.badge.online { background: #10301f; color: var(--ok); }
.excluded { margin-top: 14px; font-size: 13px; color: var(--muted); }
.status { margin-top: 10px; font-size: 12.5px; color: var(--muted); }

/* map overlays */
.route-bar { position: absolute; left: 12px; right: 64px; bottom: 12px; background: rgba(13,18,28,.92);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; font-size: 13.5px; }
.route-bar .title { font-weight: 650; margin-bottom: 6px; }
.route-bar .title .muted { color: var(--muted); font-weight: 400; }
.route-bar .path { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.route-bar .hop { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; font-size: 12.5px;
  background: var(--panel-2); border-radius: 6px; padding: 2px 6px; }
.route-bar .arrow { color: var(--muted); align-self: center; }
.map-tools { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.legend { position: absolute; left: 12px; top: 12px; display: flex; gap: 12px; font-size: 12.5px; color: var(--muted);
  background: rgba(13,18,28,.8); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.legend span { display: inline-flex; gap: 5px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.high { background: var(--high); } .dot.low { background: var(--low); } .dot.null { background: var(--null); }
.mk { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 2px solid; }
.mk.origin { border-color: var(--origin); } .mk.target { border-color: var(--target); }
.tooltip { position: absolute; pointer-events: none; background: rgba(13,18,28,.95); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 9px; font-size: 13px; transform: translate(12px, -50%); white-space: nowrap; }
.tooltip .muted { color: var(--muted); }

/* dialogs and forms */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; width: min(560px, 94vw); }
dialog::backdrop { background: rgba(0,0,0,.55); }
.dlg h2 { margin: 0 0 10px; font-size: 18px; }
.dlg textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; font: inherit; resize: vertical; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
#paste-result { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

/* characters page */
.page { max-width: 1100px; width: 100%; margin: 0 auto; padding: 20px 16px 40px; }
.page h1 { font-size: 22px; margin: 4px 0 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; }
table.grid input[type=text] { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 8px; width: 100%; font: inherit; }
.status-pill { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.status-OK { background: #10301f; color: var(--ok); }
.status-LIMITED { background: #2d2a17; color: #e2c35a; }
.status-REAUTH { background: #3a1620; color: var(--bad); }
.status-DISABLED { background: #222a37; color: var(--muted); }
.notice { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.notice.err { border-color: #5a2230; color: #ffb3bf; }
.notice.ok { border-color: #1d4d33; color: #a7e8c6; }
.report td.r-Rejected { color: var(--bad); } .report td.r-Added { color: var(--ok); }
.report td.r-Limited { color: #e2c35a; } .report td.r-Updated { color: var(--high); }
.small { font-size: 12.5px; color: var(--muted); }

/* login */
.login { margin: 10vh auto; max-width: 420px; text-align: center; }
.login .card { padding: 28px; }
.login h1 { font-size: 22px; margin: 0 0 8px; }
.login p { color: var(--muted); }

/* phones: map on top, list below (WEB-03) */
@media (max-width: 820px) {
  .topbar { gap: 10px; padding: 8px 10px; }
  .target { flex-basis: 100%; order: 3; }
  .nav { gap: 10px; flex-wrap: wrap; row-gap: 4px; justify-content: flex-end; max-width: 100%; }
  .split { display: flex; flex-direction: column; }
  .map-pane { order: -1; height: 46vh; min-height: 280px; flex: none; border-bottom: 1px solid var(--line); }
  .list-pane { border-right: 0; overflow: visible; }
  .legend { display: none; }
  .route-bar { right: 8px; left: 8px; bottom: 8px; padding: 6px 8px; font-size: 12.5px; }
  .route-bar .title { margin-bottom: 4px; }
  .route-bar .title .muted { display: none; }
  .demo-banner .detail { display: none; }
  .map-tools { top: 8px; right: 8px; }
  .btn.icon { width: 34px; height: 34px; }
  .btn { padding: 8px 10px; }
  table.grid .hide-sm { display: none; }
}

/* accounts */
.badge.main { margin-left: 8px; background: var(--accent); color: var(--accent-ink); vertical-align: 1px; }
.card.account { margin-top: 16px; }
.card.account h2 { margin: 0 0 6px; font-size: 16px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* wars page */
.wars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.war-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.war-title { font-weight: 700; font-size: 16px; color: var(--text); }
.war-head .when { margin-left: auto; }
.badge.war-none { background: #3a1620; color: var(--bad); }
.badge.war-mutual { background: #2a2140; color: #d9c8ff; }
.badge.war-open_for_allies { background: #3b2a12; color: var(--warn); }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.party { display: flex; gap: 8px; align-items: center; min-width: 0; }
.party img { border-radius: 6px; flex: none; background: var(--panel-2); }
.targets { margin: 8px 0 4px; }
.target-chip { display: inline-flex; gap: 4px; align-items: center; font-size: 13.5px; padding: 4px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.target-chip:hover { border-color: var(--accent); text-decoration: none; }
.structs { margin-top: 6px; font-size: 13.5px; }
.structs summary { cursor: pointer; color: var(--muted); }
.structs ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px; }
.links { margin-top: 6px; }
#more { margin-top: 12px; }
.wars-page select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 8px; font: inherit; margin-left: 4px; }
@media (max-width: 640px) { .parties { grid-template-columns: 1fr; } .war-head .when { margin-left: 0; } }

/* ranking: status line with auto-refresh, map options */
.status-line { margin-top: 10px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.status-line .status { margin-top: 0; }
.auto-refresh select, .map-opts select { background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 4px; font: inherit; margin-left: 4px; }
.map-opts { position: absolute; right: 56px; top: 12px; z-index: 5; display: flex; flex-direction: column; gap: 6px;
  background: rgba(13,18,28,.95); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.map-opts label { display: flex; gap: 6px; align-items: center; white-space: nowrap; cursor: pointer; }

/* wars page: tabs, statistics, high-sec structures */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: inherit;
  padding: 8px 12px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.kpi b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.stat-grid h2 { font-size: 15px; margin: 0 0 8px; }
.grid.compact td, .grid.compact th { padding: 4px 6px; font-size: 13.5px; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid.compact + .grid.compact { margin-top: 10px; }
.filters select { max-width: 190px; }
.grid.loot { margin-top: 8px; width: 100%; }
.grid.loot .jumps b { font-size: 18px; }
.badge.state-fighting { background: #3a1620; color: var(--bad); }
.badge.state-pending { background: #2d2a17; color: #e2c35a; }
.badge.state-ending { background: #1b2333; color: var(--muted); }
@media (max-width: 700px) {
  .grid.loot thead { display: none; }
  .grid.loot, .grid.loot tbody, .grid.loot tr, .grid.loot td { display: block; width: 100%; }
  .grid.loot tr { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; padding: 6px 8px;
    background: var(--panel); }
  .grid.loot td { border: 0; padding: 2px 0; text-align: left; }
  .filters select { max-width: 140px; }
}

/* structures page */
.filters input[type=search] { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 8px; font: inherit; width: 200px; max-width: 100%; margin-left: 4px; }
.structures-page code { font-size: 12px; background: var(--panel-2); padding: 0 4px; border-radius: 4px; }

/* set destination */
.set-route { margin-top: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn.small-btn { padding: 4px 10px; font-size: 13px; }

/* alerts page */
.alert-destroyed { border-left: 3px solid var(--bad); }
.alert-combat { border-left: 3px solid var(--warn); }
.alert-firing { border-left: 3px solid var(--muted); }
.where-line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.kills { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 2px; }
.closest ul { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 6px; }
.closest li { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.alerts-page li.flash { outline: 2px solid var(--accent, #4aa3ff); outline-offset: 2px; }

/* static roster (UC-12): tabs on the ranking page, badges and the Roster page */
.tabs { display: flex; gap: 6px; margin: 0 0 10px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-weight: 650; padding: 6px 10px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { color: var(--muted); font-weight: 500; margin-left: 6px; font-size: 12.5px; }
.badge.static { background: #15283a; color: var(--high); }
.badge.unresolved { background: #3a1620; color: var(--bad); }
.badge.shadowed { background: #2d2a17; color: #e2c35a; }
.row.static .jumps b { font-size: 22px; }
.closest .static-closest { margin-top: 4px; }
.roster-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.roster-filters input[type=text], .roster-filters select { background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); font: inherit; padding: 5px 8px; }
.suggest-fix { color: var(--muted); font-size: 12.5px; }
.suggest-fix button { background: none; border: none; color: var(--high); cursor: pointer; font: inherit; padding: 0 4px; }

/* notifications (UC-13) */
.ntf-list { gap: 10px; margin-top: 12px; }
.card.ntf { display: flex; flex-direction: column; gap: 6px; }
.ntf-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ntf-title { font-weight: 650; }
.card.ntf.asset_safety { border-left: 3px solid var(--accent); }
.card.ntf.structure_attack, .card.ntf.tower { border-left: 3px solid var(--bad); }
.card.ntf .when { color: var(--muted); }
.ntf-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 8px 0; }
.ntf-group { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.ntf-group-title { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.ntf-type { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.ntf-type span { word-break: break-word; }
/* long type names and scope names must not widen a 360 px screen (WEB-03) */
.card.ntf, .ntf-groups, .page p code { overflow-wrap: anywhere; }
.ntf-head .badge { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
.card.ntf .where-line { flex-wrap: wrap; }
