:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: rgba(15, 23, 42, 0.78);
  --panel-border: rgba(148, 163, 184, 0.2);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --blue: #3b82f6;
  --green: #34d399;
  --red: #fb7185;
  --amber: #facc15;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 32rem),
    radial-gradient(circle at top right, rgba(250, 204, 21, 0.12), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.center-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.glass {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(18px);
}

.login-card {
  width: min(440px, 100%);
  border-radius: 28px;
  padding: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
  font-size: 28px;
}

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

.muted {
  color: var(--muted);
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field span {
  display: block;
  margin-bottom: 8px;
  color: #cbd5e1;
  font-size: 14px;
}

.input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid #334155;
  background: rgba(2, 6, 23, 0.6);
  color: white;
  padding: 12px 14px;
  outline: none;
}

.input:focus {
  border-color: #60a5fa;
}

.btn {
  border: 0;
  border-radius: 16px;
  padding: 11px 16px;
  font-weight: 700;
  color: white;
  background: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-primary {
  background: var(--blue);
}

.btn-danger {
  background: #e11d48;
}

.btn-ghost {
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.8);
}

.btn-warning {
  background: #ca8a04;
}

.btn-full {
  width: 100%;
}

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

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

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

.pve-card,
.add-card {
  min-height: 230px;
  border-radius: 28px;
  padding: 22px;
  text-align: left;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.pve-card:hover,
.add-card:hover {
  transform: translateY(-4px);
  border-color: rgba(96, 165, 250, 0.55);
}

.pve-main-button {
  width: 100%;
  height: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
}

.pve-icon {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
  font-size: 28px;
  margin-bottom: 22px;
}

.edit-button {
  position: absolute;
  right: 18px;
  bottom: 18px;
}

.warning-badge {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--amber);
  color: #0f172a;
  font-weight: 900;
}

.pulse-warning {
  animation: pulse-warning 1.5s infinite;
}

@keyframes pulse-warning {
  0% {
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.75);
  }

  70% {
    box-shadow: 0 0 0 12px rgba(250, 204, 21, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0);
  }
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #64748b;
}

.dot.running,
.dot.online {
  background: var(--green);
}

.dot.stopped,
.dot.failed {
  background: var(--red);
}

.add-card {
  border-style: dashed;
  display: grid;
  place-items: center;
  text-align: center;
  background: transparent;
}

.plus {
  width: 82px;
  height: 82px;
  margin: 0 auto 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
  font-size: 42px;
  font-weight: 300;
}

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-radius: 26px;
  padding: 16px;
  margin-bottom: 24px;
  background: rgba(2, 6, 23, 0.86);
  border: 1px solid rgba(51, 65, 85, 0.9);
  backdrop-filter: blur(18px);
}

.vm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 38px;
}

.vm-card {
  border-radius: 28px;
  overflow: hidden;
}

.vm-card.warning {
  border-color: rgba(250, 204, 21, 0.65);
}

.vm-thumb {
  padding: 22px;
  min-height: 210px;
  position: relative;
}

.thumb-running {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.5), rgba(59, 130, 246, 0.26), rgba(15, 23, 42, 1));
}

.thumb-stopped {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.5), rgba(51, 65, 85, 0.45), rgba(15, 23, 42, 1));
}

.thumb-other {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.45), rgba(51, 65, 85, 0.45), rgba(15, 23, 42, 1));
}

.vm-actions-top {
  position: absolute;
  right: 16px;
  top: 16px;
  display: flex;
  gap: 8px;
}

.round-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.22);
  color: white;
  display: grid;
  place-items: center;
}

.round-btn.active {
  background: var(--amber);
  color: #0f172a;
  border-color: var(--amber);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 26px;
}

.metric {
  background: rgba(0, 0, 0, 0.22);
  border-radius: 16px;
  padding: 12px;
}

.metric small {
  display: block;
  color: rgba(255, 255, 255, 0.62);
}

.metric strong {
  display: block;
  font-size: 20px;
}

.vm-body {
  padding: 18px;
}

.vm-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  color: #cbd5e1;
  margin-bottom: 16px;
  font-size: 14px;
}

.vm-meta span {
  display: block;
  color: #64748b;
  font-size: 12px;
}

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

.backup-panel {
  border-radius: 28px;
  overflow: hidden;
}

.backup-row,
.backup-header {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 0.8fr 0.6fr;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.7);
  align-items: center;
}

.backup-row {
  width: 100%;
  background: transparent;
  color: inherit;
  text-align: left;
  border-left: 0;
  border-right: 0;
  border-top: 0;
}

.backup-row:hover {
  background: rgba(30, 41, 59, 0.55);
}

.backup-header {
  color: #cbd5e1;
  font-weight: 800;
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.pill.success {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.14);
}

.pill.failed {
  color: #fecdd3;
  background: rgba(244, 63, 94, 0.14);
}

.form-panel {
  border-radius: 28px;
  padding: 24px;
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #334155;
  background: rgba(2, 6, 23, 0.5);
  border-radius: 16px;
  padding: 12px 14px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  padding: 16px;
}

.modal {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: hidden;
  border-radius: 28px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.75);
}

.modal-body {
  padding: 18px;
  max-height: 72vh;
  overflow: auto;
}

.pre {
  white-space: pre-wrap;
  background: rgba(2, 6, 23, 0.76);
  border-radius: 18px;
  padding: 14px;
  overflow: auto;
  color: #cbd5e1;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 120;
  max-width: 420px;
  border-radius: 18px;
  padding: 13px 16px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(6, 78, 59, 0.92);
  color: #d1fae5;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
}

.toast.error {
  border-color: rgba(251, 113, 133, 0.35);
  background: rgba(136, 19, 55, 0.92);
  color: #ffe4e6;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .grid,
  .vm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .backup-header {
    display: none;
  }

  .backup-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 24px, 1280px);
    padding: 18px 0;
  }

  .topbar,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    flex-direction: column;
  }

  .grid,
  .vm-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .btn {
    width: 100%;
  }
}
