:root {
  color-scheme: dark;
  --bg: #050816;
  --bg-2: #08111f;
  --panel: rgba(11, 18, 34, 0.78);
  --panel-strong: rgba(13, 22, 42, 0.94);
  --glass: rgba(16, 27, 51, 0.62);
  --text: #e6f3ff;
  --muted: #89a0bb;
  --soft: #b8c7dc;
  --line: rgba(139, 166, 205, 0.18);
  --line-strong: rgba(64, 224, 208, 0.34);
  --accent: #24f0d2;
  --accent-2: #61a8ff;
  --accent-3: #b878ff;
  --danger: #ff5f7a;
  --warning: #ffc857;
  --ok: #31e981;
  --unknown: #a6b1c2;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.44);
  --glow: 0 0 30px rgba(36, 240, 210, 0.22);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(36, 240, 210, 0.18), transparent 22rem),
    radial-gradient(circle at 82% 18%, rgba(97, 168, 255, 0.18), transparent 26rem),
    radial-gradient(circle at 68% 92%, rgba(184, 120, 255, 0.13), transparent 22rem),
    linear-gradient(135deg, #050816 0%, #07111f 44%, #0b1324 100%);
  color: var(--text);
  display: grid;
  grid-template-columns: 260px 1fr;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  background-image:
    linear-gradient(rgba(36, 240, 210, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 240, 210, 0.055) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.86), transparent 92%);
}

body::after {
  background: linear-gradient(180deg, transparent 0%, rgba(36, 240, 210, 0.035) 50%, transparent 100%);
  background-size: 100% 8px;
  mix-blend-mode: screen;
  opacity: 0.42;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  position: relative;
  border: 1px solid rgba(36, 240, 210, 0.46);
  background:
    linear-gradient(135deg, rgba(36, 240, 210, 0.95), rgba(97, 168, 255, 0.86)),
    #24f0d2;
  color: #03131d;
  border-radius: var(--radius);
  min-height: 38px;
  padding: 0 15px;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 14px 36px rgba(36, 240, 210, 0.19);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    filter 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 48px rgba(36, 240, 210, 0.28);
  filter: saturate(1.1);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(9, 16, 31, 0.96), rgba(5, 9, 18, 0.98)),
    var(--bg);
  border-right: 1px solid rgba(36, 240, 210, 0.18);
  color: var(--text);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 34px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 18px 0 70px rgba(0, 0, 0, 0.22);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(36, 240, 210, 0.12);
  border-radius: 18px;
  pointer-events: none;
}

.sidebar h1,
.topbar h2,
.panel h3,
.login-visual h1,
.login-card h2 {
  margin: 0;
  letter-spacing: 0;
}

.sidebar h1 {
  font-size: 28px;
  line-height: 1;
  text-shadow: 0 0 24px rgba(36, 240, 210, 0.42);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: #d9e8f8;
  text-decoration: none;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 11px;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    transform 180ms ease,
    color 180ms ease;
}

nav a:hover,
nav a:first-child {
  background: linear-gradient(90deg, rgba(36, 240, 210, 0.14), rgba(97, 168, 255, 0.08));
  border-color: rgba(36, 240, 210, 0.24);
  color: #ffffff;
  transform: translateX(2px);
}

.nav-icon {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(36, 240, 210, 0.34);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(36, 240, 210, 0.08);
  box-shadow: inset 0 0 18px rgba(36, 240, 210, 0.1);
}

.logout-button {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(139, 166, 205, 0.18);
  box-shadow: none;
  color: #dcecff;
}

main {
  min-width: 0;
  padding: 30px;
  display: grid;
  gap: 22px;
}

.topbar {
  min-height: 180px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px;
  border: 1px solid rgba(36, 240, 210, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(12, 21, 40, 0.9), rgba(11, 23, 42, 0.58)),
    radial-gradient(circle at 80% 0%, rgba(36, 240, 210, 0.18), transparent 18rem);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: -1px;
  background:
    linear-gradient(110deg, transparent 0%, rgba(36, 240, 210, 0.12) 28%, transparent 44%),
    linear-gradient(90deg, rgba(36, 240, 210, 0.08), transparent 36%);
  transform: translateX(-38%);
  animation: sweep 6s ease-in-out infinite;
  pointer-events: none;
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.topbar h2 {
  max-width: 760px;
  font-size: clamp(28px, 3.5vw, 48px);
  line-height: 1.05;
}

.topbar .icon-button {
  background: rgba(36, 240, 210, 0.1);
  color: var(--accent);
  border-color: rgba(36, 240, 210, 0.38);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metrics article,
.panel,
dialog,
.login-card {
  background:
    linear-gradient(180deg, rgba(16, 28, 52, 0.82), rgba(8, 14, 28, 0.9)),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.metrics article {
  min-height: 126px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  isolation: isolate;
}

.metrics article::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 88% 18%, rgba(36, 240, 210, 0.2), transparent 6rem),
    linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  opacity: 0.8;
  z-index: -1;
}

.metrics article::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(36, 240, 210, 0.2);
  background:
    linear-gradient(135deg, rgba(36, 240, 210, 0.18), rgba(97, 168, 255, 0.08));
  box-shadow: inset 0 0 18px rgba(36, 240, 210, 0.12);
}

.metrics article:nth-child(2)::before {
  background: radial-gradient(circle at 88% 18%, rgba(49, 233, 129, 0.22), transparent 6rem);
}

.metrics article:nth-child(3)::before {
  background: radial-gradient(circle at 88% 18%, rgba(255, 200, 87, 0.22), transparent 6rem);
}

.metrics article:nth-child(4)::before {
  background: radial-gradient(circle at 88% 18%, rgba(255, 95, 122, 0.2), transparent 6rem);
}

.metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
  text-shadow: 0 0 28px rgba(36, 240, 210, 0.28);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border-radius: 16px;
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(36, 240, 210, 0.12), transparent 36%, rgba(97, 168, 255, 0.08));
  pointer-events: none;
  opacity: 0.72;
}

.panel > * {
  position: relative;
}

.panel-header,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  font-size: 18px;
}

.toolbar {
  justify-content: flex-start;
  background: rgba(255, 255, 255, 0.025);
}

.toolbar input {
  flex: 1;
  min-width: 180px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(139, 166, 205, 0.2);
  border-radius: var(--radius);
  padding: 10px 11px;
  background: rgba(3, 10, 24, 0.58);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(137, 160, 187, 0.78);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(36, 240, 210, 0.72);
  box-shadow: 0 0 0 3px rgba(36, 240, 210, 0.12), 0 0 24px rgba(36, 240, 210, 0.08);
  outline: none;
  background: rgba(6, 14, 30, 0.82);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
  table-layout: fixed;
}

.col-name {
  width: 21%;
}

.col-type {
  width: 11%;
}

.col-status {
  width: 10%;
}

.col-host {
  width: 18%;
}

.col-secret {
  width: 23%;
}

.col-actions {
  width: 17%;
}

th,
td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(139, 166, 205, 0.12);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr {
  transition:
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

tbody tr:hover {
  background: rgba(36, 240, 210, 0.06);
  box-shadow: inset 3px 0 0 rgba(36, 240, 210, 0.58);
}

th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3) {
  white-space: nowrap;
}

th:nth-child(5),
td:nth-child(4),
td:nth-child(5) {
  overflow: hidden;
}

td:nth-child(4),
td:nth-child(6) {
  white-space: nowrap;
}

td:nth-child(4),
td:nth-child(5) .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td:nth-child(5) .muted {
  display: block;
}

.resource-name {
  font-weight: 900;
  color: #f5fbff;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid rgba(139, 166, 205, 0.18);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  background: rgba(139, 166, 205, 0.1);
  color: var(--unknown);
}

.resource-cards {
  display: none;
}

.resource-card {
  display: grid;
  gap: 14px;
  margin: 12px;
  padding: 16px;
  border: 1px solid rgba(139, 166, 205, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
}

.resource-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.resource-card dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

.resource-card dl > div {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 12px;
}

.resource-card dt {
  color: var(--muted);
  font-size: 12px;
}

.resource-card dd {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state {
  color: var(--muted);
  padding: 28px 16px;
  text-align: center;
}

.status.healthy {
  color: var(--ok);
  background: rgba(49, 233, 129, 0.11);
  border-color: rgba(49, 233, 129, 0.28);
  box-shadow: 0 0 20px rgba(49, 233, 129, 0.08);
}

.status.warning {
  color: var(--warning);
  background: rgba(255, 200, 87, 0.11);
  border-color: rgba(255, 200, 87, 0.28);
}

.status.down {
  color: var(--danger);
  background: rgba(255, 95, 122, 0.11);
  border-color: rgba(255, 95, 122, 0.28);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.row-actions button {
  min-width: 48px;
  padding: 0 10px;
}

.row-actions button,
.dialog-actions button:first-child {
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  border-color: rgba(139, 166, 205, 0.2);
  box-shadow: none;
}

.row-actions button:hover,
.dialog-actions button:first-child:hover {
  color: #ffffff;
  border-color: rgba(36, 240, 210, 0.4);
}

.issue-list {
  display: grid;
  gap: 0;
}

.issue-item {
  padding: 15px 16px;
  border-bottom: 1px solid rgba(139, 166, 205, 0.12);
  transition: background 160ms ease;
}

.issue-item:hover {
  background: rgba(97, 168, 255, 0.055);
}

.issue-item a {
  color: var(--text);
  font-weight: 850;
  text-decoration: none;
}

.issue-item a:hover {
  color: var(--accent);
}

.labels {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

dialog {
  width: min(660px, calc(100vw - 32px));
  border-radius: 16px;
  padding: 0;
  color: var(--text);
}

dialog::backdrop {
  background: rgba(1, 5, 14, 0.76);
  backdrop-filter: blur(8px);
}

form {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.dialog-header,
.dialog-actions,
.form-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-grid > label {
  flex: 1;
}

label {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 13px;
  font-weight: 800;
}

.is-loading .metrics article,
.is-loading .panel {
  animation: pulse 1.2s ease-in-out infinite alternate;
}

.login-page {
  display: block;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 15%, rgba(36, 240, 210, 0.23), transparent 25rem),
    radial-gradient(circle at 86% 78%, rgba(184, 120, 255, 0.17), transparent 25rem),
    linear-gradient(135deg, #030712 0%, #07111f 52%, #061826 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  align-items: center;
  gap: 38px;
  padding: 54px;
}

.login-visual {
  color: #ffffff;
  max-width: 680px;
  position: relative;
}

.login-visual::after {
  content: "";
  display: block;
  width: min(460px, 70vw);
  height: 140px;
  margin-top: 34px;
  border: 1px solid rgba(36, 240, 210, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(36, 240, 210, 0.16), transparent 32%),
    repeating-linear-gradient(90deg, rgba(36, 240, 210, 0.16) 0 2px, transparent 2px 34px),
    rgba(255, 255, 255, 0.03);
  box-shadow: var(--glow);
  opacity: 0.9;
}

.login-visual h1 {
  margin: 0;
  font-size: clamp(48px, 8vw, 92px);
  line-height: 0.92;
  text-shadow: 0 0 40px rgba(36, 240, 210, 0.36);
}

.login-visual p:not(.eyebrow) {
  max-width: 520px;
  color: var(--soft);
  font-size: 18px;
}

.login-card {
  border-radius: 18px;
  padding: 24px;
}

.login-card button {
  min-height: 44px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

@keyframes sweep {
  0%,
  42% {
    transform: translateX(-48%);
  }
  62%,
  100% {
    transform: translateX(48%);
  }
}

@keyframes pulse {
  from {
    opacity: 0.72;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1080px) {
  body {
    grid-template-columns: 230px 1fr;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    height: auto;
    position: static;
  }

  .sidebar::before {
    display: none;
  }

  nav {
    display: flex;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-shell {
    grid-template-columns: 1fr;
    padding: 32px;
  }
}

@media (max-width: 640px) {
  body {
    padding-bottom: 76px;
  }

  main,
  .sidebar {
    padding: 16px;
  }

  main {
    gap: 16px;
  }

  .topbar {
    min-height: 150px;
    padding: 18px;
  }

  .topbar h2 {
    font-size: 28px;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    padding: 10px 12px;
    border-right: 0;
    border-top: 1px solid rgba(36, 240, 210, 0.2);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .sidebar > div,
  .logout-button {
    display: none;
  }

  nav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  nav a {
    justify-content: center;
    padding: 8px;
    font-size: 13px;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics article {
    min-height: 108px;
  }

  .table-wrap {
    display: none;
  }

  .resource-cards {
    display: grid;
  }

  .topbar,
  .panel-header,
  .toolbar,
  .dialog-header,
  .dialog-actions,
  .form-grid {
    align-items: stretch;
    flex-direction: column;
  }

  dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .login-shell {
    padding: 22px;
  }

  .login-visual::after {
    height: 82px;
  }
}
