/* ========================================
   CUSTOMER VPS VIEWS
   Card-based index and detail show page
   ======================================== */

/* ─── INDEX: VM Card List ─── */

.vm-card-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.vm-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-bottom: none;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.vm-card:first-child {
  border-radius: 10px 10px 0 0;
}

.vm-card:last-child {
  border-bottom: 1px solid #e5e7eb;
  border-radius: 0 0 10px 10px;
}

.vm-card:only-child {
  border-radius: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.vm-card:hover {
  background-color: #f9fafb;
}

[data-theme="dark"] .vm-card {
  background: #1f2937;
  border-color: #374151;
}

[data-theme="dark"] .vm-card:last-child {
  border-color: #374151;
}

[data-theme="dark"] .vm-card:hover {
  background-color: #263044;
}

/* OS logo in card */
.vm-card-os-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vm-card-os-icon img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

[data-theme="dark"] .vm-card-os-icon img[alt="OpenBSD"] {
  filter: invert(1);
}

.vm-card-os-icon .fa-server {
  font-size: var(--bulma-size-large);
  color: #9ca3af;
}

[data-theme="dark"] .vm-card-os-icon .fa-server {
  color: #6b7280;
}

/* Main info block */
.vm-card-info {
  flex: 1;
  min-width: 0;
}

.vm-card-name {
  font-weight: 600;
  font-size: var(--bulma-size-normal);
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .vm-card-name {
  color: #f3f4f6;
}

.vm-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
  font-size: var(--bulma-size-normal);
  color: #6b7280;
  flex-wrap: wrap;
}

[data-theme="dark"] .vm-card-meta {
  color: #9ca3af;
}

.vm-card-meta code {
  background: #f3f4f6;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: var(--bulma-size-small);
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

[data-theme="dark"] .vm-card-meta code {
  background: #374151;
  color: #d1d5db;
}

.vm-card-meta .meta-separator {
  color: #d1d5db;
}

[data-theme="dark"] .vm-card-meta .meta-separator {
  color: #4b5563;
}

/* Resource tags in the card */
.vm-card-resources {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}

.vm-card-resource-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  font-size: var(--bulma-size-normal);
  font-weight: 500;
  background: #f0f4ff;
  color: #3b5998;
  white-space: nowrap;
}

[data-theme="dark"] .vm-card-resource-tag {
  background: #1e2a45;
  color: #93b4f5;
}

.vm-card-resource-tag .icon {
  font-size: var(--bulma-size-small);
  opacity: 0.7;
}

/* Status column in card */
.vm-card-status {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.5rem;
}

/* Status dot */
.vm-status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9ca3af;
  flex-shrink: 0;
}

.vm-status-dot.is-active,
.vm-status-dot.is-running {
  background: #10b981;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
  animation: pulse-active 2s infinite;
}

.vm-status-dot.is-shutoff {
  background: #9ca3af;
}

.vm-status-dot.is-paused {
  background: #3b82f6;
}

.vm-status-dot.is-crashed {
  background: #ef4444;
}

.vm-status-dot.is-provisioning {
  background: none;
  width: auto;
  height: auto;
  color: #f59e0b;
  font-size: var(--bulma-size-small);
}

.vm-status-dot.is-pending {
  background: #f59e0b;
}

[data-theme="dark"] .vm-status-dot.is-active,
[data-theme="dark"] .vm-status-dot.is-running {
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.5);
}

@keyframes pulse-active {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ─── SHOW: Hero Banner ─── */

.vm-hero {
  border-radius: 12px;
  padding: 1.75rem 2rem;
  color: white;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.vm-hero.is-active,
.vm-hero.is-running {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.vm-hero.is-shutoff {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  box-shadow: 0 4px 12px rgba(156, 163, 175, 0.25);
}

.vm-hero.is-paused {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.vm-hero.is-crashed {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.vm-hero.is-provisioning {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.vm-hero.is-pending {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

[data-theme="dark"] .vm-hero.is-active,
[data-theme="dark"] .vm-hero.is-running {
  background: linear-gradient(135deg, #064e3b 0%, #022c22 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .vm-hero.is-shutoff {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  border: 1px solid rgba(156, 163, 175, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .vm-hero.is-paused {
  background: linear-gradient(135deg, #1e3a5f 0%, #172554 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .vm-hero.is-crashed {
  background: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%);
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .vm-hero.is-provisioning {
  background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
  border: 1px solid rgba(102, 126, 234, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .vm-hero.is-pending {
  background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.vm-hero-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.vm-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--bulma-size-large);
  flex-shrink: 0;
}

.vm-hero-text h2 {
  position: relative;
  font-size: var(--bulma-size-large);
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: white;
}

/* Editable label */
.vm-editable-label {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s ease;
}

.vm-editable-label:hover {
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

.vm-label-input {
  position: absolute;
  left: 0;
  top: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  color: white;
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  line-height: inherit;
  outline: none;
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 400px;
}

.vm-label-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.vm-label-check {
  display: inline-block;
  margin-left: 0.4rem;
  color: rgba(255, 255, 255, 0.9);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.vm-label-check.is-visible {
  animation: check-fade 1.5s ease forwards;
}

@keyframes check-fade {
  0% { opacity: 0; }
  15% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

.vm-hero-subtitle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  opacity: 0.9;
  font-size: var(--bulma-size-normal);
  flex-wrap: wrap;
}

.vm-hero-subtitle code {
  background: rgba(0, 0, 0, 0.2);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: var(--bulma-size-small);
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

[data-theme="dark"] .vm-hero-subtitle code {
  background: rgba(255, 255, 255, 0.15);
}

.vm-hero-subtitle .hero-sep {
  opacity: 0.5;
}

.vm-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.vm-hero-status-dot {
  display: flex;
  align-items: center;
  margin-right: 0.5rem;
}

.vm-hero-status-dot .vm-status-dot {
  width: 14px;
  height: 14px;
}

.vm-hero-status-dot .vm-status-dot.is-active,
.vm-hero-status-dot .vm-status-dot.is-running {
  background: #6ee7b7;
  box-shadow: 0 0 0 rgba(255, 255, 255, 0.5);
  animation: pulse-hero 2s infinite;
}

.vm-hero-status-dot .vm-status-dot.is-shutoff {
  background: #d1d5db;
}

.vm-hero-status-dot .vm-status-dot.is-paused {
  background: #93c5fd;
}

.vm-hero-status-dot .vm-status-dot.is-crashed {
  background: #fca5a5;
}

@keyframes pulse-hero {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.vm-hero-actions .button.vm-hero-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: var(--bulma-size-normal);
}

.vm-hero-actions .button.vm-hero-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

.vm-hero-actions .button.vm-hero-btn.is-danger {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  opacity: 0.8;
}

.vm-hero-actions .button.vm-hero-btn.is-danger:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  opacity: 1;
}

/* ─── SHOW: Resource Stats Bar ─── */

.vm-resource-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.vm-resource-stat {
  flex: 1;
  min-width: 140px;
  background: white;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

[data-theme="dark"] .vm-resource-stat {
  background: #1f2937;
  border-color: #374151;
}

.vm-resource-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--bulma-size-medium);
  flex-shrink: 0;
}

.vm-resource-stat-icon.is-cpu {
  background: #eff6ff;
  color: #3b82f6;
}

.vm-resource-stat-icon.is-ram {
  background: #f0fdf4;
  color: #22c55e;
}

.vm-resource-stat-icon.is-storage {
  background: #faf5ff;
  color: #a855f7;
}

.vm-resource-stat-icon.is-storage_sata {
  background: #f5f3ff;
  color: #8b5cf6;
}

[data-theme="dark"] .vm-resource-stat-icon.is-cpu {
  background: #1e3a5f;
  color: #60a5fa;
}

[data-theme="dark"] .vm-resource-stat-icon.is-ram {
  background: #14412a;
  color: #4ade80;
}

[data-theme="dark"] .vm-resource-stat-icon.is-storage {
  background: #2e1a47;
  color: #c084fc;
}

[data-theme="dark"] .vm-resource-stat-icon.is-storage_sata {
  background: #251a3d;
  color: #a78bfa;
}

.vm-resource-stat-info {
  display: flex;
  flex-direction: column;
}

.vm-resource-stat-value {
  font-size: var(--bulma-size-large);
  font-weight: 700;
  line-height: 1.2;
  color: #111827;
}

[data-theme="dark"] .vm-resource-stat-value {
  color: #f3f4f6;
}

.vm-resource-stat-label {
  font-size: var(--bulma-size-small);
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

[data-theme="dark"] .vm-resource-stat-label {
  color: #9ca3af;
}

/* ─── SHOW: Detail Card ─── */

.vm-detail-card {
  background: white;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
}

.vm-detail-card.is-full-height {
  height: 100%;
  margin-bottom: 0;
}

[data-theme="dark"] .vm-detail-card {
  background: #1f2937;
  border-color: #374151;
}

.vm-detail-card-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: var(--bulma-size-medium);
  font-weight: 600;
  color: #1f2937;
}

[data-theme="dark"] .vm-detail-card-header {
  border-color: #374151;
  color: #f3f4f6;
}

.vm-detail-card-header .icon {
  color: #6b7280;
}

[data-theme="dark"] .vm-detail-card-header .icon {
  color: #9ca3af;
}

.vm-detail-card-body {
  padding: 1.25rem;
  flex: 1;
}

/* Detail grid */
.vm-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
}

.vm-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.vm-detail-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  font-weight: 500;
  font-size: var(--bulma-size-small);
}

[data-theme="dark"] .vm-detail-label {
  color: #6b7280;
}

.vm-detail-value {
  color: #374151;
  font-size: var(--bulma-size-normal);
}

[data-theme="dark"] .vm-detail-value {
  color: #d1d5db;
}

.vm-detail-value code {
  background: #f3f4f6;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: var(--bulma-size-normal);
}

[data-theme="dark"] .vm-detail-value code {
  background: #374151;
}

.os-inline-logo {
  width: 18px;
  height: 18px;
  vertical-align: text-bottom;
  margin-right: 0.25rem;
}

[data-theme="dark"] img.os-inline-logo[alt="OpenBSD"] {
  filter: invert(1);
}

/* Copyable regions (click anywhere to copy) */
.vm-copyable {
  cursor: pointer;
}

.vm-copy-btn {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
  color: #9ca3af;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
  font-size: var(--bulma-size-normal);
}

.vm-copyable:hover .vm-copy-btn {
  opacity: 1;
}

.vm-copyable:hover .vm-copy-btn:hover {
  color: #3b82f6;
}

[data-theme="dark"] .vm-copy-btn {
  color: #6b7280;
}

[data-theme="dark"] .vm-copyable:hover .vm-copy-btn:hover {
  color: #60a5fa;
}

/* Card footer */
.vm-detail-card-footer {
  padding: 0.625rem 1.25rem;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  color: #6b7280;
  font-size: var(--bulma-size-normal);
}

[data-theme="dark"] .vm-detail-card-footer {
  border-color: #374151;
  background: #1a1f2e;
  color: #6b7280;
}

/* ─── SHOW: SSH Host Keys Table ─── */

.vm-host-key-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.vm-host-key-row:last-child {
  border-bottom: none;
}

[data-theme="dark"] .vm-host-key-row {
  border-color: #374151;
}

.vm-host-key-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
  font-weight: 600;
  font-size: var(--bulma-size-small);
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  background: #f0f4ff;
  color: #3b5998;
  min-width: 70px;
  text-align: center;
}

[data-theme="dark"] .vm-host-key-type {
  background: #1e2a45;
  color: #93b4f5;
}

.vm-host-key-fingerprint {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: var(--bulma-size-6);
  color: #6b7280;
  word-break: break-all;
}

[data-theme="dark"] .vm-host-key-fingerprint {
  color: #9ca3af;
}

/* ─── SHOW: Credentials ─── */

.vm-credential-block {
  padding: 1rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.vm-credential-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.vm-credential-block:first-child {
  padding-top: 0;
}

[data-theme="dark"] .vm-credential-block {
  border-color: #374151;
}

.vm-credential-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.vm-credential-label {
  font-weight: 500;
  font-size: var(--bulma-size-normal);
  color: #6b7280;
  min-width: 80px;
}

[data-theme="dark"] .vm-credential-label {
  color: #9ca3af;
}

.vm-credential-mono {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: var(--bulma-size-normal);
  background: #f3f4f6;
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
  color: #1f2937;
}

[data-theme="dark"] .vm-credential-mono {
  background: #374151;
  color: #d1d5db;
}

.vm-credential-pw-wrapper {
  display: inline-flex;
}

.vm-credential-masked {
  font-size: var(--bulma-size-normal);
  color: #9ca3af;
  letter-spacing: 0.1em;
}

/* Hide mask when real password is visible */
.vm-credential-pw-wrapper .vm-credential-mono:not(.is-hidden) ~ .vm-credential-masked,
.vm-credential-pw-wrapper .vm-credential-masked:has(~ .vm-credential-mono:not(.is-hidden)) {
  display: none;
}

.vm-credential-reveal {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--bulma-size-normal);
  color: #3b82f6;
  cursor: pointer;
}

.vm-credential-reveal:hover {
  color: #2563eb;
}

[data-theme="dark"] .vm-credential-reveal {
  color: #60a5fa;
}

[data-theme="dark"] .vm-credential-reveal:hover {
  color: #93b4f5;
}

.vm-credential-expiry {
  font-size: var(--bulma-size-normal);
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ─── SHOW: Advanced Configuration ─── */

.vm-config-heading {
  font-weight: 600;
  font-size: var(--bulma-size-normal);
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

[data-theme="dark"] .vm-config-heading {
  color: #9ca3af;
}

.vm-config-tooltip {
  color: #9ca3af;
  cursor: help;
  vertical-align: middle;
  margin-left: 0.25rem;
}

[data-theme="dark"] .vm-config-tooltip {
  color: #6b7280;
}

.vm-config-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.vm-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.vm-config-row:last-child {
  border-bottom: none;
}

[data-theme="dark"] .vm-config-row {
  border-color: #374151;
}

.vm-config-label {
  font-size: var(--bulma-size-normal);
  color: #374151;
}

[data-theme="dark"] .vm-config-label {
  color: #d1d5db;
}

.vm-config-radios {
  display: flex;
  gap: 1rem;
}

.vm-config-radios .radio {
  font-size: var(--bulma-size-normal);
  color: #374151;
}

[data-theme="dark"] .vm-config-radios .radio {
  color: #d1d5db;
}

/* Toggle switch */
.vm-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.vm-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.vm-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: background-color 0.2s ease;
}

.vm-toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.vm-toggle-switch input:checked + .vm-toggle-slider {
  background: #3b82f6;
}

.vm-toggle-switch input:checked + .vm-toggle-slider::before {
  transform: translateX(20px);
}

.vm-toggle-switch input:disabled + .vm-toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

[data-theme="dark"] .vm-toggle-slider {
  background: #4b5563;
}

[data-theme="dark"] .vm-toggle-slider::before {
  background: #d1d5db;
}

[data-theme="dark"] .vm-toggle-switch input:checked + .vm-toggle-slider {
  background: #2563eb;
}

/* ─── SHOW: ISO Dropdown ─── */

.vm-detail-card:has(.iso-dropdown) {
  overflow: visible;
}

.vm-detail-card:has(.iso-dropdown) .vm-detail-card-header {
  border-radius: 10px 10px 0 0;
}

div.dropdown.iso-dropdown {
  display: flex;
  width: 100%;
}

.iso-dropdown .dropdown-trigger {
  display: flex;
  width: 100%;
}

.iso-dropdown .dropdown-menu {
  display: flex;
  width: 100%;
}

.iso-dropdown .dropdown-trigger .button {
  flex: 1;
  width: 100%;
  min-width: 0;
  text-align: left;
  justify-content: flex-start;
}

.iso-dropdown .dropdown-trigger .button > .icon.is-small {
  margin-left: auto;
}

.iso-dropdown-menu .dropdown-content {
  max-height: 350px;
  overflow-y: auto;
}

.iso-dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--bulma-size-normal);
}

.iso-dropdown-menu .dropdown-item.is-active {
  background: #f3f4f6;
  color: inherit;
}

[data-theme="dark"] .iso-dropdown-menu .dropdown-item.is-active {
  background: #374151;
}

.iso-dropdown .button > span {
  font-size: var(--bulma-size-normal);
}

.iso-dropdown-icon {
  width: 18px;
  height: 18px;
}

[data-theme="dark"] .iso-dropdown-icon[src*="openbsd"] {
  filter: invert(1);
}

.iso-dropdown .dropdown-trigger .button span[data-iso-select-target="display"] {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.iso-item-icon {
  flex-shrink: 0;
}

.iso-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── INDEX: Filter Bar ─── */

.vm-filter-bar {
  margin-bottom: 1rem;
}

.vm-filter-bar-fields {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.vm-filter-bar-fields .vm-search-control {
  flex: 1;
  min-width: 200px;
}

.vm-filter-bar .input {
  border: none;
  background: #f3f4f6;
  box-shadow: none;
}

.vm-filter-bar .input:focus {
  background: #e5e7eb;
  box-shadow: none;
}

[data-theme="dark"] .vm-filter-bar .input {
  background: #1f2937;
  color: #d1d5db;
}

[data-theme="dark"] .vm-filter-bar .input:focus {
  background: #263044;
}

.vm-location-btn {
  border: none;
  background: #f3f4f6;
  box-shadow: none;
  gap: 0.25rem;
}

.vm-location-btn:hover {
  background: #e5e7eb;
}

[data-theme="dark"] .vm-location-btn {
  background: #1f2937;
  color: #d1d5db;
  border: none;
}

[data-theme="dark"] .vm-location-btn:hover {
  background: #263044;
}

.vm-location-dropdown .dropdown-item {
  display: flex;
  align-items: center;
}

.vm-location-dropdown .dropdown-item.is-active {
  background: #f3f4f6;
  color: inherit;
}

[data-theme="dark"] .vm-location-dropdown .dropdown-item.is-active {
  background: #374151;
}

/* ─── INDEX: Card Actions Dropdown ─── */

.vm-card-actions {
  flex-shrink: 0;
  position: relative;
}

.vm-kebab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.vm-kebab-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

[data-theme="dark"] .vm-kebab-btn:hover {
  background: #374151;
  color: #d1d5db;
}

.vm-card-actions .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vm-card-actions .dropdown-item .icon {
  width: 1.25rem;
  font-size: var(--bulma-size-small);
}

/* ─── SHOW: Actions Card ─── */

.vm-actions-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.vm-action-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #374151;
  font-size: var(--bulma-size-normal);
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.12s ease;
  width: 100%;
  text-align: left;
}

.vm-action-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

[data-theme="dark"] .vm-action-btn {
  color: #d1d5db;
}

[data-theme="dark"] .vm-action-btn:hover {
  background: #374151;
  color: #f3f4f6;
}

.vm-action-btn .icon {
  width: 1.25rem;
  color: #6b7280;
  font-size: var(--bulma-size-normal);
}

[data-theme="dark"] .vm-action-btn .icon {
  color: #9ca3af;
}

.vm-action-btn.is-danger {
  color: #dc2626;
}

.vm-action-btn.is-danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

[data-theme="dark"] .vm-action-btn.is-danger {
  color: #f87171;
}

[data-theme="dark"] .vm-action-btn.is-danger:hover {
  background: #450a0a;
  color: #fca5a5;
}

.vm-action-btn.is-danger .icon {
  color: inherit;
}

.vm-actions-divider {
  border: none;
  border-top: 1px solid #f3f4f6;
  margin: 0.5rem 0;
}

[data-theme="dark"] .vm-actions-divider {
  border-color: #374151;
}

/* ─── INDEX: Header with count ─── */

.vm-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #6b7280;
  font-weight: 600;
  font-size: var(--bulma-size-small);
  padding: 0 0.4rem;
  margin-left: 0.5rem;
  vertical-align: middle;
  position: relative;
  top: -0.2em;
}

[data-theme="dark"] .vm-count-badge {
  background: #374151;
  color: #9ca3af;
}

/* ─── Thunder Badge ─── */

.vm-thunder-badge {
  font-size: var(--bulma-size-7);
  vertical-align: middle;
  margin-left: 0.35rem;
}

/* ─── Billing Mode Badges ─── */

.vm-billing-badge {
  font-size: var(--bulma-size-7);
  vertical-align: middle;
  margin-left: 0.35rem;
}

.vm-billing-badge-reserved {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  font-weight: 500;
  padding: 0.15rem 0.65rem;
}

[data-theme="dark"] .vm-billing-badge-reserved {
  background-color: rgba(14, 165, 233, 0.2);
  color: #7dd3fc;
  border-color: rgba(14, 165, 233, 0.3);
}

/* ─── SHOW: Network Interfaces ─── */

.vm-net-iface-col {
  width: 5rem;
}

/* ─── FORM: Hide number spinners on resource allocation fields ─── */

[data-controller~="vm-form"] input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

[data-controller~="vm-form"] input[type="number"]::-webkit-inner-spin-button,
[data-controller~="vm-form"] input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ─── FORM: Network Interface Card ─── */

.vm-nic-card {
  padding: 1rem 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
}

[data-theme="dark"] .vm-nic-card {
  background: #1a1f2e;
  border-color: #374151;
}

/* Stack NIC fields at intermediate widths where the 1/3 column is too narrow */
@media screen and (min-width: 769px) and (max-width: 1407px) {
  .vm-nic-card .columns {
    display: block;
  }

  .vm-nic-card .column {
    width: 100%;
  }

  .vm-nic-card .level {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* ─── Responsive ─── */

@media screen and (max-width: 1023px) {
  .vm-card-resources {
    display: none;
  }

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

@media screen and (max-width: 768px) {
  .vm-card {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
  }

  .vm-card-info {
    flex: 1 1 calc(100% - 60px);
  }

  .vm-card-actions {
    order: 10;
    margin-left: auto;
  }

  .vm-card-status {
    margin-left: auto;
  }

  .vm-filter-bar-fields {
    flex-direction: column;
    align-items: stretch;
  }

  .vm-filter-bar-fields .control:first-child {
    min-width: 0;
  }

  .vm-hero {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }

  .vm-hero-content {
    flex-direction: column;
  }

  .vm-hero-subtitle {
    justify-content: center;
  }

  .vm-hero-actions {
    justify-content: center;
  }

  .vm-resource-bar {
    flex-direction: column;
  }

  .vm-resource-stat {
    min-width: 0;
  }

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

  .vm-detail-card-footer {
    flex-direction: column;
    gap: 0.5rem;
  }

  .vm-credential-field {
    flex-wrap: wrap;
  }

  .vm-credential-label {
    min-width: 100%;
  }

  .vm-credential-mono {
    word-break: break-all;
  }

  .vm-config-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}
