:root {
  --bg: #05080f;
  --panel: rgba(13, 21, 35, 0.72);
  --panel-strong: #0b1220;
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.26);
  --text: #e8eef8;
  --muted: #8d9cb5;
  --faint: #5d6c85;
  --green: #34d399;
  --sky: #38bdf8;
  --violet: #a78bfa;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans SC", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

h1,
h2,
h3,
p,
dl,
dd,
dt {
  margin: 0;
}

svg {
  display: block;
}

::selection {
  background: rgba(52, 211, 153, 0.28);
}

:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.75);
  outline-offset: 2px;
}

/* ---------- Ambient background ---------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient::before {
  content: "";
  position: absolute;
  inset: -25%;
  background:
    radial-gradient(620px 430px at 12% -4%, rgba(56, 189, 248, 0.14), transparent 62%),
    radial-gradient(760px 520px at 88% 4%, rgba(52, 211, 153, 0.11), transparent 62%),
    radial-gradient(900px 620px at 48% 112%, rgba(167, 139, 250, 0.09), transparent 62%);
}

.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 12%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 12%, transparent 78%);
}

/* ---------- Shared bits ---------- */

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background:
    linear-gradient(145deg, rgba(52, 211, 153, 0.24), rgba(56, 189, 248, 0.1)),
    rgba(9, 16, 28, 0.8);
  color: #6ee7b7;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 10px 30px rgba(52, 211, 153, 0.12);
}

.brand-mark.large {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  font-size: 15px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.07);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.tag.green {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.08);
}

.tag.red {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}

.tag.amber {
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
}

.muted-sm {
  color: var(--faint);
  font-size: 11.5px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Splash & login ---------- */

.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  color: var(--faint);
  font-size: 12.5px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(148, 163, 184, 0.18);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.login-view {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 20px;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 405px;
  padding: 38px 34px 30px;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(20, 31, 50, 0.9), rgba(9, 15, 26, 0.94));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 40px 100px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: rise 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(110, 231, 183, 0.5), transparent);
}

.login-card::after {
  content: "";
  position: absolute;
  top: -130px;
  left: 50%;
  width: 320px;
  height: 240px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(52, 211, 153, 0.13), transparent);
  pointer-events: none;
}

.login-head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 26px;
}

.login-head .brand-mark {
  margin-bottom: 8px;
}

.kicker {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-head h1 {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-sub {
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(5, 9, 16, 0.75);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field input::placeholder {
  color: #46546b;
}

.field input:focus {
  outline: none;
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(5, 9, 16, 0.95);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12);
}

.form-error {
  min-height: 18px;
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.5;
}

.login-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 11px;
  line-height: 1.55;
}

.login-foot svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: rgba(52, 211, 153, 0.65);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 650;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn.block {
  width: 100%;
}

.btn.primary {
  background: linear-gradient(180deg, #5eead4, #34d399);
  color: #03231b;
  box-shadow: 0 10px 24px rgba(52, 211, 153, 0.18);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #7df3e0, #3ee0a8);
}

.btn.primary:disabled {
  opacity: 0.6;
  box-shadow: none;
}

.btn.danger {
  background: linear-gradient(180deg, #f87171, #ef4444);
  color: #2a0505;
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.2);
}

.btn.danger:hover {
  background: linear-gradient(180deg, #fca5a5, #f87171);
}

.btn.ghost {
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.05);
  color: var(--muted);
}

.btn.ghost:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.11);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(148, 163, 184, 0.05);
  color: var(--muted);
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.11);
}

.icon-btn.spinning svg {
  animation: spin 0.9s linear infinite;
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.mini-btn svg {
  width: 12px;
  height: 12px;
}

.mini-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.12);
}

.mini-btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--faint);
}

.mini-btn.ghost:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.09);
}

/* ---------- App shell ---------- */

.app-view {
  position: relative;
  z-index: 1;
  animation: fade 0.3s ease;
}

.shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 26px 46px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-text {
  min-width: 0;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-title h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-text p {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.pill .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.pill.online {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.32);
  background: rgba(52, 211, 153, 0.08);
}

.pill.online .pulse {
  animation: pulse 2s ease-out infinite;
}

.pill.offline {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.07);
}

.pill.disabled {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.07);
}

.pill.unknown {
  color: var(--faint);
}

.pill.unknown .pulse {
  animation: pulse 1.6s ease-out infinite;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 0 2px;
  color: var(--faint);
  font-size: 11.5px;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.09);
}

.banner {
  margin-top: 16px;
  padding: 12px 15px;
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-left: 3px solid var(--amber);
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.07);
  color: #fde68a;
  font-size: 12.5px;
  line-height: 1.6;
}

.banner.error {
  border-color: rgba(248, 113, 113, 0.3);
  border-left-color: var(--red);
  background: rgba(248, 113, 113, 0.07);
  color: #fecaca;
}

/* ---------- Grid & cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-7 {
  grid-column: span 7;
}

.span-12 {
  grid-column: span 12;
}

.card {
  position: relative;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 28, 45, 0.74), rgba(10, 17, 29, 0.78));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 18px 44px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-head h2 {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

/* ---------- Cluster overview ---------- */

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

.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 14px 17px 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(18, 28, 45, 0.62), rgba(10, 17, 29, 0.72));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--stat-color, var(--faint));
  opacity: 0.7;
}

.stat-online {
  --stat-color: var(--green);
}

.stat-offline {
  --stat-color: var(--red);
}

.stat-error {
  --stat-color: var(--amber);
}

.stat-label {
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.stat strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.stat-online strong {
  color: #6ee7b7;
}

.stat-offline strong {
  color: #fca5a5;
}

.stat-error strong {
  color: #fcd34d;
}

.stat-note {
  color: #4e5c73;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Fleet list ---------- */

.fleet {
  margin-top: 24px;
}

.fleet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.fleet-head h2 {
  font-size: 14px;
  font-weight: 650;
}

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

.server-tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(18, 28, 45, 0.74), rgba(10, 17, 29, 0.78));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 18px 44px rgba(0, 0, 0, 0.18);
}

.server-tile[data-status="offline"],
.server-tile[data-status="disabled"] {
  border-color: rgba(248, 113, 113, 0.22);
}

.tile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tile-ident {
  display: flex;
  gap: 9px;
  min-width: 0;
}

.tile-name-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}

.tile-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.tile-loc {
  padding: 2px 7px;
  font-size: 9.5px;
}

.tile-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--faint);
}

.tile-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.tile-dot.offline,
.tile-dot.disabled {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.09);
}

.tile-host {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tile-hostname {
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.tile-ip {
  color: var(--sky);
  font-family: var(--mono);
  font-size: 11px;
}

.tile-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.tile-bar {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 9px;
}

.tile-bar-label {
  color: var(--faint);
  font-size: 11px;
}

.tile-bar .bar {
  height: 5px;
}

.tile-bar-pct {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
}

.tile-bar .bar > span {
  background: var(--tile-res, var(--sky));
  box-shadow: 0 0 10px var(--tile-glow, rgba(56, 189, 248, 0.16));
}

.tile-bar[data-resource="hdd"] {
  --tile-res: var(--violet);
  --tile-glow: rgba(167, 139, 250, 0.16);
}

.tile-bar[data-resource="mem"] {
  --tile-res: var(--amber);
  --tile-glow: rgba(251, 191, 36, 0.16);
}

.tile-bar .bar > span.warn {
  background: var(--amber);
}

.tile-bar .bar > span.crit {
  background: var(--red);
}

.tile-alert {
  color: #fca5a5;
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.tile-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 2px;
}

.tile-actions .mini-btn {
  padding: 5px 10px;
}

.tile-spacer {
  flex: 1;
}

.tile-open {
  border-color: var(--border-strong);
  color: var(--text);
}

.grid-state {
  padding: 26px 16px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--faint);
  font-size: 12.5px;
  text-align: center;
}

/* ---------- Server card ---------- */

.server-card {
  display: flex;
  flex-direction: column;
}

.host-block {
  padding: 2px 0 16px;
}

.hostname {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ip-block {
  padding: 14px 0 4px;
  border-top: 1px solid var(--border);
}

.ip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ip-row code {
  color: var(--sky);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.01em;
}

.kv {
  margin-top: auto;
  padding-top: 14px;
}

.kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.kv dt {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 11.5px;
}

.kv dd {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  overflow-wrap: anywhere;
}

/* ---------- Power card ---------- */

.power-card {
  display: flex;
  flex-direction: column;
}

.power-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  margin-top: 2px;
}

.power-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.035);
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.power-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.09);
  color: var(--muted);
  transition: color 0.16s ease, background 0.16s ease;
}

.power-icon svg {
  width: 18px;
  height: 18px;
}

.power-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.power-copy strong {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
}

.power-copy small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.power-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.08);
}

.power-btn[data-action="boot"]:hover:not(:disabled) .power-icon {
  color: var(--green);
  background: rgba(52, 211, 153, 0.13);
}

.power-btn[data-action="boot"]:hover:not(:disabled) {
  border-color: rgba(52, 211, 153, 0.32);
}

.power-btn[data-action="reboot"]:hover:not(:disabled) .power-icon {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.13);
}

.power-btn[data-action="reboot"]:hover:not(:disabled) {
  border-color: rgba(251, 191, 36, 0.32);
}

.power-btn[data-action="shutdown"]:hover:not(:disabled) .power-icon {
  color: var(--red);
  background: rgba(248, 113, 113, 0.13);
}

.power-btn[data-action="shutdown"]:hover:not(:disabled) {
  border-color: rgba(248, 113, 113, 0.32);
}

.power-btn:disabled {
  opacity: 0.34;
}

.power-status {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 14px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(148, 163, 184, 0.035);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.ps-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--faint);
}

.ps-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ps-copy strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.ps-copy span {
  color: var(--faint);
  font-size: 10.5px;
}

.power-status.online {
  border-color: rgba(52, 211, 153, 0.18);
  background: rgba(52, 211, 153, 0.045);
}

.power-status.online .ps-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.power-status.offline,
.power-status.disabled {
  border-color: rgba(248, 113, 113, 0.18);
  background: rgba(248, 113, 113, 0.04);
}

.power-status.offline .ps-dot,
.power-status.disabled .ps-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.09);
}

.power-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: auto;
  padding-top: 16px;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.6;
}

.power-note svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-top: 2px;
  color: rgba(251, 191, 36, 0.6);
}

/* ---------- Resource cards ---------- */

.resource {
  --res: var(--sky);
  --res-soft: rgba(56, 189, 248, 0.12);
}

.resource[data-resource="hdd"] {
  --res: var(--violet);
  --res-soft: rgba(167, 139, 250, 0.12);
}

.resource[data-resource="mem"] {
  --res: var(--amber);
  --res-soft: rgba(251, 191, 36, 0.12);
}

.resource .card-head {
  margin-bottom: 15px;
}

.res-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.res-heading h3 {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.res-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--res-soft);
  color: var(--res);
}

.res-icon svg {
  width: 15px;
  height: 15px;
}

.res-percent {
  color: var(--res);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.11);
  overflow: hidden;
}

.bar > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--res);
  box-shadow: 0 0 12px var(--res-soft);
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease;
}

.bar > span.warn {
  background: var(--amber);
}

.bar > span.crit {
  background: var(--red);
}

.res-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--faint);
  font-size: 11.5px;
}

.res-row b {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
}

.res-row.res-sub {
  margin-top: 6px;
  color: #4e5c73;
}

.res-row.res-sub b {
  color: var(--faint);
}

.res-note {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Chart ---------- */

.chart-head {
  align-items: center;
}

.legend {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--faint);
  font-size: 10.5px;
  white-space: nowrap;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dot.bw {
  background: var(--sky);
}

.dot.hdd {
  background: var(--violet);
}

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

.chart-wrap {
  position: relative;
  margin-top: 4px;
}

.chart-wrap.is-empty {
  min-height: 196px;
}

#chart {
  width: 100%;
  height: auto;
  display: block;
}

#chart text {
  font-family: var(--mono);
}

#chart .grid-line {
  stroke: rgba(148, 163, 184, 0.1);
  stroke-width: 1;
  stroke-dasharray: 1 5;
  vector-effect: non-scaling-stroke;
}

#chart .axis-label {
  fill: var(--faint);
  font-size: 10px;
}

#chart .series {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.chart-foot {
  margin-top: 10px;
  color: #4e5c73;
  font-size: 10.5px;
}

/* ---------- Log ---------- */

.log-list {
  list-style: none;
  max-height: 224px;
  margin: 0;
  padding: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}

.log-list::-webkit-scrollbar {
  width: 6px;
}

.log-list::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.2);
}

.log-item {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  padding: 10px 2px;
  border-top: 1px solid var(--border);
}

.log-item:first-child {
  border-top: 0;
}

.log-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.09);
}

.log-dot.error {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.09);
}

.log-main {
  min-width: 0;
}

.log-main strong {
  display: block;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}

.log-main span {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.log-item time {
  color: #4e5c73;
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.log-empty {
  padding: 26px 2px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  list-style: none;
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 26px;
  padding: 0 2px;
  color: #46546b;
  font-size: 10.5px;
  flex-wrap: wrap;
}

.footer-right,
.secure {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.secure i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.65);
}

/* ---------- Dialog ---------- */

.dialog {
  width: min(430px, calc(100vw - 32px));
  margin: auto;
  padding: 26px;
  border: 1px solid rgba(248, 113, 113, 0.26);
  border-radius: 18px;
  background: linear-gradient(180deg, #111b2c, #0a111d);
  color: var(--text);
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.7);
}

.dialog[open] {
  animation: dialogIn 0.18s ease-out;
}

.dialog::backdrop {
  background: rgba(3, 6, 12, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.dialog-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 16px;
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 50%;
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
}

.dialog h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dialog-text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-line;
}

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

.dialog-actions .btn {
  min-width: 90px;
}

/* ---------- Detail dialog ---------- */

body.dialog-open {
  overflow: hidden;
}

.detail-dialog {
  width: min(1080px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: linear-gradient(180deg, #0d1626, #080f1b);
  color: var(--text);
  box-shadow: 0 50px 120px rgba(0, 0, 0, 0.72);
  overflow: hidden;
}

.detail-dialog[open] {
  animation: dialogIn 0.2s ease-out;
}

.detail-dialog::backdrop {
  background: rgba(3, 6, 12, 0.76);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.detail-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 42px);
  padding: 0;
  overflow: hidden;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex: 0 0 auto;
  padding: 20px 22px 15px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #0d1626, rgba(12, 21, 37, 0.96));
}

.detail-body {
  padding: 0 22px 24px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}

.detail-ident {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.detail-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.detail-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.detail-dot.offline,
.detail-dot.disabled {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.09);
}

.detail-ident-text {
  min-width: 0;
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.detail-title-row h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.detail-sub {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.detail-head-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.detail-dialog .banner {
  margin-top: 14px;
}

.detail-grid {
  margin-top: 16px;
}

.detail-dialog .detail-grid > .card {
  background: linear-gradient(180deg, rgba(18, 28, 45, 0.6), rgba(10, 17, 29, 0.66));
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(370px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--sky);
  border-radius: 11px;
  background: rgba(12, 19, 32, 0.96);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.55;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.45);
  animation: toastIn 0.22s ease-out;
  overflow-wrap: anywhere;
}

.toast.success {
  border-left-color: var(--green);
}

.toast.error {
  border-left-color: var(--red);
}

.toast.info {
  border-left-color: var(--sky);
}

.toast.leaving {
  animation: toastOut 0.18s ease-in forwards;
}

/* ---------- Animations ---------- */

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

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(52, 211, 153, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1020px) {
  .span-5,
  .span-7 {
    grid-column: span 12;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 22px 15px 38px;
  }

  .span-4 {
    grid-column: span 12;
  }

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

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

  .detail-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
    border-radius: 15px;
  }

  .detail-shell {
    max-height: calc(100dvh - 20px);
  }

  .detail-head {
    flex-wrap: wrap;
    padding: 16px 14px 12px;
  }

  .detail-body {
    padding: 0 14px 20px;
  }

  .detail-head-actions {
    margin-left: auto;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .top-actions {
    flex: 1 1 auto;
  }

  .meta-row {
    flex-wrap: wrap;
    gap: 6px 14px;
  }
}

@media (max-width: 560px) {
  .brand-text p {
    max-width: 180px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .pill {
    margin-right: auto;
  }

  .stat {
    padding: 12px 14px;
  }

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

  .fleet-head {
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  .tile-actions {
    flex-wrap: wrap;
  }

  .tile-spacer {
    display: none;
  }

  .tile-open {
    margin-left: auto;
  }

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

  .power-btn {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px;
  }

  .power-copy {
    flex: 1;
  }

  .power-note {
    padding-top: 14px;
  }

  .login-card {
    padding: 30px 22px 24px;
  }

  .dialog {
    padding: 22px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .btn {
    width: 100%;
  }

  .toasts {
    right: 16px;
    bottom: 16px;
  }
}

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