/* ==========================================================================
   ec-vpn · design system v2
   One entry → two countries → one subscription.
   ========================================================================== */

:root {
  --bg: #05060a;
  --bg-2: #080a11;
  --surface: #0b0d15;
  --surface-2: #0f121c;
  --surface-3: #141826;
  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f2f3f8;
  --muted: #9aa0b4;
  --dim: #666d82;
  --accent: #8b95ff;
  --accent-2: #5fd4e6;
  --violet: #b79cff;
  --ok: #45d6a0;
  --warn: #f2b544;
  --bad: #ff7373;
  --r: 18px;
  --r-sm: 12px;
  --shadow: 0 30px 70px -46px rgba(0, 0, 0, 0.95);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 520px at 12% -12%, rgba(139, 149, 255, 0.16), transparent 62%),
    radial-gradient(760px 460px at 92% -8%, rgba(95, 212, 230, 0.08), transparent 58%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 20%, transparent 72%);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
h1, h2, h3, h4, p { margin: 0; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.eyebrow {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 650;
}

/* --------------------------------------------------------------- shell -- */
.app { display: flex; min-height: 100vh; }

.side {
  width: 238px;
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: rgba(8, 10, 16, 0.72);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand .logo {
  width: 31px; height: 31px; border-radius: 10px;
  display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #7f8bff, #8f7bff 48%, #5fd4e6);
  box-shadow: 0 10px 24px -10px rgba(127, 139, 255, 0.9);
}
.brand b { display: block; font-size: 14.5px; letter-spacing: -0.01em; }
.brand small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--dim); font-weight: 650; padding: 16px 10px 7px;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 10px; border-radius: 10px;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a svg { width: 17px; height: 17px; opacity: 0.9; flex: none; }
.nav a:hover { background: rgba(255, 255, 255, 0.045); color: var(--text); }
.nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(139, 149, 255, 0.16), rgba(139, 149, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(139, 149, 255, 0.16);
}
.nav a.active svg { color: var(--accent); }
.nav a .count {
  margin-left: auto; font-size: 10px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 0 6px;
}
.nav a.active .count { color: var(--text); border-color: rgba(139, 149, 255, 0.25); }

.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 10px; }
.who:hover { background: rgba(255, 255, 255, 0.035); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
  background: linear-gradient(135deg, #7f8bff, #5fd4e6); color: #080a10;
}
.who b { display: block; font-size: 12.5px; font-weight: 600; }
.who small { display: block; font-size: 10.5px; color: var(--dim); }
.who .role { margin-left: auto; }

.main { flex: 1; min-width: 0; }
.container { width: 100%; max-width: 1680px; margin: 0 auto; padding: 18px clamp(16px, 2.4vw, 40px) 56px; }

.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  min-height: 44px; margin-bottom: 10px;
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 11.5px; }
.crumbs a:hover { color: var(--muted); }
.crumbs .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--dim); }
.crumbs b { color: var(--muted); font-weight: 500; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.page-head { display: flex; align-items: flex-start; gap: 18px; margin: 4px 0 22px; }
.page-head h1 {
  font-size: 27px; line-height: 1.15; letter-spacing: -0.035em; font-weight: 650;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.page-head .sub { color: var(--muted); font-size: 12px; margin-top: 6px; }
.page-head .head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-head h2 { font-size: 16px; letter-spacing: -0.02em; font-weight: 600; }
.section-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- grid -- */
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.split-wide { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }

/* --------------------------------------------------------------- cards -- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.018));
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}
.card.tight { padding: 16px 18px; }
.card.flat { background: var(--surface); box-shadow: none; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-note { font-size: 11px; color: var(--dim); margin-top: 10px; }

.stat { padding: 16px 18px; }
.stat .label { font-size: 9.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--dim); font-weight: 650; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -0.035em; margin-top: 5px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 12px; color: var(--dim); font-weight: 500; letter-spacing: 0; }
.stat .sub { font-size: 11px; color: var(--dim); margin-top: 3px; }
.stat .spark { margin-top: 7px; }

/* ------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.045);
  color: var(--text); font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  border: 0; color: #fff;
  background: linear-gradient(135deg, #7f8bff, #9a7dff);
  box-shadow: 0 12px 26px -14px rgba(127, 139, 255, 0.9);
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.btn.danger { color: #ffb0b0; border-color: rgba(255, 115, 115, 0.32); background: rgba(255, 115, 115, 0.07); }
.btn.danger:hover { background: rgba(255, 115, 115, 0.13); }
.btn.warn { color: #ffd28a; border-color: rgba(242, 181, 68, 0.3); background: rgba(242, 181, 68, 0.07); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 11px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn svg { width: 15px; height: 15px; }

/* -------------------------------------------------------------- chips -- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03);
  color: var(--muted); font-size: 11.5px; font-weight: 500; cursor: pointer;
  transition: 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.active { color: #fff; border-color: rgba(139, 149, 255, 0.4); background: rgba(139, 149, 255, 0.12); }
.chip .flag { width: 16px; height: 11px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.flag { display: inline-block; width: 18px; height: 12px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); flex: none; }
.flag.de { background: linear-gradient(#111 0 33.33%, #d61f26 33.33% 66.66%, #f5c518 66.66%); }
.flag.nl { background: linear-gradient(#ae1c28 0 33.33%, #f4f4f4 33.33% 66.66%, #21468b 66.66%); }
.flag.fr { background: linear-gradient(90deg, #1c3f94 0 33.33%, #fff 33.33% 66.66%, #d61f26 66.66%); }

/* ------------------------------------------------------------- badges -- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04);
  color: var(--muted); font-size: 10px; font-weight: 550; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); border-color: rgba(69, 214, 160, 0.24); background: rgba(69, 214, 160, 0.08); }
.badge.warn { color: var(--warn); border-color: rgba(242, 181, 68, 0.24); background: rgba(242, 181, 68, 0.08); }
.badge.bad { color: var(--bad); border-color: rgba(255, 115, 115, 0.24); background: rgba(255, 115, 115, 0.08); }
.badge.accent { color: #c4c9ff; border-color: rgba(139, 149, 255, 0.3); background: rgba(139, 149, 255, 0.1); }
.badge.violet { color: #d6c6ff; border-color: rgba(183, 156, 255, 0.3); background: rgba(183, 156, 255, 0.1); }
.badge.lg { height: 26px; padding: 0 10px; font-size: 11px; border-radius: 7px; }

/* -------------------------------------------------------------- forms -- */
.field { min-width: 0; }
.field > label { display: block; font-size: 10.5px; color: var(--dim); font-weight: 550; margin-bottom: 5px; }
.field .hint { font-size: 10.5px; color: var(--dim); margin-top: 5px; }
.input, .select, textarea.input {
  width: 100%; height: 40px; padding: 0 11px;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22); color: var(--text);
  font-family: var(--font); font-size: 12.5px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.input::placeholder { color: #4d5366; }
.input:focus, .select:focus { border-color: rgba(139, 149, 255, 0.55); box-shadow: 0 0 0 3px rgba(139, 149, 255, 0.12); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }

.copy {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, 0.26); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px 3px 3px 10px; min-width: 0;
}
.copy input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--muted); font-family: var(--mono); font-size: 10.5px; height: 30px;
}
.copy .btn { flex: none; }

.seg { display: inline-flex; padding: 2px; border-radius: 9px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.2); gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--dim);
  font-size: 11px; font-weight: 550; padding: 5px 10px; border-radius: 7px; cursor: pointer;
}
.seg button.on { background: rgba(255, 255, 255, 0.09); color: var(--text); }

.switch { width: 36px; height: 21px; border-radius: 11px; background: rgba(255, 255, 255, 0.12); position: relative; cursor: pointer; flex: none; border: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #cfd3e2; transition: 0.15s; }
.switch.on { background: linear-gradient(90deg, #7f8bff, #5fd4e6); }
.switch.on::after { left: 17px; background: #fff; }

/* -------------------------------------------------------------- table -- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  text-align: left; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dim); font-weight: 650; padding: 0 10px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 12px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.045); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .strong { font-weight: 600; }

/* ------------------------------------------------------------ progress -- */
.meter { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #7f8bff, #5fd4e6); }
.meter > span.warn { background: var(--warn); }
.meter > span.bad { background: var(--bad); }

/* --------------------------------------------------------------- route -- */
.route {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, 0.16);
}
.route-node { display: flex; align-items: center; gap: 9px; min-width: 0; }
.route-ico {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line); color: var(--muted);
}
.route-ico svg { width: 16px; height: 16px; }
.route-node b { font-size: 12px; font-weight: 600; display: block; line-height: 1.2; }
.route-node small { font-size: 10px; color: var(--dim); display: block; margin-top: 1px; }
.route-node.active .route-ico { border-color: rgba(139, 149, 255, 0.5); background: rgba(139, 149, 255, 0.12); color: #b9c0ff; }
.route-line { flex: 1; height: 1px; background: linear-gradient(90deg, rgba(139, 149, 255, 0.1), rgba(139, 149, 255, 0.5)); position: relative; min-width: 18px; }
.route-line::after {
  content: ""; position: absolute; right: -2px; top: -2px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(139, 149, 255, 0.8);
}
.route.compact { padding: 10px 12px; }
.route.compact .route-ico { width: 28px; height: 28px; border-radius: 8px; }

/* -------------------------------------------------------------- device -- */
.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.device-card {
  display: flex; flex-direction: column; gap: 0;
  padding: 16px; border-radius: 16px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.016));
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.device-card:hover { border-color: var(--line-2); transform: translateY(-1px); background: rgba(255, 255, 255, 0.04); }
.dc-top { display: flex; align-items: flex-start; gap: 10px; }
.dc-ico {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center; background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line); color: var(--muted);
}
.dc-ico svg { width: 18px; height: 18px; }
.dc-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.dc-meta { font-size: 10.5px; color: var(--dim); margin-top: 2px; }
.dc-status { margin-left: auto; }
.dc-exit { display: flex; align-items: center; gap: 7px; margin-top: 14px; font-size: 11.5px; color: var(--muted); }
.dc-exit b { color: var(--text); font-weight: 550; }
.dc-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.05); font-size: 10.5px; color: var(--dim); }
.dc-foot .right { margin-left: auto; }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(69, 214, 160, 0.5); animation: pulse 2.4s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(69, 214, 160, 0.45); } 70% { box-shadow: 0 0 0 7px rgba(69, 214, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(69, 214, 160, 0); } }

/* ---------------------------------------------------------- exit tabs -- */
.exit-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.exit-tab {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025); color: var(--muted); cursor: pointer;
  transition: 0.15s;
}
.exit-tab:hover { border-color: var(--line-2); }
.exit-tab.active { border-color: rgba(139, 149, 255, 0.48); background: rgba(139, 149, 255, 0.09); color: var(--text); }
.exit-tab .flag { width: 26px; height: 18px; border-radius: 3px; }
.exit-tab b { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.exit-tab small { display: block; font-size: 10px; color: var(--dim); margin-top: 1px; }
.exit-tab .badge { margin-left: auto; }

/* --------------------------------------------------------------- qr ---- */
.qr-card {
  width: 168px; flex: none; border-radius: 14px; overflow: hidden;
  background: #fff; padding: 10px; position: relative;
}
.qr-card img { width: 100%; height: auto; image-rendering: pixelated; }
.qr-card.locked img { filter: blur(7px); opacity: 0.55; }
.qr-card .qr-cover {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  background: rgba(9, 11, 17, 0.55); backdrop-filter: blur(2px);
  color: #fff; font-size: 10.5px;
}
.qr-card .qr-cover svg { width: 22px; height: 22px; opacity: 0.8; }
.qr-card .qr-cover .btn { height: 30px; font-size: 10.5px; }

/* ------------------------------------------------------------- login --- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.95fr; }
.login-left {
  position: relative; padding: 44px 56px; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); overflow: hidden;
}
.login-left::before {
  content: ""; position: absolute; inset: -20% -10% auto -20%; height: 80%;
  background: radial-gradient(closest-side, rgba(139, 149, 255, 0.22), transparent 70%);
  pointer-events: none;
}
.login-brand { display: flex; align-items: center; gap: 11px; font-size: 15px; font-weight: 650; }
.login-hero { margin: auto 0; max-width: 480px; }
.login-hero .eyebrow { color: var(--accent); margin-bottom: 16px; }
.login-hero h1 { font-size: 44px; line-height: 1.06; letter-spacing: -0.045em; font-weight: 650; }
.login-hero h1 em { font-style: normal; color: var(--muted); }
.login-hero p { color: var(--muted); font-size: 14px; line-height: 1.6; margin-top: 18px; max-width: 380px; }
.login-route { margin-top: 34px; }
.login-foot { display: flex; gap: 16px; color: var(--dim); font-size: 10.5px; }
.login-right { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 22px; letter-spacing: -0.03em; }
.login-card .sub { color: var(--muted); font-size: 12px; margin-top: 6px; margin-bottom: 22px; }
.login-card .field + .field { margin-top: 12px; }
.login-card .btn { width: 100%; margin-top: 18px; height: 42px; }
.login-meta { display: flex; align-items: center; gap: 8px; margin-top: 16px; color: var(--dim); font-size: 10.5px; }

/* ------------------------------------------------------------- modal --- */
.modal { position: fixed; inset: 0; z-index: 60; display: none; align-items: flex-start; justify-content: center; padding: 8vh 20px 20px; background: rgba(3, 4, 8, 0.62); backdrop-filter: blur(8px); }
.modal.open { display: flex; }
.modal-panel {
  width: 100%; max-width: 520px; background: #0c0f18; border: 1px solid var(--line-2);
  border-radius: 20px; box-shadow: 0 50px 120px -40px #000; padding: 22px;
  max-height: 84vh; overflow: auto;
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { font-size: 18px; letter-spacing: -0.025em; }
.modal-head .sub { color: var(--dim); font-size: 11.5px; margin-top: 4px; }
.modal-head .x { margin-left: auto; }
.modal-qr { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0 2px; }
.modal-qr .qr-card { width: 220px; }
.modal-qr .caption { font-size: 11px; color: var(--dim); text-align: center; }

/* ------------------------------------------------------------- misc ---- */
.note {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 11px 13px; border-radius: 11px; font-size: 11px; line-height: 1.5;
  border: 1px solid rgba(242, 181, 68, 0.2); background: rgba(242, 181, 68, 0.055); color: #e9c98d;
}
.note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.note.info { border-color: rgba(139, 149, 255, 0.2); background: rgba(139, 149, 255, 0.06); color: #c2c8ff; }
.note.bad { border-color: rgba(255, 115, 115, 0.22); background: rgba(255, 115, 115, 0.06); color: #ffb4b4; }
.note.ok { border-color: rgba(69, 214, 160, 0.2); background: rgba(69, 214, 160, 0.055); color: #a5e9cd; }

.empty { text-align: center; padding: 46px 20px; }
.empty .ico { width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 14px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.045); border: 1px solid var(--line); color: var(--dim); }
.empty h3 { font-size: 15px; font-weight: 600; }
.empty p { color: var(--dim); font-size: 11.5px; max-width: 320px; margin: 5px auto 14px; }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.05); font-size: 12px; }
.list-row:first-child { border-top: 0; padding-top: 0; }
.list-row .lbl { color: var(--muted); }
.list-row .val { margin-left: auto; text-align: right; }
.list-row .val.mono { font-size: 10.5px; }

.timeline { display: flex; flex-direction: column; }
.ev { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.ev:first-child { border-top: 0; padding-top: 0; }
.ev .t { font-family: var(--mono); font-size: 9.5px; color: var(--dim); width: 36px; flex: none; padding-top: 2px; }
.ev .ico { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.035); color: var(--muted); font-size: 10px; }
.ev .ico.ok { color: var(--ok); border-color: rgba(69, 214, 160, 0.22); background: rgba(69, 214, 160, 0.06); }
.ev .ico.warn { color: var(--warn); border-color: rgba(242, 181, 68, 0.22); background: rgba(242, 181, 68, 0.06); }
.ev .ico.accent { color: var(--accent); border-color: rgba(139, 149, 255, 0.25); background: rgba(139, 149, 255, 0.07); }
.ev .body { min-width: 0; }
.ev .body b { font-size: 11.5px; font-weight: 550; display: block; }
.ev .body small { font-size: 10px; color: var(--dim); display: block; margin-top: 1px; }
.ev .ago { margin-left: auto; font-size: 9.5px; color: var(--dim); font-family: var(--mono); white-space: nowrap; }

.kbd { font-family: var(--mono); font-size: 9.5px; border: 1px solid var(--line); border-bottom-color: var(--line-2); background: rgba(255, 255, 255, 0.05); border-radius: 5px; padding: 1px 5px; color: var(--dim); }

/* ------------------------------------------------------------ toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px);
  background: #141826; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 9px 14px; font-size: 11.5px; color: var(--text);
  box-shadow: 0 20px 40px -20px #000; opacity: 0; pointer-events: none;
  transition: 0.2s; z-index: 80;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------------------------------------------------- accordion -- */
.acc { border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.02); overflow: hidden; }
.acc summary {
  list-style: none; cursor: pointer; padding: 14px 16px;
  display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 550;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary .right { margin-left: auto; display: flex; gap: 8px; align-items: center; color: var(--dim); }
.acc summary .chev { transition: 0.15s; }
.acc[open] summary .chev { transform: rotate(180deg); }
.acc .acc-body { padding: 0 16px 16px; border-top: 1px solid var(--line); }

/* ----------------------------------------------------------- mobile ---- */
.mobile-bar, .tabbar { display: none; }

@media (max-width: 1180px) {
  .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split-wide { grid-template-columns: minmax(0, 1fr); }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .side { display: none; }
  .container { padding: 12px 16px 92px; }
  .mobile-bar {
    display: flex; align-items: center; gap: 10px; height: 54px;
    padding: 0 16px; position: sticky; top: 0; z-index: 30;
    background: rgba(8, 10, 16, 0.86); backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
  }
  .mobile-bar .brand { padding: 0; }
  .mobile-bar .brand small { display: none; }
  .mobile-bar .avatar { margin-left: auto; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    background: rgba(8, 10, 16, 0.92); backdrop-filter: blur(20px);
    border-top: 1px solid var(--line); justify-content: space-around;
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 9px; color: var(--dim); padding: 2px 8px; border-radius: 8px; }
  .tabbar a svg { width: 19px; height: 19px; }
  .tabbar a.on { color: var(--accent); }
  .page-head { flex-wrap: wrap; }
  .page-head .head-actions { margin-left: 0; width: 100%; }
  .page-head h1 { font-size: 23px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .route { flex-wrap: wrap; }
  .route-line { display: none; }
  .exit-tabs { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: 1fr; }
  .login-left { padding: 28px 24px 10px; border: 0; }
  .login-hero { margin: 34px 0 10px; }
  .login-hero h1 { font-size: 34px; }
  .login-route { display: none; }
  .login-right { padding: 14px 20px 40px; }
  .topbar .top-actions .hide-sm { display: none; }
  .qr-card { width: 100%; max-width: 220px; }
}
@media (max-width: 600px) {
  .container { padding: 10px 12px 90px; }
  .card { padding: 16px; border-radius: 16px; }
  .stat .value { font-size: 23px; }
  .page-head h1 { font-size: 21px; }
}

/* ------------------------------------------------------------- additions -- */
[hidden] { display: none !important; }

.infra-strip { display: flex; padding: 0; overflow-x: auto; scrollbar-width: thin; }
.infra-cell { padding: 18px 20px; border-left: 1px solid var(--line); min-width: 0; flex: 1 0 220px; }
.infra-cell:first-child { border-left: 0; background: rgba(139, 149, 255, 0.035); flex-basis: 260px; }
.infra-cell .card-note { margin-top: 8px; }

.screen-card { display: block; }
@media (max-width: 900px) {
  .infra-strip { display: block; overflow: visible; }
  .infra-cell { display: block; flex: none; border-left: 0; border-top: 1px solid var(--line); }
  .infra-cell:first-child { border-top: 0; }
}

/* locked QR placeholder */
.qr-lock {
  flex: none; min-height: 168px; border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.025);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 14px; text-align: center;
}
.qr-ghost { color: var(--dim); opacity: .8; }
.qr-lock-t { font-size: 10.5px; color: var(--dim); }

/* phone layout */
@media (max-width: 760px) {
  body { overflow-x: hidden; }
  .card-head { flex-wrap: wrap; row-gap: 6px; }
  .exit-row, .sub-row { flex-direction: column; align-items: stretch !important; }
  .exit-row .qr-lock, .sub-row .qr-lock { width: 100% !important; min-height: 148px; }
  .hero-split { grid-template-columns: minmax(0, 1fr) !important; }
  .hero-split > div:last-child { border-left: 0 !important; border-top: 1px solid var(--line); }
  .route { flex-direction: column; align-items: stretch; }
  .route-line { display: none; }
  .page-head .head-actions { width: 100%; }
  .copy .btn { padding: 0 8px; }
  .copy input { font-size: 9px; }
}

/* ==========================================================================
   panel integration: legacy hooks used by app.js + forms
   ========================================================================== */
.err {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 11px 13px; border-radius: 11px; margin-bottom: 14px;
  border: 1px solid rgba(255, 115, 115, 0.28);
  background: rgba(255, 115, 115, 0.08); color: #ffb4b4; font-size: 12px;
}
.note.ok { border-color: rgba(69,214,160,.2); background: rgba(69,214,160,.055); color: #a5e9cd; }

.copy-field { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.26);
  border: 1px solid var(--line); border-radius: 10px; padding: 3px 3px 3px 10px; min-width: 0; }
.copy-field input, .copy-field textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--muted); font-family: var(--mono); font-size: 10.5px; padding: 0;
}
.copy-field input { height: 30px; }
.copy-field textarea { height: auto; padding: 6px 0; resize: vertical; line-height: 1.45; }
.copy-btn { flex: none; width: 32px; height: 30px; display: grid; place-items: center;
  border-radius: 7px; border: 1px solid var(--line); background: rgba(255,255,255,.04);
  color: var(--muted); cursor: pointer; }
.copy-btn:hover { color: var(--text); border-color: var(--line-2); }
.copy-btn.copied { color: var(--ok); border-color: rgba(69,214,160,.35); }
.copy-btn svg { width: 14px; height: 14px; }

.qr { width: 120px; height: 120px; border-radius: 10px; background: #fff; padding: 7px; image-rendering: pixelated; }
.qr-card img { width: 100%; height: auto; image-rendering: pixelated; }

.item { display: flex; align-items: center; gap: 10px; }
.item .lbl { display: flex; align-items: center; gap: 8px; }
.item .ico { display: none; }
.ports { display: flex; flex-wrap: wrap; gap: 6px; }
.port { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px;
  border-radius: 6px; border: 1px solid var(--line); background: rgba(255,255,255,.03);
  color: var(--muted); font-size: 10.5px; }
.port b { color: var(--text); font-weight: 550; }
.port.up { border-color: rgba(69,214,160,.22); }
.port.down { opacity: .45; }

.chart-wrap { position: relative; height: 210px; }
#traffic-chart { width: 100%; height: 100%; display: block; }
.chart-tooltip { position: absolute; z-index: 5; min-width: 150px; padding: 8px 10px;
  border-radius: 9px; border: 1px solid var(--line-2); background: rgba(12,15,24,.96);
  box-shadow: 0 20px 40px -20px #000; font-size: 10.5px; pointer-events: none; }
.chart-tooltip .tt-title { color: var(--muted); margin-bottom: 5px; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.chart-tooltip .sw { width: 7px; height: 7px; border-radius: 2px; }
.chart-ranges { display: flex; gap: 2px; }
.chart-ranges .chip { height: 26px; padding: 0 8px; font-size: 10.5px; border: 0; background: transparent; }
.chart-ranges .chip.active { background: rgba(255,255,255,.09); color: var(--text); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-size: 10.5px; }
.legend-item .sw { width: 7px; height: 7px; border-radius: 2px; }

.qr-lightbox { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; }
.qr-lightbox.open { display: flex; }
.qr-lightbox-backdrop { position: absolute; inset: 0; background: rgba(3,4,8,.72); backdrop-filter: blur(8px); }
.qr-lightbox-card { position: relative; width: 280px; padding: 16px; border-radius: 18px;
  background: #fff; box-shadow: 0 40px 100px -30px #000; }
.qr-lightbox-card img { width: 100%; height: auto; image-rendering: pixelated; border-radius: 6px; }
.qr-lightbox-close { position: absolute; top: -14px; right: -14px; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--line-2); background: #12151f; color: #fff;
  font-size: 20px; cursor: pointer; }

.toggle { position: relative; display: inline-flex; width: 38px; height: 22px; flex: none; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle span { width: 100%; height: 100%; border-radius: 11px; background: rgba(255,255,255,.12); position: relative; transition: .15s; }
.toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #cfd3e2; transition: .15s; }
.toggle input:checked + span { background: linear-gradient(90deg,#7f8bff,#5fd4e6); }
.toggle input:checked + span::after { left: 18px; background: #fff; }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.section-title { font-size: 16px; font-weight: 600; letter-spacing: -.02em; margin: 22px 0 10px; }

/* inline forms */
.stack { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1; min-width: 150px; }
.form-row > .btn { margin-bottom: 1px; }

/* tables inside cards */
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table-wrap th { text-align: left; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim); font-weight: 650; padding: 0 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-wrap td { padding: 12px 10px; border-bottom: 1px solid rgba(255,255,255,.045); vertical-align: middle; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr:hover { background: rgba(255,255,255,.022); }

@media (max-width: 980px) {
  .qr { width: 100%; max-width: 220px; height: auto; }
  .chart-wrap { height: 170px; }
  .table-wrap { overflow-x: auto; }
}

/* live audit feed + services rendered by app.js */
.audit-line { display: flex; gap: 8px; padding: 7px 0; border-top: 1px solid rgba(255,255,255,.05); font-size: 11px; line-height: 1.4; }
.audit-line:first-child { border-top: 0; padding-top: 0; }
.audit-line .t { color: var(--dim); font-family: var(--mono); font-size: 9.5px; width: 76px; flex: none; padding-top: 1px; white-space: nowrap; }
.audit-line .a { color: #c4c9ff; }
.audit-line .act { color: var(--muted); }
.audit-line .tgt { color: var(--dim); }
.item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid rgba(255,255,255,.05); }
.item:first-child { border-top: 0; padding-top: 0; }
.item .lbl { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.item .val { margin-left: auto; }

/* keep wide tables inside cards on narrow screens */
.table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; }
@media (max-width: 760px) {
  .table-wrap table { min-width: 540px; }
}

@media (max-width: 600px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
}

/* per-card delete action */
.dc-wrap { position: relative; display: flex; }
.dc-wrap > .device-card { flex: 1; }
.dc-wrap .dc-top { padding-right: 30px; }
.dc-del { position: absolute; top: 9px; right: 9px; z-index: 2; opacity: 0.55; transition: opacity 0.15s; }
.dc-wrap:hover .dc-del, .dc-del:focus-within { opacity: 1; }
.dc-del .btn { padding: 4px; }
