:root {
  color-scheme: dark;
  --bg: #070910;
  --bg-soft: #0b0f18;
  --surface: rgba(18, 23, 35, .82);
  --surface-solid: #111725;
  --surface-light: rgba(255, 255, 255, .045);
  --surface-hover: rgba(255, 255, 255, .072);
  --text: #f4f7fb;
  --muted: #8993a7;
  --muted-strong: #aab3c3;
  --accent: var(--tg-theme-button-color, #6d7cff);
  --accent-2: #8b5cf6;
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --green: #34d399;
  --orange: #f59e0b;
  --danger: #fb7185;
  --line: rgba(255, 255, 255, .085);
  --line-strong: rgba(255, 255, 255, .135);
  --shadow: 0 22px 70px rgba(0, 0, 0, .34);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, rgba(109, 124, 255, .16), transparent 32rem),
    radial-gradient(circle at 96% 18%, rgba(139, 92, 246, .1), transparent 28rem),
    linear-gradient(180deg, #080b12 0%, var(--bg) 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 80%, white);
  outline-offset: 2px;
}
svg { display: block; }

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  opacity: .42;
}
.ambient-one { width: 320px; height: 320px; left: -180px; top: 180px; background: rgba(75, 91, 255, .17); }
.ambient-two { width: 260px; height: 260px; right: -170px; top: 520px; background: rgba(134, 82, 255, .13); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: calc(12px + env(safe-area-inset-top)) max(18px, calc((100vw - 1100px) / 2)) 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .055);
  background: rgba(7, 9, 16, .7);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: white;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(112, 125, 255, .95), rgba(117, 72, 225, .9));
  box-shadow: 0 10px 28px rgba(84, 94, 232, .28), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.brand-mark svg { width: 25px; height: 25px; }
.eyebrow, .section-kicker {
  margin: 0 0 3px;
  color: #7f8aa2;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
}
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 18px; line-height: 1.1; letter-spacing: -.025em; }
h2 { margin: 4px 0 7px; font-size: clamp(27px, 4vw, 38px); line-height: 1.08; letter-spacing: -.045em; }
h3 { margin-bottom: 6px; font-size: 18px; line-height: 1.25; letter-spacing: -.02em; }
h4 { letter-spacing: -.015em; }

main {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 30px 18px calc(52px + env(safe-area-inset-bottom));
}
.hidden { display: none !important; }
.muted { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .04);
  transition: transform .18s ease, color .18s ease, background .18s ease, border-color .18s ease;
}
.icon-button svg {
  width: 20px;
  height: 20px;
  transform-origin: 50% 50%;
}
.icon-button:hover {
  color: white;
  border-color: var(--line-strong);
  background: var(--surface-hover);
}
.icon-button:active { transform: scale(.95); }
.icon-button:disabled { cursor: wait; }
.icon-button.is-loading svg { animation: refresh-spin .75s linear infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }

.notice {
  margin-bottom: 18px;
  padding: 13px 15px;
  color: #fcd68a;
  border: 1px solid rgba(245, 158, 11, .28);
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, .09);
  font-size: 13px;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 12px 2px 24px;
}
.page-intro p { margin: 0; color: var(--muted); font-size: 14px; }
.page-intro__actions { display: flex; align-items: center; gap: 9px; }
.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .025);
  font-size: 11px;
  white-space: nowrap;
}
.connection-state span, .live-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .11), 0 0 16px rgba(52, 211, 153, .5);
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
  gap: 16px;
}
.server-card {
  position: relative;
  min-height: 194px;
  padding: 21px;
  overflow: hidden;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .058), rgba(255, 255, 255, .015)),
    rgba(14, 18, 29, .84);
  box-shadow: 0 16px 45px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .035);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.server-card::before {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -75px;
  top: -75px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(110, 124, 255, .22), transparent 68%);
  transition: transform .3s ease, opacity .3s ease;
}
.server-card:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 137, 255, .36);
  box-shadow: 0 22px 55px rgba(0, 0, 0, .28), 0 0 0 1px rgba(109, 124, 255, .06) inset;
}
.server-card:hover::before { transform: scale(1.2); }
.server-card:active { transform: scale(.985); }
.server-card__top, .server-card__footer { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.server-card__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #aab4ff;
  border: 1px solid rgba(124, 137, 255, .18);
  border-radius: 16px;
  background: rgba(109, 124, 255, .1);
}
.server-card__icon svg { width: 25px; height: 25px; }
.server-card__arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .025);
  transition: color .18s ease, transform .18s ease, background .18s ease;
}
.server-card__arrow svg { width: 17px; height: 17px; }
.server-card:hover .server-card__arrow { color: white; background: rgba(255, 255, 255, .07); transform: translateX(2px); }
.server-card h3 { position: relative; z-index: 1; margin: 21px 0 5px; font-size: 21px; }
.server-card__location { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.server-card__location svg { width: 14px; height: 14px; }
.server-card__footer { margin-top: 22px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .065); }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 5px 9px;
  color: #b9c1ff;
  border: 1px solid rgba(124, 137, 255, .15);
  border-radius: 999px;
  background: rgba(109, 124, 255, .09);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.server-card__status { display: flex; align-items: center; gap: 7px; color: var(--muted-strong); font-size: 11px; }
.server-card__status i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(52, 211, 153, .62); }

.server-hero {
  position: relative;
  margin-bottom: 16px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(120deg, rgba(109, 124, 255, .1), transparent 42%),
    rgba(14, 18, 29, .82);
  box-shadow: 0 14px 42px rgba(0, 0, 0, .17);
}
.server-hero::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -135px;
  bottom: -170px;
  border-radius: 50%;
  background: rgba(124, 89, 255, .14);
  filter: blur(30px);
  pointer-events: none;
}
.server-hero__top { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.link-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  color: var(--muted);
  border: 0;
  background: transparent;
  font-size: 12px;
  transition: color .18s ease;
}
.link-button:hover { color: white; }
.link-button svg { width: 16px; height: 16px; }
.server-heading { display: flex; align-items: center; gap: 13px; margin-top: 17px; }
.server-heading__icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  color: #b5bdff;
  border: 1px solid rgba(124, 137, 255, .2);
  border-radius: 16px;
  background: rgba(109, 124, 255, .11);
}
.server-heading__icon svg { width: 27px; height: 27px; }
.server-title-row { display: flex; align-items: center; gap: 10px; }
.server-title-row h2 { margin: 0; font-size: clamp(24px, 4vw, 32px); }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  color: #88e7c2;
  border: 1px solid rgba(52, 211, 153, .17);
  border-radius: 999px;
  background: rgba(52, 211, 153, .08);
  font-size: 10px;
  font-weight: 650;
}
.live-pill i { width: 5px; height: 5px; box-shadow: 0 0 10px rgba(52, 211, 153, .7); }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.primary, .secondary, .danger-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 43px;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 12px;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.primary svg, .secondary svg, .danger-outline svg { width: 17px; height: 17px; }
.primary {
  color: var(--accent-text);
  border: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 92%, white), color-mix(in srgb, var(--accent) 75%, var(--accent-2)));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 20%, transparent), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px color-mix(in srgb, var(--accent) 25%, transparent), inset 0 1px 0 rgba(255, 255, 255, .2); }
.primary:active, .secondary:active, .danger-outline:active { transform: scale(.98); }
.secondary { color: var(--text); border: 1px solid var(--line); background: rgba(255, 255, 255, .045); }
.secondary:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .075); }
.danger-outline { color: #ff9aaa; border: 1px solid rgba(251, 113, 133, .25); background: rgba(251, 113, 133, .06); }
.danger-outline:hover { border-color: rgba(251, 113, 133, .42); background: rgba(251, 113, 133, .1); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric {
  position: relative;
  min-height: 116px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(15, 20, 31, .75);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
}
.metric::after {
  content: "";
  position: absolute;
  width: 78px;
  height: 78px;
  right: -38px;
  top: -38px;
  border-radius: 50%;
  background: rgba(109, 124, 255, .09);
}
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.metric span { color: var(--muted); font-size: 11px; font-weight: 550; }
.metric-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: #9ca7ff;
  border-radius: 9px;
  background: rgba(109, 124, 255, .1);
}
.metric-icon svg { width: 15px; height: 15px; }
.metric strong { display: block; margin-top: 22px; font-size: 18px; line-height: 1.2; letter-spacing: -.025em; overflow-wrap: anywhere; }
.metric:nth-child(1) .metric-icon { color: #72dfb7; background: rgba(52, 211, 153, .1); }
.metric:nth-child(6) .metric-icon { color: #f9c768; background: rgba(245, 158, 11, .1); }

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(14, 18, 29, .76);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255, 255, 255, .025);
}
.create-panel { margin-top: 16px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-header.standalone { margin: 29px 2px 12px; }
.panel-title-group { display: flex; align-items: center; gap: 12px; }
.panel-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  color: #aeb7ff;
  border: 1px solid rgba(124, 137, 255, .16);
  border-radius: 14px;
  background: rgba(109, 124, 255, .09);
}
.panel-icon svg { width: 22px; height: 22px; }
.panel-header h3 { margin-bottom: 3px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.field { display: grid; gap: 7px; min-width: 0; }
.field-wide { grid-column: span 2; }
.field > span, .uri-field > span { color: var(--muted-strong); font-size: 11px; font-weight: 560; }
input, select, textarea {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(4, 7, 13, .45);
  outline: none;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
input, select { min-height: 44px; padding: 10px 12px; }
select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, .14); }
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--accent) 65%, white); background: rgba(4, 7, 13, .68); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent); }
input::placeholder { color: #596276; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 48px; }
.input-suffix i { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: #697387; font-size: 10px; font-style: normal; pointer-events: none; }
.form-grid .primary { grid-column: span 2; }

.wizard-form { display: grid; gap: 4px; }
.wizard-section { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.wizard-section:last-of-type { border-bottom: 0; }
.wizard-section .panel-header.standalone { margin-top: 18px; }
.wizard-section:first-child .panel-header.standalone { margin-top: 2px; }
.wizard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wizard-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 17px; }
.wizard-options label { display: flex; align-items: center; gap: 9px; color: var(--muted-strong); font-size: 11px; }
.wizard-options input { width: 17px; min-height: 17px; accent-color: var(--accent); }
.wizard-hint { margin: 14px 0 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .02); font-size: 11px; line-height: 1.5; }
.wizard-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 18px; }
.wizard-actions button { min-width: 170px; }

.users-section { margin-top: 4px; }
.inbound-card {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(14, 18, 29, .74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
}
.inbound-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .065);
  background: rgba(255, 255, 255, .017);
}
.inbound-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.inbound-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: #aab3ff;
  border-radius: 12px;
  background: rgba(109, 124, 255, .09);
}
.inbound-icon svg { width: 20px; height: 20px; }
.inbound-summary h4 { margin: 0 0 3px; font-size: 15px; }
.inbound-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.inbound-meta b { color: var(--muted-strong); font-weight: 550; }
.traffic-badge { text-align: right; }
.traffic-badge strong { display: block; font-size: 13px; }
.traffic-badge span { color: var(--muted); font-size: 10px; }
.client-list { display: grid; }
.client-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.45fr) minmax(120px, .8fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px 17px;
  border-bottom: 1px solid rgba(255, 255, 255, .055);
  transition: background .16s ease;
}
.client-row:last-child { border-bottom: 0; }
.client-row:hover { background: rgba(255, 255, 255, .018); }
.client-person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.client-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  color: #bec5ff;
  border: 1px solid rgba(124, 137, 255, .13);
  border-radius: 11px;
  background: rgba(109, 124, 255, .08);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border: 2px solid #101521;
  border-radius: 50%;
  background: #5d6678;
}
.status-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, .55); }
.client-name { min-width: 0; overflow: hidden; }
.client-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.client-name .muted, .client-traffic .muted { margin-top: 3px; font-size: 10px; }
.client-traffic { text-align: right; }
.client-traffic strong { font-size: 13px; }
.actions { display: flex; align-items: center; gap: 6px; }
.actions button {
  min-width: 39px;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 10px;
}
.actions .qr-button { color: #c3c9ff; }
.actions .client-state-button { color: #f2c979; }
.actions .client-reset-button { color: #8fdac3; }
.actions svg { width: 16px; height: 16px; }
.empty { padding: 26px 18px; color: var(--muted); text-align: center; font-size: 12px; }

.loading-shimmer { position: relative; overflow: hidden; }
.loading-shimmer::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .05), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

html:has(dialog[open]) { overflow: hidden; }
dialog {
  width: min(92vw, 470px);
  max-height: min(90vh, 760px);
  padding: 0;
  overflow: auto;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 25px;
  background: #111621;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .62);
}
dialog::backdrop { background: rgba(1, 3, 8, .76); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.dialog-shell { position: relative; padding: 23px; }
.dialog-close {
  position: absolute;
  top: 15px;
  right: 15px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .035);
}
.dialog-close:hover { color: white; background: rgba(255, 255, 255, .07); }
.dialog-close svg { width: 17px; height: 17px; }
.dialog-heading { display: flex; align-items: center; gap: 11px; padding-right: 40px; }
.dialog-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  color: #bcc3ff;
  border-radius: 13px;
  background: rgba(109, 124, 255, .1);
}
.dialog-icon svg { width: 22px; height: 22px; }
.dialog-heading h3 { margin-bottom: 2px; }
.qr-shell {
  width: fit-content;
  margin: 23px auto 20px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 22px;
  background: white;
  box-shadow: 0 16px 45px rgba(0, 0, 0, .25), 0 0 0 7px rgba(255, 255, 255, .025);
}
.qr { display: block; width: 210px; height: 210px; border-radius: 12px; background: white; }
.uri-field { display: grid; gap: 7px; }
textarea { min-height: 96px; padding: 11px; resize: vertical; color: #c7cddd; font-size: 10px; line-height: 1.45; word-break: break-all; }
.full-width { width: 100%; margin-top: 11px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: min(90vw, 440px);
  padding: 11px 16px;
  transform: translateX(-50%);
  color: #10131a;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 999px;
  background: rgba(244, 247, 251, .96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-wide { grid-column: span 2; }
  .form-grid .primary { grid-column: span 2; }
}

@media (max-width: 640px) {
  .topbar { min-height: 68px; padding-left: 15px; padding-right: 15px; }
  .brand-mark { width: 39px; height: 39px; border-radius: 13px; }
  .brand-mark svg { width: 23px; height: 23px; }
  main { padding: 22px 14px calc(40px + env(safe-area-inset-bottom)); }
  .page-intro { align-items: flex-start; margin-top: 7px; }
  .page-intro__actions { margin-left: auto; }
  .connection-state { display: none; }
  .server-grid { grid-template-columns: 1fr; }
  .server-card { min-height: 184px; padding: 19px; }
  .server-hero { padding: 18px; }
  .server-hero__top { align-items: flex-start; flex-direction: column; }
  .server-heading { margin-top: 14px; }
  .header-actions { width: 100%; justify-content: stretch; }
  .header-actions button { flex: 1; }
  .metric-grid { gap: 9px; }
  .metric { min-height: 105px; padding: 14px; }
  .metric strong { margin-top: 18px; font-size: 16px; }
  .panel { padding: 17px; }
  .panel-title-group { align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide, .form-grid .primary { grid-column: auto; }
  .form-grid .primary { width: 100%; margin-top: 2px; }
  .wizard-options { grid-template-columns: 1fr; }
  .wizard-actions { flex-direction: column-reverse; }
  .wizard-actions button { width: 100%; }
  .inbound-summary { align-items: flex-start; padding: 15px; }
  .traffic-badge { flex: 0 0 auto; }
  .client-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "person person"
      "traffic actions";
    column-gap: 9px;
    row-gap: 9px;
    padding: 12px 13px;
  }
  .client-person { grid-area: person; }
  .client-traffic { grid-area: traffic; align-self: center; padding-left: 47px; text-align: left; }
  .client-traffic .muted { white-space: nowrap; }
  .actions {
    grid-area: actions;
    display: grid;
    grid-template-columns: repeat(4, 34px);
    gap: 5px;
  }
  .actions button { min-width: 34px; min-height: 34px; padding: 7px; }
  dialog { width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 25px 25px 0 0; }
  .dialog-shell { padding: 21px 18px calc(22px + env(safe-area-inset-bottom)); }
  .qr { width: min(55vw, 220px); height: min(55vw, 220px); }
}

@media (max-width: 360px) {
  .client-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "person"
      "traffic"
      "actions";
  }
  .actions { margin-left: 47px; justify-content: start; }
}

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

.warning-action {
  color: #f4d18b;
  border-color: rgba(245, 158, 11, .22);
  background: rgba(245, 158, 11, .07);
}
.warning-action:hover {
  border-color: rgba(245, 158, 11, .4);
  background: rgba(245, 158, 11, .12);
}
button:disabled {
  cursor: wait;
  opacity: .58;
  transform: none !important;
}

.version-panel { margin-top: 16px; }
.version-panel__header { margin-bottom: 15px; }
.version-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.version-item {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .025);
}
.version-item span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.version-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
}
.version-ok { color: #72dfb7; }
.version-warning { color: #f7c76e; }
.version-muted { color: var(--muted-strong); }

.users-hero { margin-bottom: 16px; }
.operation-shell { width: min(92vw, 640px); }
.operation-output {
  max-height: 48vh;
  margin: 20px 0 0;
  padding: 14px;
  overflow: auto;
  color: #c7cedd;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #090d14;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .header-actions button { min-width: calc(50% - 4px); }
  .version-panel__header { align-items: flex-start; }
  .version-grid { grid-template-columns: 1fr; }
  .operation-shell { width: 100%; }
}

/* v3: compact dashboard, enriched server cards and release page */
.server-card {
  min-height: 168px;
  padding: 19px;
}
.server-card__headline {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.server-card__identity { min-width: 0; }
.server-card__identity h3,
.server-card h3 {
  margin: 0 0 3px;
  overflow: hidden;
  font-size: 21px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-card__identity p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-card__facts {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.server-fact {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  padding: 6px 10px;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .025);
  font-size: 10px;
}
.server-fact b {
  margin-right: 4px;
  color: var(--text);
  font-size: 11px;
}
.server-fact--os {
  color: #c0c7ff;
  border-color: rgba(124, 137, 255, .16);
  background: rgba(109, 124, 255, .08);
  font-weight: 650;
}
.server-card__footer { margin-top: 15px; padding-top: 12px; }
.server-card__status.is-active i { background: var(--green); box-shadow: 0 0 12px rgba(52, 211, 153, .62); }
.server-card__status.is-degraded { color: #e7c47d; }
.server-card__status.is-degraded i { background: #f0b95b; box-shadow: 0 0 12px rgba(240, 185, 91, .48); }
.server-card__status.is-inactive { color: #d799a5; }
.server-card__status.is-inactive i { background: var(--danger); box-shadow: 0 0 12px rgba(251, 113, 133, .45); }
.server-card--loading { min-height: 155px; }
.server-card--loading p { color: var(--muted); font-size: 11px; }

.server-hero--compact { padding: 18px 20px; }
.server-heading--compact { margin-top: 12px; }
.server-heading--compact .server-heading__icon { width: 44px; height: 44px; border-radius: 14px; }
.server-heading--compact .server-heading__icon svg { width: 23px; height: 23px; }
.server-heading--compact .server-title-row h2 { font-size: clamp(22px, 3.6vw, 29px); }
.live-pill.is-inactive {
  color: #f2a2af;
  border-color: rgba(251, 113, 133, .2);
  background: rgba(251, 113, 133, .08);
}
.live-pill.is-inactive i { background: var(--danger); box-shadow: 0 0 10px rgba(251, 113, 133, .55); }
.live-pill.is-degraded {
  color: #f0ca7d;
  border-color: rgba(240, 185, 91, .22);
  background: rgba(240, 185, 91, .09);
}
.live-pill.is-degraded i { background: #f0b95b; box-shadow: 0 0 10px rgba(240, 185, 91, .55); }

.metric-grid--compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metric--compact {
  min-height: 91px;
  padding: 13px 14px;
  text-align: left;
}
.metric--compact .metric-icon { width: 25px; height: 25px; }
.metric--compact strong { margin-top: 13px; font-size: 16px; }
.metric--compact small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.35;
}
.metric--link {
  width: 100%;
  color: var(--text);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.metric--link:hover { transform: translateY(-2px); border-color: rgba(124, 137, 255, .34); background: rgba(24, 30, 46, .88); }
.metric--link:active { transform: scale(.985); }
.metric--ok strong, .metric--link.version-ok strong { color: #72dfb7; }
.metric--warning strong, .metric--link.version-warning strong { color: #f7c76e; }
.metric--link.version-warning { border-color: rgba(245, 158, 11, .25); }
.metric--link.version-warning .metric-icon { color: #f9c768; background: rgba(245, 158, 11, .1); }
.metric--link.version-ok .metric-icon { color: #72dfb7; background: rgba(52, 211, 153, .1); }

.release-panel { margin-top: 16px; }
.release-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--line);
}
.release-version-block {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .025);
}
.release-version-block span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.release-version-block strong { font-size: 22px; letter-spacing: -.03em; }
.release-arrow { color: var(--muted); font-size: 20px; }
.release-status {
  min-width: 112px;
  padding: 9px 11px;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .025);
  font-size: 10px;
  font-weight: 650;
  text-align: center;
}
.release-status.is-current { color: #72dfb7; border-color: rgba(52, 211, 153, .2); background: rgba(52, 211, 153, .08); }
.release-status.is-warning { color: #f7c76e; border-color: rgba(245, 158, 11, .25); background: rgba(245, 158, 11, .08); }
.release-status.is-muted { color: var(--muted); }
.release-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 21px 0 17px;
}
.release-meta h3 { margin-bottom: 4px; }
.release-advisory {
  margin: 0 0 17px;
  padding: 14px 15px;
  color: #f4d18b;
  border: 1px solid rgba(245, 158, 11, .25);
  border-radius: 14px;
  background: rgba(245, 158, 11, .07);
}
.release-advisory strong { display: block; margin-bottom: 6px; font-size: 12px; }
.release-advisory p { margin: 0; white-space: pre-wrap; font-size: 11px; line-height: 1.55; }
.release-notes-wrap {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #090d14;
}
.release-notes-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.release-notes-heading h3 { margin: 0; font-size: 15px; }
.release-link { color: #aeb8ff; font-size: 10px; font-weight: 650; text-decoration: none; }
.release-link:hover { color: white; }
.release-notes {
  max-height: 52vh;
  margin: 0;
  overflow: auto;
  color: #c4cbda;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.version-hero__icon { color: #72dfb7; background: rgba(52, 211, 153, .08); border-color: rgba(52, 211, 153, .18); }

@media (max-width: 640px) {
  .server-card { min-height: 160px; padding: 17px; }
  .server-card__icon { width: 43px; height: 43px; border-radius: 14px; }
  .server-card__identity h3, .server-card h3 { font-size: 19px; }
  .server-card__facts { margin-top: 15px; gap: 6px; }
  .server-fact { min-height: 27px; padding: 5px 8px; }
  .server-card__footer { margin-top: 13px; }
  .server-hero--compact { padding: 15px; }
  .server-heading--compact { margin-top: 10px; }
  .metric-grid--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric--compact { min-height: 82px; padding: 11px 12px; }
  .metric--compact strong { margin-top: 10px; font-size: 15px; }
  .release-summary { grid-template-columns: 1fr auto 1fr; gap: 8px; }
  .release-status { grid-column: 1 / -1; width: 100%; }
  .release-version-block { padding: 12px; }
  .release-version-block strong { font-size: 18px; }
  .release-meta { align-items: flex-start; flex-direction: column; }
  .release-meta button { width: 100%; }
  .release-notes-wrap { padding: 14px; }
}
