/* Admin-only chrome. Most rules come from the shared dashboard/instances
   CSS; this file adds a small "owner" meta accent. */

.header-status {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Make the owner row stand out a hair — it's the field admins scan first. */
.vm-card .vm-meta-row[title="instance owner"] .vm-meta-value {
  color: var(--text-0);
}

/* ⋯ overflow on live instance cards — long secondary actions (failed-payment
   reminder email) stay out of the primary restart/delete row. Opens upward
   because .vm-actions sits at the bottom of the card. */
.vm-overflow {
  position: relative;
  margin-left: auto;
  display: flex;           /* so the ⋯ button can fill the row height */
  align-items: stretch;
}
.vm-overflow-btn {
  min-width: 28px;
  height: 100%;            /* match restart/delete (taller due to alert icon) */
  padding-left: 8px;
  padding-right: 8px;
  letter-spacing: 0.08em;
  box-sizing: border-box;
}
.vm-overflow-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  min-width: 260px;
  padding: 4px 0;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 36px -12px rgba(0, 0, 0, 0.55);
  z-index: 40;
}
.vm-overflow-menu[hidden] { display: none; }
.vm-overflow-item {
  display: block;
  width: calc(100% - 8px);
  margin: 0 4px;
  padding: 7px 8px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  color: var(--text-1);
  cursor: pointer;
  transition: color .12s, background .12s;
}
.vm-overflow-item:hover {
  background: var(--bg-2);
  color: var(--text-0);
}
.vm-overflow-item:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* Read-only marker when the owner heads a team (spec43). Context only — no
   team management from admin. */
.team-owner-badge {
  flex-shrink: 0;            /* a flex sibling of the ellipsing owner value */
  align-self: center;
  margin-left: 2px;
  padding: 0 6px;
  border: 1px solid var(--blue-dim);
  border-radius: var(--radius);
  font-size: 10px;
  color: var(--blue);
  white-space: nowrap;
}

.instance-search {
  width: min(220px, 42vw);
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-0);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.instance-search::placeholder { color: var(--text-3); }

.vm-card-archived {
  padding: 8px 10px;
  gap: 4px;
  opacity: 0.55;
  filter: grayscale(0.35);
}
.vm-card-archived:hover { opacity: 0.72; }
.vm-card-archived .vm-name { font-size: 12px; }
.vm-card-archived .badge { font-size: 10px; padding: 1px 6px; }
.vm-card-header-compact { gap: 6px; }
.vm-archived-line {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vm-archived-owner { color: var(--text-1); }
.vm-grid-archived {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px;
}
.instance-archived-section { margin-top: 18px; }
.instance-archived-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  text-transform: lowercase;
}
.instance-archived-count {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
}
.instance-archived-pager { margin-top: 6px; }
.badge-deleted { color: var(--text-3); }

/* ── tab bar ─────────────────────────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.admin-tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-2);
  text-transform: lowercase;
  cursor: pointer;
  margin-bottom: -1px;
}
.admin-tab:hover { color: var(--text-0); background: var(--bg-1); }
.admin-tab.active {
  color: var(--text-0);
  background: var(--bg-1);
  border-color: var(--border);
  border-bottom-color: var(--bg-1);
  font-weight: 600;
}

.admin-tab-panel[hidden] { display: none; }

/* ── hosts list (tabular) ────────────────────────────────────────────── */
.host-row {
  display: grid;
  /* host (id/name/url) · gpu · status · live · reservation.
     Each row is its own grid, so the content columns are fixed-width to stay
     aligned row-to-row while hugging their content; only the id/name/url
     column flexes and absorbs the slack (no proportional gaps). */
  grid-template-columns: minmax(0, 1fr) 120px 130px 44px 170px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-top: 0;
  background: var(--bg-1);
}
.host-row:first-child {
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.host-row:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}
.host-row-head {
  background: var(--bg-2);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.host-row-cell { min-width: 0; }
.host-row-cell-label { display: none; }
.host-id  { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.host-name { color: var(--text-0); font-weight: 600; }
.host-name-empty { color: var(--text-3); font-style: italic; font-weight: 400; }
.host-dns-pending {
  color: var(--yellow);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.host-gpu {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius);
  background: var(--bg-3);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-1);
}
.host-url {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.host-live-vms {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-1);
  text-align: center;
}
.host-live-vms.busy { color: var(--blue); font-weight: 600; }
.host-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
/* Reservation cell: the "reserved: <email>" / "in pool" line above the
   dedicate / release / create-instance controls. */
.host-reserved {
  flex-basis: 100%;
  text-align: right;
  font-size: 11px;
  color: var(--text-1);
  overflow-wrap: anywhere;
}
.host-reserved-pool { color: var(--text-3); }
/* Non-general pools echo the VM-card tier accents: blue prebook, green dual. */
.host-pool-prebook { color: var(--blue); }
.host-pool-dual { color: var(--green); }

/* active toggle switch — compact, tactile, and still terminal-native */
.host-switch {
  --switch-color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 104px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--switch-color);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.host-switch.is-active { --switch-color: var(--green); }
.host-switch.is-inactive { --switch-color: var(--text-3); }
.host-switch-track {
  position: relative;
  width: 38px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid var(--switch-color);
  border-radius: 999px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--switch-color) 18%, transparent), transparent),
    var(--bg-0);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
  transition: border-color 120ms ease, background 120ms ease, opacity 120ms ease;
}
.host-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--switch-color);
  box-shadow: 0 0 10px color-mix(in srgb, var(--switch-color) 45%, transparent);
  transition: transform 140ms ease, background 120ms ease, box-shadow 120ms ease;
}
.host-switch.is-active .host-switch-thumb { transform: translateX(18px); }
.host-switch-label { min-width: 48px; text-align: left; }
.host-switch:hover:not([disabled]) .host-switch-track,
.host-switch:focus-visible .host-switch-track {
  border-color: var(--text-0);
}
.host-switch:hover:not([disabled]) .host-switch-thumb,
.host-switch:focus-visible .host-switch-thumb {
  background: var(--text-0);
  box-shadow: 0 0 12px rgba(255,255,255,0.28);
}
.host-switch:focus-visible { outline: none; }
.host-switch:focus-visible .host-switch-track {
  box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 4px var(--blue);
}
.host-switch[disabled] { cursor: wait; opacity: 0.55; }
.host-switch[disabled] .host-switch-thumb { animation: host-switch-pulse 700ms ease-in-out infinite alternate; }

@keyframes host-switch-pulse {
  from { opacity: 0.5; }
  to   { opacity: 1; }
}

/* ── add-host form ───────────────────────────────────────────────────── */
.add-host-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  margin: 14px 0;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Start-onboarding result — the one-liner the operator copies to the owner. */
.onboard-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.onboard-oneliner {
  font-family: var(--mono);
  font-size: 12px;
  padding: 9px 11px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  word-break: break-all;
  user-select: all;
}

/* Billing-config tab — principals table (live↔sandbox operator switch). */
.billing-callout {
  margin: 4px 0 16px;
  padding: 11px 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-left: 2px solid var(--blue);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
  max-width: 760px;
}
.billing-callout code { font-size: 12px; }
.billing-row {
  display: grid;
  grid-template-columns: 2.6fr 0.9fr 0.8fr 0.8fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-top: 0;
  background: var(--bg-0);
  font-family: var(--mono);
  font-size: 12px;
}
.billing-row:first-of-type {
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  margin-top: 12px;
}
.billing-row:last-of-type { border-radius: 0 0 var(--radius) var(--radius); }
.billing-row-head {
  background: var(--bg-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.billing-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.billing-cell-email { display: flex; align-items: center; gap: 6px; overflow: visible; }
.billing-email-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.billing-cell-action { text-align: right; white-space: nowrap; }
.billing-env-badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border);
}
.billing-env-live { color: var(--text-2); }
.billing-env-sandbox { color: var(--yellow); border-color: var(--yellow); }
.billing-pager { margin-top: 12px; }

.users-row {
  display: grid;
  grid-template-columns: 2fr 2.1fr 1.2fr 0.6fr 0.6fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-top: 0;
  background: var(--bg-0);
  font-family: var(--mono);
  font-size: 12px;
}
.users-row:first-of-type {
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  margin-top: 12px;
}
.users-row:last-of-type { border-radius: 0 0 var(--radius) var(--radius); }
.users-row-head {
  background: var(--bg-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.users-sort-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.users-sort-btn:hover { color: var(--text-0); }
.users-sort-btn:disabled { opacity: 0.5; cursor: default; }
.users-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-cell-label { display: none; }
.users-cell-email {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: visible;
  flex-wrap: wrap;
}
.users-email-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-email-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
}
.users-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  white-space: nowrap;
}
.users-chip-live {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 35%, var(--border));
  background: color-mix(in srgb, var(--green) 10%, transparent);
}
.users-chip-past {
  color: var(--text-2);
  background: var(--bg-2);
}
.users-chip-queue {
  color: var(--cyan, #22d3ee);
  border-color: color-mix(in srgb, var(--cyan, #22d3ee) 35%, var(--border));
  background: color-mix(in srgb, var(--cyan, #22d3ee) 10%, transparent);
}
.users-cell-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 11px;
}
.users-row .users-cell:nth-child(3) {
  color: var(--text-2);
  font-size: 11px;
}
.users-bool {
  font-size: 11px;
  text-transform: lowercase;
}
.users-bool.yes { color: var(--green); }
.users-bool.no  { color: var(--text-3); }
.users-pager { margin-top: 12px; }

.add-host-form[hidden] { display: none; }
.add-host-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.add-host-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.add-host-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.add-host-form input,
.add-host-form select {
  background: var(--bg-0);
  border: 1px solid var(--border);
  color: var(--text-0);
  font-family: var(--mono);
  font-size: 13px;
  padding: 7px 9px;
  border-radius: var(--radius);
}
.add-host-form input:focus,
.add-host-form select:focus {
  outline: none;
  border-color: var(--blue);
}
.add-host-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

@media (max-width: 720px) {
  .host-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .host-row-head { display: none; }
  .host-row-cell-label {
    display: inline-block;
    min-width: 60px;
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-3);
    margin-right: 6px;
  }
  .add-host-row { grid-template-columns: 1fr; }
}

/* ── feedback tab ──────────────────────────────────────────────────────── */

.feedback-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.feedback-row {
  display: grid;
  grid-template-columns: 7.25rem 1.15fr 2fr 0.7fr 1.4fr auto;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-top: 0;
  background: var(--bg-0);
  font-family: var(--mono);
  font-size: 12px;
}
.feedback-row:first-of-type {
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.feedback-row:last-of-type {
  border-radius: 0 0 var(--radius) var(--radius);
}
.feedback-row-head {
  background: var(--bg-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  align-items: center;
}
.feedback-cell { min-width: 0; }
.feedback-cell-label { display: none; }
.feedback-cell-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.feedback-user {
  color: var(--text-0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feedback-when {
  color: var(--text-2);
  font-size: 11px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.feedback-question {
  color: var(--text-0);
  line-height: 1.4;
}
.feedback-response {
  color: var(--text-0);
  line-height: 1.45;
  word-break: break-word;
}
.feedback-outcome {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius);
  font-size: 11px;
  text-transform: lowercase;
}
.feedback-outcome-answered  { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.feedback-outcome-dismissed { background: var(--bg-3); color: var(--text-3); }
.feedback-outcome-shown     { background: color-mix(in srgb, var(--yellow) 18%, transparent); color: var(--yellow); }

@media (max-width: 720px) {
  .feedback-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .feedback-row-head { display: none; }
  .feedback-cell-label {
    display: inline-block;
    min-width: 56px;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-3);
    margin-right: 6px;
  }
  .feedback-cell-actions {
    justify-content: flex-start;
    margin-top: 4px;
  }
}

.feedback-detail-card {
  min-width: min(520px, calc(100vw - 32px));
  max-width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}
.feedback-detail-body {
  margin: 0 0 14px;
}
.feedback-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
}
.feedback-detail-k {
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}
.feedback-detail-prompt {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-0);
}
.feedback-detail-section-label {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}
.feedback-detail-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.feedback-detail-option {
  display: inline-block;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.3;
}
.feedback-detail-option.is-selected {
  border-color: color-mix(in srgb, var(--green) 55%, var(--border));
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--green);
}
.feedback-detail-rating {
  min-width: 1.75rem;
  text-align: center;
}
.feedback-detail-scale-hint {
  display: flex;
  justify-content: space-between;
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: lowercase;
}
.feedback-detail-picked {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-1);
}
.feedback-detail-text {
  margin: 0;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-0);
  white-space: pre-wrap;
  word-break: break-word;
}
.feedback-detail-empty {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}

/* ── analytics tab ───────────────────────────────────────────────────── */

/* Live waitlist queue (open vm_waitlist rows) — queue tab */
.queue-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.queue-filter-chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
  cursor: pointer;
  transition: color 80ms, border-color 80ms, background 80ms;
}
.queue-filter-chip:hover { color: var(--text-1); border-color: var(--border-strong); }
.queue-filter-chip.active {
  color: var(--text-0);
  background: var(--bg-3);
  border-color: var(--border-strong);
}
.queue-filter-count {
  display: inline-block;
  margin-left: 4px;
  color: var(--text-3);
  font-size: 11px;
}
.queue-filter-chip.active .queue-filter-count { color: var(--text-1); }

.waitlist-queue-row {
  display: grid;
  grid-template-columns: 0.35fr 1.4fr 1fr 0.65fr 0.55fr 0.45fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-top: 0;
  background: var(--bg-0);
  font-family: var(--mono);
  font-size: 12px;
}
.waitlist-queue-row:first-of-type {
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  margin-top: 12px;
}
.waitlist-queue-row:last-of-type {
  border-radius: 0 0 var(--radius) var(--radius);
}
.waitlist-queue-row-head {
  background: var(--bg-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.waitlist-queue-cell { min-width: 0; }
.waitlist-queue-cell-label { display: none; }
.waitlist-queue-pos {
  font-weight: 600;
  color: var(--text-0);
  text-align: center;
}
.waitlist-queue-owner {
  color: var(--text-0);
  display: flex;
  align-items: center;
  gap: 6px;
}
.waitlist-queue-owner-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.waitlist-queue-waited { color: var(--text-2); }
.waitlist-active-vm {
  font-size: 11px;
  text-transform: lowercase;
}
.waitlist-active-vm.yes { color: var(--green); }
.waitlist-active-vm.no  { color: var(--text-3); }

/* Pre-bookings table (below the waitlist queue) reuses the waitlist-queue
   row/cell styling with its own 7-column template. Placed before the 720px
   media query so the single-column collapse still applies. */
.prebook-queue-heading {
  margin-top: 28px;
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
}
.prebook-queue-row {
  grid-template-columns: 1.3fr 0.55fr 1fr 0.35fr 0.6fr 0.6fr 1.5fr;
}
.prebook-queue-row .waitlist-queue-cell:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.prebook-paid        { color: var(--green); text-transform: lowercase; }
.prebook-unpaid      { color: var(--text-3); text-transform: lowercase; }
.prebook-interrupted { color: var(--yellow); text-transform: lowercase; }

@media (max-width: 720px) {
  .waitlist-queue-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .waitlist-queue-row-head { display: none; }
  .waitlist-queue-cell-label {
    display: inline-block;
    min-width: 56px;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-3);
    margin-right: 6px;
  }
}

.range-select {
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--text-0);
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: var(--radius);
}

.chart-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 12px;
  margin-bottom: 18px;
}
.chart-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
  margin: 0 0 4px;
  text-transform: lowercase;
}
.chart-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin: 0 0 12px;
  font-family: var(--mono);
}
.chart-canvas {
  width: 100%;
  position: relative;          /* anchors .chart-tooltip absolute */
}

/* Hover tooltip — absolutely positioned inside .chart-canvas, follows
   the cursor. Updated by the delegated mousemove handler in admin.js. */
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-0);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 1;
  transition: opacity 80ms linear;
}
.chart-tooltip[hidden] { display: none; }
.chart-tooltip-day {
  color: var(--text-3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.chart-tooltip-value {
  font-weight: 600;
  color: var(--text-0);
  font-size: 13px;
}

/* In-SVG hover marker (vertical line + emphasised dot) — coordinates
   updated by the same handler so the visual cue stays aligned with the
   nearest data point. */
.chart-hover-line { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
.chart-hover-dot  { fill: var(--text-0); stroke: var(--bg-0); stroke-width: 1.5; pointer-events: none; }
.chart-svg {
  width: 100%;
  height: auto;
  max-height: 240px;
  display: block;
}
.chart-empty {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  padding: 40px 0;
}

/* SVG element styling — classes (not inline) so the terminal theme can
   restyle in one place. */
.chart-axis  { stroke: var(--border-strong); stroke-width: 1; }
.chart-grid  { stroke: var(--border-soft);   stroke-width: 1; stroke-dasharray: 2 4; }
.chart-line  { fill: none; stroke: var(--green); stroke-width: 1.5; }
.chart-dot   { fill: var(--green); }
.chart-bar   { fill: var(--blue); }
.chart-bar:hover, .chart-dot:hover { fill: var(--text-0); }

/* Grouped-bar fills — one class per gpu_type so the legend, the tooltip
   swatch, and the SVG rect all stay in sync via a single token. */
.chart-bar-spark1 { fill: var(--blue);  }
.chart-bar-spark2 { fill: var(--green); }

.chart-xlabel,
.chart-ylabel {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--text-3);
}

/* Header row inside .chart-card for charts that carry a legend on the
   right. The non-legend cards keep their flat title+sub markup, so
   .chart-header is opt-in (no global side-effects). */
.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.chart-header .chart-title { margin: 0 0 4px; }
.chart-header .chart-sub   { margin: 0; }

.chart-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
  text-transform: lowercase;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Right-side slot inside .chart-header. Holds the optional legend +
   the csv download button, separated by a thin divider. */
.chart-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.chart-actions > .chart-legend + .chart-csv-btn {
  border-left: 1px solid var(--border);
  padding-left: 12px;
}

.chart-csv-btn {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 8px;
  cursor: pointer;
  transition: color 80ms linear, border-color 80ms linear;
}
.chart-csv-btn:hover {
  color: var(--text-0);
  border-color: var(--border-strong);
}
.chart-csv-btn:focus-visible {
  outline: 1px solid var(--text-3);
  outline-offset: 1px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--text-3);
}
.legend-swatch.swatch-spark1 { background: var(--blue);  }
.legend-swatch.swatch-spark2 { background: var(--green); }

/* Grouped-chart tooltip rows. Single-value tooltip (.chart-tooltip-value)
   stays as-is for the non-grouped charts; the rows below only appear in
   grouped tooltips that the JS builds dynamically. */
.chart-tooltip-row,
.chart-tooltip-total {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11.5px;
}
.chart-tooltip-total {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-0);
}
.chart-tooltip-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
/* The swatch in the tooltip reuses the bar fill colors — background here
   (not SVG fill) since the tooltip is plain HTML divs. */
.chart-tooltip-swatch.chart-bar-spark1 { background: var(--blue);  }
.chart-tooltip-swatch.chart-bar-spark2 { background: var(--green); }
.chart-tooltip-label    { color: var(--text-2); }
.chart-tooltip-segvalue { color: var(--text-0); font-variant-numeric: tabular-nums; text-align: right; }

/* ── alert glyph on destructive admin buttons ───────────────────────── */

.btn-icon-alert {
  width: 12px;
  height: 12px;
  color: var(--yellow);
  flex-shrink: 0;
}

/* ── confirm modal (restart/delete email gate) ──────────────────────── */

.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.modal-card {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px 18px 14px;
  min-width: 360px;
  max-width: 440px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
}
.modal-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-family: var(--mono);
  color: var(--text-0);
}
.modal-body {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}
.modal-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-3);
}
.modal-label input {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-0);
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
}
.modal-label input:focus {
  outline: none;
  border-color: var(--focus);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* ── status tab: host health + disk usage ──────────────────────────────── */

/* Stacked (host, source) charts inside #disk-usage-card. Each block past the
   first gets a divider + spacing so the lines read as separate filesystems. */
.disk-chart-block + .disk-chart-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* State → fill, shared by the live badges, dots, swatches and grid squares. */
.hs-healthy     { background: var(--green);  }
.hs-degraded    { background: var(--yellow); }
.hs-down        { background: var(--red);    }
.hs-unreachable { background: var(--purple); }
.hs-unknown     { background: var(--text-3); }
.hs-nodata      { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }

.status-live {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.status-host-card {
  flex: 1 1 240px;
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: var(--bg-2);
  padding: 12px 14px;
}

.status-host-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.status-host-name { font-weight: 600; color: var(--text-0); }
.status-host-seen { margin-left: auto; color: var(--text-2); font-size: 12px; }

.status-host-subs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 8px;
}

.status-badge {
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 3px;
  color: var(--bg-deep);
  font-weight: 600;
}

.status-host-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-2);
  font-size: 12px;
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.hs-swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: -1px;
}

/* The grid: rows of (host label, then per-subsystem lanes of hourly squares). */
.hs-host-label {
  margin: 14px 0 4px;
  color: var(--text-1);
  font-weight: 600;
}

.hs-lane {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
}

.hs-lane-label {
  width: 70px;
  flex: 0 0 auto;
  color: var(--text-2);
  font-size: 12px;
  text-align: right;
}

.hs-lane-overall { color: var(--text-0); font-weight: 600; }

.hs-lane-squares {
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  overflow: hidden;
}

/* 13px square + 2px gap = 15px, matching SQUARE_PX in status.js. */
.hs-square {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  flex: 0 0 auto;
}

/* ── billing summary row (instances tab) ─────────────────────────────────── */
.bill-row .vm-meta-value.bill-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  overflow: visible;        /* badges must not be clipped by the value ellipsis */
  white-space: normal;
  text-overflow: clip;
}
.bill-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid currentColor;
  line-height: 1.5;
  flex: 0 0 auto;
}
.bill-active   { color: var(--green); }
.bill-pastdue  { color: var(--red); }
.bill-canceled { color: var(--text-3); }
.bill-none     { color: var(--yellow); }
.bill-loading  { color: var(--text-3); border-color: transparent; }
.bill-amt      { color: var(--text-2); font-size: 11px; }
.bill-due      { color: var(--red); font-size: 11px; font-weight: 600; }
.bill-accruing { color: var(--blue); font-size: 11px; }
