/* RiseForge VPN panel. Brand: royal blue #4C95FF / #1F4FD1, deep navy #1B3A8C,
   midnight #0B1A45, night #04060D. Light and dark follow the system. */
:root {
  --bg: #f4f6fa; --panel: #ffffff; --panel2: #f8fafd; --line: #e2e7f0; --line2: #cfd7e6;
  --text: #0b1a45; --muted: #5b6785; --accent: #1f4fd1; --accent2: #4c95ff; --accent-soft: #e8f0ff;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2;
  --side: linear-gradient(180deg, #0b1a45 0%, #04060d 100%); --side-text: #c9d3ea; --side-dim: #8592b0;
  --radius: 12px; --shadow: 0 1px 2px rgba(11, 26, 69, .06), 0 4px 16px rgba(11, 26, 69, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #060a14; --panel: #0d1426; --panel2: #111a30; --line: #1c2741; --line2: #2a3858;
    --text: #e8edf7; --muted: #9aa6bf; --accent: #4c95ff; --accent2: #7db3ff; --accent-soft: #13254d;
    --ok: #4ade80; --ok-soft: #0f2e1d; --warn: #fbbf24; --warn-soft: #33270b; --bad: #f87171; --bad-soft: #3a1515;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
code.wrap { word-break: break-all; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---- layout ---- */
body.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh;
  background: linear-gradient(90deg, #04060d 240px, var(--bg) 240px); }
.side { background: var(--side); color: var(--side-text); padding: 20px 14px; display: flex; flex-direction: column;
  gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 8px; }
.brand:hover { text-decoration: none; }
.brand .emblem { width: 34px; height: 34px; flex: none; border-radius: 8px; box-shadow: 0 0 0 1px rgba(76, 149, 255, .35); }
.brand b { display: block; font-size: 15px; letter-spacing: .01em; }
.brand small { display: block; color: var(--side-dim); font-size: 12px; line-height: 1.3; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a, .me > a { display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 9px 10px;
  border-radius: 9px; font-weight: 500; }
.side nav a:hover, .me > a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.side nav a.on, .me > a.on { background: rgba(76, 149, 255, .16); color: #fff; box-shadow: inset 3px 0 0 #4c95ff; }
.side svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }
.me { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; }
.me span small { display: block; color: var(--side-dim); font-size: 12px; font-weight: 400; }
.linkish { background: none; border: 0; color: var(--side-dim); padding: 6px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.linkish:hover { color: #fff; }
main { padding: 28px clamp(16px, 3vw, 40px) 24px; min-width: 0; max-width: 1240px; width: 100%; }
footer { color: var(--muted); font-size: 12px; margin-top: 32px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head p { margin: 0; max-width: 70ch; }
.crumbs { font-size: 13px; margin: 0 0 2px !important; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 18px; position: relative; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 560px; }
.card.danger { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + section { margin-top: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat span { color: var(--muted); font-size: 13px; }
.stat b { display: block; font-size: 26px; letter-spacing: -.02em; margin-top: 2px; }
.stat small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--panel2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td:first-child { white-space: nowrap; }
.table.compact td, .table.compact th { padding: 8px 10px; }
.card:not(.flush) .table.compact th { background: none; }
tr.is-off td { opacity: .55; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line2); margin-right: 9px;
  vertical-align: 1px; flex: none; }
.is-online .dot { background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 22%, transparent); }
.pill { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--line); font-weight: 600; font-size: 13px; white-space: nowrap; }
.pill.is-online { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.empty { padding: 28px 20px; color: var(--muted); margin: 0; }
form.inline { display: inline; margin: 0; }
form.inline select { min-width: 130px; padding: 5px 30px 5px 8px; font-size: 14px; }

/* ---- badges ---- */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
a.badge:hover { text-decoration: none; filter: brightness(.97); }

/* ---- forms ---- */
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; }
label small { font-weight: 400; color: var(--muted); }
input, select { font: inherit; font-weight: 400; color: var(--text); background: var(--panel); border: 1px solid var(--line2);
  border-radius: 9px; padding: 9px 11px; width: 100%; min-width: 0; }
input:focus, select:focus, button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent2); outline-offset: 1px; }
select { appearance: none; padding-right: 32px; background-repeat: no-repeat; background-position: right 10px center;
  background-size: 12px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b6785' stroke-width='1.6'/%3E%3C/svg%3E"); }
label.check { flex-direction: row; align-items: center; gap: 9px; font-weight: 500; font-size: 14px; margin: 6px 0; }
label.check input { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
label.plain { margin: 10px 0; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 6px; margin: 12px 0; }
legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 6px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span2 { grid-column: 1 / -1; }
.title-input { font-size: 18px; font-weight: 700; border-color: transparent; background: transparent; padding: 4px 6px; margin-left: -6px; }
.title-input:hover { border-color: var(--line2); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  font-size: 14px; padding: 9px 15px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel);
  color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--panel2); }
.btn.primary { background: linear-gradient(180deg, #4c95ff, #1f4fd1); border-color: #1f4fd1; color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line2)); }
.btn.bad:hover { background: var(--bad-soft); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; padding: 11px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- flash ---- */
.flash { border-radius: 10px; padding: 11px 14px; margin-bottom: 16px; border: 1px solid transparent; font-weight: 500; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.flash code { background: transparent; border-color: currentColor; }

/* ---- device page ---- */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.choice { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--panel2); }
.qr { display: block; margin-top: 12px; width: 240px; max-width: 100%; height: auto; image-rendering: pixelated;
  background: #fff; padding: 8px; border-radius: 8px; }
details.help { margin-top: 14px; }
details.help summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details.help ol { padding-left: 20px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; min-width: 0; }
ol.steps { padding-left: 20px; }

/* ---- networks ---- */
.net-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; margin-bottom: 18px; }
.net-list .card { margin: 0; }
.net-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.net.deletable .net-head { padding-right: 70px; }
.corner { position: absolute; top: 18px; right: 18px; }

/* ---- users ---- */
details.pop { position: relative; display: inline-block; text-align: left; }
details.pop summary { list-style: none; }
details.pop summary::-webkit-details-marker { display: none; }
details.pop[open] > form:first-of-type { margin-top: 10px; }
details.pop[open] { display: block; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; min-width: 280px; }
details.pop[open] summary { margin-bottom: 4px; }
details.pop form + form { margin-top: 10px; }

/* ---- activity ---- */
ul.feed { list-style: none; margin: 0 0 12px; padding: 0; }
ul.feed li { padding: 7px 0; border-bottom: 1px solid var(--line); }
ul.feed li:last-child { border-bottom: 0; }
ul.feed time { display: inline-block; min-width: 92px; color: var(--muted); font-size: 13px; }

/* ---- sign in ---- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, #1b3a8c 0%, #0b1a45 45%, #04060d 100%); }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.brand.big { color: var(--text); padding: 0 0 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.brand.big small { color: var(--muted); }
.auth-card h1 { font-size: 20px; margin-bottom: 14px; }

/* ---- small screens ---- */
@media (max-width: 860px) {
  body.app { grid-template-columns: 1fr; background: var(--bg); }
  .side { position: static; height: auto; padding: 12px 14px; gap: 10px; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side nav a { padding: 7px 9px; }
  .side nav a.on { box-shadow: inset 0 -2px 0 #4c95ff; }
  .me { margin-top: 0; display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .net-list, .grid2 { grid-template-columns: 1fr; }
  dl.facts { grid-template-columns: 1fr; gap: 2px; }
  dl.facts dd { margin-bottom: 8px; }
}
