@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
@import 'tokens.css';

/* ---------------------------------------------------------------- Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; }
code, .mono { font-family: var(--font-mono); }

a { color: var(--accent-8); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent-subtle-bg); }

:focus-visible {
  outline: 2px solid var(--accent-8);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------------- App shell */
.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface-0);
}
.app-content {
  flex: 1;
  padding: var(--space-6) var(--space-6) var(--space-8);
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 72px 1fr; }
}

/* ---------------------------------------------------------------- Typography helpers */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }

.chip-address {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  line-height: 1.4;
}

/* ---------------------------------------------------------------- Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}
.page-header__breadcrumb {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.page-header__title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.page-header__description {
  margin-top: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  max-width: 60ch;
}
.page-header__actions {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 34px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), opacity var(--duration-fast);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent-9); color: var(--text-on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-8); }
.btn-primary:active:not(:disabled) { background: var(--accent-7); }

.btn-secondary { background: var(--surface-3); color: var(--text-primary); border-color: var(--border-default); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-4); border-color: var(--border-strong); }

.btn-tertiary { background: transparent; color: var(--text-secondary); }
.btn-tertiary:hover:not(:disabled) { background: var(--surface-3); color: var(--text-primary); }

.btn-destructive { background: transparent; color: var(--status-error-fg); border-color: var(--status-error-border); }
.btn-destructive:hover:not(:disabled) { background: var(--status-error-bg); }

.btn-sm { height: 28px; padding: 0 var(--space-3); font-size: var(--text-xs); }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--radius-md);
  background: transparent; border: 1px solid transparent; color: var(--text-secondary);
  cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast);
}
.btn-icon:hover { background: var(--surface-3); color: var(--text-primary); }
.btn-icon:disabled { opacity: 0.4; cursor: not-allowed; background: transparent; }

/* Compact variant for inline use in a table cell or resource-card header (Upgrade,
   disk extend/detach, NIC detach) — the default 30px is sized for a standalone close/
   dismiss button, too large sitting next to a chip or a card label. */
.btn-icon--sm { width: 22px; height: 22px; }

/* Colour-coded intent, applied at rest (not just on hover) — accent for "this grows or
   upgrades something" (disk extend, SKU upgrade), destructive for "this removes
   something" (disk/NIC detach). Consistent with btn-primary/btn-destructive already
   meaning the same two things elsewhere in the app. */
.btn-icon--accent { color: var(--accent-8); }
.btn-icon--accent:hover:not(:disabled) { background: var(--accent-subtle-bg); color: var(--accent-8); }
.btn-icon--destructive { color: var(--status-error-fg); }
.btn-icon--destructive:hover:not(:disabled) { background: var(--status-error-bg); color: var(--status-error-fg); }

/* ---------------------------------------------------------------- Inputs */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field-label { font-size: var(--text-xs); font-weight: 500; color: var(--text-secondary); }
.field-hint { font-size: var(--text-xs); color: var(--text-tertiary); }
.field-error { font-size: var(--text-xs); color: var(--status-error-fg); }

.input, .select, textarea.input {
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-family: inherit;
  width: 100%;
  transition: border-color var(--duration-fast);
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--accent-8);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-subtle-bg);
}
.input.has-error { border-color: var(--status-error-border); }
textarea.input { height: auto; padding: var(--space-3); resize: vertical; }

/* ---------------------------------------------------------------- Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 2px 8px 2px 6px;
  border-radius: var(--radius-full);
  border: 1px solid;
  line-height: 1.6;
  white-space: nowrap;
}
.status-badge__dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.status-pending  { color: var(--status-pending-fg);  background: var(--status-pending-bg);  border-color: var(--status-pending-border); }
.status-pending  .status-badge__dot { background: var(--status-pending-fg); }
.status-running  { color: var(--status-running-fg);  background: var(--status-running-bg);  border-color: var(--status-running-border); }
.status-running  .status-badge__dot { background: var(--status-running-fg); }
.status-success  { color: var(--status-success-fg);  background: var(--status-success-bg);  border-color: var(--status-success-border); }
.status-success  .status-badge__dot { background: var(--status-success-fg); }
.status-error    { color: var(--status-error-fg);    background: var(--status-error-bg);    border-color: var(--status-error-border); }
.status-error    .status-badge__dot { background: var(--status-error-fg); }
.status-neutral  { color: var(--status-neutral-fg);  background: var(--status-neutral-bg);  border-color: var(--status-neutral-border); }
.status-neutral  .status-badge__dot { background: var(--status-neutral-fg); }

/* ---------------------------------------------------------------- Panels / cards */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.panel-header__title { font-size: var(--text-lg); font-weight: 600; }
.panel-body { padding: var(--space-5); }

/* ---------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--space-5); }
.tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: none; border-left: none; border-right: none; border-top: none;
  display: flex; align-items: center; gap: var(--space-2);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); border-bottom-color: var(--accent-9); }
.tab-count {
  font-size: 11px; font-family: var(--font-mono); background: var(--surface-3);
  color: var(--text-secondary); padding: 1px 6px; border-radius: var(--radius-full);
}
.tab.active .tab-count { background: var(--accent-subtle-bg); color: var(--accent-8); }

/* ---------------------------------------------------------------- Table */
.data-table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.data-table thead th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration-fast);
}
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: var(--surface-2); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table td { padding: var(--space-3) var(--space-4); vertical-align: middle; }
.data-table td.cell-primary { font-weight: 500; color: var(--text-primary); }
.data-table td.cell-muted { color: var(--text-tertiary); }
.data-table td.cell-actions { text-align: right; white-space: nowrap; }

/* ---------------------------------------------------------------- Empty / loading states */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: var(--space-8) var(--space-5);
  color: var(--text-secondary);
}
.empty-state__icon { color: var(--text-tertiary); margin-bottom: var(--space-4); }
.empty-state__title { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-2); }
.empty-state__description { font-size: var(--text-sm); max-width: 42ch; margin-bottom: var(--space-4); }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------------------------------------------------------------- Alert (inline banner) */
.alert {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid; font-size: var(--text-sm);
}
.alert-error   { background: var(--status-error-bg);   border-color: var(--status-error-border);   color: var(--status-error-fg); }
.alert-warning { background: var(--status-pending-bg); border-color: var(--status-pending-border); color: var(--status-pending-fg); }
.alert-info    { background: var(--status-running-bg); border-color: var(--status-running-border); color: var(--status-running-fg); }

/* ---------------------------------------------------------------- Drawer (slide-over) */
.drawer-backdrop {
  position: fixed; inset: 0; background: var(--surface-overlay);
  z-index: 40; animation: fade-in var(--duration-base) var(--ease-standard);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 100vw;
  background: var(--surface-1);
  border-left: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  z-index: 41;
  display: flex; flex-direction: column;
  animation: slide-in var(--duration-base) var(--ease-standard);
}
.drawer-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: var(--space-5); border-bottom: 1px solid var(--border-subtle);
}
.drawer-body { flex: 1; overflow-y: auto; padding: var(--space-5); }
.drawer-footer {
  padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-subtle);
  display: flex; justify-content: flex-end; gap: var(--space-3);
}
/* Console viewer (VM noVNC / LXC xterm.js) */
.console-shell {
  position: fixed; inset: var(--space-5); z-index: 41;
  display: flex; flex-direction: column;
  background: var(--surface-1); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg, 8px); box-shadow: var(--shadow-lg);
  animation: fade-in var(--duration-base) var(--ease-standard);
}
.console-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-subtle);
}
.console-host-wrap { position: relative; flex: 1; min-height: 0; background: #000; }
.console-host { position: absolute; inset: 0; overflow: hidden; }
.console-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1; }
@media (max-width: 640px) { .console-shell { inset: 0; border-radius: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------- Dialog (confirm) */
.dialog {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 420px; max-width: calc(100vw - 32px);
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 51;
  padding: var(--space-5);
}
.code-block {
    margin: 0;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: var(--font-mono, monospace);
    font-size: var(--text-xs);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.dialog-title { font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-2); }
.dialog-body { color: var(--text-secondary); font-size: var(--text-sm); margin-bottom: var(--space-5); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-3); }

/* ---------------------------------------------------------------- Toasts */
.toast-stack {
  position: fixed; bottom: var(--space-5); right: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-2);
  z-index: 60;
}
.toast {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--surface-3); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm); box-shadow: var(--shadow-md);
  min-width: 260px; animation: slide-in var(--duration-base) var(--ease-standard);
}
.toast-success { border-left: 3px solid var(--status-success-fg); }
.toast-error { border-left: 3px solid var(--status-error-fg); }
.toast-info { border-left: 3px solid var(--status-running-fg); }

/* ---------------------------------------------------------------- Nav sidebar
   Lives here (not in NavMenu.razor.css) deliberately: these rules target classes applied
   to <NavLink>, a child component, not a literal element authored in NavMenu.razor —
   Blazor's CSS scoping only auto-attaches its scope attribute to elements literally
   written in the owning file, so a bare `.nav-item { ... }` rule scoped there would
   silently never match a child component's own rendered root. */
.nav-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--surface-1);
    border-right: 1px solid var(--border-subtle);
    height: 100vh;
    position: sticky;
    top: 0;
    padding: var(--space-4) 0;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-4) var(--space-5);
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}
.nav-brand__mark {
    width: 32px; height: 32px; border-radius: var(--radius-md);
    background: var(--accent-9); color: var(--text-on-accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.nav-brand__text { display: flex; flex-direction: column; min-width: 0; }
.nav-brand__name { font-weight: 600; font-size: var(--text-sm); color: var(--text-primary); }
.nav-brand__tag { font-size: 11px; color: var(--text-tertiary); }

.nav-groups { flex: 1; overflow-y: auto; padding: 0 var(--space-3); }
.nav-group { margin-bottom: var(--space-5); }
.nav-group__label {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-tertiary); padding: 0 var(--space-3); margin-bottom: var(--space-2);
}

.nav-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm); font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none; background: none; width: 100%; text-align: left;
    transition: background var(--duration-fast), color var(--duration-fast);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--accent-subtle-bg); color: var(--accent-8); }

.nav-item__badge {
    margin-left: auto;
    background: var(--status-pending-fg); color: #1a1400;
    font-size: 11px; font-weight: 700; font-family: var(--font-mono);
    border-radius: var(--radius-full); padding: 0 6px; min-width: 18px; text-align: center;
}

.nav-item--planned { opacity: 0.55; cursor: default; }
.nav-item--planned:hover { background: none; color: var(--text-secondary); }
.nav-item__tag {
    margin-left: auto; font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.03em; color: var(--text-tertiary);
    border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 1px 5px;
}

.nav-footer { padding: var(--space-3) var(--space-3) 0; border-top: 1px solid var(--border-subtle); margin-top: var(--space-3); }
.nav-item--logout:hover { color: var(--status-error-fg); }

/* Icon-only rail: labels are visually hidden, not display:none, so each link keeps its
   accessible name for screen readers. */
@media (max-width: 1024px) {
    .nav-brand__text, .nav-group__label, .nav-item__tag { display: none; }
    .nav-item span:not(.nav-item__badge) {
        position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
        overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
    }
    .nav-item { justify-content: center; }
    .nav-brand { justify-content: center; padding: 0 0 var(--space-4); }
}

/* ---------------------------------------------------------------- Accessibility helpers */
.skip-link {
  position: absolute; left: var(--space-3); top: -48px; z-index: 100;
  background: var(--accent-9); color: var(--text-on-accent);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500;
}
.skip-link:focus { top: var(--space-3); text-decoration: none; }
main:focus { outline: none; }
a.alert { text-decoration: none; }
a.alert:hover { text-decoration: none; filter: brightness(1.08); }

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

/* ---------------------------------------------------------------- Small screens */
@media (max-width: 640px) {
  .app-shell { grid-template-columns: 56px 1fr; }
  .app-shell--single { grid-template-columns: 1fr; }
  .app-content { padding: var(--space-4) var(--space-4) var(--space-7, var(--space-8)); }
  .page-header { flex-direction: column; gap: var(--space-3); }
  .page-header__actions { flex-wrap: wrap; }
  .nav-groups { padding: 0 var(--space-2); }
  .nav-footer { padding: var(--space-3) var(--space-2) 0; }
  .toast-stack { left: var(--space-3); right: var(--space-3); bottom: var(--space-3); }
  .toast { min-width: 0; }
  .drawer { width: 100vw; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
}

/* ---------------------------------------------------------------- Drawer content sections */
.drawer-section { padding: var(--space-4) 0; border-bottom: 1px solid var(--border-subtle); }
.drawer-section:last-child { border-bottom: none; }
.drawer-section__title { font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-3); }
.member-row { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); }
.member-row:last-child { border-bottom: none; }
.activity-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); }
.activity-row:last-child { border-bottom: none; }

/* ---------------------------------------------------------------- Utility */
.flex-row { display: flex; align-items: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent-8);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Resizable disk card */
.resource-card--resizable { min-width: 110px; }
.resource-card__header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.resource-card__picker { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.resource-card__picker-btn {
  font-size: 11px; font-family: var(--font-mono); font-weight: 500;
  background: var(--surface-3); border: 1px solid var(--border-default); color: var(--text-primary);
  border-radius: var(--radius-sm); padding: 2px 6px; cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.resource-card__picker-btn:hover { background: var(--accent-subtle-bg); border-color: var(--accent-subtle-border); color: var(--accent-8); }
.resource-card__picker-btn--cancel { color: var(--text-tertiary); font-family: var(--font-sans); }
.resource-card__picker-btn--cancel:hover { background: var(--surface-4); color: var(--text-secondary); border-color: var(--border-strong); }

.resource-card--add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: transparent; border: 1px dashed var(--border-strong); color: var(--text-tertiary);
  border-radius: var(--radius-md); padding: var(--space-2) var(--space-4); min-width: 90px;
  cursor: pointer; transition: background var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast);
}
.resource-card--add:hover { background: var(--accent-subtle-bg); border-color: var(--accent-subtle-border); color: var(--accent-8); }

/* ---------------------------------------------------------------- Toggle-state secondary button
   Reserves btn-primary for one true primary action per page (see Resources.razor's header:
   "Create" is now the only btn-primary there). A toggle that's currently "on" (e.g.
   auto-refresh) gets this instead of switching to btn-primary, so it reads as "active"
   without competing with the page's actual primary action. */
.btn-secondary.is-toggled { background: var(--accent-subtle-bg); border-color: var(--accent-subtle-border); color: var(--accent-8); }
.btn-secondary.is-toggled:hover { background: var(--accent-subtle-bg); border-color: var(--accent-subtle-border); }

/* ---------------------------------------------------------------- Segmented control
   Used for a small, closed set of mutually-exclusive choices inside a form (e.g. VM vs
   container in the create drawer) — distinct from .tabs, which is for page-level
   navigation between filtered views, not a form field. */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 2px; gap: 2px; }
.segmented-btn {
  border: none; background: transparent; color: var(--text-secondary);
  font-size: var(--text-sm); font-weight: 500; font-family: inherit;
  padding: var(--space-2) var(--space-4); border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast);
}
.segmented-btn:hover:not(:disabled) { color: var(--text-primary); }
.segmented-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.segmented-btn.active { background: var(--accent-9); color: var(--text-on-accent); }

/* ---------------------------------------------------------------- Choice cards
   A selectable resource-card — same chip look as Specs/Disks and the Add Disk button
   (surface-2, border-default, accent-tinted hover), just clickable and stateful. Used for
   template/SKU selection in the create drawer instead of inventing a separate list-row
   pattern for "pick one of these". */
.resource-card--option {
  align-items: flex-start; text-align: left; cursor: pointer; font-family: inherit;
  min-width: 160px; max-width: 240px; color: var(--text-primary);
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.resource-card--option:hover:not(:disabled) { background: var(--accent-subtle-bg); border-color: var(--accent-subtle-border); }
.resource-card--option:disabled { opacity: 0.6; cursor: not-allowed; }
.resource-card--option.resource-card--selected { border-color: var(--accent-8); background: var(--accent-subtle-bg); }
.resource-card--option .resource-card__value { white-space: normal; }

/* ---------------------------------------------------------------- Stat strip
   A row of centered stat tiles inside a .panel — used by Dashboard's compute overview and
   Billing's forecast/period/as-of row. Global rather than scoped to one page's <style>
   block on purpose: Blazor scopes a component's own <style> block to that component only,
   so a second page reusing these class names without this got unstyled stacked text
   instead of tiles (confirmed live — moved here from Dashboard.razor's local style block,
   which is where this used to live before Billing.razor needed the same pattern). */
.overview-strip { display: flex; }
.overview-stat { flex: 1; padding: var(--space-5); text-align: center; border-right: 1px solid var(--border-subtle); }
.overview-stat:last-child { border-right: none; }
.overview-stat__value { font-size: var(--text-2xl); font-weight: 600; font-family: var(--font-mono); line-height: 1.2; }
.overview-stat__label { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: var(--space-2); text-transform: uppercase; letter-spacing: 0.03em; }
@media (max-width: 640px) {
    .overview-strip { flex-wrap: wrap; }
    .overview-stat { flex: 1 1 50%; border-bottom: 1px solid var(--border-subtle); }
}

/* ---------------------------------------------------------------- Quota bar
   QuotaBar.razor — one resource line (vCPU/RAM/Disk, or VNets) in a Dashboard quota panel.
   A segmented bar: green fill up to Bought, red fill for whatever's past it, plus a vertical
   threshold line marking Bought itself. Global for the same reason the stat strip above is:
   a shared component's classes need to work wherever it's reused, not just wherever it first
   shipped. */
.quota-list { display: flex; flex-direction: column; gap: var(--space-4); }
.quota-row__header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-2); }
.quota-row__label { font-size: var(--text-sm); font-weight: 500; }
.quota-row__value { font-size: var(--text-xs); font-family: var(--font-mono); color: var(--text-tertiary); }
.quota-row__value--over { color: var(--status-error-fg); font-weight: 600; }
.quota-row__track { position: relative; height: 8px; background: var(--surface-2); border-radius: var(--radius-full); overflow: hidden; }
.quota-row__fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: inherit; transition: width var(--duration-fast), left var(--duration-fast); }
.quota-row__fill--ok { background: var(--status-success-fg); }
.quota-row__fill--over { background: var(--status-error-fg); }
.quota-row__threshold { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text-primary); opacity: 0.6; transform: translateX(-1px); }

/* Preview marker (top bar + login). Global: a child component's root isn't reached by scoped CSS. */
.preview-pill {
    flex-shrink: 0;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--status-pending-fg); background: var(--status-pending-bg); border: 1px solid var(--status-pending-border);
    border-radius: var(--radius-sm); padding: 2px 7px;
}
.preview-notice { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.preview-notice__text { font-size: var(--text-xs); color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-note {
    display: flex; align-items: flex-start; gap: var(--space-3);
    margin-bottom: var(--space-5); padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs); color: var(--text-secondary);
    background: var(--status-pending-bg); border: 1px solid var(--status-pending-border); border-radius: var(--radius-md);
}
@media (max-width: 900px) { .preview-notice__text { display: none; } }

/* Console "Paste text" panel (VM consoles). */
.console-paste {
    display: flex; flex-direction: column; gap: var(--space-2);
    padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-subtle);
}
.console-paste textarea { width: 100%; font-family: var(--font-mono); resize: vertical; }
.console-paste__meta { display: flex; justify-content: space-between; gap: var(--space-4); }
