:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18202b;
  --muted: #667085;
  --line: #d7dce2;
  --accent: #176b87;
  --accent-strong: #0f4c5c;
  --danger: #b42318;
  --ok: #087443;
  --warn: #b54708;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgb(255 255 255 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 3%) 1px, transparent 1px),
    linear-gradient(135deg, #081215 0%, #0e2429 48%, #09110f 100%);
  background-size: 42px 42px, 42px 42px, auto;
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  animation: login-grid 18s linear infinite;
}

button,
input {
  font: inherit;
}

button {
  position: relative;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

button:disabled {
  cursor: progress;
  opacity: 0.72;
}

button.secondary {
  background: rgb(232 237 242 / 92%);
  color: var(--text);
}

.dialog-close-button,
.mobile-back-button {
  min-height: 40px;
  border: 1px solid rgb(23 107 135 / 18%);
  background: rgb(15 76 92 / 10%);
  color: var(--accent-strong);
  font-weight: 800;
  box-shadow: none;
}

.dialog-close-button:hover,
.mobile-back-button:hover {
  background: rgb(15 76 92 / 16%);
  color: #083944;
}

.hidden {
  display: none !important;
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgb(255 255 255 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 3%) 1px, transparent 1px),
    linear-gradient(135deg, #081215 0%, #0e2429 48%, #09110f 100%);
  background-size: 42px 42px, 42px 42px, auto;
  color: #f6fbfc;
  transition:
    opacity 300ms ease,
    transform 300ms ease;
}

.app-loader.is-hidden {
  opacity: 0;
  transform: scale(1.01);
  pointer-events: none;
}

.loader-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(300px, 100%);
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 8px;
  padding: 28px;
  background: rgb(250 252 253 / 9%);
  box-shadow: 0 28px 90px rgb(0 0 0 / 34%);
  backdrop-filter: blur(18px);
  animation: login-rise 420ms ease-out both;
}

.loader-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: rgb(255 255 255 / 12%);
  color: #ffffff;
  font-size: 22px;
  font-weight: 850;
}

.loader-ring {
  width: 58px;
  height: 58px;
  margin: 6px 0 2px;
  border: 2px solid rgb(255 255 255 / 18%);
  border-top-color: #7acddb;
  border-right-color: #43b581;
  border-radius: 50%;
  animation: loader-spin 900ms linear infinite;
}

.loader-card strong {
  font-size: 18px;
}

.loader-card span {
  color: rgb(246 251 252 / 68%);
  font-size: 13px;
  text-align: center;
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

.refresh-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 15;
  width: 100%;
  height: 3px;
  overflow: hidden;
  background: transparent;
}

.pull-refresh {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  z-index: 17;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 999px;
  padding: 8px 13px 8px 9px;
  background: rgb(16 24 40 / 88%);
  color: #f8fafc;
  box-shadow: 0 18px 50px rgb(0 0 0 / 30%);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-70px + var(--pull-distance, 0px)));
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.pull-refresh.is-visible {
  opacity: 1;
}

.pull-refresh.is-ready,
.pull-refresh.is-loading {
  background: rgb(15 76 92 / 92%);
}

.pull-refresh-ring {
  width: 26px;
  height: 26px;
  border: 2px solid rgb(255 255 255 / 18%);
  border-top-color: #7acddb;
  border-right-color: #43b581;
  border-radius: 50%;
  transform: rotate(calc(var(--pull-distance, 0px) * 2deg));
}

.pull-refresh.is-loading .pull-refresh-ring {
  animation: loader-spin 820ms linear infinite;
}

.pull-refresh span {
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.refresh-progress::before {
  content: "";
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #7acddb, #43b581, transparent);
  animation: progress-slide 900ms ease-in-out infinite;
}

@keyframes progress-slide {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(240%);
  }
}

.offline-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 16;
  max-width: min(360px, calc(100% - 32px));
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgb(16 24 40 / 92%);
  color: #f8fafc;
  box-shadow: 0 18px 50px rgb(0 0 0 / 30%);
  font-size: 13px;
  animation: toast-in 220ms ease-out both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.shell {
  width: 100%;
  margin: 0 auto;
}

.login-view {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: transparent;
  color: #f6fbfc;
}

.login-view::before,
.login-view::after,
.dashboard::before,
.dashboard::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-view::before,
.dashboard::before {
  background:
    linear-gradient(120deg, transparent 0%, rgb(122 205 219 / 12%) 34%, transparent 68%),
    linear-gradient(260deg, transparent 12%, rgb(67 181 129 / 9%) 50%, transparent 82%);
  mix-blend-mode: screen;
  opacity: 0.7;
  animation: login-light 10s ease-in-out infinite alternate;
}

.login-view::after,
.dashboard::after {
  background: linear-gradient(180deg, rgb(255 255 255 / 5%), transparent 18%, rgb(0 0 0 / 20%));
}

@keyframes login-grid {
  from {
    background-position: 0 0, 0 0, center;
  }

  to {
    background-position: 42px 42px, 42px 42px, center;
  }
}

@keyframes login-light {
  from {
    transform: translate3d(-3%, -2%, 0);
    opacity: 0.48;
  }

  to {
    transform: translate3d(3%, 2%, 0);
    opacity: 0.78;
  }
}

.login-stage {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(420px, 100%);
  animation: login-rise 480ms ease-out both;
}

@keyframes login-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-box {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 8px;
  padding: 26px;
  background:
    linear-gradient(rgb(250 252 253 / 96%), rgb(250 252 253 / 96%)) padding-box,
    linear-gradient(135deg, rgb(255 255 255 / 54%), rgb(23 107 135 / 20%), rgb(255 255 255 / 14%)) border-box;
  color: var(--text);
  box-shadow: 0 26px 90px rgb(0 0 0 / 32%);
  backdrop-filter: blur(18px);
}

.login-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgb(255 255 255 / 42%) 45%, transparent 78%);
  transform: translateX(-120%);
  animation: card-sheen 7s ease-in-out infinite;
  pointer-events: none;
}

@keyframes card-sheen {
  0%,
  62% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(120%);
  }
}

.login-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 22px;
  border-radius: 8px;
  background: #10242a;
  color: #ffffff;
  font-weight: 850;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 14%), 0 14px 28px rgb(16 36 42 / 20%);
}

.login-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.login-box h1 {
  margin: 0;
  font-size: 26px;
}

.login-box-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.login-box-head span {
  display: inline-flex;
  align-items: center;
  height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef6f7;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.login-box button[type="submit"] {
  overflow: hidden;
  width: 100%;
  min-height: 46px;
  margin-top: 2px;
  font-weight: 750;
  box-shadow: 0 12px 28px rgb(23 107 135 / 22%);
}

.login-box button[type="submit"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0%, rgb(255 255 255 / 24%) 45%, transparent 72%);
  transform: translateX(-110%);
  transition: transform 420ms ease;
}

.login-box button[type="submit"]:hover::after {
  transform: translateX(110%);
}

.login-box input {
  height: 46px;
  background: #f8fafb;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.login-box input:focus {
  outline: 3px solid rgb(23 107 135 / 16%);
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 10px 26px rgb(16 36 42 / 8%);
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
}

.error {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.dashboard {
  position: relative;
  overflow: hidden;
  width: min(1220px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 42px;
  color: #f6fbfc;
  animation: login-rise 420ms ease-out both;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 28px;
  text-shadow: 0 10px 30px rgb(0 0 0 / 26%);
}

.topbar p {
  margin: 0;
  color: rgb(246 251 252 / 64%);
}

.actions {
  display: flex;
  gap: 10px;
}

.mobile-bottom-nav {
  display: none;
}

.stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats article,
.server {
  background:
    linear-gradient(rgb(250 252 253 / 94%), rgb(250 252 253 / 94%)) padding-box,
    linear-gradient(135deg, rgb(255 255 255 / 48%), rgb(23 107 135 / 18%), rgb(255 255 255 / 10%)) border-box;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 60px rgb(0 0 0 / 18%);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.stats article:hover,
.server:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 70px rgb(0 0 0 / 22%);
}

.is-refreshing .stats article,
.is-refreshing .server {
  animation: card-breathe 1100ms ease-in-out infinite alternate;
}

@keyframes card-breathe {
  from {
    box-shadow: 0 18px 60px rgb(0 0 0 / 18%);
  }

  to {
    box-shadow: 0 22px 72px rgb(67 181 129 / 13%);
  }
}

.stats article {
  padding: 16px;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stats strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.servers {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.server {
  overflow: hidden;
}

.server-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid rgb(24 32 43 / 10%);
}

.server-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.server-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #10242a;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 14%), 0 12px 24px rgb(16 36 42 / 16%);
}

.server-title h2 {
  margin: 0;
  font-size: 19px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.badge.ok {
  background: #dcfae6;
  color: var(--ok);
}

.badge.off {
  background: #fee4e2;
  color: var(--danger);
}

.meta,
.server-error {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.server-error {
  color: var(--danger);
}

.server-metrics {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.server-metrics span {
  min-width: 74px;
}

.latency-fast {
  color: var(--ok) !important;
}

.latency-mid {
  color: var(--warn) !important;
}

.latency-slow {
  color: var(--danger) !important;
}

.traffic-mini {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  margin-top: 6px;
  background: rgb(24 32 43 / 8%);
}

.traffic-mini span {
  display: block;
  min-width: 4px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #176b87, #43b581);
}

.mobile-open-server,
.mobile-detail-view {
  display: none;
}

.inbounds {
  display: grid;
}

.inbound {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.inbound:last-child {
  border-bottom: 0;
}

.inbound-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.inbound-name {
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

.client-cards,
.mobile-empty {
  display: none;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 9px 8px;
  border-top: 1px solid rgb(24 32 43 / 8%);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 650;
}

.empty {
  position: relative;
  z-index: 1;
  padding: 28px;
  border: 1px dashed rgb(255 255 255 / 26%);
  border-radius: 8px;
  color: rgb(246 251 252 / 72%);
  text-align: center;
}

.link-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-actions {
  display: flex;
  gap: 8px;
}

.mini-actions button,
.copy-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.client-card button {
  width: 100%;
  min-height: 38px;
}

.mobile-detail-head,
.mobile-detail-meta,
.mobile-inbounds {
  position: relative;
  z-index: 1;
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-line,
.skeleton-card .server-metrics span {
  display: block;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgb(24 32 43 / 7%), rgb(255 255 255 / 54%), rgb(24 32 43 / 7%));
  background-size: 240% 100%;
  animation: skeleton-shimmer 1100ms ease-in-out infinite;
}

.skeleton-line {
  width: 180px;
  margin-bottom: 12px;
}

.skeleton-line.wide {
  width: 260px;
  height: 22px;
}

@keyframes skeleton-shimmer {
  from {
    background-position: 120% 0;
  }

  to {
    background-position: -120% 0;
  }
}

.dialog {
  width: min(980px, calc(100% - 24px));
  max-height: min(860px, calc(100vh - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 24px 80px rgb(24 32 43 / 20%);
  animation: dialog-pop 180ms ease-out both;
  backdrop-filter: blur(18px);
}

.dialog::backdrop {
  background: rgb(24 32 43 / 42%);
}

@keyframes dialog-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.dialog-head p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.dialog-body {
  display: grid;
  gap: 16px;
  padding: 18px;
  overflow: auto;
}

.detail-section {
  display: grid;
  gap: 12px;
  border: 1px solid rgb(24 32 43 / 8%);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.detail-section h3 {
  margin: 0;
  font-size: 15px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.detail-item span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.detail-item strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.link-panel {
  display: grid;
  gap: 10px;
}

.link-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.link-actions {
  display: flex;
  gap: 8px;
}

.link-row code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: #f8fafc;
  white-space: nowrap;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.qr-card {
  display: grid;
  gap: 10px;
  justify-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.qr-card img {
  width: 190px;
  height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

pre {
  overflow: auto;
  margin: 10px 0 0;
  border-radius: 6px;
  padding: 12px;
  background: #101828;
  color: #f8fafc;
  font-size: 12px;
}

.compact-mode .dashboard {
  width: min(1380px, calc(100% - 24px));
  padding-top: 18px;
}

.compact-mode .stats {
  margin-bottom: 12px;
}

.compact-mode .stats article {
  padding: 12px;
}

.compact-mode .server-header {
  padding: 12px;
}

.compact-mode .inbound {
  padding: 10px 12px;
}

.compact-mode th,
.compact-mode td {
  padding: 7px 8px;
}

@media (max-width: 800px) {
  body {
    background-size: 34px 34px, 34px 34px, auto;
  }

  .app-loader {
    background-size: 34px 34px, 34px 34px, auto;
  }

  .pull-refresh {
    display: flex;
  }

  .offline-toast {
    right: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
  }

  .dashboard {
    width: min(100% - 20px, 1220px);
    padding: 18px 0 28px;
  }

  .topbar,
  .server-header,
  .inbound-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    gap: 14px;
    margin-bottom: 16px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .mobile-detail-active .stats {
    display: none;
  }

  .stats article {
    padding: 13px;
  }

  .stats strong {
    font-size: 21px;
  }

  .server-header {
    padding: 14px;
    border-bottom: 0;
  }

  .server {
    cursor: pointer;
  }

  .server-title h2 {
    width: 100%;
    font-size: 18px;
  }

  .actions,
  .server-metrics {
    justify-content: flex-start;
    text-align: left;
  }

  .server-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .server-metrics span {
    min-height: 30px;
    border-radius: 6px;
    padding: 7px 9px;
    background: rgb(24 32 43 / 5%);
  }

  .mobile-open-server {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 12px;
  }

  .servers > .server > .inbounds {
    display: none;
  }

  .mobile-detail-view {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 12px;
  }

  .mobile-detail-enter {
    animation: mobile-slide-in 240ms ease-out both;
  }

  @keyframes mobile-slide-in {
    from {
      opacity: 0;
      transform: translateX(16px);
    }

    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .mobile-detail-head {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 14px;
    border-radius: 8px;
    padding: 13px;
    background:
      linear-gradient(rgb(250 252 253 / 94%), rgb(250 252 253 / 94%)) padding-box,
      linear-gradient(135deg, rgb(255 255 255 / 48%), rgb(23 107 135 / 18%), rgb(255 255 255 / 10%)) border-box;
    border: 1px solid transparent;
    color: var(--text);
    box-shadow: 0 18px 60px rgb(0 0 0 / 18%);
  }

  .mobile-detail-head button {
    justify-self: stretch;
  }

  .mobile-back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 46px;
    border-color: rgb(16 36 42 / 16%);
    border-radius: 8px;
    padding: 0 14px;
    background: #10242a;
    color: #ffffff;
    box-shadow: 0 14px 32px rgb(16 36 42 / 24%);
  }

  .mobile-back-button span {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgb(255 255 255 / 14%);
    font-size: 25px;
    line-height: 18px;
  }

  .mobile-back-button:hover {
    background: var(--accent-strong);
    color: #ffffff;
  }

  .mobile-detail-head h2 {
    margin: 0;
    font-size: 20px;
  }

  .mobile-detail-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
  }

  .mobile-detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-detail-meta span {
    min-height: 34px;
    border-radius: 8px;
    padding: 9px 10px;
    background: rgb(250 252 253 / 92%);
    color: var(--muted);
    font-size: 13px;
    box-shadow: 0 12px 36px rgb(0 0 0 / 12%);
  }

  .mobile-inbounds {
    display: grid;
    gap: 12px;
  }

  .mobile-inbound {
    overflow: hidden;
    border-radius: 8px;
    background:
      linear-gradient(rgb(250 252 253 / 94%), rgb(250 252 253 / 94%)) padding-box,
      linear-gradient(135deg, rgb(255 255 255 / 48%), rgb(23 107 135 / 18%), rgb(255 255 255 / 10%)) border-box;
    border: 1px solid transparent;
    color: var(--text);
    box-shadow: 0 18px 60px rgb(0 0 0 / 18%);
  }

  .mobile-inbound > header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 13px;
    border-bottom: 1px solid rgb(24 32 43 / 10%);
  }

  .mobile-inbound > header strong {
    display: block;
    font-size: 16px;
  }

  .mobile-inbound > header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-client-table {
    display: grid;
  }

  .mobile-client-row {
    display: grid;
    gap: 0;
    border-bottom: 1px solid rgb(24 32 43 / 8%);
  }

  .mobile-client-row:last-child {
    border-bottom: 0;
  }

  .mobile-client-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    border-radius: 0;
    padding: 12px 13px;
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  .mobile-client-main:hover {
    background: rgb(23 107 135 / 8%);
    transform: none;
  }

  .mobile-client-main span {
    min-width: 0;
  }

  .mobile-client-main strong,
  .mobile-client-main small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-client-main small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-client-main b {
    color: var(--accent-strong);
    font-size: 14px;
  }

  .mobile-client-row dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0 13px 13px;
  }

  .mobile-client-row dl div {
    min-width: 0;
    border-radius: 6px;
    padding: 8px;
    background: rgb(24 32 43 / 5%);
  }

  .mobile-client-row dt,
  .mobile-client-row dd {
    margin: 0;
  }

  .mobile-client-row dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
  }

  .mobile-client-row dd {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 700;
  }

  .inbound {
    padding: 13px;
  }

  .table-wrap {
    display: none;
  }

  .client-cards {
    display: none;
    gap: 10px;
  }

  .mobile-empty {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
  }

  .client-card {
    display: grid;
    gap: 12px;
    border: 1px solid rgb(24 32 43 / 9%);
    border-radius: 8px;
    padding: 12px;
    background: rgb(255 255 255 / 52%);
  }

  .client-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .client-card-head strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .client-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .client-card-grid span {
    min-width: 0;
    border-radius: 6px;
    padding: 8px;
    background: rgb(24 32 43 / 5%);
  }

  .client-card-grid small {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
  }

  .client-card-grid b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
  }

  .detail-grid,
  .qr-grid,
  .link-row {
    grid-template-columns: 1fr;
  }

  .dialog {
    width: min(100% - 12px, 980px);
    max-height: calc(100vh - 12px);
  }

  .dialog-head {
    align-items: center;
    flex-direction: row;
    padding: 14px;
  }

  .dialog-head > div {
    min-width: 0;
  }

  .dialog-head h2,
  .dialog-head p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dialog-close-button {
    flex: 0 0 auto;
    min-height: 40px;
    border-radius: 999px;
    padding: 0 14px;
    background: #10242a;
    color: #ffffff;
    box-shadow: 0 12px 30px rgb(16 36 42 / 18%);
  }

  .dialog-close-button:hover {
    background: var(--accent-strong);
    color: #ffffff;
  }

  .dialog-body {
    padding: 14px;
  }

  .detail-section {
    padding: 12px;
  }

  .link-row code {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .link-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .qr-card {
    justify-items: center;
  }

  .qr-card .copy-button {
    width: 100%;
  }

  .mobile-bottom-nav {
    position: sticky;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 8px;
    padding: 8px;
    background: rgb(16 24 40 / 82%);
    box-shadow: 0 18px 50px rgb(0 0 0 / 28%);
    backdrop-filter: blur(18px);
  }

  .mobile-bottom-nav button {
    min-height: 38px;
    border-radius: 6px;
    padding: 0 8px;
    background: rgb(255 255 255 / 10%);
    color: #f8fafc;
    font-size: 12px;
    font-weight: 750;
  }
}

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

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .actions button {
    padding: 0 10px;
  }

  .client-card-grid {
    grid-template-columns: 1fr;
  }
}

/* 2026 admin-inspired dashboard refresh */
:root {
  color-scheme: dark;
  --bg: #090807;
  --surface: rgba(255, 255, 255, 0.045);
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.13);
  --text: #f6f2ea;
  --muted: rgba(246, 242, 234, 0.62);
  --line: rgba(246, 242, 234, 0.16);
  --accent: #f05f3d;
  --accent-strong: #ff784f;
  --danger: #ff6b5f;
  --ok: #76e4a6;
  --warn: #ffc56d;
}

body {
  background:
    radial-gradient(circle at 20% 0%, rgba(240, 95, 61, 0.22), transparent 34rem),
    radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0.11), transparent 28rem),
    linear-gradient(135deg, #050505, #15110f 54%, #080808);
  color: var(--text);
  animation: none;
}

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--text);
  color: #111;
  font-weight: 800;
  box-shadow: none;
}

button:hover {
  background: #ffffff;
  color: #111;
}

button.secondary,
button.secondary:hover {
  border-color: var(--line);
  background: var(--panel-strong);
  color: var(--text);
}

button.secondary[aria-pressed="true"] {
  border-color: rgba(240, 95, 61, 0.55);
  background: rgba(240, 95, 61, 0.16);
  color: #ffd6cc;
}

input {
  border-radius: 14px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.login-view,
.app-loader {
  background:
    radial-gradient(circle at 20% 0%, rgba(240, 95, 61, 0.22), transparent 34rem),
    radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0.11), transparent 28rem),
    linear-gradient(135deg, #050505, #15110f 54%, #080808);
}

.login-view::before,
.login-view::after,
.dashboard::before,
.dashboard::after {
  display: none;
}

.login-box,
.loader-card,
.dialog,
.mobile-detail-head,
.mobile-inbound,
.stats article,
.server {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(24px);
}

.login-box {
  padding: 24px;
  background: rgba(255, 255, 255, 0.09);
}

.login-box::before {
  display: none;
}

.login-mark,
.loader-mark,
.server-mark {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.login-box h1,
.topbar h1 {
  letter-spacing: -0.04em;
}

.login-box input {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.login-box input:focus {
  border-color: rgba(240, 95, 61, 0.55);
  outline: 3px solid rgba(240, 95, 61, 0.14);
  background: rgba(255, 255, 255, 0.11);
  box-shadow: none;
}

.login-box-head span,
.badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.badge.ok {
  background: rgba(118, 228, 166, 0.13);
  color: var(--ok);
}

.badge.off {
  background: rgba(255, 107, 95, 0.13);
  color: var(--danger);
}

.dashboard {
  width: min(1320px, calc(100% - 32px));
  padding: 32px 0 48px;
  color: var(--text);
}

.topbar {
  align-items: center;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px 20px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(24px);
}

.topbar h1 {
  margin-bottom: 6px;
  font-size: clamp(32px, 5vw, 64px);
  line-height: 0.92;
  text-transform: uppercase;
  text-shadow: none;
}

.topbar p,
.meta,
.server-error,
.stats span,
th,
.dialog-head p,
.detail-item span,
.mobile-detail-head p,
.mobile-inbound > header p,
.mobile-client-main small,
.mobile-client-row dt,
.client-card-grid small,
.loader-card span,
.login-box-head p,
label {
  color: var(--muted);
}

.actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats {
  gap: 14px;
  margin-bottom: 18px;
}

.stats article,
.server {
  background: var(--panel);
}

.stats article:hover,
.server:hover {
  transform: translateY(-1px);
  border-color: rgba(240, 95, 61, 0.28);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
}

.stats article {
  padding: 18px;
}

.stats strong {
  font-size: 28px;
  letter-spacing: -0.04em;
}

.servers {
  gap: 16px;
}

.server {
  overflow: hidden;
}

.server-header {
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.server-title {
  gap: 10px;
}

.server-title h2 {
  font-size: 22px;
  letter-spacing: -0.035em;
}

.server-metrics {
  gap: 10px;
  color: var(--muted);
}

.server-metrics span {
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.045);
}

.traffic-mini {
  background: rgba(255, 255, 255, 0.08);
}

.traffic-mini span {
  background: linear-gradient(90deg, var(--accent), #f7b267);
}

.inbound {
  border-bottom-color: var(--line);
  padding: 16px 18px;
}

.inbound-name {
  font-size: 16px;
}

table {
  color: var(--text);
}

th,
td {
  border-top-color: rgba(246, 242, 234, 0.1);
}

.mini-actions button,
.copy-button {
  min-height: 34px;
  border-radius: 999px;
}

.dialog {
  background: rgba(19, 17, 15, 0.94);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(10px);
}

.dialog-head {
  border-bottom-color: var(--line);
}

.detail-section,
.detail-item,
.qr-card,
details,
.link-row code {
  border-color: var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

pre {
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.3);
}

.dialog-close-button,
.mobile-back-button {
  border-color: var(--line);
  background: var(--panel-strong);
  color: var(--text);
}

.dialog-close-button:hover,
.mobile-back-button:hover {
  background: var(--text);
  color: #111;
}

/* Compact mode now materially changes the dashboard layout. */
.compact-mode .dashboard {
  width: min(1480px, calc(100% - 24px));
  padding-top: 20px;
}

.compact-mode .topbar {
  padding: 14px 16px;
}

.compact-mode .topbar h1 {
  font-size: clamp(28px, 4vw, 48px);
}

.compact-mode .stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.compact-mode .stats article {
  padding: 12px;
}

.compact-mode .stats strong {
  font-size: 22px;
}

.compact-mode .servers {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.compact-mode .server {
  min-height: 100%;
}

.compact-mode .server-header {
  grid-template-columns: 1fr;
  border-bottom: 0;
  padding: 14px;
}

.compact-mode .server-title h2 {
  width: 100%;
  font-size: 18px;
}

.compact-mode .server .meta {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.compact-mode .server-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  text-align: left;
}

.compact-mode .server-metrics span {
  min-width: 0;
  padding: 8px 10px;
}

.compact-mode .server > .inbounds {
  display: none;
}

.compact-mode .mobile-open-server {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 10px;
}

.server-focus {
  border-color: rgba(240, 95, 61, 0.72) !important;
  box-shadow: 0 0 0 4px rgba(240, 95, 61, 0.14), 0 28px 90px rgba(0, 0, 0, 0.34) !important;
}

@media (max-width: 800px) {
  .dashboard {
    width: min(100% - 20px, 1320px);
    padding: 18px 0 28px;
  }

  .topbar {
    padding: 16px;
  }

  .topbar h1 {
    font-size: 34px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .actions button:first-child {
    grid-column: 1 / -1;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .server-header {
    padding: 16px;
  }

  .server-metrics span,
  .mobile-detail-meta span,
  .mobile-client-row dl div,
  .client-card-grid span {
    background: rgba(255, 255, 255, 0.045);
  }

  .mobile-detail-head,
  .mobile-inbound,
  .mobile-detail-meta span {
    color: var(--text);
    background: var(--panel);
    border-color: var(--line);
  }

  .mobile-bottom-nav {
    border-radius: 18px;
    background: rgba(19, 17, 15, 0.86);
  }

  .mobile-bottom-nav button {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
  }

  .compact-mode .servers {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .stats,
  .compact-mode .stats {
    grid-template-columns: 1fr 1fr;
  }
}
