﻿:root {
  --bg: #07101d;
  --bg-soft: #0b1728;
  --panel: rgba(11, 23, 40, .82);
  --panel-solid: #0c1a2d;
  --panel-2: rgba(14, 31, 53, .92);
  --line: rgba(162, 196, 255, .13);
  --line-strong: rgba(162, 196, 255, .24);
  --text: #f6f9ff;
  --muted: #8da5c4;
  --muted-2: #607895;
  --blue: #5da8ff;
  --blue-deep: #1e66d0;
  --cyan: #7ee7ff;
  --green: #45d79a;
  --amber: #f6c85f;
  --red: #ff647c;
  --gray: #93a2b8;
  --shadow: 0 22px 70px rgba(0,0,0,.35);
  --radius-xl: 30px;
  --radius: 22px;
  --radius-md: 16px;
  --font-main: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-main);
  color: var(--text);
  background:
    radial-gradient(circle at 18% 0%, rgba(93, 168, 255, .16), transparent 34%),
    radial-gradient(circle at 80% 10%, rgba(126, 231, 255, .09), transparent 30%),
    linear-gradient(135deg, #030915 0%, #07101d 44%, #09192c 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 82%);
}

button, input, textarea, select {
  font: inherit;
  font-family: var(--font-main);
}

button {
  border: 0;
}

.shell {
  display: grid;
  grid-template-columns: 288px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 17, 31, .84), rgba(5, 12, 24, .72));
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 7px 6px 18px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  position: relative;
  background: linear-gradient(145deg, #112947, #07162a);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px rgba(255,255,255,.09), 0 18px 40px rgba(0,0,0,.25);
}

.brand-mark span {
  position: absolute;
  width: 22px;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.brand-mark span:nth-child(1) { transform: translateY(-9px); opacity: .72; }
.brand-mark span:nth-child(2) { width: 28px; }
.brand-mark span:nth-child(3) { transform: translateY(9px); opacity: .45; }

.brand b {
  display: block;
  font-size: 18px;
  letter-spacing: -.3px;
}

.brand small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 13px;
  border-radius: 16px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: left;
  transition: .18s ease;
}

.nav-item:hover, .nav-item.active {
  color: var(--text);
  background: rgba(255,255,255,.055);
  border-color: var(--line);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 16px currentColor;
}

.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.dot.gray { background: var(--gray); }

.side-card {
  margin-top: auto;
  padding: 16px;
  border-radius: 20px;
  background: rgba(93, 168, 255, .07);
  border: 1px solid rgba(93, 168, 255, .16);
}

.side-card-title {
  font-weight: 800;
  margin-bottom: 8px;
}

.side-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}

code {
  color: #cfe6ff;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px 6px;
}

.main {
  min-width: 0;
  padding: 32px clamp(18px, 3vw, 38px) 42px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 82% 0%, rgba(126, 231, 255, .12), transparent 34%),
    linear-gradient(135deg, rgba(16, 38, 65, .72), rgba(9, 21, 38, .7));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  font-weight: 900;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(32px, 5vw, 62px);
  line-height: .94;
  letter-spacing: -3px;
}

.hero-text {
  max-width: 720px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  margin-bottom: 0;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary, .ghost {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 15px;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  transition: .18s ease;
}

.primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  box-shadow: 0 16px 36px rgba(40, 123, 255, .22);
}

.ghost {
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
}

.primary:hover, .ghost:hover, .icon-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.full {
  width: 100%;
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 14px;
  margin: 18px 0;
}

.overview-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px;
  background: rgba(255,255,255,.045);
}

.overview-card::after {
  content: "";
  position: absolute;
  right: -42px;
  top: -42px;
  width: 110px;
  height: 110px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(93,168,255,.16), transparent 68%);
}

.overview-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.overview-card strong {
  display: block;
  font-size: 34px;
  margin: 9px 0 3px;
  letter-spacing: -1.2px;
}

.overview-card small {
  color: var(--muted-2);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 200px 220px;
  gap: 12px;
  margin-bottom: 18px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255,255,255,.045);
}

.search svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex: none;
}

input, textarea, select {
  width: 100%;
  color: var(--text);
  background: rgba(4, 11, 22, .58);
  border: 1px solid var(--line);
  outline: 0;
  border-radius: 15px;
  min-height: 48px;
  padding: 0 14px;
}

.search input {
  border: 0;
  background: transparent;
  min-height: auto;
  padding: 0;
}

textarea {
  min-height: 96px;
  resize: vertical;
  padding: 14px;
  line-height: 1.5;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(126, 231, 255, .42);
  box-shadow: 0 0 0 4px rgba(93, 168, 255, .12);
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(326px, 1fr));
  gap: 16px;
}

.server-card {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(17, 38, 64, .88), rgba(8, 19, 35, .92));
  box-shadow: 0 18px 48px rgba(0,0,0,.24);
  padding: 18px;
  transition: .2s ease;
}

.server-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.server-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, rgba(93,168,255,.8), rgba(126,231,255,.42), transparent);
}

.server-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.server-name {
  min-width: 0;
}

.server-name h3 {
  margin: 0 0 6px;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-family: var(--font-main);
}

.server-name p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font-mono);
}

.status {
  align-self: flex-start;
  border-radius: 999px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.055);
  font-size: 12px;
  font-weight: 900;
}

.status.online { color: #bfffe2; border-color: rgba(69,215,154,.25); background: rgba(69,215,154,.1); }
.status.warning { color: #ffe6a7; border-color: rgba(246,200,95,.28); background: rgba(246,200,95,.1); }
.status.offline, .status.silent { color: #ffc9d1; border-color: rgba(255,100,124,.26); background: rgba(255,100,124,.1); }

.rings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  margin-bottom: 16px;
}

.ring {
  min-width: 0;
  border-radius: 18px;
  padding: 12px 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  text-align: center;
}

.ring .circle {
  --value: 0;
  width: 68px;
  height: 68px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, #0e2036 0 55%, transparent 57%),
    conic-gradient(var(--ring-color, var(--blue)) calc(var(--value) * 1%), rgba(255,255,255,.08) 0);
}

.ring strong {
  font-size: 16px;
}

.ring span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.metrics {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.metric-row {
  display: grid;
  grid-template-columns: 44px 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}

.metric-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.metric-row strong {
  text-align: right;
  font-size: 13px;
}

.metric-row i {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}

.metric-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.metric-row.warn b {
  background: linear-gradient(90deg, var(--amber), #f59e0b);
}

.metric-row.bad b {
  background: linear-gradient(90deg, var(--red), #ef4444);
}

.card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.meta-item {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  min-width: 0;
}

.card-meta > div {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  min-width: 0;
}

.meta-item span,
.card-meta > div span {
  display: block;
  color: var(--muted-2);
  font-size: 11px;
  margin-bottom: 5px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.meta-item strong,
.card-meta > div strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.billing.good strong { color: #caffdf; }
.billing.warning strong { color: #ffe4a2; }
.billing.danger strong { color: #ffc2cb; }

.card-footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 15px;
}

.card-footer button {
  min-width: 0;
  min-height: 40px;
  border-radius: 14px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.card-footer .renew-wide {
  grid-column: 1 / -1;
  min-height: 42px;
}

.empty {
  grid-column: 1 / -1;
  padding: 52px 22px;
  border-radius: var(--radius-xl);
  border: 1px dashed var(--line-strong);
  text-align: center;
  color: var(--muted);
  background: rgba(255,255,255,.035);
}

.drawer-backdrop, .modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(1, 6, 14, .68);
  backdrop-filter: blur(10px);
  display: none;
  z-index: 20;
}

.drawer {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: min(520px, calc(100vw - 36px));
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: rgba(10, 22, 39, .96);
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 28px));
  transition: .25s ease;
  z-index: 21;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-backdrop.show, .modal-backdrop.show {
  display: block;
}

.drawer-head, .modal-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2, .modal-head h2 {
  margin: 0 0 6px;
  letter-spacing: -.7px;
}

.drawer-head span, .modal-head p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0;
}

.icon-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.drawer-content {
  overflow: auto;
  padding: 18px 22px 22px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.04);
  min-width: 0;
}

.detail-item.full {
  grid-column: 1 / -1;
}

.detail-item span {
  display: block;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 7px;
}

.detail-item strong, .detail-item pre {
  color: var(--text);
  word-break: break-word;
}

.detail-item pre {
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.55;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.drawer-actions button {
  flex: 1;
}

.danger {
  color: #fecaca;
  border-color: rgba(255,100,124,.26);
}

.agent-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  background: #06101e;
  border: 1px solid var(--line);
}

.agent-box pre {
  margin: 0;
  overflow: auto;
  color: #d7eaff;
  line-height: 1.5;
  font-size: 12px;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(780px, calc(100vw - 34px));
  max-height: calc(100vh - 34px);
  overflow: auto;
  transform: translate(-50%, -50%) scale(.96);
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: rgba(10, 22, 39, .98);
  box-shadow: var(--shadow);
  z-index: 25;
  transition: .18s ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.modal.small {
  width: min(500px, calc(100vw - 34px));
}

.form {
  padding: 22px;
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label span, .settings-field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

.install-tabs {
  display: flex;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.035);
}

.install-tab {
  flex: 1;
  min-height: 38px;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.install-tab.active {
  color: var(--text);
  background: rgba(93, 168, 255, .18);
}

.install-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
}

.install-panel p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

.install-panel pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: 13px;
  border-radius: 14px;
  color: #d7eaff;
  background: #050d19;
  border: 1px solid var(--line);
  line-height: 1.55;
  font-size: 12px;
}

.drawer-install {
  margin-top: 16px;
}

.settings-field {
  display: block;
  padding: 22px 22px 12px;
}

#saveAdminKey {
  width: calc(100% - 44px);
  margin: 0 22px 22px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  border: 1px solid var(--line-strong);
  background: rgba(9, 22, 40, .96);
  color: var(--text);
  border-radius: 16px;
  padding: 13px 15px;
  display: none;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 16px;
  }

  .brand {
    padding: 0;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
  }

  .side-card {
    display: none;
  }

  .logout-link {
    width: auto;
    margin-left: auto;
  }

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

  .toolbar {
    grid-template-columns: 1fr 180px 200px;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 16px 12px 30px;
  }

  .hero {
    flex-direction: column;
    padding: 22px;
  }

  h1 {
    letter-spacing: -2px;
  }

  .hero-actions, .form-actions {
    width: 100%;
  }

  .hero-actions button, .form-actions button {
    flex: 1;
  }

  .overview, .toolbar, .form-grid, .detail-grid {
    grid-template-columns: 1fr;
  }

  .server-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    gap: 12px;
  }

  .nav {
    width: 100%;
  }

  .nav-item {
    width: auto;
    flex: 1;
    min-width: max-content;
  }

  .logout-link {
    margin-left: 0;
    width: 100%;
  }
}

.logout-link {
  display: inline-flex;
  justify-content: center;
  text-decoration: none;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(54, 130, 246, 0.24), transparent 34%),
    radial-gradient(circle at 84% 80%, rgba(34, 211, 238, 0.12), transparent 30%),
    linear-gradient(135deg, #06111f 0%, #0b1b31 48%, #08111f 100%);
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, #000, transparent 90%);
}

.login-shell {
  width: min(420px, 100%);
  position: relative;
  z-index: 1;
}

.login-card {
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(23, 44, 76, 0.94), rgba(9, 20, 38, 0.96)),
    rgba(10, 26, 48, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-brand {
  margin-bottom: 24px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 34px;
  letter-spacing: -1px;
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

.login-form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--text);
  background: rgba(4, 12, 24, 0.72);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input:focus {
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.13);
}

.login-error {
  display: none;
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 12px;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
}

.login-error.show {
  display: block;
}

.login-switch {
  margin: 18px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.login-switch a {
  color: var(--cyan);
  font-weight: 800;
  text-decoration: none;
}

.login-switch a:hover {
  text-decoration: underline;
}

