:root {
  --bg: #050b14; --panel: #0a1521; --card: #0f1d2b; --card2: #142738; --line: #1d3347;
  --text: #e6f0f5; --muted: #8fa6b5; --teal: #19c3ad; --teal-d: #12907f; --amber: #f5a623; --green: #3ddc84;
  --red: #ff6b5e; --blue: #4aa8ff;
  --ok-bg: #0e3a2a; --warn-bg: #3d2e0a; --bad-bg: #4a1613; --info-bg: #14283a;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
a { color: var(--teal); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.error { color: var(--red); }
.ok { color: var(--green); }
.warn { color: var(--amber); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; letter-spacing: .2px; text-decoration: none; color: var(--text); }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand b { color: var(--teal); }
nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
nav a { color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 999px; border: 1px solid transparent; }
nav a:hover { background: var(--card); }
nav a[aria-current="page"] { background: var(--teal); color: #03211c; font-weight: 650; }
.pill { display: inline-block; min-width: 20px; padding: 0 7px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; text-align: center; margin-left: 4px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button, select, input, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; min-height: 38px; }
textarea { width: 100%; min-height: 70px; }
button { cursor: pointer; }
button:hover { background: var(--card2); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, textarea:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
button.primary { background: var(--teal); color: #03211c; border-color: var(--teal); font-weight: 650; }
button.danger { border-color: #8a2a24; color: #ff9c92; }
button.ghost { background: transparent; }
button.small { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.who { color: var(--muted); font-size: 13px; }

main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.card > h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 10px; }
.section { font-size: 17px; margin: 24px 0 10px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.tile.accent { border-color: var(--teal-d); background: linear-gradient(160deg, var(--card2), var(--card)); }
.tile .value { font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile.accent .value { color: var(--teal); }
.tile .label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: 6px; }
.banner { border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; border: 1px solid var(--line); background: var(--info-bg); }
.banner.warn { background: var(--warn-bg); border-color: #6b5115; color: #ffe2a3; }
.banner.bad { background: var(--bad-bg); border-color: #8a2a24; color: #ffc2bb; }

.badge { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; border: 1px solid transparent; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: #8cf0b7; border-color: #1f6b3e; }
.badge.warn { background: var(--warn-bg); color: #ffd477; border-color: #7a5d17; }
.badge.bad { background: var(--bad-bg); color: #ff9c92; border-color: #8a2a24; }
.badge.info { background: var(--info-bg); color: var(--muted); border-color: var(--line); }

.appcard { cursor: pointer; display: grid; gap: 8px; text-decoration: none; color: inherit; }
.appcard:hover { border-color: var(--teal-d); }
.appcard .name { font-size: 16px; font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item { border: 1px solid var(--line); border-left-width: 5px; border-radius: 12px; padding: 10px 12px; background: var(--card); }
.item.bad { border-left-color: var(--red); } .item.warn { border-left-color: var(--amber); } .item.info { border-left-color: var(--muted); } .item.done { opacity: .6; }
.item .head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.item .meta { color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.item .detail { color: var(--muted); font-size: 14px; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }

.chart svg { width: 100%; height: auto; display: block; }
.chart .lbl { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 4px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }

.form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); align-items: end; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.form label.check { display: flex; align-items: center; gap: 8px; }
.form input[type="checkbox"] { min-height: 0; width: 18px; height: 18px; }
.login { max-width: 440px; margin: 56px auto; display: grid; gap: 14px; text-align: center; }
.login img { width: 96px; height: 96px; border-radius: 22px; margin: 0 auto; }
.login form { display: grid; gap: 10px; text-align: left; }
.empty { color: var(--muted); font-style: italic; margin: 0; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--card2); border: 1px solid var(--teal-d); padding: 10px 16px; border-radius: 12px; z-index: 20; max-width: 90vw; }
.toast.bad { border-color: var(--red); }
@media (max-width: 600px) { main { padding: 12px; } .tile .value { font-size: 24px; } .grid.wide { grid-template-columns: 1fr; } }

/* users and countries */
.num.big { font-size: 22px; font-weight: 700; }
.small { font-size: 12px; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.bars li { display: grid; grid-template-columns: minmax(90px, 46%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.bars .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .bar { height: 8px; background: var(--card2); border-radius: 4px; overflow: hidden; }
.bars .bar i { display: block; height: 100%; background: var(--teal); border-radius: 4px; }
.bars .v { color: var(--muted); font-variant-numeric: tabular-nums; }
.maprow { display: grid; gap: 12px; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; }
.worldmap svg { width: 100%; height: auto; display: block; }
.worldmap .sphere { fill: #08121d; stroke: var(--line); stroke-width: .6; }
.worldmap .land { fill: var(--card2); stroke: #050b14; stroke-width: .4; }
.worldmap .land.has { cursor: pointer; }
.worldmap .land.has:hover { stroke: var(--amber); stroke-width: 1.2; }
.worldmap .scale { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.worldmap .scale i { flex: 1; height: 8px; border-radius: 4px; background: linear-gradient(90deg, rgba(25,195,173,.22), rgba(25,195,173,1)); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--card2); }
@media (max-width: 800px) { .maprow { grid-template-columns: 1fr; } }
.bars .rel { color: var(--muted); font-size: 11px; }
