/* AWG Panel — "Техно без паники" dark UI */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../fonts/manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/caveat-cyrillic.woff2") format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1; }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/caveat-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }

:root {
  --bg: #040b1c;
  --bg-2: #071330;
  --panel: #0a1834;
  --panel-2: #0d1f42;
  --panel-3: #12264f;
  --line: #19305c;
  --line-2: #22407a;
  --text: #e8effd;
  --text-2: #b7c6e4;
  --muted: #7f93b9;
  --accent: #2f7dff;
  --accent-2: #4f95ff;
  --accent-soft: rgba(47, 125, 255, .16);
  --glow: 0 0 0 1px rgba(79, 149, 255, .35), 0 8px 30px rgba(20, 90, 255, .25);
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, .14);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, .14);
  --bad: #ef4444;
  --bad-soft: rgba(239, 68, 68, .14);
  --off: #7f93b9;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text);
  background: radial-gradient(1200px 600px at 70% -10%, rgba(47,125,255,.12), transparent 60%), var(--bg);
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg.i.sm { width: 15px; height: 15px; } svg.i.lg { width: 24px; height: 24px; } svg.i.xl { width: 30px; height: 30px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); cursor: pointer;
  font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--panel-3); border-color: #2c4f93; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #3d8bff, #2266f0); border-color: #3d86ff; box-shadow: 0 4px 18px rgba(47,125,255,.35); }
.btn.primary:hover { background: linear-gradient(180deg, #4f97ff, #2a70f7); }
.btn.danger { background: var(--bad-soft); border-color: rgba(239,68,68,.5); color: #ffb4b4; }
.btn.danger:hover { background: rgba(239,68,68,.25); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
input.inp, select.inp, textarea.inp {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: #07142d; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.inp { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp::placeholder { color: #5a6f98; }
.inp-group { display: flex; gap: 8px; }
.inp-group > .inp:first-child { flex: 1; }
.inp-group > select.inp { width: 90px; flex: none; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; margin: 6px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.radio-cards button { border: 1px solid var(--line-2); background: #07142d; border-radius: 10px; padding: 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.radio-cards button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); box-shadow: var(--glow); }

/* toggle switch */
.switch { position: relative; display: inline-flex; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #243556; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #cfd9ee; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.switch input:disabled + span { opacity: .5; }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- layout ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 10px 22px;
  background: rgba(4, 11, 28, .86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 42px; height: 42px; }
.brand b { display: block; font-size: 19px; line-height: 1.1; }
.brand small { display: block; color: var(--accent-2); font-weight: 600; font-size: 12px; }
.brand .tagline { font-family: "Caveat", cursive; font-size: 19px; color: var(--text-2); margin-left: 14px; line-height: 1.05; }
.brand .tagline em { color: #6aa8ff; font-style: normal; }
.topbar .spacer { flex: 1; }
.modes { display: inline-flex; padding: 3px; border-radius: 12px; background: #07122a; border: 1px solid var(--line-2); }
.modes button { border: 0; background: transparent; color: var(--text-2); padding: 7px 16px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13px; }
.modes button.on { background: linear-gradient(180deg, #3d8bff, #2266f0); color: #fff; box-shadow: 0 2px 12px rgba(47,125,255,.45); }
/* the server pill is what gives way in a narrow header: it shrinks with an ellipsis, the brand and mode switch keep their size */
.brand, .modes { flex: none; }
.modes button, .brand small { white-space: nowrap; }
.server-slot { min-width: 0; flex: 0 1 auto; }
.server-slot .pop-anchor { max-width: 100%; }
.server-pill { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line-2);
  background: #07122a; cursor: default; font: inherit; font-size: 13px; color: var(--text); text-align: left; min-width: 0;
  max-width: min(340px, 100%); }
.server-pill.click { cursor: pointer; }
.server-pill.click:hover { border-color: var(--accent); }
.pop .pop-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.notif-server { display: block; font-size: 11.5px; }
.server-pill .lines { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.server-pill .lines span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent;
  color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.iconbtn:hover { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.badge { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--bad); color: #fff;
  font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.usermenu { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; background: transparent; color: var(--text); }
.usermenu:hover { background: var(--panel-2); border-color: var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-3); display: flex; align-items: center; justify-content: center; color: var(--text-2); }

.page { padding: 22px; max-width: 1560px; margin: 0 auto; }
.detailed { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 0; min-height: calc(100vh - 63px); }
.sidebar { border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px;
  background: linear-gradient(180deg, rgba(10,24,52,.6), rgba(4,11,28,.2)); position: sticky; top: 63px; height: calc(100vh - 63px); }
.sidebar a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; }
.sidebar a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.sidebar a.on { background: linear-gradient(180deg, #2f7dff, #2266f0); color: #fff; box-shadow: 0 4px 16px rgba(47,125,255,.35); }
.sidebar .mascot { margin-top: auto; text-align: center; padding-top: 12px; }
.sidebar .mascot img { width: 140px; filter: drop-shadow(0 8px 24px rgba(47,125,255,.35)); }
.sidebar .mascot p { font-family: "Caveat", cursive; font-size: 22px; color: var(--text-2); margin: 4px 0 0; transform: rotate(-4deg); }
.main { padding: 22px; min-width: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

.card { background: linear-gradient(180deg, rgba(14,32,68,.92), rgba(9,22,48,.92)); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.tight { padding: 14px; }
.card h3 { margin-bottom: 12px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18,40,84,.85), rgba(10,24,52,.85)); min-width: 0; }
.tile .ic { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none;
  background: var(--accent-soft); color: var(--accent-2); }
.tile .ic.ok { background: var(--ok-soft); color: var(--ok); }
.tile b { display: block; font-size: 19px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { display: block; color: var(--muted); font-size: 12px; line-height: 1.25; }

/* hero (simple mode) */
.hero { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line-2); min-height: 270px;
  background: #0a1834 url("../img/banner.webp") right center / cover no-repeat; box-shadow: var(--shadow); }
.hero::before { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(4,11,28,.97) 0%, rgba(4,11,28,.93) 34%, rgba(4,11,28,.55) 58%, rgba(4,11,28,.05) 80%); }
.hero.warn::before { background: linear-gradient(90deg, rgba(40,24,4,.97) 0%, rgba(28,18,6,.92) 34%, rgba(20,14,6,.5) 60%, rgba(4,11,28,.05) 82%); }
.hero.fail::before { background: linear-gradient(90deg, rgba(46,8,12,.97) 0%, rgba(36,8,12,.93) 34%, rgba(30,8,12,.55) 60%, rgba(4,11,28,.05) 82%); }
.hero-inner { position: relative; display: flex; gap: 8px; padding: 18px 22px; align-items: center; }
.hero .bot { width: 190px; flex: none; align-self: flex-end; margin-bottom: -18px; filter: drop-shadow(0 10px 30px rgba(47,125,255,.35)); }
.hero .bot + .sign { display: none; }
.hero-body { flex: 1; min-width: 0; padding-left: 8px; }
.hero-title { display: flex; align-items: center; gap: 12px; }
.hero-title h1 { font-size: 30px; color: #7df0a3; text-shadow: 0 0 22px rgba(34,197,94,.35); }
.hero.warn .hero-title h1 { color: #ffd27a; text-shadow: 0 0 22px rgba(245,165,36,.35); }
.hero.fail .hero-title h1 { color: #ff9a9a; text-shadow: 0 0 22px rgba(239,68,68,.35); }
.hero-badge { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--ok); color: #04150a; flex: none; }
.hero.warn .hero-badge { background: var(--warn); } .hero.fail .hero-badge { background: var(--bad); color: #fff; }
.hero-sub { color: var(--text-2); margin: 4px 0 16px; }
.hero-problems { margin: -8px 0 14px; padding: 0; list-style: none; }
.hero-problems li { display: flex; gap: 8px; align-items: flex-start; color: #ffe2b0; margin: 3px 0; font-size: 13px; }
.hero.fail .hero-problems li { color: #ffd0d0; }
.hero .tiles { grid-template-columns: repeat(4, minmax(0, 192px)); }
.hero .tile { background: rgba(10, 24, 52, .78); backdrop-filter: blur(6px); }
.hero-slogan { position: absolute; left: 47%; top: 20px; font-family: "Caveat", cursive; font-size: 23px; line-height: 1.1; color: #e8f0ff;
  transform: rotate(-8deg); text-shadow: 0 2px 12px rgba(0,0,0,.7); max-width: 300px; pointer-events: none; }
.hero-slogan em { color: #7fb3ff; font-style: normal; }
.hero-cta { position: absolute; right: 18px; top: 16px; }

/* device cards */
.devices { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 14px; }
.dev { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15,34,72,.95), rgba(9,21,46,.95)); box-shadow: var(--shadow); min-width: 0; }
.dev.blocked { border-color: rgba(239,68,68,.45); }
.dev.disabled { opacity: .82; }
.dev-head { display: flex; align-items: flex-start; gap: 12px; }
.dev-ic { position: relative; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none;
  background: var(--ok-soft); color: #5ee08e; }
.dev.offline .dev-ic { background: var(--accent-soft); color: var(--accent-2); }
.dev.disabled .dev-ic { background: rgba(127,147,185,.12); color: var(--off); }
.dev.blocked .dev-ic { background: var(--bad-soft); color: #ff8a8a; }
.dev-name { flex: 1; min-width: 0; }
.dev-name b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-name .ip { color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); flex: none; }
.dot.online { background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.dot.offline { background: #5a6f98; }
.dot.disabled { background: var(--warn); }
.dot.blocked { background: var(--bad); box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
.status.online { color: #6ee7a0; } .status.offline { color: var(--muted); } .status.disabled { color: #ffc970; } .status.blocked { color: #ff8f8f; }
.dev.schedule { opacity: .9; }
.dev.schedule .dev-ic { background: rgba(139,124,246,.14); color: #b3a6ff; }
.dot.schedule { background: #8b7cf6; }
.status.schedule { color: #b3a6ff; }
.slow-text { color: #f5b041; }
.controls { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.speed-inp { max-width: 190px; }
.inp-unit { display: flex; align-items: center; padding: 0 10px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.sched-rule { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--line-2); border-radius: 12px; }
.day-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.day-chips button { min-width: 36px; padding: 5px 0; border-radius: 8px; border: 1px solid var(--line-2); background: transparent;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.day-chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sched-times { display: flex; gap: 6px; align-items: center; }
.sched-times .inp { width: 108px; padding: 6px 8px; }
.sched-state { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(139,124,246,.08); }
.limit-badge { display: inline-block; margin-top: 3px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; color: #9ec2ff;
  background: rgba(79,149,255,.12); white-space: nowrap; }
.limit-badge.slow { color: #f5b041; background: rgba(245,176,65,.12); }
.speeds { display: flex; gap: 14px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.speeds .dn { color: #7fb3ff; } .speeds .up { color: #6ee7a0; }
.usage-line { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; }
.usage-line span:last-child { font-size: 12.5px; color: var(--text-2); }
.bar { height: 8px; border-radius: 99px; background: #1a2b4f; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #22c55e, #4ade80); }
.bar.blue i { background: linear-gradient(90deg, #2f7dff, #5aa2ff); }
.bar.warn i { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar.bad i { background: linear-gradient(90deg, #dc2626, #f87171); }
.bar.none i { background: repeating-linear-gradient(45deg, #2a3d66 0 6px, #22345a 6px 12px); width: 100% !important; }
.dev-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); gap: 8px; }
.dev-meta .bad { color: #ff8f8f; font-weight: 600; }
.dev-actions { display: flex; gap: 6px; margin-top: 2px; }
.dev-actions .btn { flex: 1; padding: 0 6px; }
.dev-actions .btn.icon { flex: none; }
.spark { width: 100%; height: 28px; display: block; }
.add-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 250px; border-radius: 14px;
  border: 2px dashed #2f5bb0; background: rgba(47,125,255,.05); color: var(--accent-2); cursor: pointer; text-align: center; padding: 20px; }
.add-card:hover { background: rgba(47,125,255,.1); border-color: var(--accent); }
.add-card b { font-size: 17px; color: #8fbcff; }
.add-card small { color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 10px 10px; background: rgba(7,18,42,.75);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid rgba(25,48,92,.6); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: rgba(47,125,255,.05); }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-name { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.cell-name .dev-ic { width: 32px; height: 32px; border-radius: 9px; }
.cell-name .dev-ic svg { width: 17px; height: 17px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.cell-spark { width: 90px; }
.cell-spark .spark { height: 24px; }

/* key-value list */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.kv.left dd { text-align: left; }
@media (max-width: 560px) {  /* long values (domains, addresses) under their label on a phone */
  .kv.stack-sm { grid-template-columns: 1fr; gap: 2px; }
  .kv.stack-sm dd { text-align: left; margin-bottom: 8px; }
}
.state-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13px; gap: 8px; }
.state-row + .state-row { border-top: 1px dashed rgba(34,64,122,.5); }

/* events */
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed rgba(34,64,122,.45); }
.events li:last-child { border-bottom: 0; }
.events time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; min-width: 42px; }
.ev-ic { width: 18px; height: 18px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.ev-ic.info { color: var(--ok); } .ev-ic.warning { color: var(--warn); } .ev-ic.error { color: var(--bad); } .ev-ic.muted { color: var(--muted); }

/* chart */
.chart { width: 100%; height: 170px; display: block; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--text-2); padding: 6px 12px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.seg button.on { background: var(--accent-soft); color: #fff; }
.seg button + button { border-left: 1px solid var(--line-2); }

/* modal */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(2, 6, 18, .72); backdrop-filter: blur(4px); display: flex;
  align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; overflow-y: auto; animation: fade .15s ease; }
.modal { width: 100%; max-width: 520px; background: linear-gradient(180deg, #0f2248, #0a1834); border: 1px solid var(--line-2);
  border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: pop .18s ease; }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0 } } @keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0 } }
.steps { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
.steps span { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.steps span i { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal;
  background: var(--panel-3); color: var(--text-2); font-weight: 700; font-size: 12px; }
.steps span.on { color: var(--text); } .steps span.on i { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.steps span.done i { background: var(--ok); color: #04150a; }
.steps .sep { width: 26px; height: 1px; background: var(--line-2); align-self: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }  /* on a narrow phone the tabs still scroll sideways by touch */
.tabs button { flex: none; white-space: nowrap; }
.tabs button { border: 0; background: transparent; color: var(--muted); padding: 9px 12px; cursor: pointer; font-weight: 600; font-size: 13px;
  border-bottom: 2px solid transparent; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.qr-box { display: flex; justify-content: center; }
.qr-box img { width: 290px; max-width: 100%; height: auto; border-radius: 12px; background: #fff; padding: 6px; }
/* VPN profiles */
.profiles { display: flex; flex-direction: column; gap: 8px; }
.profile-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px;
  background: #07122a; }
.profile-row.off { opacity: .7; }
.profile-row > .dot { margin-top: 6px; flex: none; }
.profile-row .who { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; }
.awg-update { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.speed-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.speed-nums > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; }
.speed-nums b { font-size: 18px; white-space: nowrap; }
.speed-nums span { font-size: 12px; color: var(--muted); }
.speed-page { display: flex; gap: 16px; align-items: center; }
.speed-page img { background: #fff; border-radius: 10px; padding: 4px; flex: none; }
table.t .show-sm { display: none; }
.guard-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 12px; }
.guard-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; }
.guard-stats b { font-size: 20px; }
.guard-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.guard-list li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 8px 8px 8px 12px;
  border: 1px solid var(--line-2); border-radius: 10px; }
.guard-trust { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.vpn-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; padding: 14px; border: 1px solid var(--line-2);
  border-radius: 12px; }
@media (max-width: 640px) { .vpn-options { grid-template-columns: 1fr; } }
/* access between devices (personal edition) */
.peer-rules, .peer-groups, .member-list, .access-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.peer-rule { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 8px 10px 12px;
  border: 1px solid var(--line-2); border-radius: 12px; }
.peer-rule.off { opacity: .7; }
.peer-rule-main { display: grid; gap: 5px; min-width: 0; }
.peer-rule-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 600; }
.peer-arrow { color: var(--accent); font-size: 17px; line-height: 1; }
.peer-ep { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.peer-ep .i { color: var(--text-2); flex: none; }
.peer-ep.archived { color: var(--muted); }
.peer-groups li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 8px 10px 12px;
  border: 1px solid var(--line-2); border-radius: 12px; }
.member-list { max-height: 320px; overflow-y: auto; gap: 2px; }
.member-list .check { padding: 6px 4px; }
.rule-preview { padding: 10px 12px; border-radius: 12px; background: rgba(47, 125, 255, .08); border: 1px solid rgba(47, 125, 255, .3); }
.access-h { font-size: 14px; margin: 14px 0 6px; }
.access-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px; }
.device-access .kv dd .btn { vertical-align: middle; }
.device-access .btn-row .btn { white-space: normal; height: auto; min-height: 36px; padding-top: 6px; padding-bottom: 6px; text-align: left; }
.card.inset { margin: 10px 0; padding: 14px; background: rgba(7, 20, 45, .6); }
.choice-list { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; }
.choice.on { border-color: var(--accent); background: rgba(47, 125, 255, .08); }
.choice input { margin-top: 3px; }
.choice > span { display: flex; flex-direction: column; gap: 3px; }
/* Yandex.Disk login with a code */
.cloud-code { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.steps-list { margin: 0 0 12px; padding-left: 20px; line-height: 1.55; }
.code-big { font: 700 34px/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 3px; padding: 10px 16px;
  border-radius: 12px; background: #07122a; border: 1px solid var(--line-2); display: inline-block; margin-bottom: 10px; }
.qr-sm { width: 170px; height: auto; border-radius: 10px; background: #fff; padding: 5px; }
.ok-text { color: #22c55e; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.copy-field .btn, .copy-field .iconbtn { flex-shrink: 0; }
/* a password the person may copy by hand: always shown whole, large and unambiguous */
.pw-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 8px 8px 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: #07142d; }
.pw-box .pw { flex: 1 1 200px; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 17px; letter-spacing: .06em;
  word-break: break-all; color: var(--text); user-select: all; }
.pw-box .pw-actions { display: flex; gap: 6px; margin-left: auto; }

/* popover menus */
.pop-anchor { position: relative; }
.pop { position: fixed; z-index: 70; min-width: 220px; background: #0d1f42; border: 1px solid var(--line-2);
  border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.55); padding: 6px; animation: pop .12s ease; }
.pop button, .pop a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: transparent; color: var(--text);
  border-radius: 8px; cursor: pointer; text-align: left; font-size: 13px; }
.pop button:hover, .pop a:hover { background: var(--panel-3); text-decoration: none; }
.pop button.danger { color: #ff9a9a; }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.notif { width: 360px; max-width: calc(100vw - 24px); padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif ul { list-style: none; margin: 0; padding: 6px; max-height: 380px; overflow-y: auto; }
.notif li { display: flex; gap: 10px; padding: 9px 8px; border-radius: 8px; font-size: 12.5px; }
.notif li.unread { background: rgba(47,125,255,.08); }
.notif li time { color: var(--muted); margin-left: auto; white-space: nowrap; padding-left: 8px; }

/* alerts, toasts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid; font-size: 13px; margin-bottom: 14px; }
.alert.info { border-color: rgba(79,149,255,.4); background: rgba(47,125,255,.08); color: #cfe0ff; }
.alert.warn { border-color: rgba(245,165,36,.45); background: var(--warn-soft); color: #ffe2b0; }
.alert.bad { border-color: rgba(239,68,68,.5); background: var(--bad-soft); color: #ffd0d0; }
.alert.ok { border-color: rgba(34,197,94,.45); background: var(--ok-soft); color: #c7f5d8; }
.alert details { margin-top: 6px; }
.alert summary { cursor: pointer; color: var(--text-2); font-size: 12px; }
.alert pre { white-space: pre-wrap; word-break: break-word; font-size: 11.5px; color: var(--text-2); margin: 6px 0 0; max-height: 220px; overflow: auto; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { padding: 12px 14px; border-radius: 12px; background: #0f2248; border: 1px solid var(--line-2); box-shadow: 0 12px 40px rgba(0,0,0,.5);
  display: flex; gap: 10px; align-items: flex-start; font-size: 13px; animation: pop .15s ease; }
.toast.ok { border-color: rgba(34,197,94,.5); } .toast.bad { border-color: rgba(239,68,68,.55); } .toast.warn { border-color: rgba(245,165,36,.55); }
.welcome { display: flex; gap: 20px; align-items: center; margin-bottom: 16px; }
.welcome img { width: 110px; flex-shrink: 0; }
@media (max-width: 600px) { .welcome { flex-direction: column; text-align: center; } }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty img { width: 120px; opacity: .9; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; border: 1px solid; }
.pill.ok { color: #6ee7a0; border-color: rgba(34,197,94,.4); background: var(--ok-soft); }
.pill.warn { color: #ffc970; border-color: rgba(245,165,36,.4); background: var(--warn-soft); }
.pill.bad { color: #ff9a9a; border-color: rgba(239,68,68,.45); background: var(--bad-soft); }
.pill.off { color: var(--muted); border-color: var(--line-2); background: transparent; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed rgba(34,64,122,.5); }
.checks li:last-child { border-bottom: 0; }
.checks .c-ic { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.checks .c-ic.ok { background: var(--ok-soft); color: var(--ok); } .checks .c-ic.warn { background: var(--warn-soft); color: var(--warn); }
.checks .c-ic.fail { background: var(--bad-soft); color: var(--bad); } .checks .c-ic.run { background: var(--accent-soft); color: var(--accent-2); }
.checks b { display: block; }
.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg) } }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid2 > .full { grid-column: 1 / -1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.skeleton { background: linear-gradient(90deg, #0d1f42 25%, #14295a 50%, #0d1f42 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0 } }

/* login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; background: #081530 url("../img/banner.webp") 72% center / cover no-repeat; }
.login-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4,11,28,.2), rgba(4,11,28,.85)); }
.login-art .slogan { position: absolute; left: 40px; bottom: 44px; z-index: 1; font-family: "Caveat", cursive; font-size: 34px; line-height: 1.1;
  color: #eaf2ff; text-shadow: 0 2px 14px rgba(0,0,0,.7); max-width: 460px; transform: rotate(-4deg); }
.login-art .slogan em { color: #7fb3ff; font-style: normal; }
.login-side { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-box { width: 100%; max-width: 380px; }
.login-box .brand { margin-bottom: 26px; }
.login-box .brand img { width: 64px; height: 64px; }
.login-box .brand b { font-size: 26px; }

/* ---------- responsive ---------- */
@media (max-width: 1500px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .cols > .stack:last-child { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}
@media (max-width: 1400px) { .hero-slogan { display: none; } }
@media (max-width: 1100px) {
  .brand .tagline, .server-pill .hide-md { display: none; }
  .hero .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detailed { grid-template-columns: 70px minmax(0, 1fr); }
  .sidebar { padding: 14px 8px; }
  .sidebar a { justify-content: center; padding: 11px; }
  .sidebar a span, .sidebar .mascot { display: none; }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .topbar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .brand img { width: 36px; height: 36px; } .brand b { font-size: 17px; } .brand small { font-size: 11px; }
  /* second row: which server is open + simple/detailed switch */
  .server-slot { order: 9; flex: 1 1 130px; }
  .server-slot .pop-anchor, .server-slot .server-pill { width: 100%; max-width: none; }
  .server-pill { padding: 5px 10px; gap: 8px; } .server-pill svg { margin-left: auto; flex: none; }
  .modes { order: 10; flex: 1 0 auto; } .modes button { flex: 1; padding: 7px 12px; }
  .modes .hide-sm, .server-pill .hide-sm { display: none; }
  .page, .main { padding: 14px 12px; }
  .detailed { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line);
    padding: 8px 10px; gap: 4px; }
  .sidebar a { flex: none; padding: 8px 12px; }
  .sidebar a span { display: inline; font-size: 13px; }
  .hero { min-height: 0; background-image: none; }
  .hero::before { background: linear-gradient(180deg, rgba(4,11,28,.25), rgba(4,11,28,.96) 42%) , url("../img/banner-mobile.webp") center top / cover no-repeat; }
  .hero.warn::before { background: linear-gradient(180deg, rgba(40,24,4,.35), rgba(28,18,6,.97) 42%), url("../img/banner-mobile.webp") center top / cover no-repeat; }
  .hero.fail::before { background: linear-gradient(180deg, rgba(46,8,12,.35), rgba(36,8,12,.97) 42%), url("../img/banner-mobile.webp") center top / cover no-repeat; }
  .hero-inner { flex-direction: column; align-items: stretch; padding: 16px; }
  .hero .bot, .hero .bot + .sign { display: none; }
  .hero-cta { position: relative; inset: auto; z-index: 1; padding: 0 16px 16px; } .hero-cta .btn { width: 100%; height: 42px; }
  .hero-title h1 { font-size: 22px; } .hero-body { padding: 110px 0 0; }
  .hero .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px; gap: 10px; } .tile .ic { width: 36px; height: 36px; } .tile b { font-size: 16px; }
  .devices { grid-template-columns: 1fr; }
  .add-card { min-height: 120px; }
  .grid2, .form-grid, .cloud-code { grid-template-columns: minmax(0, 1fr); }
  .cloud-code .qr-sm { display: none; }  /* on the phone itself the link is enough */  /* minmax: wide content scrolls inside, never widens the page */
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { min-height: 200px; } .login-art .slogan { font-size: 26px; left: 20px; bottom: 20px; }
  .overlay { padding: 0; align-items: stretch; }
  .modal { max-width: none; border-radius: 0; min-height: 100vh; }
  table.t .hide-sm { display: none; }
  table.t .show-sm { display: block; }
  .speed-nums { grid-template-columns: repeat(2, 1fr); }
  .speed-page { flex-direction: column; align-items: flex-start; }
  .steps { gap: 4px; } .steps .sep { width: 8px; } .steps span { font-size: 11.5px; gap: 5px; }
  .usermenu .hide-sm { display: none; }
}

.rot { transform: rotate(-90deg); }
.bad { color: #ff8f8f; }
.warn-text { color: #f5b041; }


.ic-more { stroke-width: 3.4; }
