/* =============================================================================
   VPN Dedicated Panel — styles.css
   Build-less. Plain CSS with custom properties for theming.

   Sections:
     1.  Design tokens (dark default + light override)
     2.  Reset & base
     3.  Typography & utilities
     4.  Buttons
     5.  Forms & fields
     6.  App shell (sidebar, topbar, main)
     7.  Cards & stat cards
     8.  Tables
     9.  Badges, chips, dots
     10. Modal & drawer
     11. Toasts
     12. Spinner, skeleton, empty / error states
     13. Login
     14. Wizard & job log
     15. Misc (drawer content, ledger, audit)
     16. Responsive
     17. Reduced motion
   ========================================================================== */

/* ----------------------------------------------------------------------------
   1. Design tokens
   Dark is the default (:root); light overrides via [data-theme="light"].
   The inline bootstrap in index.html always sets an explicit data-theme,
   honouring prefers-color-scheme on first visit.
---------------------------------------------------------------------------- */
:root,
:root[data-theme="dark"] {
  --bg: #0b0f17;
  --bg-elev: #0e1420;
  --surface: #131b29;
  --surface-2: #18212f;
  --surface-3: #1f2a3b;
  --border: #253044;
  --border-strong: #33415c;

  --text: #e7ecf5;
  --text-dim: #9aa6bd;
  --text-faint: #6b7793;

  --accent: #6d7dff;
  --accent-hover: #8090ff;
  --accent-weak: rgba(109, 125, 255, 0.16);
  --accent-contrast: #ffffff;

  --ok: #34d399;
  --ok-weak: rgba(52, 211, 153, 0.15);
  --warn: #fbbf24;
  --warn-weak: rgba(251, 191, 36, 0.15);
  --danger: #f87171;
  --danger-weak: rgba(248, 113, 113, 0.15);
  --info: #60a5fa;
  --info-weak: rgba(96, 165, 250, 0.15);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 12px 34px -14px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
  --overlay: rgba(6, 9, 15, 0.6);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eef1f7;
  --bg-elev: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #eaeff7;
  --border: #e3e8f1;
  --border-strong: #d2dae7;

  --text: #101725;
  --text-dim: #55617a;
  --text-faint: #8791a6;

  --accent: #5b4bd6;
  --accent-hover: #4b3cc4;
  --accent-weak: rgba(91, 75, 214, 0.1);
  --accent-contrast: #ffffff;

  --ok: #17a34a;
  --ok-weak: rgba(23, 163, 74, 0.12);
  --warn: #c47605;
  --warn-weak: rgba(196, 118, 5, 0.14);
  --danger: #dc2626;
  --danger-weak: rgba(220, 38, 38, 0.1);
  --info: #2563eb;
  --info-weak: rgba(37, 99, 235, 0.1);

  --shadow-sm: 0 1px 2px rgba(20, 30, 60, 0.08);
  --shadow: 0 14px 34px -16px rgba(20, 30, 60, 0.22);
  --shadow-lg: 0 26px 60px -22px rgba(20, 30, 60, 0.28);
  --overlay: rgba(24, 33, 54, 0.32);

  color-scheme: light;
}

:root {
  --r-xs: 6px;
  --r-sm: 9px;
  --r: 13px;
  --r-lg: 18px;
  --r-pill: 999px;

  --sidebar-w: 240px;
  --topbar-h: 60px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ----------------------------------------------------------------------------
   2. Reset & base
---------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* never let the page scroll sideways */
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
}

input,
select,
textarea,
button {
  font-family: inherit;
}

img,
svg {
  max-width: 100%;
}

::selection {
  background: var(--accent-weak);
}

/* Consistent, visible keyboard focus everywhere. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Slim, themed scrollbars. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}

/* ----------------------------------------------------------------------------
   3. Typography & utilities
---------------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

.muted {
  color: var(--text-dim);
}
.faint {
  color: var(--text-faint);
}

.icon {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row--wrap {
  flex-wrap: wrap;
}
.spacer {
  flex: 1 1 auto;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hidden {
  display: none !important;
}
.nowrap {
  white-space: nowrap;
}
.truncate {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ----------------------------------------------------------------------------
   4. Buttons
---------------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    transform 0.06s var(--ease), color 0.15s var(--ease);
}
.btn:hover {
  background: var(--surface-3);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-contrast);
  --btn-bd: transparent;
  box-shadow: 0 6px 16px -8px var(--accent);
}
.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--danger {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
  --btn-bd: transparent;
}
.btn--danger:hover {
  filter: brightness(1.06);
  background: var(--danger);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-bd: transparent;
  --btn-fg: var(--text-dim);
}
.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn--subtle {
  --btn-bg: var(--surface-2);
  --btn-bd: transparent;
}

.btn--sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  gap: 6px;
}

.btn--icon {
  width: 38px;
  height: 38px;
  padding: 0;
  --btn-bg: transparent;
  --btn-bd: transparent;
  --btn-fg: var(--text-dim);
  border-radius: var(--r-sm);
}
.btn--icon:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn--icon.btn--sm {
  width: 30px;
  height: 30px;
}

.btn-danger-text {
  color: var(--danger);
}
.btn-danger-text:hover {
  background: var(--danger-weak);
  color: var(--danger);
}

/* ----------------------------------------------------------------------------
   5. Forms & fields
---------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.field__label .req {
  color: var(--danger);
  margin-left: 2px;
}
.field__help {
  font-size: 12px;
  color: var(--text-faint);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 9px 11px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease),
    background 0.15s var(--ease);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-faint);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.textarea {
  resize: vertical;
  min-height: 68px;
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

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

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.form-error {
  display: none;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--danger-weak);
  color: var(--danger);
  font-size: 13px;
  border: 1px solid transparent;
}
.form-error.show {
  display: block;
}

/* Toggle switch (checkbox). */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch__track {
  width: 40px;
  height: 23px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  position: relative;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
  flex: none;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}
.switch input:checked + .switch__track {
  background: var(--accent);
  border-color: transparent;
}
.switch input:checked + .switch__track::after {
  transform: translateX(17px);
  background: #fff;
}
.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------------------
   6. App shell
---------------------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 12px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 10px 16px;
}
.brand__logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(150deg, var(--accent), #9b7bff);
  box-shadow: 0 6px 16px -8px var(--accent);
  flex: none;
}
.brand__name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand__sub {
  font-size: 11px;
  color: var(--text-faint);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-weight: 550;
  font-size: 13.5px;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav a.active {
  background: var(--accent-weak);
  color: var(--accent);
}
.nav a.active .icon {
  color: var(--accent);
}
.nav__spacer {
  flex: 1;
}
.sidebar__foot {
  padding: 10px;
  font-size: 11px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0; /* allow inner content to shrink & scroll */
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__title {
  font-size: 17px;
  font-weight: 650;
}
.hamburger {
  display: none;
}

.userchip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
}
.userchip__name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  line-height: 1.15;
}
.userchip__name b {
  font-size: 13px;
  font-weight: 600;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(150deg, var(--accent), #9b7bff);
  flex: none;
}

/* Live VM inventory list (server drawer) */
.hostvms {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.hostvm {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 11px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.hostvm:last-child {
  border-bottom: none;
}
.hostvm__id {
  min-width: 46px;
}
.hostvm__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  padding: 22px;
  flex: 1;
}
.view {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1240px;
  animation: fade-up 0.28s var(--ease);
}
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.view__head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}
.view__head h1 {
  font-size: 21px;
}
.view__head p {
  margin: 3px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

/* ----------------------------------------------------------------------------
   7. Cards & stat cards
---------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card__head h2,
.card__head h3 {
  font-size: 14.5px;
}
.card__body {
  padding: 18px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.stat {
  position: relative;
  overflow: hidden;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease);
}
.stat:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.stat__top {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
}
.stat__ico {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-weak);
  color: var(--accent);
  flex: none;
}
.stat__value {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stat__value small {
  font-size: 15px;
  color: var(--text-faint);
  font-weight: 600;
}
.stat__sub {
  font-size: 12px;
  color: var(--text-faint);
}

/* ----------------------------------------------------------------------------
   8. Tables
---------------------------------------------------------------------------- */
.tbl-wrap {
  width: 100%;
  overflow-x: auto; /* wide tables scroll inside their own box */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 560px;
}
.tbl thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
  padding: 11px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.tbl tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tbody tr:last-child td {
  border-bottom: 0;
}
.tbl tbody tr {
  transition: background 0.12s var(--ease);
}
.tbl tbody tr[data-clickable] {
  cursor: pointer;
}
.tbl tbody tr[data-clickable]:hover {
  background: var(--surface-2);
}
.tbl .cell-actions {
  text-align: right;
  white-space: nowrap;
}
.tbl .cell-strong {
  font-weight: 600;
  color: var(--text);
}
.tbl .cell-actions .row {
  justify-content: flex-end;
  gap: 4px;
}
.tbl caption {
  caption-side: bottom;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: left;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search .icon {
  position: absolute;
  left: 10px;
  color: var(--text-faint);
  pointer-events: none;
}
.search .input {
  padding-left: 32px;
  min-width: 220px;
}

/* ----------------------------------------------------------------------------
   9. Badges, chips, dots
---------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid transparent;
}
.badge--accent {
  background: var(--accent-weak);
  color: var(--accent);
}
.badge--ok {
  background: var(--ok-weak);
  color: var(--ok);
}
.badge--warn {
  background: var(--warn-weak);
  color: var(--warn);
}
.badge--danger {
  background: var(--danger-weak);
  color: var(--danger);
}
.badge--info {
  background: var(--info-weak);
  color: var(--info);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}
.dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}
.dot--ok::before {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-weak);
}
.dot--off::before {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-weak);
}
.dot--checking::before {
  background: var(--warn);
  animation: pulse 1.1s var(--ease) infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* ----------------------------------------------------------------------------
   10. Modal & drawer
---------------------------------------------------------------------------- */
.modal-overlay,
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  display: flex;
  animation: overlay-in 0.16s var(--ease);
}
@keyframes overlay-in {
  from {
    opacity: 0;
  }
}
.modal-overlay {
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 520px;
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px);
  animation: modal-in 0.2s var(--ease);
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}
.modal--md {
  max-width: 640px;
}
.modal--lg {
  max-width: 820px;
}
.modal__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal__head h2 {
  font-size: 16px;
}
.modal__head .sub {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 2px;
}
.modal__body {
  padding: 20px;
  overflow-y: auto;
}
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* Drawer: slides in from the right. */
.drawer-overlay {
  justify-content: flex-end;
}
.drawer {
  width: 100%;
  max-width: 480px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: drawer-in 0.24s var(--ease);
}
@keyframes drawer-in {
  from {
    transform: translateX(30px);
    opacity: 0;
  }
}
.drawer__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.drawer__head h2 {
  font-size: 16px;
}
.drawer__head .sub {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 2px;
}
.drawer__body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Key/value definition rows used in drawers. */
.kv {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 8px 14px;
  font-size: 13px;
}
.kv dt {
  color: var(--text-faint);
}
.kv dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}

/* Resource meters (server CPU / RAM). */
.meter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.meter__row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-dim);
}
.meter__bar {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.meter__fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), #9b7bff);
  transition: width 0.4s var(--ease);
}
.meter__fill.high {
  background: linear-gradient(90deg, var(--warn), var(--danger));
}

/* ----------------------------------------------------------------------------
   11. Toasts
---------------------------------------------------------------------------- */
.toast-root {
  position: fixed;
  z-index: 200;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  animation: toast-in 0.24s var(--ease);
  border-left: 3px solid var(--accent);
}
.toast.leaving {
  animation: toast-out 0.2s var(--ease) forwards;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(16px);
  }
}
.toast--ok {
  border-left-color: var(--ok);
}
.toast--error {
  border-left-color: var(--danger);
}
.toast--warn {
  border-left-color: var(--warn);
}
.toast--info {
  border-left-color: var(--info);
}
.toast__ico {
  flex: none;
  margin-top: 1px;
}
.toast--ok .toast__ico {
  color: var(--ok);
}
.toast--error .toast__ico {
  color: var(--danger);
}
.toast--warn .toast__ico {
  color: var(--warn);
}
.toast--info .toast__ico {
  color: var(--info);
}
.toast__msg {
  font-size: 13px;
  color: var(--text);
}
.toast__close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-faint);
  padding: 0 2px;
}

/* ----------------------------------------------------------------------------
   12. Spinner, skeleton, empty / error states
---------------------------------------------------------------------------- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}
.spinner--lg {
  width: 30px;
  height: 30px;
  border-width: 3px;
}
.spinner--on-accent {
  border-color: rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-dim);
}

.skel {
  background: linear-gradient(
    100deg,
    var(--surface-2) 30%,
    var(--surface-3) 50%,
    var(--surface-2) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.3s var(--ease) infinite;
  border-radius: var(--r-xs);
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
.skel-line {
  height: 12px;
  margin: 4px 0;
}

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 46px 24px;
  color: var(--text-dim);
}
.placeholder__ico {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-faint);
}
.placeholder--error .placeholder__ico {
  background: var(--danger-weak);
  color: var(--danger);
}
.placeholder h3 {
  font-size: 15px;
  color: var(--text);
}
.placeholder p {
  margin: 0;
  font-size: 13px;
  max-width: 340px;
}

/* ----------------------------------------------------------------------------
   13. Login
---------------------------------------------------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(
      1100px 500px at 50% -10%,
      var(--accent-weak),
      transparent 70%
    ),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 30px 28px;
  animation: modal-in 0.3s var(--ease);
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  text-align: center;
}
.login-brand .brand__logo {
  width: 48px;
  height: 48px;
  border-radius: 13px;
}
.login-brand h1 {
  font-size: 19px;
}
.login-brand p {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}
.login-card .form {
  gap: 15px;
}
.login-card .btn--primary {
  height: 42px;
  width: 100%;
}

/* ----------------------------------------------------------------------------
   14. Wizard & job log
---------------------------------------------------------------------------- */
.steps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-faint);
}
.step__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-faint);
  flex: none;
}
.step.active .step__num {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
.step.active {
  color: var(--text);
}
.step.done .step__num {
  background: var(--ok-weak);
  border-color: transparent;
  color: var(--ok);
}
.step__bar {
  width: 18px;
  height: 2px;
  background: var(--border-strong);
  border-radius: 2px;
}

/* Selectable option list (templates, servers, subnets in the wizard). */
.pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}
.pick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  text-align: left;
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease);
  width: 100%;
}
.pick:hover {
  border-color: var(--border-strong);
}
.pick.selected {
  border-color: var(--accent);
  background: var(--accent-weak);
}
.pick__radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex: none;
  display: grid;
  place-items: center;
}
.pick.selected .pick__radio {
  border-color: var(--accent);
}
.pick.selected .pick__radio::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
.pick__main {
  flex: 1;
  min-width: 0;
}
.pick__title {
  font-weight: 600;
  font-size: 13.5px;
}
.pick__meta {
  font-size: 12px;
  color: var(--text-dim);
}

.review {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 9px 14px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.review dt {
  color: var(--text-faint);
}
.review dd {
  margin: 0;
  font-weight: 550;
}

.logbox {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  background: #06090f;
  color: #d5deec;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
:root[data-theme="light"] .logbox {
  background: #0d1320;
  color: #dde5f2;
}
.job-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

/* ----------------------------------------------------------------------------
   15. Misc
---------------------------------------------------------------------------- */
.next-free {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: var(--ok-weak);
  border: 1px solid transparent;
  color: var(--text);
  font-size: 13px;
}
.next-free .mono {
  font-weight: 600;
  color: var(--ok);
}

.usebar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}
.usebar__track {
  flex: 1;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
  min-width: 46px;
}
.usebar__fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
}
.usebar__txt {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.detail-expand {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
}
.audit-detail {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  max-width: 320px;
}

/* ----------------------------------------------------------------------------
   16. Responsive — collapses to a top bar + slide-in sidebar under 760px
---------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .hamburger {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.24s var(--ease);
    z-index: 120;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: none;
  }
  .scrim {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: var(--overlay);
    backdrop-filter: blur(2px);
    animation: overlay-in 0.16s var(--ease);
  }
  .topbar {
    padding: 0 14px;
  }
  .content {
    padding: 16px 14px;
  }
  .userchip__name {
    display: none;
  }
  .userchip {
    padding: 5px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .kv {
    grid-template-columns: 100px 1fr;
  }
  .drawer,
  .modal {
    max-width: none;
  }
}

/* Hide the role text on very small bars but keep the avatar. */
@media (max-width: 420px) {
  .topbar__title {
    font-size: 15px;
  }
  .hide-xs {
    display: none !important;
  }
}

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