:root {
  --bg: #0e1b1f;
  --card: rgba(9, 32, 38, 0.78);
  --card-border: rgba(104, 179, 191, 0.2);
  --text: #e9f5f5;
  --muted: #9bbec2;
  --accent: #00d9a3;
  --accent-alt: #ffb347;
  --danger: #ff6d6d;
  --ok: #6ce5b1;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(73, 196, 204, 0.65) rgba(5, 34, 40, 0.55);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: rgba(5, 34, 40, 0.55);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(82, 219, 205, 0.88), rgba(46, 153, 169, 0.9));
  border-radius: 999px;
  border: 2px solid rgba(5, 34, 40, 0.55);
}

*::-webkit-scrollbar-thumb:hover {
  filter: brightness(1.08);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", "Noto Sans SC", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(2, 138, 176, 0.2), transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(250, 145, 64, 0.18), transparent 35%),
    linear-gradient(165deg, #071215 0%, #0a1f24 45%, #0c242a 100%);
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(30px);
  z-index: 0;
  animation: float 12s ease-in-out infinite;
}

.orb-a {
  width: 320px;
  height: 320px;
  background: rgba(0, 217, 163, 0.18);
  top: -80px;
  right: -60px;
}

.orb-b {
  width: 280px;
  height: 280px;
  background: rgba(255, 179, 71, 0.2);
  bottom: -80px;
  left: -70px;
  animation-delay: -4s;
}

.layout {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100% - 32px));
  margin: 24px auto 40px;
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 22px;
}

.panel h1,
.panel h2 {
  margin: 2px 0 6px;
  letter-spacing: 0.3px;
}

.kicker {
  margin: 0;
  color: var(--accent-alt);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1.4px;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-content {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 18px;
}

#qr-image {
  width: 220px;
  height: 220px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  object-fit: contain;
}

.auth-meta {
  display: grid;
  gap: 8px;
}

.auth-meta a {
  color: #82f7d5;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

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

.filters {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select {
  border: 1px solid rgba(157, 209, 214, 0.32);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 180px;
}

.btn {
  border: 1px solid transparent;
  background: linear-gradient(135deg, #00d9a3, #1ec6d6);
  color: #03272a;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.06);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(148, 223, 226, 0.36);
  color: var(--text);
}

.btn-copy {
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 12px;
  min-width: 48px;
}

.ip-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.ip-value {
  color: #d3ecee;
}

.table-wrap {
  margin-top: 14px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(143, 203, 209, 0.2);
  vertical-align: top;
}

th {
  color: #bee8ea;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

td {
  color: #e5f5f5;
  font-size: 14px;
}

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-online {
  background: rgba(108, 229, 177, 0.15);
  color: var(--ok);
}

.status-offline {
  background: rgba(255, 109, 109, 0.15);
  color: var(--danger);
}

.terminal-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 13, 16, 0.8);
  display: grid;
  place-items: center;
  padding: clamp(8px, 1.6vw, 16px);
  z-index: 20;
}

.terminal-card {
  width: min(1100px, 100%);
  height: min(820px, calc(100dvh - 24px));
  background: #061519;
  border: 1px solid rgba(122, 208, 214, 0.28);
  border-radius: 14px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.terminal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(122, 208, 214, 0.22);
}

.ssh-form {
  display: flex;
  gap: 10px;
  align-items: end;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(122, 208, 214, 0.22);
  flex-wrap: wrap;
}

#ssh-msg {
  color: var(--muted);
  font-size: 12px;
}

#terminal {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 8px;
  overflow: hidden;
}

#terminal .xterm,
#terminal .xterm-viewport {
  height: 100% !important;
}

#terminal .xterm-viewport {
  overflow-y: auto !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(77, 205, 213, 0.72) rgba(7, 25, 31, 0.85);
}

.hidden {
  display: none;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(16px);
  }
}

@media (max-width: 760px) {
  .layout {
    width: calc(100% - 20px);
    margin-top: 10px;
  }

  .panel {
    padding: 16px;
    border-radius: 14px;
  }

  .auth-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  input,
  select {
    min-width: 0;
    width: 100%;
  }

  .terminal-card {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }

  .terminal-head {
    padding: 10px;
  }

  .ssh-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
  }

  .ssh-form .btn {
    width: 100%;
  }

  #terminal {
    padding: 6px;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 13px;
  }
}
