/* =========================================================
   RelayDeck — control plane UI
   ========================================================= */
:root {
  --bg: #06090f;
  --bg-deep: #04070c;
  --bg-soft: #080d16;
  --panel: #0b1320;
  --panel-2: #0e1826;
  --panel-3: #122031;
  --line: rgba(148, 163, 184, 0.12);
  --line-soft: rgba(148, 163, 184, 0.08);
  --line-strong: rgba(148, 163, 184, 0.22);
  --text: #e8eef7;
  --text-soft: #b6c4d6;
  --muted: #8091a7;
  --faint: #56677e;
  --mint: #5ff0c6;
  --mint-2: #2dd4bf;
  --mint-dim: rgba(95, 240, 198, 0.11);
  --mint-line: rgba(95, 240, 198, 0.28);
  --ice: #7dd3fc;
  --ice-dim: rgba(125, 211, 252, 0.1);
  --blue: #60a5fa;
  --purple: #c4b5fd;
  --purple-dim: rgba(196, 181, 253, 0.1);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.1);
  --danger: #fb7185;
  --danger-dim: rgba(251, 113, 133, 0.1);
  --success: #34d399;
  --mono: "Cascadia Code", "SFMono-Regular", "JetBrains Mono", "Fira Code", Consolas, monospace;
  --sans: "Segoe UI Variable Display", "Segoe UI", "Microsoft JhengHei UI", "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --sidebar-w: 252px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 700px at 8% -12%, rgba(45, 212, 191, 0.075), transparent 58%),
    radial-gradient(900px 640px at 104% -8%, rgba(96, 165, 250, 0.055), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open { overflow: hidden; }

::selection { background: rgba(95, 240, 198, 0.25); color: #f4fffb; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.18);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.3); background-clip: padding-box; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
svg { display: block; }
img { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mobile-only { display: none !important; }
.text-mint { color: var(--mint); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }

/* Ambient background */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ambient-orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.orb-a { width: 480px; height: 480px; top: -230px; left: 18%; background: rgba(45, 212, 191, 0.11); }
.orb-b { width: 520px; height: 520px; bottom: -300px; right: 8%; background: rgba(59, 130, 246, 0.09); }
.ambient-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.026) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 15%, transparent 82%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 15%, transparent 82%);
}

/* =========================================================
   Boot
   ========================================================= */
.boot-screen {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  background:
    radial-gradient(600px 400px at 50% 40%, rgba(45, 212, 191, 0.08), transparent 70%),
    var(--bg);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}
.boot-screen.done { opacity: 0; visibility: hidden; }
.boot-mark {
  width: 62px; height: 62px; display: grid; place-items: center;
  border: 1px solid var(--mint-line); border-radius: 18px;
  background: linear-gradient(160deg, rgba(95, 240, 198, 0.16), rgba(95, 240, 198, 0.03));
  color: var(--mint);
  box-shadow: 0 0 50px rgba(95, 240, 198, 0.12);
}
.boot-mark .icon { width: 34px; height: 34px; }
.boot-copy { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.boot-copy b { font-size: 17px; letter-spacing: 0.04em; }
.boot-copy span { color: var(--muted); font-size: 12px; }
.boot-bar {
  width: 138px; height: 2px; background: rgba(148, 163, 184, 0.12);
  border-radius: 999px; overflow: hidden; margin-top: 8px;
}
.boot-bar i {
  display: block; width: 45%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--mint), transparent);
  animation: bootSlide 1.15s ease-in-out infinite;
}
@keyframes bootSlide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(330%); }
}

/* =========================================================
   Shared primitives
   ========================================================= */
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid var(--mint-line);
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(95, 240, 198, 0.25), transparent 55%),
    linear-gradient(160deg, #122538, #0a1521);
  color: var(--mint);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.25);
}
.brand-mark .icon { width: 24px; height: 24px; }

.brand-word {
  font-size: 18px; font-weight: 700; letter-spacing: -0.03em; color: var(--text);
  white-space: nowrap;
}
.brand-word span { color: var(--mint); }
.brand-edition {
  font-family: var(--mono); font-size: 8px; letter-spacing: 0.16em;
  color: var(--faint); border: 1px solid var(--line);
  padding: 3px 5px; border-radius: 5px; margin-left: 2px;
}

.eyebrow {
  margin: 0; display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase;
}
.eyebrow-line { width: 26px; height: 1px; background: var(--mint); opacity: 0.6; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; line-height: 1;
  background: transparent;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}
.btn .icon { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  color: #03130f;
  background: linear-gradient(135deg, #79f6d3, #40dfb8 62%, #2dd4bf);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 28px rgba(45, 212, 191, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn.primary:hover { box-shadow: 0 12px 34px rgba(45, 212, 191, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.btn.secondary {
  color: var(--text-soft);
  background: rgba(148, 163, 184, 0.06);
  border-color: var(--line);
}
.btn.secondary:hover { background: rgba(148, 163, 184, 0.11); border-color: var(--line-strong); color: var(--text); }
.btn.danger {
  color: #ffdbe1;
  background: rgba(251, 113, 133, 0.13);
  border-color: rgba(251, 113, 133, 0.3);
}
.btn.danger:hover { background: rgba(251, 113, 133, 0.2); }
.btn.small { min-height: 36px; padding: 0 13px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; min-height: 50px; border-radius: 12px; font-size: 14px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(148, 163, 184, 0.08); }
.btn.loading { pointer-events: none; opacity: 0.8; }
.btn.loading .icon { animation: spin 0.9s linear infinite; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.045);
  color: var(--muted);
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: rgba(148, 163, 184, 0.09); }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn.danger:hover { color: var(--danger); border-color: rgba(251, 113, 133, 0.35); background: var(--danger-dim); }

.live-chip, .live-tag, .status-pill, .status-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  color: var(--mint); text-transform: uppercase;
}
.live-chip {
  padding: 7px 10px; border: 1px solid rgba(95, 240, 198, 0.18);
  border-radius: 999px; background: rgba(95, 240, 198, 0.05);
}
.live-chip i, .live-tag i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--mint);
  box-shadow: 0 0 0 4px rgba(95, 240, 198, 0.08);
  animation: pulseDot 2s ease-in-out infinite;
}
.live-chip.offline {
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.24);
  background: rgba(251, 113, 133, 0.06);
}
.live-chip.offline i {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.08);
  animation: none;
}
.status-pill {
  padding: 6px 9px; border-radius: 7px; letter-spacing: 0.04em;
  font-family: var(--sans); font-size: 11px; text-transform: none;
  border: 1px solid rgba(95, 240, 198, 0.16); background: rgba(95, 240, 198, 0.05);
  color: #bdf7e6;
}
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.live-tag i { width: 5px; height: 5px; }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.ok { background: var(--mint); box-shadow: 0 0 0 4px rgba(95, 240, 198, 0.08); }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.08); }
.dot.danger { background: var(--danger); box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.08); }
.dot.muted { background: var(--faint); box-shadow: none; }

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.82); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.22);
  border-top-color: var(--mint);
  animation: spin 0.75s linear infinite;
}

/* Fields */
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > label, .field-label {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  color: var(--text-soft); font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
}
.field-label .optional { color: var(--faint); font-weight: 400; font-size: 11px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input-icon {
  position: absolute; left: 13px; width: 17px; height: 17px;
  color: var(--faint); pointer-events: none;
}
.input-wrap input { padding-left: 40px; }
.input-wrap .reveal-btn {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--faint); border-radius: 7px;
}
.input-wrap .reveal-btn:hover { color: var(--text-soft); background: rgba(148, 163, 184, 0.08); }
.input-wrap .reveal-btn .icon { width: 17px; height: 17px; }

input[type="text"], input[type="password"], input[type="number"],
input[type="search"], select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(5, 10, 17, 0.56);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
/* Must follow the base input rule above so the icon gutter is not overwritten. */
.input-wrap input[type="text"],
.input-wrap input[type="password"],
.input-wrap input[type="search"] {
  padding-left: 40px;
  padding-right: 40px;
}
input::placeholder, textarea::placeholder { color: #4f6076; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(95, 240, 198, 0.55);
  box-shadow: 0 0 0 3px rgba(95, 240, 198, 0.08);
  background: rgba(5, 10, 17, 0.8);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #6f8198 50%),
    linear-gradient(135deg, #6f8198 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 13px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.65; }
input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; }

.form-error {
  margin: 0; color: #ffb7c2; font-size: 12.5px; line-height: 1.5;
  padding: 10px 12px; border: 1px solid rgba(251, 113, 133, 0.24);
  border-radius: 9px; background: rgba(251, 113, 133, 0.075);
}
.field-hint { margin: 0; color: var(--faint); font-size: 11.5px; line-height: 1.55; }
.field-hint code {
  font-family: var(--mono); font-size: 11px; color: var(--text-soft);
  background: rgba(148, 163, 184, 0.08); border-radius: 4px; padding: 1px 5px;
}

/* Switch */
.switch {
  position: relative;
  display: inline-flex; align-items: center;
  width: 38px; height: 22px; flex: 0 0 auto;
  padding: 0; border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.1);
  transition: background 0.18s ease, border-color 0.18s ease;
}
.switch::after {
  content: ""; position: absolute; left: 3px; top: 50%;
  width: 14px; height: 14px; border-radius: 50%;
  background: #8ea0b6; transform: translateY(-50%);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.switch.on {
  background: rgba(95, 240, 198, 0.16);
  border-color: rgba(95, 240, 198, 0.42);
}
.switch.on::after {
  transform: translate(16px, -50%);
  background: var(--mint);
  box-shadow: 0 0 10px rgba(95, 240, 198, 0.55);
}
.switch:focus-visible { outline-offset: 3px; }

.switch-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  padding: 14px 15px; border: 1px solid var(--line); border-radius: 11px;
  background: rgba(148, 163, 184, 0.035);
}
.switch-row .switch-copy { min-width: 0; }
.switch-row b { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 3px; }
.switch-row span { display: block; color: var(--faint); font-size: 11.5px; line-height: 1.5; }

/* =========================================================
   Auth screen
   ========================================================= */
.auth-screen {
  position: relative; z-index: 10;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(420px, 0.82fr);
}
.auth-visual {
  position: relative;
  display: flex; flex-direction: column;
  padding: 42px clamp(36px, 5.2vw, 76px) 28px;
  overflow: hidden;
  border-right: 1px solid var(--line-soft);
  background:
    radial-gradient(900px 650px at 12% 22%, rgba(45, 212, 191, 0.07), transparent 60%),
    radial-gradient(700px 500px at 96% 78%, rgba(56, 189, 248, 0.045), transparent 64%),
    linear-gradient(150deg, rgba(9, 16, 26, 0.88), rgba(5, 9, 15, 0.6));
}
.auth-visual::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.032) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 85% 80% at 30% 30%, #000, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 85% 80% at 30% 30%, #000, transparent 78%);
}
.auth-visual::after {
  content: "";
  position: absolute; width: 400px; height: 400px;
  right: -160px; top: 18%;
  border: 1px solid rgba(95, 240, 198, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 80px rgba(95, 240, 198, 0.018), 0 0 0 160px rgba(95, 240, 198, 0.012);
  pointer-events: none;
}
.auth-brand {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 11px;
}
.auth-brand .brand-word { font-size: 19px; }
.auth-hero {
  position: relative; z-index: 1;
  margin-top: clamp(42px, 8vh, 92px);
  max-width: 690px;
}
.auth-hero .eyebrow { margin-bottom: 22px; }
.auth-hero h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 70px);
  line-height: 1.04;
  letter-spacing: -0.055em;
  font-weight: 650;
  color: #edf5ff;
}
.auth-hero h1 span {
  color: var(--mint);
  text-shadow: 0 0 60px rgba(95, 240, 198, 0.16);
}
.auth-hero .lede {
  margin: 24px 0 0;
  max-width: 520px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.9;
}
.auth-features {
  display: flex; flex-wrap: wrap; gap: 9px;
  margin-top: 28px;
}
.auth-features span {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-soft);
  background: rgba(148, 163, 184, 0.035);
  font-size: 11.5px;
}
.auth-features .icon { width: 14px; height: 14px; color: var(--mint); }

.route-visual {
  position: relative; z-index: 1;
  margin-top: auto;
  padding: 17px 18px 14px;
  width: 100%; max-width: 650px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(160deg, rgba(15, 25, 39, 0.86), rgba(7, 12, 20, 0.74));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.route-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.16em; color: var(--faint);
}
.route-live { display: inline-flex; align-items: center; gap: 6px; color: var(--mint); }
.route-live i { width: 5px; height: 5px; border-radius: 50%; background: var(--mint); animation: pulseDot 2s infinite; }
.route-row {
  display: grid;
  grid-template-columns: 148px minmax(70px, 1fr) 190px;
  align-items: center;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.055);
}
.route-row:last-of-type { border-bottom: 0; }
.route-node {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.route-cap {
  font-family: var(--mono); font-size: 8px; letter-spacing: 0.14em;
  color: var(--faint); text-transform: uppercase;
}
.route-node b {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  color: var(--text); letter-spacing: 0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.route-node em { font-style: normal; font-size: 10px; color: var(--muted); }
.port-node b { color: #c9f9ec; }
.exit-node { padding-left: 13px; border-left: 1px solid rgba(95, 240, 198, 0.18); }
.exit-node b { font-family: var(--sans); font-size: 12.5px; }
.exit-node em { color: var(--mint); font-family: var(--mono); font-size: 9.5px; }
.route-flow {
  position: relative; height: 18px;
  display: flex; align-items: center; gap: 6px;
}
.route-flow::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(95, 240, 198, 0.3) 0 5px, transparent 5px 10px);
  opacity: 0.7;
}
.route-flow i {
  position: relative; z-index: 1;
  width: 4px; height: 4px; border-radius: 50%;
  background: rgba(95, 240, 198, 0.55);
}
.route-flow i:nth-child(2) { margin-left: auto; }
.route-flow i:nth-child(3) { margin-left: 0; }
.route-packet {
  position: absolute; z-index: 2; top: 50%; left: 0;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 12px rgba(95, 240, 198, 0.9);
  transform: translateY(-50%);
  animation: routePacket 3.1s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.route-packet.packet-b { animation-delay: 1.1s; animation-duration: 3.6s; }
.route-packet.packet-c { animation-delay: 2.2s; animation-duration: 2.8s; }
@keyframes routePacket {
  0% { left: 0; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { left: calc(100% - 7px); opacity: 0; }
}
.route-footer {
  display: flex; justify-content: space-between; gap: 12px;
  padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--line-soft);
  font-size: 9.5px; color: var(--faint); font-family: var(--mono);
  letter-spacing: 0.04em;
}
.route-footer span { display: inline-flex; align-items: center; gap: 6px; }
.route-footer .icon { width: 12px; height: 12px; color: var(--mint); }
.auth-visual-footer {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 22px;
  font-family: var(--mono); font-size: 8.5px;
  letter-spacing: 0.13em; color: #435267;
}
.auth-panel {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px clamp(28px, 4vw, 58px) 74px;
  background:
    radial-gradient(700px 500px at 100% 0%, rgba(45, 212, 191, 0.045), transparent 60%),
    linear-gradient(180deg, rgba(10, 16, 26, 0.48), rgba(5, 8, 14, 0.75));
}
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 24px; }
.auth-card {
  width: min(100%, 402px);
  padding: 27px 27px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(165deg, rgba(18, 29, 45, 0.88), rgba(9, 15, 24, 0.92));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  animation: cardIn 0.5s ease both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-card-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 25px;
}
.auth-version {
  font-family: var(--mono); font-size: 10px; color: var(--faint);
}
.auth-card-head { margin-bottom: 24px; }
.auth-card-head .eyebrow { margin-bottom: 9px; }
.auth-card-head h2 {
  margin: 0 0 7px;
  font-size: 27px; font-weight: 650; letter-spacing: -0.035em;
}
.auth-card-head p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.65; }
#auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-submit { margin-top: 3px; justify-content: space-between; padding: 0 18px; }
.auth-submit .icon { width: 18px; height: 18px; }
.auth-note {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 19px; padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint); font-size: 10.5px; line-height: 1.6;
}
.auth-note .icon { width: 13px; height: 13px; flex: 0 0 auto; margin-top: 1px; color: var(--mint); opacity: 0.8; }
.auth-meta {
  position: absolute; left: clamp(28px, 4vw, 58px); right: clamp(28px, 4vw, 58px); bottom: 26px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  color: #435267; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.08em;
}
.auth-meta span { display: inline-flex; align-items: center; gap: 5px; }
.auth-meta .icon { width: 11px; height: 11px; color: var(--mint); opacity: 0.65; }

/* =========================================================
   App shell
   ========================================================= */
.app-shell { position: relative; z-index: 1; min-height: 100vh; display: flex; }
.nav-scrim {
  position: fixed; inset: 0; z-index: 35;
  background: rgba(3, 6, 10, 0.66);
  backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s ease;
}
.sidebar {
  position: fixed; z-index: 40; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  padding: 24px 16px 16px;
  border-right: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(11, 18, 29, 0.9), rgba(6, 10, 16, 0.88));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px 24px;
}
.sidebar-brand .brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sidebar-brand .brand-word { font-size: 16.5px; }
.brand-sub {
  font-size: 9.5px; color: var(--faint);
  letter-spacing: 0.08em; white-space: nowrap;
}
.sidebar-brand .brand-edition { margin-left: auto; }
.nav { display: flex; flex-direction: column; gap: 5px; }
.nav-label {
  margin: 0 0 6px; padding: 0 11px;
  color: #435267; font-family: var(--mono);
  font-size: 8.5px; letter-spacing: 0.18em;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  height: 43px; padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
.nav-item .icon { width: 17px; height: 17px; opacity: 0.85; }
.nav-item:hover { color: var(--text-soft); background: rgba(148, 163, 184, 0.05); }
.nav-item.active {
  color: #e7fff8;
  border-color: rgba(95, 240, 198, 0.14);
  background: linear-gradient(90deg, rgba(95, 240, 198, 0.13), rgba(95, 240, 198, 0.025));
}
.nav-item.active::before {
  content: ""; position: absolute; left: -17px; top: 50%;
  width: 2px; height: 20px; transform: translateY(-50%);
  border-radius: 0 2px 2px 0;
  background: var(--mint);
  box-shadow: 0 0 12px rgba(95, 240, 198, 0.7);
}
.nav-item.active .icon { color: var(--mint); opacity: 1; }
.nav-count {
  margin-left: auto; min-width: 20px; height: 19px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: 6px; border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.05);
  font-family: var(--mono); font-size: 9px; color: var(--muted);
}
.nav-item.active .nav-count { color: var(--mint); border-color: rgba(95, 240, 198, 0.2); background: rgba(95, 240, 198, 0.07); }
.nav-active-dot { display: none; }
.sidebar-pulse {
  margin-top: auto;
  padding: 14px; border: 1px solid var(--line);
  border-radius: 13px;
  background:
    radial-gradient(180px 80px at 20% 0%, rgba(95, 240, 198, 0.055), transparent 70%),
    rgba(148, 163, 184, 0.028);
}
.sidebar-pulse-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  font-size: 10px; color: var(--muted); letter-spacing: 0.07em;
  font-family: var(--mono); text-transform: uppercase;
}
.mini-metric {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; padding: 3px 0;
  font-size: 10.5px; color: var(--faint);
}
.mini-metric b { color: var(--text-soft); font-family: var(--mono); font-size: 10.5px; font-weight: 500; }
.sidebar-wave {
  display: flex; align-items: flex-end; gap: 3px;
  height: 25px; margin-top: 10px; padding-top: 4px;
  border-top: 1px solid var(--line-soft);
}
.sidebar-wave i {
  flex: 1; min-width: 2px; border-radius: 2px 2px 0 0;
  background: linear-gradient(to top, rgba(95, 240, 198, 0.12), rgba(95, 240, 198, 0.55));
  animation: wave 3s ease-in-out infinite;
}
.sidebar-wave i:nth-child(1) { height: 30%; animation-delay: -0.2s; }
.sidebar-wave i:nth-child(2) { height: 52%; animation-delay: -0.7s; }
.sidebar-wave i:nth-child(3) { height: 42%; animation-delay: -1.4s; }
.sidebar-wave i:nth-child(4) { height: 75%; animation-delay: -0.4s; }
.sidebar-wave i:nth-child(5) { height: 58%; animation-delay: -1.8s; }
.sidebar-wave i:nth-child(6) { height: 92%; animation-delay: -0.9s; }
.sidebar-wave i:nth-child(7) { height: 48%; animation-delay: -2.2s; }
.sidebar-wave i:nth-child(8) { height: 68%; animation-delay: -1.1s; }
.sidebar-wave i:nth-child(9) { height: 36%; animation-delay: -0.5s; }
.sidebar-wave i:nth-child(10) { height: 80%; animation-delay: -2.6s; }
.sidebar-wave i:nth-child(11) { height: 54%; animation-delay: -1.5s; }
.sidebar-wave i:nth-child(12) { height: 40%; animation-delay: -0.1s; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.72); opacity: 0.55; }
  50% { transform: scaleY(1); opacity: 0.95; }
}
.sidebar-foot { margin-top: 12px; }
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 5px;
}
.avatar {
  width: 32px; height: 32px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid rgba(95, 240, 198, 0.18);
  background: rgba(95, 240, 198, 0.08);
  color: var(--mint); font-size: 12px; font-weight: 700;
}
.user-copy { display: flex; flex-direction: column; min-width: 0; gap: 0; }
.user-copy b {
  font-size: 12px; font-weight: 600; color: var(--text-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-copy span { font-size: 9.5px; color: var(--faint); }
.user-card .icon-btn { margin-left: auto; width: 30px; height: 30px; }
.sidebar-version {
  padding: 9px 6px 0; border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 8px; letter-spacing: 0.1em;
  color: #3d4c60; display: flex; justify-content: space-between;
}
.sidebar-version span { color: #506177; }

.main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
}
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  min-height: 84px; padding: 16px 32px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(6, 10, 16, 0.9), rgba(6, 10, 16, 0.72));
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
.topbar-title { min-width: 0; margin-right: auto; }
.topbar-kicker {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 3px;
  font-family: var(--mono); font-size: 8px; letter-spacing: 0.17em;
  color: var(--faint); text-transform: uppercase;
}
.kicker-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--mint); }
.topbar-title h1 {
  margin: 0; font-size: 23px; line-height: 1.2;
  font-weight: 650; letter-spacing: -0.035em;
}
.topbar-title p { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.topbar-actions .btn .icon { width: 15px; height: 15px; }
.view {
  flex: 1; width: 100%; max-width: 1560px; margin: 0 auto;
  padding: 26px 32px 24px;
}
.app-footer {
  display: flex; justify-content: space-between; gap: 18px;
  max-width: 1560px; width: 100%; margin: 0 auto;
  padding: 6px 32px 22px;
  color: #425166; font-size: 9.5px; letter-spacing: 0.02em;
}
.app-footer b { color: #5f7188; font-weight: 500; }
.footer-right { display: inline-flex; align-items: center; gap: 7px; }
.footer-right .dot { width: 5px; height: 5px; }

/* =========================================================
   Dashboard
   ========================================================= */
.pulse-banner {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 18px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    radial-gradient(500px 160px at 0% 50%, rgba(95, 240, 198, 0.07), transparent 65%),
    linear-gradient(110deg, rgba(16, 27, 42, 0.86), rgba(9, 15, 24, 0.8));
}
.pulse-banner::after {
  content: ""; position: absolute; right: -40px; top: -80px;
  width: 240px; height: 240px; border-radius: 50%;
  border: 1px solid rgba(95, 240, 198, 0.07);
  box-shadow: 0 0 0 30px rgba(95, 240, 198, 0.012), 0 0 0 60px rgba(95, 240, 198, 0.008);
  pointer-events: none;
}
.pulse-orb {
  position: relative; flex: 0 0 auto;
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(95, 240, 198, 0.22);
  background: rgba(95, 240, 198, 0.05);
  color: var(--mint);
}
.pulse-orb::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 1px solid rgba(95, 240, 198, 0.12);
  animation: orbitPulse 2.8s ease-out infinite;
}
@keyframes orbitPulse {
  0% { transform: scale(0.86); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}
.pulse-orb .icon { width: 17px; height: 17px; }
.pulse-copy { min-width: 0; }
.pulse-copy b { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.pulse-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.pulse-right {
  margin-left: auto; display: flex; align-items: center; gap: 18px;
  position: relative; z-index: 1;
}
.pulse-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  color: var(--faint); font-size: 9px; font-family: var(--mono);
  letter-spacing: 0.04em;
}
.pulse-meta b { color: var(--text-soft); font-size: 11px; font-weight: 500; }
.pulse-banner.warn {
  border-color: rgba(251, 191, 36, 0.2);
  background:
    radial-gradient(500px 160px at 0% 50%, rgba(251, 191, 36, 0.06), transparent 65%),
    linear-gradient(110deg, rgba(24, 25, 31, 0.9), rgba(12, 16, 22, 0.85));
}
.pulse-banner.warn .pulse-orb { color: var(--amber); border-color: rgba(251, 191, 36, 0.25); background: rgba(251, 191, 36, 0.05); }
.pulse-banner.warn .pulse-orb::before { border-color: rgba(251, 191, 36, 0.14); }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px; margin: 18px 0;
}
.stat-card {
  position: relative; overflow: hidden;
  padding: 18px 18px 16px;
  min-height: 148px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(158deg, rgba(17, 28, 44, 0.9), rgba(9, 15, 24, 0.86));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  animation: fadeUp 0.45s ease both;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }
.stat-card:hover { border-color: rgba(148, 163, 184, 0.24); transform: translateY(-2px); }
.stat-card::before {
  content: ""; position: absolute; top: 0; left: 18px; right: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(95, 240, 198, 0.3), transparent);
  opacity: 0.5;
}
.stat-card::after {
  content: ""; position: absolute; width: 150px; height: 150px;
  right: -70px; bottom: -90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(95, 240, 198, 0.08), transparent 66%);
  pointer-events: none;
}
.stat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stat-label { color: var(--muted); font-size: 11px; letter-spacing: 0.03em; }
.stat-icon {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.045);
  color: var(--muted);
}
.stat-icon .icon { width: 16px; height: 16px; }
.stat-card.accent .stat-icon {
  color: var(--mint); border-color: rgba(95, 240, 198, 0.18); background: rgba(95, 240, 198, 0.07);
}
.stat-card.ice .stat-icon { color: var(--ice); border-color: rgba(125, 211, 252, 0.16); background: var(--ice-dim); }
.stat-card.violet .stat-icon { color: var(--purple); border-color: rgba(196, 181, 253, 0.16); background: var(--purple-dim); }
.stat-value {
  display: flex; align-items: baseline; gap: 6px;
  margin-top: 15px;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: clamp(24px, 2.1vw, 31px); line-height: 1.1; font-weight: 600;
  letter-spacing: -0.04em; color: var(--text);
}
.stat-value .unit {
  font-family: var(--sans); font-size: 11px; font-weight: 400;
  color: var(--faint); letter-spacing: 0;
}
.stat-sub {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 10px;
  color: var(--faint); font-size: 10.5px;
}
.stat-sub b { color: var(--text-soft); font-weight: 500; font-family: var(--mono); font-size: 10px; }
.stat-sub .up { color: var(--mint); }
.stat-sub .down { color: var(--ice); }
.stat-bars {
  position: absolute; left: 18px; right: 18px; bottom: 11px;
  display: flex; align-items: flex-end; gap: 2px; height: 12px; opacity: 0.42;
}
.stat-bars i {
  flex: 1; min-width: 1px; height: 20%;
  border-radius: 1px;
  background: linear-gradient(to top, rgba(95, 240, 198, 0.15), rgba(95, 240, 198, 0.8));
}
.dashboard-main {
  display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.85fr);
  gap: 14px;
}
.dashboard-lower {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.95fr);
  gap: 14px; margin-top: 14px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(158deg, rgba(15, 25, 39, 0.88), rgba(8, 14, 22, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  min-width: 0;
  animation: fadeUp 0.45s ease both;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 18px 20px 0;
}
.panel-head-copy { min-width: 0; }
.panel-title {
  display: flex; align-items: center; gap: 8px;
  margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
}
.panel-title .icon { width: 15px; height: 15px; color: var(--mint); }
.panel-sub { margin: 4px 0 0; color: var(--faint); font-size: 10.5px; }
.panel-link {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: 10.5px; white-space: nowrap;
  transition: color 0.16s ease;
}
.panel-link:hover { color: var(--mint); }
.panel-link .icon { width: 12px; height: 12px; }
.panel-head-right { display: flex; align-items: center; gap: 12px; }
.legend { display: flex; align-items: center; gap: 13px; font-size: 9.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.legend .down i { background: var(--mint); box-shadow: 0 0 6px rgba(95, 240, 198, 0.4); }
.legend .up i { background: var(--ice); opacity: 0.85; }
.range-chip {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px;
  font-family: var(--mono); font-size: 8.5px; color: var(--faint);
  letter-spacing: 0.06em; white-space: nowrap;
}
.chart-wrap { position: relative; height: 264px; margin: 8px 6px 0; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-tooltip {
  position: absolute; z-index: 4; pointer-events: none;
  min-width: 126px; padding: 9px 10px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: rgba(7, 12, 20, 0.96);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
  font-size: 10px; color: var(--muted);
  backdrop-filter: blur(12px);
  transform: translate(-50%, -105%);
  transition: opacity 0.12s ease;
}
.chart-tooltip b { display: block; margin-bottom: 5px; color: var(--text-soft); font-family: var(--mono); font-size: 9px; font-weight: 500; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; }
.chart-tooltip .tt-row span { display: inline-flex; align-items: center; gap: 5px; }
.chart-tooltip .tt-row i { width: 5px; height: 5px; border-radius: 50%; }
.chart-tooltip .tt-row i.down { background: var(--mint); }
.chart-tooltip .tt-row i.up { background: var(--ice); }
.chart-tooltip .tt-row b { display: inline; margin: 0; color: var(--text); font-size: 9px; }
.chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--faint); font-size: 10.5px; letter-spacing: 0.03em;
  pointer-events: none;
}
.chart-empty span { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(7, 12, 20, 0.7); }
.chart-foot {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 0 20px 15px;
  color: #425166; font-family: var(--mono); font-size: 8.5px;
  letter-spacing: 0.04em;
}
.chart-foot span { display: inline-flex; align-items: center; gap: 5px; }
.chart-foot .dot { width: 5px; height: 5px; background: var(--mint); }

/* System panel */
.system-panel { display: flex; flex-direction: column; }
.system-body { padding: 12px 20px 18px; }
.gauges { display: flex; justify-content: center; gap: clamp(18px, 3vw, 34px); padding: 8px 0 18px; }
.gauge-block { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.gauge {
  --pct: 0;
  --gauge-color: var(--mint);
  position: relative; width: 104px; height: 104px; border-radius: 50%;
  background: conic-gradient(var(--gauge-color) calc(var(--pct) * 1%), rgba(148, 163, 184, 0.09) 0);
  box-shadow: 0 0 26px rgba(95, 240, 198, 0.05);
}
.gauge::before {
  content: ""; position: absolute; inset: 8px; border-radius: 50%;
  background: linear-gradient(160deg, #0f1a29, #0a111c);
  border: 1px solid rgba(148, 163, 184, 0.075);
}
.gauge-inner {
  position: absolute; inset: 8px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0;
}
.gauge-inner b {
  font-family: var(--mono); font-size: 17px; font-weight: 600;
  letter-spacing: -0.04em; color: var(--text);
}
.gauge-inner span { font-size: 8px; color: var(--faint); letter-spacing: 0.1em; font-family: var(--mono); }
.gauge.ice { --gauge-color: var(--ice); box-shadow: 0 0 26px rgba(125, 211, 252, 0.04); }
.gauge-label {
  display: flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: 10px;
}
.gauge-label .icon { width: 12px; height: 12px; color: var(--faint); }
.sys-list { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.sys-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 7px 0; font-size: 10.5px; color: var(--muted);
}
.sys-row b { color: var(--text-soft); font-family: var(--mono); font-size: 10px; font-weight: 500; }
.sys-note {
  display: flex; align-items: center; gap: 6px;
  margin-top: 9px; padding: 8px 10px;
  border: 1px solid var(--line-soft); border-radius: 8px;
  background: rgba(148, 163, 184, 0.025);
  color: var(--faint); font-size: 9.5px;
}
.sys-note .dot { width: 5px; height: 5px; }

/* Mini port list */
.mini-list { padding: 6px 20px 14px; }
.mini-port {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center; gap: 13px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.mini-port:last-child { border-bottom: 0; }
.mini-port-port {
  display: flex; flex-direction: column; gap: 1px;
  font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text);
}
.mini-port-port span { font-size: 8px; font-weight: 400; color: var(--faint); letter-spacing: 0.04em; }
.mini-port-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mini-port-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-port-name .dot { width: 5px; height: 5px; }
.mini-port-upstream {
  font-family: var(--mono); font-size: 9px; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-port-meta { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.mini-port-meta b { font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--text-soft); }
.mini-port-meta span { font-size: 8.5px; color: var(--faint); }
.mini-empty { padding: 26px 0 22px; text-align: center; color: var(--faint); font-size: 11px; }
.mini-empty .btn { margin-top: 12px; }

/* Event list */
.event-list { padding: 8px 20px 16px; }
.event-item {
  display: grid; grid-template-columns: 55px 1fr; gap: 10px;
  padding: 8px 0;
  position: relative;
}
.event-item + .event-item { border-top: 1px solid rgba(148, 163, 184, 0.055); }
.event-time { font-family: var(--mono); font-size: 8.5px; color: #46566b; padding-top: 2px; }
.event-body { min-width: 0; display: flex; gap: 8px; align-items: flex-start; }
.event-mark {
  width: 5px; height: 5px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto;
  background: var(--muted);
}
.event-mark.success { background: var(--mint); box-shadow: 0 0 7px rgba(95, 240, 198, 0.4); }
.event-mark.warn { background: var(--amber); }
.event-mark.error { background: var(--danger); }
.event-text {
  margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.event-text b { color: var(--text-soft); font-weight: 500; }
.event-empty { padding: 26px 0; text-align: center; color: var(--faint); font-size: 11px; }
.event-foot { padding: 0 20px 14px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Ports page
   ========================================================= */
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar-left { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; min-width: 0; }
.toolbar-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.search-field {
  position: relative; display: flex; align-items: center;
  width: 270px; max-width: 100%;
}
.search-field .icon {
  position: absolute; left: 12px; width: 15px; height: 15px;
  color: var(--faint); pointer-events: none;
}
.search-field input {
  min-height: 38px; padding-left: 36px; font-size: 12px;
  background: rgba(10, 17, 27, 0.7);
  border-radius: 9px;
}
.segmented {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; border: 1px solid var(--line); border-radius: 9px;
  background: rgba(10, 17, 27, 0.64);
}
.segmented button {
  border: 0; background: transparent; color: var(--faint);
  min-height: 30px; padding: 0 10px; border-radius: 6px;
  font-size: 10.5px; white-space: nowrap;
  transition: color 0.16s ease, background 0.16s ease;
}
.segmented button:hover { color: var(--text-soft); }
.segmented button.active {
  color: var(--mint); background: rgba(95, 240, 198, 0.09);
  box-shadow: inset 0 0 0 1px rgba(95, 240, 198, 0.1);
}
.segmented button .count { margin-left: 5px; font-family: var(--mono); font-size: 8.5px; color: var(--faint); }
.segmented button.active .count { color: var(--mint); opacity: 0.7; }
.result-count {
  margin-left: auto; color: var(--faint); font-size: 10px;
  font-family: var(--mono); letter-spacing: 0.02em; white-space: nowrap;
}
.table-card { overflow: hidden; }
.table-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
}
.table-head-copy { display: flex; align-items: center; gap: 8px; }
.table-head-copy b { font-size: 11px; font-weight: 500; color: var(--text-soft); }
.table-head-copy span { color: var(--faint); font-family: var(--mono); font-size: 9px; }
.table-note { color: var(--faint); font-size: 9.5px; display: flex; align-items: center; gap: 5px; }
.table-scroll { width: 100%; overflow-x: auto; }
.port-table-scroll {
  max-height: calc(100vh - 330px);
  min-height: 300px;
  overflow: auto;
  scrollbar-gutter: stable;
}
.port-table-scroll thead th {
  position: sticky; top: 0; z-index: 4;
  background: #0c1421;
}
.port-table-scroll thead th::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 1px; background: var(--line-soft);
}
.port-table {
  width: 100%; min-width: 940px; border-collapse: collapse;
  table-layout: fixed;
}
.port-table th {
  padding: 10px 14px;
  text-align: left; font-weight: 500;
  font-size: 8.5px; letter-spacing: 0.11em; color: #55667c;
  text-transform: uppercase; font-family: var(--mono);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(148, 163, 184, 0.015);
}
.port-table th:first-child, .port-table td:first-child { padding-left: 18px; }
.port-table th:last-child, .port-table td:last-child { padding-right: 18px; }
.port-table td {
  padding: 13px 14px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.port-table tbody tr { transition: background 0.16s ease; }
.port-table tbody tr:hover { background: rgba(148, 163, 184, 0.027); }
.port-table tbody tr.off { opacity: 0.66; }
.port-table tbody tr:last-child td { border-bottom: 0; }
.col-port { width: 106px; }
.col-name { width: 190px; }
.col-upstream { width: auto; }
.col-status { width: 108px; }
.col-conn { width: 92px; }
.col-traffic { width: 146px; }
.col-actions { width: 148px; }
.port-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.port-cell b {
  font-family: var(--mono); font-size: 16px; font-weight: 600;
  letter-spacing: -0.02em; color: var(--text);
}
.port-cell span { font-family: var(--mono); font-size: 8px; color: var(--faint); letter-spacing: 0.02em; }
.name-cell { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.name-cell > b {
  font-size: 12px; font-weight: 500; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.name-badges { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 5px; border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--faint); font-size: 8px; line-height: 1.3;
  background: rgba(148, 163, 184, 0.035);
  letter-spacing: 0.02em;
}
.badge .icon { width: 9px; height: 9px; }
.badge.auth { color: var(--amber); border-color: rgba(251, 191, 36, 0.16); background: var(--amber-dim); }
.badge.auto { color: var(--purple); border-color: rgba(196, 181, 253, 0.16); background: var(--purple-dim); }
.upstream-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.upstream-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.proto-chip {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 6px; border-radius: 4px;
  font-family: var(--mono); font-size: 8px; font-weight: 500;
  letter-spacing: 0.04em; line-height: 1.5;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(148, 163, 184, 0.05);
  flex: 0 0 auto;
}
.proto-chip.http { color: var(--ice); border-color: rgba(125, 211, 252, 0.18); background: var(--ice-dim); }
.proto-chip.socks5 { color: var(--purple); border-color: rgba(196, 181, 253, 0.18); background: var(--purple-dim); }
.proto-chip.auto { color: var(--amber); border-color: rgba(251, 191, 36, 0.18); background: var(--amber-dim); }
.upstream-addr {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upstream-sub {
  display: flex; align-items: center; gap: 7px;
  font-size: 8.5px; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upstream-sub .icon { width: 9px; height: 9px; }
.port-status { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.port-status .status-main {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; color: var(--text-soft); white-space: nowrap;
}
.port-status .status-main .dot { width: 6px; height: 6px; }
.port-status small { font-size: 8px; color: var(--faint); font-family: var(--mono); }
.conn-cell { display: flex; flex-direction: column; gap: 2px; }
.conn-cell b { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--text-soft); }
.conn-cell span { font-size: 8px; color: var(--faint); white-space: nowrap; }
.traffic-cell { display: flex; flex-direction: column; gap: 4px; }
.traffic-row { display: flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 9px; color: var(--muted); }
.traffic-row .icon { width: 10px; height: 10px; }
.traffic-row.down .icon { color: var(--mint); }
.traffic-row.up .icon { color: var(--ice); }
.traffic-row span { color: var(--faint); font-family: var(--sans); font-size: 8px; }
.row-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.row-actions .icon-btn { width: 29px; height: 29px; border-radius: 7px; }
.row-actions .icon-btn .icon { width: 14px; height: 14px; }
.row-actions .switch { width: 32px; height: 19px; margin-right: 2px; }
.row-actions .switch::after { width: 12px; height: 12px; }
.row-actions .switch.on::after { transform: translate(13px, -50%); }
.row-menu { position: relative; }
.row-menu summary {
  list-style: none;
  width: 29px; height: 29px;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 7px;
  color: var(--faint); cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu summary:hover, .row-menu[open] summary {
  color: var(--text-soft); background: rgba(148, 163, 184, 0.08); border-color: var(--line);
}
.row-menu summary .icon { width: 15px; height: 15px; }
.menu-pop {
  position: absolute; z-index: 20; right: 0; top: calc(100% + 6px);
  min-width: 152px; padding: 5px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: #0d1623; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  animation: menuIn 0.13s ease;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.menu-pop button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 9px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-soft); font-size: 10.5px; text-align: left;
}
.menu-pop button:hover { background: rgba(148, 163, 184, 0.08); }
.menu-pop button.danger { color: #ff9eac; }
.menu-pop button.danger:hover { background: rgba(251, 113, 133, 0.1); }
.menu-pop button .icon { width: 13px; height: 13px; color: var(--faint); }
.menu-pop button.danger .icon { color: inherit; }
.menu-sep { height: 1px; background: var(--line-soft); margin: 4px 3px; }

/* Fixed-position row menu avoids clipping inside the scrollable table. */
.row-menu-pop {
  position: fixed; z-index: 90;
  min-width: 158px; padding: 5px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: #0d1623; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.48);
  animation: menuIn 0.13s ease;
}
.row-menu-pop button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 9px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--text-soft);
  font-size: 10.5px; text-align: left;
}
.row-menu-pop button:hover { background: rgba(148, 163, 184, 0.08); color: var(--text); }
.row-menu-pop button.danger { color: #ff9eac; }
.row-menu-pop button.danger:hover { background: rgba(251, 113, 133, 0.1); }
.row-menu-pop button .icon { width: 13px; height: 13px; color: var(--faint); }
.row-menu-pop button.danger .icon { color: inherit; }

.ports-empty {
  padding: 46px 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.table-pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 11px 16px;
  border-top: 1px solid var(--line-soft);
  background: rgba(148, 163, 184, 0.014);
}
.pagination-range {
  color: var(--faint); font-family: var(--mono);
  font-size: 9px; letter-spacing: 0.02em;
}
.pagination-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-size {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--faint); font-size: 9px; white-space: nowrap;
}
select#ports-page-size {
  width: auto; min-height: 29px; padding: 4px 26px 4px 8px;
  border-radius: 7px; font-size: 10px;
  background-position:
    calc(100% - 15px) calc(50% - 2px),
    calc(100% - 10px) calc(50% - 2px);
}
.page-btn {
  min-height: 29px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 7px;
  background: rgba(148, 163, 184, 0.045);
  color: var(--muted); font-size: 10px;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.page-btn:hover:not(:disabled) {
  color: var(--text); border-color: var(--line-strong);
  background: rgba(148, 163, 184, 0.09);
}
.page-btn:disabled { opacity: 0.32; cursor: not-allowed; }
.page-label {
  min-width: 48px; text-align: center;
  color: var(--muted); font-family: var(--mono); font-size: 9px;
}
.empty-graphic {
  position: relative;
  width: 74px; height: 74px; display: grid; place-items: center;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(80% 80% at 30% 20%, rgba(95, 240, 198, 0.12), transparent 70%),
    rgba(148, 163, 184, 0.035);
  color: var(--mint);
}
.empty-graphic::after {
  content: ""; position: absolute; inset: -8px;
  border: 1px dashed rgba(95, 240, 198, 0.12); border-radius: 26px;
}
.empty-graphic .icon { width: 30px; height: 30px; }
.ports-empty h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.ports-empty p { margin: 0; max-width: 380px; color: var(--faint); font-size: 11px; line-height: 1.7; }
.empty-actions { display: flex; gap: 9px; margin-top: 18px; flex-wrap: wrap; justify-content: center; }
.search-empty { padding: 36px 20px; text-align: center; color: var(--faint); font-size: 11px; }

/* =========================================================
   Logs page
   ========================================================= */
.logs-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.logs-toolbar .search-field { width: 300px; }
.logs-card { overflow: hidden; }
.log-list { max-height: calc(100vh - 260px); overflow: auto; }
.log-day {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  background: rgba(9, 15, 24, 0.96);
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 8px; letter-spacing: 0.12em;
  color: #526278; text-transform: uppercase;
  backdrop-filter: blur(10px);
}
.log-day::after { content: ""; height: 1px; flex: 1; background: var(--line-soft); }
.log-item {
  display: grid;
  grid-template-columns: 74px 64px 66px minmax(0, 1fr);
  gap: 12px; align-items: baseline;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.055);
  transition: background 0.14s ease;
}
.log-item:hover { background: rgba(148, 163, 184, 0.025); }
.log-time { font-family: var(--mono); font-size: 9px; color: #4b5b70; }
.log-level {
  display: inline-flex; align-items: center; justify-content: center;
  width: fit-content; padding: 2px 6px; border-radius: 4px;
  font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.05em;
  text-transform: uppercase; border: 1px solid var(--line);
  color: var(--muted); background: rgba(148, 163, 184, 0.04);
}
.log-level.success { color: var(--mint); border-color: rgba(95, 240, 198, 0.16); background: var(--mint-dim); }
.log-level.warn { color: var(--amber); border-color: rgba(251, 191, 36, 0.16); background: var(--amber-dim); }
.log-level.error { color: var(--danger); border-color: rgba(251, 113, 133, 0.18); background: var(--danger-dim); }
.log-port {
  font-family: var(--mono); font-size: 8.5px; color: var(--faint);
  padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px;
  width: fit-content; white-space: nowrap;
}
.log-port.empty { border-color: transparent; padding-left: 0; }
.log-msg { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.6; word-break: break-word; }
.logs-empty { padding: 60px 20px; text-align: center; color: var(--faint); }
.logs-empty .icon { width: 26px; height: 26px; margin: 0 auto 10px; opacity: 0.4; }

/* =========================================================
   Settings
   ========================================================= */
.settings-grid {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 14px;
}
.settings-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(158deg, rgba(15, 25, 39, 0.9), rgba(8, 14, 22, 0.9));
}
.settings-card-head { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 18px; }
.settings-icon {
  width: 32px; height: 32px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--line); background: rgba(148, 163, 184, 0.04);
  color: var(--mint);
}
.settings-icon .icon { width: 15px; height: 15px; }
.settings-card-head h2 { margin: 0 0 2px; font-size: 13.5px; font-weight: 600; }
.settings-card-head p { margin: 0; color: var(--faint); font-size: 10px; }
.settings-card form { display: flex; flex-direction: column; gap: 13px; }
.info-list { display: flex; flex-direction: column; }
.info-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 10.5px;
}
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--faint); }
.info-row b {
  color: var(--text-soft); font-family: var(--mono); font-size: 9.5px;
  font-weight: 500; text-align: right; word-break: break-all;
}
.info-row b.plain { font-family: var(--sans); font-size: 10.5px; }
.copy-path {
  display: inline-flex; align-items: center; gap: 7px; max-width: 75%;
  color: var(--text-soft); font-family: var(--mono); font-size: 9px;
  background: rgba(148, 163, 184, 0.04); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.copy-path:hover { border-color: var(--line-strong); color: var(--text); }
.copy-path .icon { width: 11px; height: 11px; flex: 0 0 auto; color: var(--faint); }
.security-list { display: flex; flex-direction: column; gap: 10px; }
.security-card { grid-column: 1 / -1; }
.security-card .security-list {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}
.security-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 9px;
  background: rgba(148, 163, 184, 0.022);
}
.security-item .icon { width: 14px; height: 14px; color: var(--mint); margin-top: 1px; flex: 0 0 auto; }
.security-item b { display: block; color: var(--text-soft); font-size: 10.5px; font-weight: 500; margin-bottom: 2px; }
.security-item p { margin: 0; color: var(--faint); font-size: 9.5px; line-height: 1.6; }
.danger-zone { grid-column: 1 / -1; }
.danger-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 13px 14px; border: 1px solid rgba(251, 113, 133, 0.13); border-radius: 10px;
  background: rgba(251, 113, 133, 0.035);
}
.danger-row b { display: block; font-size: 11px; font-weight: 500; color: var(--text-soft); margin-bottom: 2px; }
.danger-row p { margin: 0; font-size: 9.5px; color: var(--faint); }

/* =========================================================
   Modal
   ========================================================= */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(2, 5, 9, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlayIn 0.16s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  display: flex; flex-direction: column;
  width: min(100%, 780px); max-height: min(92vh, 900px);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background:
    linear-gradient(165deg, #0f1a29 0%, #0a111c 60%, #080e17 100%);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
}
.modal.small { width: min(100%, 430px); }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 21px 22px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head-icon {
  width: 36px; height: 36px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid rgba(95, 240, 198, 0.16); border-radius: 10px;
  background: rgba(95, 240, 198, 0.06); color: var(--mint);
}
.modal-head-icon .icon { width: 17px; height: 17px; }
.modal-head-icon.danger { color: var(--danger); border-color: rgba(251, 113, 133, 0.2); background: var(--danger-dim); }
.modal-title-wrap { min-width: 0; flex: 1; }
.modal-kicker {
  margin: 0 0 3px; font-family: var(--mono); font-size: 8px;
  letter-spacing: 0.16em; color: var(--faint); text-transform: uppercase;
}
.modal-title { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.03em; }
.modal-sub { margin: 4px 0 0; color: var(--faint); font-size: 10.5px; line-height: 1.6; }
.modal-close {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--faint); flex: 0 0 auto;
}
.modal-close:hover { color: var(--text); background: rgba(148, 163, 184, 0.08); border-color: var(--line); }
.modal-close .icon { width: 15px; height: 15px; }
.modal-body { padding: 20px 22px 22px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  padding: 14px 22px;
  border-top: 1px solid var(--line-soft);
  background: rgba(6, 11, 18, 0.5);
}
.modal-foot .foot-note { margin-right: auto; color: var(--faint); font-size: 9.5px; }
.modal-foot .btn { min-width: 92px; }
.form-section + .form-section {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-soft);
}
.form-section-head {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 12px;
  font-size: 9px; font-weight: 500; letter-spacing: 0.1em;
  color: var(--faint); text-transform: uppercase; font-family: var(--mono);
}
.form-section-head .icon { width: 12px; height: 12px; color: var(--mint); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.input-suffix { position: relative; display: flex; align-items: center; }
.input-suffix input { padding-right: 46px; }
.input-suffix span {
  position: absolute; right: 12px; color: var(--faint);
  font-family: var(--mono); font-size: 8px; pointer-events: none;
}
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.protocol-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.protocol-option { position: relative; cursor: pointer; }
.protocol-option input { position: absolute; opacity: 0; pointer-events: none; }
.protocol-option .proto-body {
  display: flex; flex-direction: column; gap: 3px;
  padding: 11px 11px 10px;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(148, 163, 184, 0.025);
  transition: border-color 0.16s ease, background 0.16s ease;
}
.protocol-option .proto-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.protocol-option b { font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--text-soft); }
.protocol-option span { color: var(--faint); font-size: 8.5px; line-height: 1.45; }
.proto-check {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
}
.proto-check::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.protocol-option input:checked + .proto-body {
  border-color: rgba(95, 240, 198, 0.38);
  background: rgba(95, 240, 198, 0.055);
}
.protocol-option input:checked + .proto-body .proto-check { border-color: var(--mint); }
.protocol-option input:checked + .proto-body .proto-check::after { background: var(--mint); }
.protocol-option input:checked + .proto-body b { color: var(--mint); }
.protocol-option input:focus-visible + .proto-body { outline: 2px solid var(--mint); outline-offset: 2px; }
.test-row {
  display: flex; align-items: center; gap: 10px; margin-top: 13px;
  padding: 10px 12px;
  border: 1px dashed var(--line); border-radius: 9px;
  background: rgba(148, 163, 184, 0.018);
}
.test-row .btn { min-height: 32px; }
.test-status { display: flex; align-items: center; gap: 7px; color: var(--faint); font-size: 10px; min-width: 0; }
.test-status .icon { width: 14px; height: 14px; flex: 0 0 auto; }
.test-status.ok { color: var(--mint); }
.test-status.fail { color: var(--danger); }
.test-status.loading { color: var(--muted); }
.test-status span { line-height: 1.45; }
.auth-subpanel {
  padding: 13px;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(148, 163, 184, 0.025);
  margin-top: 10px;
}
.auth-subpanel .form-grid { gap: 10px; }
.import-textarea {
  min-height: 150px;
  font-family: var(--mono); font-size: 11px; line-height: 1.7;
  background: rgba(4, 8, 14, 0.72);
  white-space: pre;
}
.import-meta {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  margin-top: 7px; color: var(--faint); font-size: 9px;
}
.import-meta .mono { color: var(--text-soft); }
.format-help {
  padding: 10px 12px; margin-top: 10px;
  border: 1px solid var(--line-soft); border-radius: 8px;
  background: rgba(148, 163, 184, 0.02);
  color: var(--faint); font-size: 9.5px; line-height: 1.75;
}
.format-help code {
  font-family: var(--mono); font-size: 9px; color: var(--text-soft);
  background: rgba(148, 163, 184, 0.07); padding: 1px 4px; border-radius: 3px;
}
.result-panel { margin-top: 14px; padding: 12px; border-radius: 9px; border: 1px solid var(--line); }
.result-panel.ok { border-color: rgba(95, 240, 198, 0.2); background: rgba(95, 240, 198, 0.035); }
.result-panel.warn { border-color: rgba(251, 191, 36, 0.2); background: rgba(251, 191, 36, 0.035); }
.result-panel h4 { margin: 0 0 7px; font-size: 11px; font-weight: 500; color: var(--text-soft); }
.result-list { margin: 0; padding-left: 16px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.confirm-copy { color: var(--muted); font-size: 12px; line-height: 1.75; }
.confirm-copy b { color: var(--text); font-family: var(--mono); font-size: 12px; }
.confirm-note {
  display: flex; gap: 8px; align-items: flex-start;
  margin-top: 12px; padding: 10px 11px;
  border: 1px solid rgba(251, 113, 133, 0.16); border-radius: 8px;
  background: rgba(251, 113, 133, 0.045);
  color: #d3a0a8; font-size: 10px; line-height: 1.6;
}
.confirm-note .icon { width: 13px; height: 13px; color: var(--danger); flex: 0 0 auto; margin-top: 1px; }

/* Toasts */
.toast-root {
  position: fixed; z-index: 300; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 9px;
  width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: rgba(12, 20, 32, 0.96);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  pointer-events: auto;
  animation: toastIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.out { animation: toastOut 0.2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(5px); } }
.toast-icon {
  width: 24px; height: 24px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 6px;
  color: var(--mint); background: var(--mint-dim);
}
.toast-icon.error { color: var(--danger); background: var(--danger-dim); }
.toast-icon.warn { color: var(--amber); background: var(--amber-dim); }
.toast-icon .icon { width: 13px; height: 13px; }
.toast-copy { min-width: 0; flex: 1; }
.toast-copy b { display: block; color: var(--text-soft); font-size: 11px; font-weight: 500; }
.toast-copy span { display: block; margin-top: 1px; color: var(--faint); font-size: 9.5px; line-height: 1.55; word-break: break-word; }
.toast-close {
  width: 22px; height: 22px; flex: 0 0 auto;
  display: grid; place-items: center; border: 0; border-radius: 5px;
  background: transparent; color: var(--faint);
}
.toast-close:hover { background: rgba(148, 163, 184, 0.08); color: var(--text); }
.toast-close .icon { width: 12px; height: 12px; }

/* Skeletons / loading */
.loading-block {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 220px; color: var(--faint); font-size: 10.5px;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1240px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-main, .dashboard-lower { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .auth-visual { padding-left: 42px; padding-right: 42px; }
  .auth-hero h1 { font-size: clamp(40px, 4.7vw, 60px); }
  .route-row { grid-template-columns: 132px minmax(60px, 1fr) 172px; gap: 12px; }
}

@media (max-width: 1080px) {
  .auth-screen { grid-template-columns: minmax(0, 1fr) minmax(390px, 0.9fr); }
  .security-card .security-list { grid-template-columns: 1fr; }
  .auth-visual { padding-left: 34px; padding-right: 34px; }
  .auth-hero { margin-top: 48px; }
  .auth-hero h1 { font-size: 44px; }
  .auth-hero .lede { font-size: 13px; }
  .route-visual { padding: 14px; }
  .route-row { grid-template-columns: 116px minmax(48px, 1fr) 150px; gap: 10px; }
  .route-node b { font-size: 11.5px; }
  .route-cap { font-size: 7px; }
  .route-footer { font-size: 8.5px; }
  .auth-panel { padding-left: 26px; padding-right: 26px; }
}

@media (max-width: 960px) {
  .auth-screen { display: block; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: 40px 24px 82px; justify-content: center; }
  .auth-mobile-brand { display: flex; }
  .auth-meta { left: 24px; right: 24px; bottom: 22px; }
  .mobile-only { display: inline-grid !important; }
  .sidebar {
    transform: translateX(-102%);
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 30px 0 70px rgba(0, 0, 0, 0.4);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-scrim { opacity: 1; visibility: visible; }
  .main { margin-left: 0; }
  .topbar { padding: 14px 20px; min-height: 76px; }
  .view { padding: 20px 20px 18px; }
  .app-footer { padding-left: 20px; padding-right: 20px; }
  .sidebar-brand .brand-edition { display: none; }
}

@media (max-width: 720px) {
  .topbar { min-height: 68px; padding: 12px 15px; gap: 11px; }
  .topbar-title h1 { font-size: 19px; }
  .topbar-title p { display: none; }
  .topbar-kicker { font-size: 7px; letter-spacing: 0.12em; }
  .topbar-actions { gap: 7px; }
  .topbar-actions .live-chip { display: none; }
  .topbar-actions .btn.small { min-height: 34px; padding: 0 11px; }
  .topbar-actions .btn.small span { display: none; }
  .topbar-actions .btn.small .icon { width: 17px; height: 17px; }
  .topbar-actions .icon-btn { width: 34px; height: 34px; }
  .view { padding: 15px 14px 18px; }
  .app-footer { padding: 0 14px 18px; font-size: 8.5px; }
  .app-footer .footer-right { display: none; }
  .pulse-banner { padding: 13px 14px; gap: 11px; }
  .pulse-orb { width: 32px; height: 32px; }
  .pulse-copy b { font-size: 12px; }
  .pulse-copy span { font-size: 9.5px; }
  .pulse-right { display: none; }
  .stat-grid { gap: 9px; margin: 12px 0; }
  .stat-card { min-height: 128px; padding: 14px 14px 12px; }
  .stat-value { font-size: 23px; margin-top: 12px; }
  .stat-sub { font-size: 9px; margin-top: 8px; }
  .stat-icon { width: 29px; height: 29px; }
  .stat-icon .icon { width: 14px; height: 14px; }
  .dashboard-main, .dashboard-lower { gap: 10px; }
  .panel-head { padding: 14px 14px 0; flex-wrap: wrap; gap: 8px; }
  .panel-head-right { gap: 8px; }
  .legend { gap: 8px; }
  .chart-wrap { height: 215px; margin: 4px 0 0; }
  .chart-foot { padding: 0 14px 12px; font-size: 7.5px; }
  .system-body { padding: 8px 14px 14px; }
  .gauges { gap: 20px; padding: 5px 0 14px; }
  .gauge { width: 92px; height: 92px; }
  .mini-list, .event-list { padding-left: 14px; padding-right: 14px; }
  .mini-port { grid-template-columns: 62px minmax(0, 1fr) auto; gap: 9px; }
  .event-foot { padding: 0 14px 12px; }
  .toolbar { gap: 8px; }
  .toolbar-left { width: 100%; }
  .search-field { flex: 1; width: auto; min-width: 150px; }
  .segmented { overflow-x: auto; max-width: 100%; }
  .toolbar-right { width: 100%; justify-content: flex-end; }
  .toolbar-right .btn { flex: 1; }
  #export-credentials { flex: 0 0 42px; padding: 0; }
  #export-credentials span { display: none; }
  .result-count { display: none; }
  .table-head { padding: 11px 14px; }
  .table-note { display: none; }
  .port-table-scroll { max-height: calc(100vh - 300px); min-height: 260px; }
  .table-pagination { padding: 10px 12px; align-items: stretch; }
  .pagination-controls { justify-content: space-between; }
  .page-label { min-width: 38px; }
  .logs-toolbar .search-field { width: 100%; }
  .logs-toolbar .segmented { width: 100%; overflow-x: auto; }
  .log-list { max-height: none; }
  .log-item { grid-template-columns: 58px 54px 52px minmax(0, 1fr); gap: 7px; padding: 9px 12px; }
  .log-item .log-msg { font-size: 10px; }
  .log-day { padding-left: 12px; padding-right: 12px; }
  .settings-card { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3 { grid-column: span 1; }
  .protocol-options { grid-template-columns: 1fr; }
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 20px); border-radius: 18px; }
  .modal-head { padding: 17px 16px 13px; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px; }
  .modal-foot .foot-note { display: none; }
  .modal-foot .btn { flex: 1; }
  .toast-root { right: 12px; bottom: 12px; width: calc(100vw - 24px); }
  .danger-row { flex-direction: column; align-items: flex-start; }
  .danger-row .btn { width: 100%; }
  .auth-panel { padding: 30px 17px 76px; }
  .auth-card { padding: 22px 19px 18px; }
  .auth-card-head h2 { font-size: 24px; }
  .auth-mobile-brand { margin-bottom: 18px; }
  .auth-meta { left: 17px; right: 17px; font-size: 7.5px; }
  .auth-features { display: none; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 114px; }
  .stat-value { font-size: 21px; }
  .stat-bars { display: none; }
  .route-options { grid-template-columns: 1fr; }
  .auth-card-top { margin-bottom: 18px; }
  .auth-card-head { margin-bottom: 18px; }
  .auth-submit { min-height: 47px; }
  .segmented button { padding: 0 8px; font-size: 9.5px; }
  .toolbar-right .btn { font-size: 11px; }
  .log-item { grid-template-columns: 47px 1fr; row-gap: 4px; }
  .log-item .log-level { grid-column: 1; justify-self: start; }
  .log-port { grid-column: 2; margin-top: -20px; justify-self: end; }
  .log-msg { grid-column: 1 / -1; }
}

@media (max-width: 360px) {
  .stat-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
