:root {
  --bg: #0a0d12;
  --bg2: #11151c;
  --bg3: #161b24;
  --border: #1e2731;
  --text: #e6eaf0;
  --muted: #8a93a3;
  --faint: #5b6472;
  --accent: #3b82f6;
  --accent-dim: #1d3a66;
  --orange: #f59e0b;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 12px;
  --sidebar: 236px;
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 14px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* layout */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar); background: #080a0e;
  border-right: 1px solid var(--border); padding: 18px 14px; position: sticky; top: 0;
  height: 100vh; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand .logo {
  width: 42px; height: 42px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: grid; place-items: center; font-weight: 800; font-size: 15px; letter-spacing: .5px;
  color: #fff; box-shadow: 0 0 0 1px #ffffff14 inset;
}
.brand .name { font-weight: 700; font-size: 15px; }
.brand .sub { color: var(--muted); font-size: 11px; }
.search { padding: 4px 6px 6px; }
.search input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 9px 12px; font-size: 13px; outline: none;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--accent); }
.search input.err { border-color: var(--red); }
.search input:disabled { opacity: .6; }
.navlabel { color: var(--faint); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px;
  color: var(--muted); font-weight: 500; cursor: pointer;
}
.nav a:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-dim); color: #fff; }
.nav a .i { width: 17px; text-align: center; opacity: .9; }
.sidebar .foot { margin-top: auto; color: var(--faint); font-size: 11px; padding: 10px; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 28px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #0a0d12e6;
  backdrop-filter: blur(8px); z-index: 5;
}
.topbar .title { font-size: 18px; font-weight: 700; }
.topbar .pill { margin-left: auto; color: var(--muted); font-size: 12px; }
.content { padding: 24px 28px 60px; max-width: 1180px; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.card .k { color: var(--muted); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; }
.card .v { font-size: 28px; font-weight: 800; margin-top: 7px; letter-spacing: -.5px; }
.card .s { color: var(--faint); font-size: 12px; margin-top: 3px; }
.v.accent { color: var(--accent); } .v.orange { color: var(--orange); }
.v.green { color: var(--green); } .v.red { color: var(--red); }

.section { margin-top: 30px; }
.section > h2, .grid2.even > div > h2 { font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; font-weight: 600; }
.panel { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--faint); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; padding: 11px 16px; border-bottom: 1px solid var(--border); }
td { padding: 11px 16px; border-bottom: 1px solid #141a22; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #0f141b; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.name-cell { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.ava { width: 28px; height: 28px; border-radius: 7px; background: var(--bg3); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); flex: none; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.badge.win { background: #16351f; color: var(--green); }
.badge.top { background: #2a2410; color: var(--orange); }
.badge.mode { background: var(--bg3); color: var(--muted); }
.place { font-weight: 700; }
.place.p1 { color: var(--orange); } .place.p2, .place.p3 { color: var(--green); }

/* kill feed */
.feed { display: flex; flex-direction: column; }
.feed .row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #141a22; font-size: 13px; }
.feed .row:last-child { border-bottom: none; }
.feed .k { font-weight: 700; } .feed .k.us { color: var(--green); } .feed .k.them { color: var(--red); }
.feed .v { color: var(--text); font-weight: 600; }
.feed .mid { color: var(--faint); }
.feed .wep { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.feed .dist { color: var(--faint); font-size: 11px; }
.feed a { color: inherit; } /* killer/victim keep their us/them color, not link blue */

.mappanel { padding: 0; line-height: 0; }
.mapsvg { width: 100%; height: auto; aspect-ratio: 1; display: block; background: #0d1520; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; }
tbody.squad + tbody.squad tr.squad-head td { border-top: 6px solid var(--bg); }
tr.squad-head td { background: var(--bg3); padding: 8px 16px; font-size: 12px; border-bottom: 1px solid var(--border); }
tr.squad-head .sq-place { display: inline-block; min-width: 34px; }
tr.squad-head .sq-name { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
tr.squad-head .sq-tot { float: right; color: var(--muted); font-variant-numeric: tabular-nums; }
tbody.squad.us tr.squad-head td { background: var(--accent-dim); }
tbody.squad.us tr.squad-head .sq-name, tbody.squad.us tr.squad-head .sq-tot { color: #fff; }
tbody.squad.us tr:not(.squad-head) td { background: #0f1d2e; }
.panel.scroll { max-height: 640px; overflow-y: auto; }
.panel.scroll thead th { position: sticky; top: 0; background: var(--bg2); z-index: 1; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

/* admin / forms */
input, button { font: inherit; }
input[type=text], input[type=password] {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 12px; width: 100%;
}
.btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: #3a1517; color: var(--red); border: 1px solid #5a2024; }
.row-form { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.center { text-align: center; } .mt { margin-top: 16px; }
.loading { color: var(--muted); padding: 40px; text-align: center; }
.empty { color: var(--faint); padding: 30px 16px; text-align: center; }

/* mobile */
@media (max-width: 720px) {
  .sidebar { position: fixed; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .content { padding: 16px; }
  .topbar { padding: 14px 16px; }
  .menu-btn { display: inline-grid !important; }
}
.menu-btn { display: none; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--bg3); border: 1px solid var(--border); color: var(--text); cursor: pointer; }
table.lobby td:first-child { white-space: nowrap; }

/* meta charts: thin single-series marks, value at the tip, hairline axis */
.chart { padding: 16px 18px; }
.chart .sub { color: var(--faint); font-size: 12px; margin: -4px 0 12px; }
.hb { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 10px; padding: 3px 0; }
.hb-l { color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hb-bar { height: 14px; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.hb-v { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cols { display: flex; align-items: flex-end; gap: 2px; height: 160px; border-bottom: 1px solid var(--border); }
.col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.col-bar { width: 100%; max-width: 24px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 1px; }
.col-v { color: var(--muted); font-size: 11px; margin-bottom: 4px; font-variant-numeric: tabular-nums; min-height: 14px; }
.col-ticks { display: flex; gap: 2px; margin-top: 6px; }
.col-ticks span { flex: 1; text-align: center; color: var(--faint); font-size: 11px; white-space: nowrap; overflow: hidden; }
.grid2.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .grid2.even { grid-template-columns: 1fr; } }
.sharebar { display: inline-block; height: 8px; background: var(--accent); border-radius: 0 4px 4px 0; vertical-align: middle; margin-right: 8px; }

.badge.ban-perm { background: #3a1517; color: var(--red); }
.badge.ban-temp { background: #2a2410; color: var(--orange); }
.seg { display: inline-flex; background: var(--bg3); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 6px 14px; border-radius: 7px; cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--accent-dim); color: #fff; }

.ctag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--muted);
        background: var(--bg3); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; margin-right: 6px;
        vertical-align: 1px; line-height: 16px; }
tr.squad-head .ctag { margin-right: 0; color: var(--text); }

.search { position: relative; }
.suggest { position: absolute; left: 6px; right: 6px; top: calc(100% - 2px); z-index: 30; background: var(--bg2);
           border: 1px solid var(--border); border-radius: 9px; padding: 4px; box-shadow: 0 10px 30px #0008; }
.sg { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.sg .ava { width: 22px; height: 22px; font-size: 9px; }
.sg-n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg[aria-selected="true"], .sg:hover { background: var(--bg3); }
.sg-api { color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); border-radius: 0 0 7px 7px; margin-top: 2px; }

/* kill feed: names never wrap (tag + name + badge stay on one line); the weapon text gives way first */
.feed .row .k, .feed .row .v { white-space: nowrap; flex-shrink: 0; }
.feed .row .wep { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
